1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 17:23:12 +02:00

BUILD : 1.7.5 (327) BUGS : none NOTES : Merged anope-capab into main trunk...

git-svn-id: svn://svn.anope.org/anope/trunk@327 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@203 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b
2004-08-23 18:36:58 +00:00
parent 26ea4bc11b
commit 61a23cd017
69 changed files with 16224 additions and 4763 deletions
+7
View File
@@ -1,3 +1,10 @@
Anope Version S V N
-------------------
Provided by Anope Dev. <dev@anope.org> - 2004
Provided by Trystan <trystan@nomadirc.net> - 2004
08/23 A New protocol independent design (aka anope-capab). [ #00]
Anope Version 1.7.5
-------------------
Provided by Anope Dev. <dev@anope.org> - 2004
+6
View File
@@ -1,3 +1,9 @@
Anope Version S V N
-------------------
** ADDED CONFIGURATION DIRECTIVES **
** MODIFIED CONFIGURATION DIRECTIVES **
** DELETED CONFIGURATION DIRECTIVES **
Anope Version 1.7.5
-------------------
** ADDED CONFIGURATION DIRECTIVES **
+8
View File
@@ -1,3 +1,11 @@
Anope Version S V N
-------------------
*** New Strings:
*** Mod Strings:
*** Del Strings:
Anope Version 1.7.5
-------------------
*** New Strings:
+10 -2
View File
@@ -214,13 +214,15 @@ ok=0
echo "Select the closest to the type of server on your IRC network:"
echo " 1) DreamForge 4.6.7 [dated IRCd, upgrade to a current one]"
echo " 2) Bahamut 1.4.27 [or later]"
echo " 3) UnrealIRCd 3.1.1 [or later]"
echo " 3) UnrealIRCd 3.1.1 [or later (not 3.2)]"
echo " 4) UltimateIRCd 2.8.2 [or later]"
echo " 5) UltimateIRCd 3.0.0 [alpha26 or later]"
echo " 6) Hybrid IRCd 7.0 [experimental]"
echo " 7) ViagraIRCd 1.3.x [or later]"
echo " 8) PTlink 6.15.0 [experimental]"
echo " 9) RageIRCd 2.0 [beta-3 or later]"
echo " 10) Unreal 3.2 [Unreal 3.2 beta19 or later]"
while [ $ok -eq 0 ] ; do
echo2 "[$IRCTYPE] "
@@ -242,7 +244,7 @@ while [ $ok -eq 0 ] ; do
ok=1;
;;
3)
IRCTYPE_DEF="IRC_UNREAL"
IRCTYPE_DEF="IRC_UNREAL31"
ok=1;
;;
4)
@@ -270,6 +272,12 @@ while [ $ok -eq 0 ] ; do
ok=1;
;;
10)
IRCTYPE_DEF="IRC_UNREAL32"
ok=1;
;;
*)
echo "Please enter a valid option number."
;;
Vendored
+6 -44
View File
@@ -1289,23 +1289,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test $# = 0; then
echo "You might want to run ./Config or provide some parameters to this script."
echo "./configure --help for information about this script"
@@ -2888,8 +2871,6 @@ _ACEOF
MYSQL=" mysql.c "
RDB=" rdb.c "
x="1";
@@ -8365,35 +8346,20 @@ cat >>confdefs.h <<\_ACEOF
#define IRC_BAHAMUT 1
_ACEOF
elif test "$withval" = "IRC_UNREAL"; then
elif test "$withval" = "IRC_UNREAL31"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_DREAMFORGE 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define IRC_UNREAL 1
#define IRC_UNREAL31 1
_ACEOF
elif test "$withval" = "IRC_ULTIMATE"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_DREAMFORGE 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define IRC_ULTIMATE 1
#define IRC_ULTIMATE2 1
_ACEOF
elif test "$withval" = "IRC_ULTIMATE3"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_BAHAMUT 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define IRC_ULTIMATE3 1
_ACEOF
@@ -8406,11 +8372,6 @@ _ACEOF
elif test "$withval" = "IRC_VIAGRA"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_BAHAMUT 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define IRC_VIAGRA 1
_ACEOF
@@ -8424,12 +8385,13 @@ _ACEOF
elif test "$withval" = "IRC_RAGE2"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_BAHAMUT 1
#define IRC_RAGE2 1
_ACEOF
elif test "$withval" = "IRC_UNREAL32"; then
cat >>confdefs.h <<\_ACEOF
#define IRC_RAGE2 1
#define IRC_UNREAL32 1
_ACEOF
fi
+55
View File
@@ -0,0 +1,55 @@
/* Bahamut functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
/*************************************************************************/
#ifdef IRC_BAHAMUT
#define PROTECT_SET_MODE "+"
#define PROTECT_UNSET_MODE "+"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_R 0x80000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_c 0x00000400 /* Colors can't be used */
#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */
#define CMODE_O 0x00008000 /* Only opers can join */
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+9 -9
View File
@@ -20,15 +20,15 @@
* terminated with a NULL name.
*/
extern Command *lookup_cmd(Command *list, const char *name);
extern void run_cmd(const char *service, User *u, Command *list,
const char *name);
extern void help_cmd(const char *service, User *u, Command *list,
const char *name);
extern void do_run_cmd(const char *service, User * u, Command *c,const char *cmd);
extern void do_help_cmd(const char *service, User * u, Command *c,const char *cmd);
extern void mod_help_cmd(const char *service, User *u, CommandHash *cmdTable[],const char *cmd);
extern void mod_run_cmd(const char *service, User *u, CommandHash *cmdTable[],const char *cmd);
extern Command *lookup_cmd(Command *list, char *name);
extern void run_cmd(char *service, User *u, Command *list,
char *name);
extern void help_cmd(char *service, User *u, Command *list,
char *name);
extern void do_run_cmd(char *service, User * u, Command *c,const char *cmd);
extern void do_help_cmd(char *service, User * u, Command *c,const char *cmd);
extern void mod_help_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd);
extern void mod_run_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd);
extern char *mod_current_module_name;
/*************************************************************************/
+51
View File
@@ -0,0 +1,51 @@
/* DreamForge IRCD functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_DREAMFORGE
#define OWNER_SET_MODE "+"
#define OWNER_UNSET_MODE "+"
#define PROTECT_SET_MODE "+"
#define PROTECT_UNSET_MODE "+"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_g 0x80000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+217 -101
View File
@@ -19,23 +19,24 @@
#define E extern
E char *uplink;
/**** modules.c ****/
E void moduleCallBackRun(void);
E void moduleCleanStruct(ModuleData * moduleData[]);
/* IRC Variables */
E IRCDVar ircd[];
E IRCDCAPAB ircdcap[];
/**** actions.c ****/
E void change_user_mode(User * u, char *modes, char *arg);
E void kill_user(const char *source, const char *user, const char *reason);
E void kill_user(char *source, char *user, char *reason);
E void bad_password(User * u);
E void sqline(char *mask, char *reason);
E void common_unban(ChannelInfo * ci, char *nick);
E void common_svsmode(User * u, char *modes, char *arg);
/**** botserv.c ****/
E BotInfo *botlists[256];
E void get_botserv_stats(long *nrec, long *memuse);
E void bs_init(void);
E void botserv(User *u, char *buf);
E void botmsgs(User *u, BotInfo *bi, char *buf);
@@ -43,7 +44,6 @@ E void botchanmsgs(User *u, ChannelInfo *ci, char *buf);
E void load_bs_dbase(void);
E void save_bs_dbase(void);
E void save_bs_rdb_dbase(void);
E BotInfo *makebot(char *nick);
E BotInfo *findbot(char *nick);
E void bot_join(ChannelInfo *ci);
@@ -54,6 +54,30 @@ E void bot_rejoin_all(BotInfo *bi);
E Channel *chanlist[1024];
E CBMode cbmodes[128];
E CBModeInfo cbmodeinfos[];
E CUMode cumodes[128];
E CMMode cmmodes[128];
E unsigned long umodes[128];
E char csmodes[128];
extern void do_mass_mode(char *modes);
extern void add_ban(Channel * chan, char *mask);
extern void chan_adduser2(User * user, Channel * c);
extern void chan_delete(Channel * c);
extern void del_ban(Channel * chan, char *mask);
extern void set_key(Channel * chan, char *value);
extern void set_limit(Channel * chan, char *value);
extern char *get_key(Channel * chan);
extern char *get_limit(Channel * chan);
extern Channel *chan_create(char *chan);
extern Channel *join_user_update(User * user, Channel * chan, char *name);
extern void add_exception(Channel * chan, char *mask);
extern void del_exception(Channel * chan, char *mask);
extern char *get_flood(Channel * chan);
extern void set_flood(Channel * chan, char *value);
extern char *get_redirect(Channel * chan);
extern void set_redirect(Channel * chan, char *value);
E void get_channel_stats(long *nrec, long *memuse);
E Channel *findchan(const char *chan);
@@ -84,6 +108,7 @@ E void do_part(const char *source, int ac, char **av);
E void do_sjoin(const char *source, int ac, char **av);
E void do_topic(const char *source, int ac, char **av);
E void do_mass_mode(char *modes);
#define whosends(ci) ((!(ci) || !((ci)->botflags & BS_SYMBIOSIS) || !(ci)->bi || !(ci)->c || (ci)->c->usercount < BSMinUsers) ? s_ChanServ : (ci)->bi->nick)
/**** chanserv.c ****/
@@ -107,25 +132,16 @@ E void cs_remove_nick(const NickCore * nc);
E void cs_remove_bot(const BotInfo * bi);
E void check_modes(Channel * c);
#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
E int check_valid_admin(User * user, Channel * chan, int servermode);
#endif
E int check_valid_op(User * user, Channel * chan, int servermode);
E int check_should_op(User * user, const char *chan);
E int check_should_voice(User * user, const char *chan);
#ifdef HAS_HALFOP
E int check_should_halfop(User * user, const char *chan);
#endif
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
E int check_should_owner(User * user, const char *chan);
E int check_should_protect(User * user, const char *chan);
#endif
#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2) || defined(IRC_PTLINK)
E int check_should_protect(User * user, const char *chan);
#endif
E int check_should_op(User * user, char *chan);
E int check_should_voice(User * user, char *chan);
E int check_should_halfop(User * user, char *chan);
E int check_should_owner(User * user, char *chan);
E int check_should_protect(User * user, char *chan);
E int check_kick(User * user, char *chan);
E void record_topic(const char *chan);
E void restore_topic(const char *chan);
E void restore_topic(char *chan);
E int check_topiclock(Channel * c, time_t topic_time);
E ChannelInfo *cs_findchan(const char *chan);
@@ -138,19 +154,14 @@ E int get_idealban(ChannelInfo * ci, User * u, char *ret, int retlen);
E AutoKick *is_stuck(ChannelInfo * ci, char *mask);
E void stick_mask(ChannelInfo * ci, AutoKick * akick);
E void stick_all(ChannelInfo * ci);
#ifdef HAS_FMODE
E char *cs_get_flood(ChannelInfo * ci);
E void cs_set_flood(ChannelInfo * ci, char *value);
#endif
E char *cs_get_key(ChannelInfo * ci);
E void cs_set_key(ChannelInfo * ci, char *value);
E char *cs_get_limit(ChannelInfo * ci);
E void cs_set_limit(ChannelInfo * ci, char *value);
#ifdef HAS_LMODE
E char *cs_get_redirect(ChannelInfo * ci);
E void cs_set_redirect(ChannelInfo * ci, char *value);
#endif
/**** compat.c ****/
@@ -482,10 +493,20 @@ E char *DefconMessage;
E char *DefConAkillReason;
E char *DefConOffMessage;
E int Numeric;
/**** converter.c ****/
E int convert_ircservices_44(void);
/**** helpserv.c ****/
E void helpserv(User * u, char *buf);
E void helpserv_init(void);
/**** hostserv.c ****/
E void hostserv_init(void);
E void addHostCore(char *nick, char *vIdent, char *vhost, char *creator, int32 tmp_time);
/**** init.c ****/
E void introduce_user(const char *user);
@@ -505,7 +526,7 @@ E void lang_init(void);
(langtexts[((nc)?((NickCore*)nc)->language:NSDefLanguage)][(index)])
E int strftime_lang(char *buf, int size, User * u, int format,
struct tm *tm);
E void syntax_error(const char *service, User * u, const char *command,
E void syntax_error(char *service, User * u, char *command,
int msgnum);
@@ -555,7 +576,6 @@ E int do_mysql;
#endif
E int is44;
E int quitting;
E int delayed_quit;
E char *quitmsg;
@@ -581,18 +601,28 @@ E void ms_init(void);
E void memoserv(User * u, char *buf);
E void check_memos(User * u);
/**** messages.c ****/
E int m_nickcoll(char *user);
E int m_away(char *source, char *msg);
E int m_kill(char *nick, char *msg);
E int m_motd(char *source);
E int m_privmsg(char *source, char *receiver, char *msg);
E int m_stats(char *source, int ac, char **av);
E int m_whois(char *source, char *who);
E int m_time(char *source, int ac, char **av);
E int m_version(char *source, int ac, char **av);
/**** misc.c ****/
E char *strscpy(char *d, const char *s, size_t len);
E char *stristr(char *s1, char *s2);
E char *strnrepl(char *s, int32 size, const char *old, const char *new);
E char *merge_args(int argc, char **argv);
E int match_wild(const char *pattern, const char *str);
E int match_wild_nocase(const char *pattern, const char *str);
E int dotime(const char *s);
E char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds);
E char *expire_left(NickAlias * na, char *buf, int len, time_t expires);
@@ -615,11 +645,18 @@ E void EnforceQlinedNick(char *nick, char *killer);
E int nickIsServices(char *nick);
E const char* inttobase64(char* buf, unsigned int v, unsigned int count);
E unsigned int base64toIP(const char* s);
E unsigned int base64toint(const char* s);
/**** modules.c ****/
E void moduleCallBackRun(void);
E void moduleCleanStruct(ModuleData * moduleData[]);
/**** news.c ****/
E int32 nnews, news_size;
E NewsItem *news;
E void get_news_stats(long *nrec, long *memuse);
E void load_news(void);
E void save_news(void);
@@ -629,15 +666,12 @@ E int do_logonnews(User * u);
E int do_opernews(User * u);
E int do_randomnews(User * u);
/**** nickserv.c ****/
E NickAlias *nalists[1024];
E NickCore *nclists[1024];
E NickRequest *nrlists[1024];
E unsigned int guestnum;
E void insert_requestnick(NickRequest * nr);
E void alpha_insert_alias(NickAlias * na);
E void insert_core(NickCore * nc);
@@ -660,23 +694,14 @@ E int nick_recognized(User * u);
E void expire_nicks(void);
E void expire_requests(void);
E int ns_do_register(User * u);
E int delnick(NickAlias * na);
E NickAlias *findnick(const char *nick);
E NickCore *findcore(const char *nick);
E void clean_ns_timeouts(NickAlias * na);
E void nsStartNickTracking(User * u);
E void nsStopNickTracking(User * u);
E int nsCheckNickTracking(User *u);
/**** helpserv.c ****/
E void helpserv(User * u, char *buf);
E void helpserv_init(void);
/**** hostserv.c ****/
E void hostserv_init(void);
E void addHostCore(char *nick, char *vIdent, char *vhost, char *creator, int32 tmp_time);
/**** operserv.c ****/
@@ -699,32 +724,28 @@ E int nick_is_services_admin(NickCore *nc);
E int nick_is_services_oper(NickCore *nc);
E int add_akill(User *u, char *mask, const char *by, const time_t expires, const char *reason);
E int check_akill(const char *nick, const char *username, const char *host, const char *vhost, const char *ip);
E int check_akill(char *nick, const char *username, const char *host, const char *vhost, const char *ip);
E void expire_akills(void);
E void oper_global(char *nick, char *fmt, ...);
#ifdef IRC_BAHAMUT
E int add_sgline(User *u, char *mask, const char *by, const time_t expires, const char *reason);
E int check_sgline(const char *nick, const char *realname);
E int check_sgline(char *nick, const char *realname);
E void expire_sglines(void);
#endif
E int add_sqline(User *u, char *mask, const char *by, const time_t expires, const char *reason);
E int check_sqline(const char *nick, int nick_change);
#ifdef IRC_BAHAMUT
E int check_chan_sqline(const char *chan);
#endif
E int check_sqline(char *nick, int nick_change);
E void expire_sqlines(void);
E int check_chan_sqline(const char *chan);
#ifdef IRC_BAHAMUT
E int add_szline(User * u, char *mask, const char *by,
const time_t expires, const char *reason);
E void expire_szlines(void);
#endif
E void check_clones(User * user);
E void delete_ignore(const char *nick);
E Server *server_global(Server * s, char *msg);
/**** process.c ****/
E int allow_ignore;
@@ -736,19 +757,6 @@ E IgnoreData *get_ignore(const char *nick);
E int split_buf(char *buf, char ***argv, int colon_special);
E void process(void);
/**** protocol.c ****/
E void s_akill(char *user, char *host, char *who, time_t when,
time_t expires, char *reason);
E void s_rakill(char *user, char *host);
E void s_sgline(char *mask, char *reason);
E void s_sqline(char *mask, char *reason);
E void s_svsnoop(char *server, int set);
E void s_szline(char *mask, char *reason);
E void s_unsgline(char *mask);
E void s_unsqline(char *mask);
E void s_unszline(char *mask);
/**** proxy.c ****/
E HostCache *hcache[1024];
@@ -769,44 +777,33 @@ E void send_cmd(const char *source, const char *fmt, ...)
E void vsend_cmd(const char *source, const char *fmt, va_list args)
FORMAT(printf,2,0);
E void wallops(const char *source, const char *fmt, ...)
FORMAT(printf,2,3);
E void notice(const char *source, const char *dest, const char *fmt, ...)
E void notice_server(char *source, Server * s, char *fmt, ...)
FORMAT(printf,3,4);
E void notice_server(const char *source, Server *s, const char *fmt, ...)
FORMAT(printf,3,4);
E void notice_user(const char *source, User *u, const char *fmt, ...)
E void notice_user(char *source, User *u, const char *fmt, ...)
FORMAT(printf,3,4);
E void notice_list(const char *source, const char *dest, const char **text);
E void notice_lang(const char *source, User *dest, int message, ...);
E void notice_help(const char *source, User *dest, int message, ...);
E void notice_list(char *source, char *dest, char **text);
E void notice_lang(char *source, User *dest, int message, ...);
E void notice_help(char *source, User *dest, int message, ...);
E void privmsg(const char *source, const char *dest, const char *fmt, ...)
FORMAT(printf,3,4);
E void send_mode(const char *source, const char *on, const char *fmt, ...)
FORMAT(printf,3,4);
/**** servers.c ****/
E Server *servlist;
E Server *me_server;
#ifdef IRC_BAHAMUT
E uint16 uplink_capab;
#endif
E uint32 uplink_capab;
E Server *first_server(int flags);
E Server *next_server(int flags);
E Server *new_server(Server *uplink, const char *name, const char *desc,
uint16 flags);
E Server *new_server(Server * uplink, const char *name, const char *desc,
uint16 flags);
E Server *findserver(Server *s, const char *name);
E void do_server(const char *source, int ac, char **av);
E void do_squit(const char *source, int ac, char **av);
E void capab_parse(int ac, char **av);
/**** sessions.c ****/
@@ -817,7 +814,7 @@ E void get_session_stats(long *nrec, long *memuse);
E void get_exception_stats(long *nrec, long *memuse);
E int do_session(User *u);
E int add_session(const char *nick, const char *host);
E int add_session(char *nick, char *host);
E void del_session(const char *host);
E void load_exceptions(void);
@@ -848,36 +845,31 @@ E User *userlist[1024];
E int32 usercnt, opcnt, maxusercnt;
E time_t maxusertime;
E void set_umode(User * user, int ac, char **av);
E void delete_user(User *user);
E void get_user_stats(long *nusers, long *memuse);
E User *finduser(const char *nick);
E User *firstuser(void);
E User *nextuser(void);
E User *finduser_uid(const char *uid);
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_VIAGRA) || defined(IRC_PTLINK) || defined(IRC_RAGE2)
E void update_host(User * user);
E void change_user_host(User * user, const char *host);
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_VIAGRA) || defined(IRC_PTLINK)
E void change_user_username(User * user, const char *username);
E void change_user_realname(User * user, const char *realname);
#endif
E User *do_nick(const char *source, char *nick, char *username, char *host,
char *server, char *realname, time_t ts, uint32 svid, ...);
char *server, char *realname, time_t ts, uint32 svid, uint32 ip, char *vhost, char *uid);
E void do_umode(const char *source, int ac, char **av);
E void do_quit(const char *source, int ac, char **av);
E void do_kill(const char *source, int ac, char **av);
E void do_kill(char *source, char *reason);
E int is_oper(User * user);
E int is_protected(User * user);
#ifdef HAS_EXCEPT
E int is_excepted(ChannelInfo * ci, User * user);
E int is_excepted_mask(ChannelInfo * ci, char *mask);
#endif
E int match_usermask(const char *mask, User * user);
E void split_usermask(const char *mask, char **nick, char **user,
@@ -922,4 +914,128 @@ extern int encrypt_in_place(char *buf, int size);
#endif
E void privmsg(char *source, char *dest, const char *fmt, ...);
E void notice(char *source, char *dest, const char *fmt, ...);
/******************************************************************************/
extern void anope_cmd_211(const char *fmt, ...); /* 211 */
extern void anope_cmd_219(char *source, char *who); /* 219 */
extern void anope_cmd_242(const char *fmt, ...); /* 242 */
extern void anope_cmd_243(const char *fmt, ...); /* 243 */
extern void anope_cmd_250(const char *fmt, ...); /* 250 */
extern void anope_cmd_307(const char *fmt, ...); /* 307 */
extern void anope_cmd_311(const char *fmt, ...); /* 311 */
extern void anope_cmd_312(const char *fmt, ...); /* 312 */
extern void anope_cmd_317(const char *fmt, ...); /* 317 */
extern void anope_cmd_318(char *source, char *who); /* 318 */
extern void anope_cmd_351(char *source); /* 351 */
extern void anope_cmd_372(char *source, char *msg); /* 372 */
extern void anope_cmd_372_error(char *source); /* 372 */
extern void anope_cmd_375(char *source); /* 375 */
extern void anope_cmd_376(char *source); /* 376 */
extern void anope_cmd_391(char *source, char *timestr); /* 391 */
extern void anope_cmd_401(char *source, char *who); /* 401 */
extern void anope_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason); /* AKILL */
extern void anope_cmd_capab(); /* CAPAB */
extern void anope_cmd_chghost(char *nick, char *vhost); /* CHGHOST */
extern void anope_cmd_chgident(char *nick, char *vIdent); /* CHGIDENT */
extern void anope_cmd_vhost_on(char *nick, char *vIdent, char *vhost); /* CHGHOST + CHGIDENT */
extern void anope_cmd_vhost_off(char *nick);
extern void anope_cmd_connect(int servernum); /* Connect */
extern void anope_cmd_ea(); /* EA */
extern void anope_cmd_global(char *source, const char *fmt, ...); /* GLOBOPS */
extern void anope_cmd_invite(char *source, char *chan, char *nick); /* INVITE */
extern void anope_cmd_join(char *user, char *channel, time_t chantime); /* JOIN */
extern void anope_cmd_kick(char *source, char *chan, char *user, const char *fmt, ...); /* KICK */
extern void anope_cmd_mode(char *source, char *dest, const char *fmt, ...); /* MODE */
extern void anope_cmd_unban(char *name, char *nick); /* MODE -b */
extern void anope_cmd_bot_chan_mode(char *nick, char *chan); /* MODE BotServ */
extern void anope_cmd_netinfo(int ac, char **av); /* NETINFO */
extern void anope_cmd_nick(char *nick, char *name, char *mode); /* NICK */
extern void anope_cmd_chg_nick(char *oldnick, char *newnick); /* NICK */
extern void anope_cmd_bot_nick(char *nick, char *user,char *host,char *real,char *modes); /* NICK */
extern void anope_cmd_guest_nick(char *nick, char *user,char *host,char *real,char *modes); /* NICK */
extern void anope_cmd_notice(char *source, char *dest, const char *fmt, ...); /* NOTICE */
extern void anope_cmd_notice_ops(char *source, char *dest, const char *fmt, ...); /* NOTICE */
extern void anope_cmd_notice2(char *source, char *dest, char *msg); /* NOTICE */
extern void anope_cmd_serv_notice(char *source, char *dest, char *msg); /* NOTICE */
extern void anope_cmd_part(char *nick, char *chan, const char *fmt, ...); /* PART */
extern void anope_cmd_pass(char *pass); /* PASS */
extern void anope_cmd_pong(char *servname, char *who); /* PONG */
extern void anope_cmd_privmsg(char *source, char *dest, const char *fmt, ...); /* PRIVMSG */
extern void anope_cmd_privmsg2(char *source, char *dest, char *msg); /* PRIVMSG */
extern void anope_cmd_serv_privmsg(char *source, char *dest, char *msg); /* PRIVMSG */
extern void anope_cmd_protoctl(); /* PROTOCTL */
extern void anope_cmd_quit(char *source, const char *fmt, ...); /* QUIT */
extern void anope_cmd_remove_akill(char *user, char *host); /* RAKILL */
extern void anope_cmd_server(char *servname, int hop, char *descript); /* SERVER */
extern void anope_cmd_sgline(char *mask, char *reason); /* SGLINE */
extern void anope_cmd_sqline(char *mask, char *reason); /* SQLINE */
extern void anope_cmd_szline(char *mask, char *reason); /* SZLINE */
extern void anope_cmd_squit(char *servname, char *message); /* SQUIT */
extern void anope_cmd_svinfo(); /* SVINFO */
extern void anope_cmd_svshold(char *nick); /* SVSHOLD */
extern void anope_cmd_relase_svshold(char *nick); /* SVSHOLD */
extern void anope_cmd_svsinfo(); /* SVSINFO */
extern void anope_cmd_svskill(char *source,char *user, const char *fmt, ...); /* SVSKILL */
extern void anope_cmd_svsmode(User * u, int ac, char **av); /* SVSMODE */
extern void anope_cmd_svsnick(char *nick,char *newnick, time_t when); /* SVSNICK */
extern void anope_cmd_svsnoop(char *server, int set); /* SVSNOOP */
extern void anope_cmd_svso(char *source,char *nick, char *flag); /* SVSO */
extern void anope_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when); /* TOPIC */
extern void anope_cmd_unsgline(char *mask); /* UNSGLINE */
extern void anope_cmd_unsqline(char *user); /* UNSQLINE */
extern void anope_cmd_unszline(char *mask); /* UNSZLINE */
extern int anope_event_436(char *source, int ac, char **av);
extern int anope_event_away(char *source, int ac, char **av);
extern int anope_event_ping(char *source, int ac, char **av);
extern int anope_event_motd(char *source, int ac, char **av);
extern int anope_event_join(char *source, int ac, char **av);
extern int anope_event_kick(char *source, int ac, char **av);
extern int anope_event_kill(char *source, int ac, char **av);
extern int anope_event_mode(char *source, int ac, char **av);
extern int anope_event_quit(char *source, int ac, char **av);
extern int anope_event_squit(char *source, int ac, char **av);
extern int anope_event_topic(char *source, int ac, char **av);
extern int anope_event_whois(char *source, int ac, char **av);
extern int anope_event_part(char *source, int ac, char **av);
extern int anope_event_server(char *source, int ac, char **av);
extern int anope_event_nick(char *source, int ac, char **av);
extern int anope_event_privmsg(char *source, int ac, char **av);
extern int anope_event_capab(char *source, int ac, char **av);
extern int anope_event_sjoin(char *source, int ac, char **av);
extern int anope_event_cs(char *source, int ac, char **av);
extern int anope_event_hs(char *source, int ac, char **av);
extern int anope_event_ms(char *source, int ac, char **av);
extern int anope_event_ns(char *source, int ac, char **av);
extern int anope_event_os(char *source, int ac, char **av);
extern int anope_event_vs(char *source, int ac, char **av);
extern int anope_event_svinfo(char *source, int ac, char **av);
extern int anope_event_chghost(char *source, int ac, char **av);
extern int anope_event_sethost(char *source, int ac, char **av);
extern int anope_event_chgident(char *source, int ac, char **av);
extern int anope_event_setident(char *source, int ac, char **av);
extern int anope_event_chgname(char *source, int ac, char **av);
extern int anope_event_setname(char *source, int ac, char **av);
extern int anope_event_svsinfo(char *source, int ac, char **av);
extern int anope_event_snick(char *source, int ac, char **av);
extern int anope_event_vhost(char *source, int ac, char **av); /* Rage IRCD Only */
extern int anope_event_tkl(char *source, int ac, char **av);
extern int anope_event_eos(char *source, int ac, char **av);
extern int anope_event_pass(char *source, int ac, char **av);
extern int anope_event_netinfo(char *source, int ac, char **av);
extern int anope_event_error(char *source, int ac, char **av);
extern int anope_event_eb(char *source, int ac, char **av);
extern void anope_set_umode(User * user, int ac, char **av);
extern void anope_cmd_svid_umode(char *nick, time_t ts);
extern void anope_cmd_svid_umode2(User *u, char *ts);
extern void anope_cmd_svid_umode3(User *u, char *ts);
extern void anope_cmd_nc_change(User *u);
extern char *common_get_vident(User *u);
extern char *common_get_vhost(User *u);
#endif /* EXTERN_H */
+48
View File
@@ -0,0 +1,48 @@
/* Hybrid IRCD functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_HYBRID
#define PROTECT_SET_MODE "+"
#define PROTECT_UNSET_MODE "+"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_a 0x00000400
#define DEFAULT_MLOCK CMODE_n | CMODE_t
#endif
+60
View File
@@ -0,0 +1,60 @@
/* PTLink IRCD functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_PTLINK
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_A 0x00000400
#define CMODE_B 0x00000800
#define CMODE_c 0x00001000
#define CMODE_d 0x00002000
#define CMODE_f 0x00004000
#define CMODE_K 0x00008000
#define CMODE_O 0x00010000
#define CMODE_q 0x00020000
#define CMODE_S 0x00040000
#define CMODE_N 0x00080000
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+58
View File
@@ -0,0 +1,58 @@
/* Rage IRCD functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_RAGE2
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define FANT_PROTECT_ADD "!admin"
#define FANT_PROTECT_DEL "!deadmin"
#define LEVEL_PROTECT_WORD "AUTOADMIN"
#define LEVELINFO_PROTECT_WORD "ADMIN"
#define LEVELINFO_PROTECTME_WORD "ADMINME"
#define CS_CMD_PROTECT "ADMIN"
#define CS_CMD_DEPROTECT "DEADMIN"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_R 0x80000000
#define UMODE_x 0x40000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_A 0x00000800
#define CMODE_N 0x00001000
#define CMODE_S 0x00002000
#define CMODE_C 0x00004000
#define CMODE_c 0x00000400 /* Colors can't be used */
#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */
#define CMODE_O 0x00008000 /* Only opers can join */
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define CMODE_I 0x08000000
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+366 -805
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -109,13 +109,16 @@
#undef IRC_RAGE2
/* "Second IRCD type" */
#undef IRC_ULTIMATE
#undef IRC_ULTIMATE2
/* "Second IRCD type" */
#undef IRC_ULTIMATE3
/* "Second IRCD type" */
#undef IRC_UNREAL
#undef IRC_UNREAL31
/* "Second IRCD type" */
#undef IRC_UNREAL32
/* "Second IRCD type" */
#undef IRC_VIAGRA
+63
View File
@@ -0,0 +1,63 @@
/* Ultimate IRCD 2 functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_ULTIMATE2
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_p 0x04000000
#define UMODE_R 0x08000000
#define UMODE_P 0x20000000
#define UMODE_g 0x80000000
#define UMODE_x 0x40000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_f 0x00000400
#define CMODE_x 0x00000800
#define CMODE_A 0x00001000
#define CMODE_I 0x00002000
#define CMODE_K 0x00004000
#define CMODE_L 0x00008000
#define CMODE_O 0x00010000
#define CMODE_S 0x00020000
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+60
View File
@@ -0,0 +1,60 @@
/* Ultimate IRCD 3.0 functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_ULTIMATE3
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define FANT_PROTECT_ADD "!admin"
#define FANT_PROTECT_DEL "!deadmin"
#define LEVEL_PROTECT_WORD "AUTOADMIN"
#define LEVELINFO_PROTECT_WORD "ADMIN"
#define LEVELINFO_PROTECTME_WORD "ADMINME"
#define CS_CMD_PROTECT "ADMIN"
#define CS_CMD_DEPROTECT "DEADMIN"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_p 0x04000000
#define UMODE_Z 0x08000000
#define UMODE_P 0x20000000
#define UMODE_R 0x80000000
#define UMODE_x 0x40000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_A 0x00000800
#define CMODE_N 0x00001000
#define CMODE_S 0x00002000
#define CMODE_K 0x00004000
#define CMODE_c 0x00000400 /* Colors can't be used */
#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */
#define CMODE_O 0x00008000 /* Only opers can join */
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+66
View File
@@ -0,0 +1,66 @@
/* Unreal IRCD 3.1.x functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
/*************************************************************************/
#ifdef IRC_UNREAL31
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_g 0x80000000
#define UMODE_x 0x40000000
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_c 0x00000400
#define CMODE_A 0x00000800
#define CMODE_H 0x00001000
#define CMODE_K 0x00002000
#define CMODE_L 0x00004000
#define CMODE_O 0x00008000
#define CMODE_Q 0x00010000
#define CMODE_S 0x00020000
#define CMODE_V 0x00040000
#define CMODE_f 0x00080000
#define CMODE_G 0x00100000
#define CMODE_C 0x00200000
#define CMODE_u 0x00400000
#define CMODE_z 0x00800000
#define CMODE_N 0x01000000
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+80
View File
@@ -0,0 +1,80 @@
/* Unreal IRCD 3.2.x functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_UNREAL32
/*************************************************************************/
/* User Modes */
#define UMODE_a 0x00000001
#define UMODE_h 0x00000002
#define UMODE_i 0x00000004
#define UMODE_o 0x00000008
#define UMODE_r 0x00000010
#define UMODE_w 0x00000020
#define UMODE_A 0x00000040
#define UMODE_g 0x80000000
#define UMODE_x 0x40000000
#define UMODE_R 0x80000000
/*************************************************************************/
/* Channel Modes */
#define CMODE_i 0x00000001
#define CMODE_m 0x00000002
#define CMODE_n 0x00000004
#define CMODE_p 0x00000008
#define CMODE_s 0x00000010
#define CMODE_t 0x00000020
#define CMODE_k 0x00000040 /* These two used only by ChanServ */
#define CMODE_l 0x00000080
#define CMODE_c 0x00000400
#define CMODE_A 0x00000800
#define CMODE_H 0x00001000
#define CMODE_K 0x00002000
#define CMODE_L 0x00004000
#define CMODE_O 0x00008000
#define CMODE_Q 0x00010000
#define CMODE_S 0x00020000
#define CMODE_V 0x00040000
#define CMODE_f 0x00080000
#define CMODE_G 0x00100000
#define CMODE_C 0x00200000
#define CMODE_u 0x00400000
#define CMODE_z 0x00800000
#define CMODE_N 0x01000000
#define CMODE_R 0x00000100 /* Only identified users can join */
#define CMODE_r 0x00000200 /* Set for all registered channels */
/*************************************************************************/
/* Since we differ !protect from !admin we need to know what to use */
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
/*************************************************************************/
/* Default Modes with MLOCK */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+2 -35
View File
@@ -50,40 +50,6 @@ const char version_number[] = "$VERSION";
const char version_build[] =
"build #" BUILD ", compiled " __DATE__ " " __TIME__;
const char version_protocol[] =
#if defined(IRC_ULTIMATE3)
"UltimateIRCd 3.0.0.a26+"
# define VER_IRCD "UltimateIRCd 3.0.* -"
#elif defined(IRC_VIAGRA)
"ViagraIRCd 1.3.x"
# define VER_IRCD "ViagraIRCd 1.3.* -"
#elif defined(IRC_RAGE2)
"RageIRCd 2.0.x"
# define VER_IRCD "RageIRCd 2.0.* -"
#elif defined(IRC_BAHAMUT)
"Bahamut 1.4.27+"
# define VER_IRCD "BahamutIRCd 1.4.*/1.8.* -"
#elif defined(IRC_ULTIMATE)
"UltimateIRCd 2.8.2+"
# define VER_IRCD "UltimateIRCd 2.8.* -"
#elif defined(IRC_UNREAL)
"UnrealIRCd 3.1.1+"
# define VER_IRCD "UnrealIRCd -"
#elif defined(IRC_DREAMFORGE)
"DreamForge 4.6.7"
# define VER_IRCD "DreamForgeIRCd 4.6.7 -"
#elif defined(IRC_HYBRID)
"Hybrid IRCd 7.0"
# define VER_IRCD "HybridIRCd 7.* -"
#elif defined(IRC_PTLINK)
"PTlink 6.14.5+"
# define VER_IRCD "PTlinkIRCd 6.14.* -"
#else
"unknown"
# define VER_IRCD
#endif
;
#ifdef DEBUG_COMMANDS
# define VER_DEBUG "D"
#else
@@ -140,7 +106,8 @@ const char version_protocol[] =
# define VER_MODULE
#endif
const char version_flags[] = VER_IRCD VER_DEBUG VER_ENCRYPTION VER_THREAD VER_OS VER_GHBNR VER_MYSQL VER_MODULE;
/* the space is needed cause if you build with nothing it will complain */
const char version_flags[] = " " VER_DEBUG VER_ENCRYPTION VER_THREAD VER_OS VER_GHBNR VER_MYSQL VER_MODULE;
EOF
+76
View File
@@ -0,0 +1,76 @@
/* Viagra IRCD functions
*
* (C) 2003 Anope Team
* Contact us at info@anope.org
*
* Please read COPYING and README for furhter details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
*
*/
#ifdef IRC_VIAGRA
#define PROTECT_SET_MODE "+a"
#define PROTECT_UNSET_MODE "+a"
#define CS_CMD_PROTECT "PROTECT"
#define CS_CMD_DEPROTECT "DEPROTECT"
#define FANT_PROTECT_ADD "!protect"
#define FANT_PROTECT_DEL "!deprotect"
#define LEVEL_PROTECT_WORD "AUTOPROTECT"
#define LEVELINFO_PROTECT_WORD "PROTECT"
#define LEVELINFO_PROTECTME_WORD "PROTECTME"
/* User Modes */
#define UMODE_A 0x00000040 /* Is a Server Administrator. */
#define UMODE_C 0x00002000 /* Is a Server Co Administrator. */
#define UMODE_I 0x00008000 /* Stealth mode, makes you beeing hidden at channel. invisible joins/parts. */
#define UMODE_N 0x00000400 /* Is a Network Administrator. */
#define UMODE_O 0x00004000 /* Local IRC Operator. */
#define UMODE_Q 0x00001000 /* Is an Abuse Administrator. */
#define UMODE_R 0x08000000 /* Cant receive messages from non registered user. */
#define UMODE_S 0x00000080 /* Is a Network Service. For Services only. */
#define UMODE_T 0x00000800 /* Is a Technical Administrator. */
#define UMODE_a 0x00000001 /* Is a Services Administrator. */
#define UMODE_b 0x00040000 /* Can listen to generic bot warnings. */
#define UMODE_c 0x00010000 /* See's all connects/disconnects on local server. */
#define UMODE_d 0x00000100 /* Can listen to debug and channel cration notices. */
#define UMODE_e 0x00080000 /* Can see client connections/exits on remote servers. */
#define UMODE_f 0x00100000 /* Listen to flood/spam alerts from server. */
#define UMODE_g 0x00000200 /* Can read & send to globops, and locops. */
#define UMODE_h 0x00000002 /* Is a Help Operator. */
#define UMODE_i 0x00000004 /* Invisible (Not shown in /who and /names searches). */
#define UMODE_n 0x00020000 /* Can see client nick change notices. */
#define UMODE_o 0x00000008 /* Global IRC Operator. */
#define UMODE_r 0x00000010 /* Identifies the nick as being registered. */
#define UMODE_s 0x00200000 /* Can listen to generic server messages. */
#define UMODE_w 0x00000020 /* Can listen to wallop messages. */
#define UMODE_x 0x40000000 /* Gives the user hidden hostname. */
/* Channel Modes */
#define CMODE_i 0x00000001 /* Invite-only allowed. */
#define CMODE_m 0x00000002 /* Moderated channel, noone can speak and changing nick except users with mode +vho */
#define CMODE_n 0x00000004 /* No messages from outside channel */
#define CMODE_p 0x00000008 /* Private channel. */
#define CMODE_s 0x00000010 /* Secret channel. */
#define CMODE_t 0x00000020 /* Only channel operators may set the topic */
#define CMODE_k 0x00000040 /* Needs the channel key to join the channel */
#define CMODE_l 0x00000080 /* Channel may hold at most <number> of users */
#define CMODE_R 0x00000100 /* Requires a registered nickname to join the channel. */
#define CMODE_r 0x00000200 /* Channel is registered. */
#define CMODE_c 0x00000400 /* No ANSI color can be sent to the channel */
#define CMODE_M 0x00000800 /* Requires a registered nickname to speak at the channel. */
#define CMODE_H 0x00001000 /* HelpOps only channel. */
#define CMODE_O 0x00008000 /* IRCOps only channel. */
#define CMODE_S 0x00020000 /* Strips all mesages out of colors. */
#define CMODE_N 0x01000000 /* No nickchanges allowed. */
#define CMODE_P 0x02000000 /* "Peace mode" No kicks allowed unless by u:lines */
#define CMODE_x 0x04000000 /* No bold/underlined or reversed text can be sent to the channel */
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
#endif
+13
View File
@@ -6282,3 +6282,16 @@ HOST_HELP_GROUP
This command allows users to set the vhost of thier
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+12
View File
@@ -6482,3 +6482,15 @@ HOST_HELP_GROUP
Dieses Command erlaubt es Usern, den vhost ihres aktuellen
Nicks, zum vhost der gessamten Group zu setzen.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6023,3 +6023,16 @@ HOST_HELP_GROUP
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6292,3 +6292,16 @@ HOST_HELP_GROUP
Este comando permite a usuarios a setear el vhost de su
nick actual para ser el vhost para todos los nicks en el
mismo grupo.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6314,3 +6314,16 @@ HOST_HELP_GROUP
Permet d'enregistrer la vHost du nick actuellement
utilisé pour tous les pseudos du groupe.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6159,3 +6159,16 @@ HOST_HELP_GROUP
This command allows users to set the vhost of thier
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+12
View File
@@ -6044,3 +6044,15 @@ HOST_HELP_GROUP
Ez a parancs lehetővé teszi, hogy a JELENLEGI nick
vhostját beállítsuk a csoport minden nickjére.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6317,3 +6317,16 @@ HOST_HELP_GROUP
Questo comando permette agli utenti di impostare il vhost del
loro nick ATTUALE come vhost di tutti i nick nello stesso gruppo.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6182,3 +6182,16 @@ HOST_HELP_GROUP
HUIDIGE nick de vhost van alle nicks in de zelfde groep te
laten zijn.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+12
View File
@@ -6597,3 +6597,15 @@ HOST_HELP_GROUP
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -5916,3 +5916,16 @@ HOST_HELP_GROUP
This command allows users to set the vhost of thier
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6061,3 +6061,16 @@ HOST_HELP_GROUP
Эта команда позволяет пользователям установить виртуальный хост с их
ТЕКУЩЕГО ника на все ники
группы.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+13
View File
@@ -6092,3 +6092,16 @@ HOST_HELP_GROUP
This command allows users to set the vhost of thier
CURRENT nick to be the vhost for all nicks in the same
group.
OPER_SVSNICK_UNSUPPORTED
Sorry, SVSNICK is not available on this network.
OPER_SQLINE_UNSUPPORTED
Sorry, SQLINE is not available on this network.
OPER_SVSO_UNSUPPORTED
Sorry, OLINE is not available on this network.
OPER_UMODE_UNSUPPORTED
Sorry, UMODE is not available on this network.
+11 -4
View File
@@ -3,13 +3,16 @@ RDB_OBJ = $(RDB:.c=.o)
OBJS = actions.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \
config.o datafiles.o encrypt.o helpserv.o hostserv.o init.o language.o list.o log.o mail.o main.o \
memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \
process.o protocol.o proxy.o send.o servers.o sessions.o slist.o sockutil.o \
timeout.o users.o \
process.o proxy.o send.o servers.o sessions.o slist.o sockutil.o \
timeout.o users.o dreamforge.o bahamut.o unreal31.o ultimate2.o ultimate3.o \
hybrid.o ptlink.o viagra.o rageircd.o unreal32.o \
$(VSNPRINTF_O) $(RDB_OBJ) $(MYSQL_OBJ)
SRCS = actions.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \
config.c datafiles.c encrypt.c helpserv.c hostserv.c init.c language.c list.c log.c mail.c main.c \
memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \
process.c protocol.c proxy.c send.c servers.c sessions.c slist.c sockutil.c \
process.c proxy.c send.c servers.c sessions.c slist.c sockutil.c \
dreamforge.c bahamut.c unreal31.c ultimate2.c ultimate3.c \
hybrid.c ptlink.c viagra.c rageircd.c unreal32.c \
timeout.c users.c \
$(VSNPRINTF_C) $(RDB) $(MYSQL)
@@ -17,7 +20,11 @@ INCLUDES = ../include/commands.h ../include/defs.h ../include/language.h \
../include/pseudo.h ../include/sysconf.h ../include/config.h \
../include/encrypt.h ../include/messages.h ../include/services.h \
../include/timeout.h ../include/datafiles.h ../include/extern.h \
../include/modules.h ../include/slist.h ../include/version.h
../include/modules.h ../include/slist.h ../include/version.h \
../include/dreamforge.h ../include/bahamut.h ../include/ultimate2.h \
../include/ultimate3.h ../include/hybrid.h ../include/ptlink.h ../include/unreal31.h \
../include/viagra.h ../include/rageircd.h ../include/unreal32.h
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
'LDFLAGS=${LDFLAGS}' 'BINDEST=${BINDEST}' 'INSTALL=${INSTALL}' \
+125 -38
View File
@@ -38,43 +38,12 @@ void bad_password(User * u)
/*************************************************************************/
void change_user_mode(User * u, char *modes, char *arg)
{
#ifndef IRC_HYBRID
int ac = 1;
char *av[2];
av[0] = modes;
if (arg) {
av[1] = arg;
ac++;
}
#ifdef IRC_BAHAMUT
send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, u->timestamp,
av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
#else
send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0],
(ac == 2 ? " " : ""), (ac == 2 ? av[1] : ""));
#endif
set_umode(u, ac, av);
#endif
}
/*************************************************************************/
/* Remove a user from the IRC network. `source' is the nick which should
* generate the kill, or NULL for a server-generated kill.
*/
void kill_user(const char *source, const char *user, const char *reason)
void kill_user(char *source, char *user, char *reason)
{
#ifdef IRC_BAHAMUT
/* Bahamut uses SVSKILL as a better way to kill users. It sends back
* a QUIT message that Anope uses to clean up after the kill is done.
*/
send_cmd(NULL, "SVSKILL %s :%s", user, reason);
#else
char *av[2];
char buf[BUFSIZE];
if (!user || !*user)
@@ -83,13 +52,131 @@ void kill_user(const char *source, const char *user, const char *reason)
source = ServerName;
if (!reason)
reason = "";
snprintf(buf, sizeof(buf), "%s (%s)", source, reason);
av[0] = sstrdup(user);
av[1] = buf;
send_cmd(source, "KILL %s :%s", user, av[1]);
do_kill(source, 2, av);
free(av[0]);
#endif
anope_cmd_svskill(source, user, buf);
if (!ircd->quitonkill) {
do_kill(user, buf);
}
}
/*************************************************************************/
void sqline(char *mask, char *reason)
{
if (ircd->chansqline) {
if (*mask == '#') {
int i;
Channel *c, *next;
char *av[3];
struct c_userlist *cu, *cunext;
anope_cmd_sqline(mask, reason);
for (i = 0; i < 1024; i++) {
for (c = chanlist[i]; c; c = next) {
next = c->next;
if (!match_wild_nocase(mask, c->name))
continue;
for (cu = c->users; cu; cu = cunext) {
cunext = cu->next;
if (is_oper(cu->user))
continue;
av[0] = c->name;
av[1] = cu->user->nick;
av[2] = reason;
anope_cmd_kick(s_OperServ, av[0], av[1],
"Q-Lined: %s", av[2]);
do_kick(s_ChanServ, 3, av);
}
}
}
} else {
anope_cmd_sqline(mask, reason);
}
} else {
anope_cmd_sqline(mask, reason);
}
}
/*************************************************************************/
void common_unban(ChannelInfo * ci, char *nick)
{
int count, i;
char *av[3], **bans;
User *u;
if (!ci || !ci->c || !ci->bi || !nick)
return;
if (!(u = finduser(nick)))
return;
if (ircd->svsmode_unban) {
anope_cmd_unban(ci->name, nick);
} else {
av[0] = ci->name;
av[1] = sstrdup("-b");
count = ci->c->bancount;
bans = scalloc(sizeof(char *) * count, 1);
memcpy(bans, ci->c->bans, sizeof(char *) * count);
for (i = 0; i < count; i++) {
if (match_usermask(bans[i], u)) {
anope_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]);
av[2] = bans[i];
do_cmode(ci->bi->nick, 3, av);
}
}
free(bans);
free(av[1]);
}
}
/*************************************************************************/
void common_svsmode(User * u, char *modes, char *arg)
{
int ac = 1;
char *av[2];
av[0] = modes;
if (arg) {
av[1] = arg;
ac++;
}
anope_cmd_svsmode(u, ac, av);
anope_set_umode(u, ac, av);
}
/*************************************************************************/
char *common_get_vhost(User * u)
{
if (u->mode & ircd->vhostmode) {
return u->vhost;
} else {
return u->host;
}
}
/*************************************************************************/
char *common_get_vident(User * u)
{
if (u->mode & ircd->vhostmode) {
if (u->vident) {
return u->vident;
} else {
return u->username;
}
} else {
return u->username;
}
}
+1299
View File
File diff suppressed because it is too large Load Diff
+80 -157
View File
@@ -46,7 +46,6 @@ static void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick,
char *reason);
static void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode,
char *nick);
static void bot_raw_unban(ChannelInfo * ci, char *nick);
static int do_help(User * u);
static int do_bot(User * u);
@@ -222,20 +221,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
cstatus = chan_get_user_status(ci->c, u);
if (buf && !check_access(u, ci, CA_NOKICK) &&
#ifdef HAS_HALFOP
#if defined(IRC_UNREAL) || defined (IRC_VIAGRA)
(!(ci->botflags & BS_DONTKICKOPS)
|| !(cstatus & (CUS_HALFOP | CUS_OP | CUS_OWNER | CUS_PROTECT)))
# elif defined (IRC_ULTIMATE3) || defined(IRC_RAGE2)
(!(ci->botflags & BS_DONTKICKOPS)
|| !(cstatus & (CUS_HALFOP | CUS_OP | CUS_PROTECT)))
# else
(!(ci->botflags & BS_DONTKICKOPS)
|| !(cstatus & (CUS_HALFOP | CUS_OP)))
# endif
#else
(!(ci->botflags & BS_DONTKICKOPS) || !(cstatus & CUS_OP))
#endif
&& (!(ci->botflags & BS_DONTKICKVOICES) || !(cstatus & CUS_VOICE))) {
/* Bolds kicker */
if ((ci->botflags & BS_KICK_BOLDS) && strchr(buf, 2)) {
@@ -466,13 +454,10 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
cmd = strtok(buf, " ");
if (cmd) {
#if defined(IRC_UNREAL) || defined (IRC_VIAGRA)
if (!stricmp(cmd, "!deowner")) {
if (!stricmp(cmd, "!deowner") && ircd->owner) {
if (is_founder(u, ci))
bot_raw_mode(u, ci, "-q", u->nick);
} else
#endif
if (!stricmp(cmd, "!kb")) {
} else if (!stricmp(cmd, "!kb")) {
char *target = strtok(NULL, " ");
char *reason = strtok(NULL, "");
@@ -502,11 +487,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
else
bot_raw_kick(u, ci, target, reason);
}
#if defined(IRC_UNREAL) || defined (IRC_VIAGRA)
} else if (!stricmp(cmd, "!owner")) {
} else if (!stricmp(cmd, "!owner") && ircd->owner) {
if (is_founder(u, ci))
bot_raw_mode(u, ci, "+q", u->nick);
#endif
} else if (!stricmp(cmd, "!seen")) {
char *target = strtok(NULL, " ");
char buf[BUFSIZE];
@@ -520,16 +503,16 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
/* If we look for the bot */
snprintf(buf, sizeof(buf),
getstring(u->na, BOT_SEEN_BOT), u->nick);
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
buf);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
buf);
} else if (!(na = findnick(target))
|| (na->status & NS_VERBOTEN)) {
/* If the nick is not registered or forbidden */
snprintf(buf, sizeof(buf),
getstring(u->na, BOT_SEEN_UNKNOWN),
target);
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
buf);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
buf);
} else if ((u2 = nc_on_chan(ci->c, na->nc))) {
/* If the nick we're looking for is on the channel,
* there are three possibilities: it's yourself,
@@ -549,8 +532,8 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
getstring(u->na,
BOT_SEEN_ON_CHANNEL_AS),
target, u2->nick);
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
buf);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
buf);
} else if ((access = get_access_entry(na->nc, ci))) {
/* User is on the access list but not present actually.
Special case: if access->last_seen is 0 it's that we
@@ -568,15 +551,15 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
getstring(u->na, BOT_SEEN_NEVER),
target);
}
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
buf);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
buf);
} else {
/* All other cases */
snprintf(buf, sizeof(buf),
getstring(u->na, BOT_SEEN_UNKNOWN),
target);
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
buf);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
buf);
}
}
} else if (!stricmp(cmd, "!unban")
@@ -584,9 +567,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
char *target = strtok(NULL, " ");
if (!target)
bot_raw_unban(ci, u->nick);
common_unban(ci, u->nick);
else
bot_raw_unban(ci, target);
common_unban(ci, target);
} else {
CSModeUtil *util = csmodeutils;
@@ -669,7 +652,7 @@ void load_bs_dbase(void)
restore_db(f); \
log_perror("Write error on %s", BotDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
wallops(NULL, "Write error on %s: %s", BotDBName, \
anope_cmd_global(NULL, "Write error on %s: %s", BotDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
@@ -830,8 +813,8 @@ BotInfo *findbot(char *nick)
static void unassign(User * u, ChannelInfo * ci)
{
if (ci->c && ci->c->usercount >= BSMinUsers) {
send_cmd(ci->bi->nick, "PART %s :UNASSIGN from %s", ci->name,
u->nick);
anope_cmd_part(ci->bi->nick, ci->name, "UNASSIGN from %s",
u->nick);
}
ci->bi->chancount--;
ci->bi = NULL;
@@ -851,7 +834,8 @@ static BanData *get_ban_data(Channel * c, User * u)
if (!c || !u)
return NULL;
snprintf(mask, sizeof(mask), "%s@%s", u->username, GetHost(u));
snprintf(mask, sizeof(mask), "%s@%s", u->username,
common_get_vhost(u));
for (bd = c->bd; bd; bd = next) {
if (now - bd->last_use > BSKeepData) {
@@ -955,7 +939,7 @@ void bot_join(ChannelInfo * ci)
av[1] = sstrdup("-b");
for (i = 0; i < count; i++) {
if (match_wild_nocase(ci->c->bans[i], botmask)) {
send_mode(ci->bi->nick, ci->name, "%s", bans[i]);
anope_cmd_mode(ci->bi->nick, ci->name, "%s", bans[i]);
av[2] = sstrdup(bans[i]);
do_cmode(ci->bi->nick, 3, av);
free(av[2]);
@@ -968,29 +952,12 @@ void bot_join(ChannelInfo * ci)
/* Should we be invited? */
if ((ci->c->mode & CMODE_i)
|| (ci->c->limit && ci->c->usercount >= ci->c->limit))
send_cmd(NULL, "NOTICE @%s :%s invited %s into the channel.",
ci->c->name, ci->bi->nick, ci->bi->nick);
anope_cmd_notice_ops(NULL, ci->c->name,
"%s invited %s into the channel.",
ci->bi->nick, ci->bi->nick);
}
#ifdef IRC_BAHAMUT
send_cmd(ci->bi->nick, "SJOIN %ld %s", ci->c->creation_time,
ci->c->name);
#elif defined(IRC_HYBRID)
send_cmd(NULL, "SJOIN %ld %s + :%s", time(NULL), ci->c->name,
ci->bi->nick);
#else
send_cmd(ci->bi->nick, "JOIN %s", ci->c->name);
#endif
#if defined(IRC_UNREAL) || defined (IRC_VIAGRA)
send_mode(ci->bi->nick, ci->c->name, "+ao %s %s", ci->bi->nick,
ci->bi->nick);
#elif defined(IRC_PTLINK)
/* PTLinks requieres an IRCop to u-line changes, so use ChanServ */
send_mode(s_ChanServ, ci->c->name, "+ao %s %s", ci->bi->nick,
ci->bi->nick);
#else
send_mode(ci->bi->nick, ci->c->name, "+o %s", ci->bi->nick);
#endif
anope_cmd_join(ci->bi->nick, ci->c->name, ci->c->creation_time);
anope_cmd_bot_chan_mode(ci->bi->nick, ci->c->name);
}
/*************************************************************************/
@@ -1033,7 +1000,7 @@ static void check_ban(ChannelInfo * ci, User * u, int ttbtype)
av[1] = sstrdup("+b");
get_idealban(ci, u, mask, sizeof(mask));
av[2] = mask;
send_mode(ci->bi->nick, av[0], "+b %s", av[2]);
anope_cmd_mode(ci->bi->nick, av[0], "+b %s", av[2]);
do_cmode(ci->bi->nick, 3, av);
free(av[1]);
}
@@ -1062,7 +1029,7 @@ static void bot_kick(ChannelInfo * ci, User * u, int message, ...)
av[0] = ci->name;
av[1] = u->nick;
av[2] = buf;
send_cmd(ci->bi->nick, "KICK %s %s :%s", av[0], av[1], av[2]);
anope_cmd_kick(ci->bi->nick, av[0], av[1], "%s", av[2]);
do_kick(ci->bi->nick, 3, av);
}
@@ -1080,31 +1047,31 @@ static void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
if (!u)
return;
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
if (is_protected(u) && (requester != u)) {
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
getstring2(NULL, PERMISSION_DENIED));
return;
if (ircd->protectedumode) {
if (is_protected(u) && (requester != u)) {
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
getstring2(NULL, PERMISSION_DENIED));
return;
}
}
#endif
if ((ci->flags & CI_PEACE) && stricmp(requester->nick, nick)
&& (get_access(u, ci) >= get_access(requester, ci)))
return;
#ifdef HAS_EXCEPT
if (is_excepted(ci, u) == 1) {
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
getstring2(NULL, BOT_EXCEPT));
return;
if (ircd->except) {
if (is_excepted(ci, u) == 1) {
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
getstring2(NULL, BOT_EXCEPT));
return;
}
}
#endif
av[0] = ci->name;
av[1] = sstrdup("+b");
get_idealban(ci, u, mask, sizeof(mask));
av[2] = mask;
send_mode(ci->bi->nick, av[0], "+b %s", av[2]);
anope_cmd_mode(ci->bi->nick, av[0], "+b %s", av[2]);
do_cmode(ci->bi->nick, 3, av);
free(av[1]);
@@ -1119,7 +1086,7 @@ static void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
av[2] = reason;
}
send_cmd(ci->bi->nick, "KICK %s %s :%s", av[0], av[1], av[2]);
anope_cmd_kick(ci->bi->nick, av[0], av[1], "%s", av[2]);
do_kick(ci->bi->nick, 3, av);
}
@@ -1136,13 +1103,13 @@ static void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick,
if (!u || !is_on_chan(ci->c, u))
return;
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
if (is_protected(u) && (requester != u)) {
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
getstring2(NULL, PERMISSION_DENIED));
return;
if (ircd->protectedumode) {
if (is_protected(u) && (requester != u)) {
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
getstring2(NULL, PERMISSION_DENIED));
return;
}
}
#endif
if ((ci->flags & CI_PEACE) && stricmp(requester->nick, nick)
&& (get_access(u, ci) >= get_access(requester, ci)))
@@ -1159,7 +1126,7 @@ static void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick,
av[2] = reason;
}
send_cmd(ci->bi->nick, "KICK %s %s :%s", av[0], av[1], av[2]);
anope_cmd_kick(ci->bi->nick, av[0], av[1], "%s", av[2]);
do_kick(ci->bi->nick, 3, av);
}
@@ -1176,13 +1143,13 @@ static void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode,
if (!u || !is_on_chan(ci->c, u))
return;
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
if (is_protected(u) && *mode == '-' && (requester != u)) {
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name,
getstring2(NULL, PERMISSION_DENIED));
return;
if (ircd->protectedumode) {
if (is_protected(u) && *mode == '-' && (requester != u)) {
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s",
getstring2(NULL, PERMISSION_DENIED));
return;
}
}
#endif
if (*mode == '-' && (ci->flags & CI_PEACE)
&& stricmp(requester->nick, nick)
@@ -1193,57 +1160,12 @@ static void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode,
av[1] = mode;
av[2] = nick;
send_mode(ci->bi->nick, av[0], "%s %s", av[1], av[2]);
anope_cmd_mode(ci->bi->nick, av[0], "%s %s", av[1], av[2]);
do_cmode(ci->bi->nick, 3, av);
}
/*************************************************************************/
/* Removes all bans for a nick on a channel */
static void bot_raw_unban(ChannelInfo * ci, char *nick)
{
#ifndef IRC_BAHAMUT
int count, i;
char *av[3], **bans;
User *u;
#endif
if (!ci || !ci->c || !ci->bi || !nick)
return;
#ifndef IRC_BAHAMUT
if (!(u = finduser(nick)))
return;
#else
if (!finduser(nick))
return;
#endif
#ifndef IRC_BAHAMUT
av[0] = ci->name;
av[1] = sstrdup("-b");
count = ci->c->bancount;
bans = scalloc(sizeof(char *) * count, 1);
memcpy(bans, ci->c->bans, sizeof(char *) * count);
for (i = 0; i < count; i++) {
if (match_usermask(bans[i], u)) {
send_mode(ci->bi->nick, ci->name, "-b %s", bans[i]);
av[2] = bans[i];
do_cmode(ci->bi->nick, 3, av);
}
}
free(bans);
free(av[1]);
#else
send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick);
#endif
}
/*************************************************************************/
/*************************************************************************/
static int do_help(User * u)
{
char *cmd = strtok(NULL, "");
@@ -1383,8 +1305,8 @@ static int do_bot(User * u)
EnforceQlinedNick(nick, s_BotServ);
/* We make the bot online, ready to serve */
NEWNICK(bi->nick, bi->user, bi->host, bi->real,
BOTSERV_BOTS_MODE, 1);
anope_cmd_bot_nick(bi->nick, bi->user, bi->host, bi->real,
ircd->botserv_bot_mode);
notice_lang(s_BotServ, u, BOT_BOT_ADDED, bi->nick, bi->user,
bi->host, bi->real);
@@ -1493,9 +1415,9 @@ static int do_bot(User * u)
if (stricmp(bi->nick, nick)) {
/* The new nick is really different, so we remove the Q line for
the old nick. */
#ifndef IRC_HYBRID
send_cmd(NULL, "UNSQLINE %s", bi->nick);
#endif
if (ircd->sqline) {
anope_cmd_unsqline(bi->nick);
}
/* We check whether the nick is registered, and drop it if so */
if ((na = findnick(nick)))
@@ -1524,12 +1446,12 @@ static int do_bot(User * u)
/* If only the nick changes, we just make the bot change his nick,
else we must make it quit and rejoin. */
if (!user)
send_cmd(oldnick, "NICK %s", bi->nick);
anope_cmd_chg_nick(oldnick, bi->nick);
else {
send_cmd(oldnick, "QUIT :Quit: Be right back");
anope_cmd_quit(oldnick, "Quit: Be right back");
NEWNICK(bi->nick, bi->user, bi->host, bi->real,
BOTSERV_BOTS_MODE, 1);
anope_cmd_bot_nick(bi->nick, bi->user, bi->host, bi->real,
ircd->botserv_bot_mode);
bot_rejoin_all(bi);
}
@@ -1546,12 +1468,12 @@ static int do_bot(User * u)
else if (!(bi = findbot(nick)))
notice_lang(s_BotServ, u, BOT_DOES_NOT_EXIST, nick);
else {
send_cmd(bi->nick,
"QUIT :Quit: Help! I'm being deleted by %s!",
u->nick);
#ifndef IRC_HYBRID
send_cmd(NULL, "UNSQLINE %s", bi->nick);
#endif
anope_cmd_quit(bi->nick,
"Quit: Help! I'm being deleted by %s!",
u->nick);
if (ircd->sqline) {
anope_cmd_unsqline(bi->nick);
}
delbot(bi);
notice_lang(s_BotServ, u, BOT_BOT_DELETED, nick);
@@ -2494,11 +2416,12 @@ static int do_say(User * u)
notice_lang(s_BotServ, u, ACCESS_DENIED);
else {
if (text[0] != '\001') {
send_cmd(ci->bi->nick, "PRIVMSG %s :%s", ci->name, text);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%s", text);
ci->bi->lastmsg = time(NULL);
if (logchan && LogBot)
send_cmd(ci->bi->nick, "PRIVMSG %s :SAY %s %s %s",
LogChannel, u->nick, ci->name, text);
anope_cmd_privmsg(ci->bi->nick, LogChannel,
":SAY %s %s %s", u->nick, ci->name,
text);
} else {
syntax_error(s_BotServ, u, "SAY", BOT_SAY_SYNTAX);
}
@@ -2528,12 +2451,12 @@ static int do_act(User * u)
else if (!check_access(u, ci, CA_SAY))
notice_lang(s_BotServ, u, ACCESS_DENIED);
else {
send_cmd(ci->bi->nick, "PRIVMSG %s :%cACTION %s%c", ci->name, 1,
text, 1);
anope_cmd_privmsg(ci->bi->nick, ci->name, "%cACTION %s%c", 1,
text, 1);
ci->bi->lastmsg = time(NULL);
if (logchan && LogBot)
send_cmd(ci->bi->nick, "PRIVMSG %s :ACT %s %s %s", LogChannel,
u->nick, ci->name, text);
anope_cmd_privmsg(ci->bi->nick, LogChannel, ":ACT %s %s %s",
u->nick, ci->name, text);
}
return MOD_CONT;
}
+109 -539
View File
@@ -19,410 +19,24 @@ Channel *chanlist[1024];
#define HASH(chan) ((chan)[1] ? ((chan)[1]&31)<<5 | ((chan)[2]&31) : 0)
static void add_ban(Channel * chan, char *mask);
#ifdef HAS_EXCEPT
static void add_exception(Channel * chan, char *mask);
#endif
static void chan_adduser2(User * user, Channel * c);
static Channel *chan_create(const char *chan);
static void chan_delete(Channel * c);
static void del_ban(Channel * chan, char *mask);
#ifdef HAS_EXCEPT
static void del_exception(Channel * chan, char *mask);
#endif
#ifdef HAS_FMODE
static char *get_flood(Channel * chan);
#endif
static char *get_key(Channel * chan);
static char *get_limit(Channel * chan);
#ifdef HAS_LMODE
static char *get_redirect(Channel * chan);
#endif
static Channel *join_user_update(User * user, Channel * chan, char *name);
#ifdef HAS_FMODE
static void set_flood(Channel * chan, char *value);
#endif
static void set_key(Channel * chan, char *value);
static void set_limit(Channel * chan, char *value);
#ifdef HAS_LMODE
static void set_redirect(Channel * chan, char *value);
#endif
void add_ban(Channel * chan, char *mask);
void add_exception(Channel * chan, char *mask);
void chan_adduser2(User * user, Channel * c);
Channel *chan_create(char *chan);
void chan_delete(Channel * c);
void del_ban(Channel * chan, char *mask);
void del_exception(Channel * chan, char *mask);
char *get_flood(Channel * chan);
char *get_key(Channel * chan);
char *get_limit(Channel * chan);
char *get_redirect(Channel * chan);
Channel *join_user_update(User * user, Channel * chan, char *name);
void set_flood(Channel * chan, char *value);
void set_key(Channel * chan, char *value);
void set_limit(Channel * chan, char *value);
void set_redirect(Channel * chan, char *value);
void do_mass_mode(char *modes);
/*************************************************************************/
/* *INDENT-OFF* */
CBMode cbmodes[128] = {
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 },
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2) || defined(IRC_VIAGRA)
{ CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL },
#else
{ 0 }, /* A */
#endif
{ 0 }, /* B */
#if defined(IRC_UNREAL) || defined(IRC_RAGE2)
{ CMODE_C, 0, NULL, NULL },
#else
{ 0 }, /* C */
#endif
{ 0 }, /* D */
{ 0 }, /* E */
{ 0 }, /* F */
#ifdef IRC_UNREAL
{ CMODE_G, 0, NULL, NULL },
#else
{ 0 }, /* G */
#endif
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
{ CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL },
#else
{ 0 }, /* H */
#endif
#ifdef IRC_ULTIMATE
{ CMODE_I },
#else
{ 0 }, /* I */
#endif
{ 0 }, /* J */
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3) || defined(IRC_UNREAL)
{ CMODE_K, 0, NULL, NULL },
#else
{ 0 }, /* K */
#endif
#ifdef HAS_LMODE
{ CMODE_L, 0, set_redirect, cs_set_redirect },
#else
{ 0 }, /* L */
#endif
#ifdef IRC_BAHAMUT
{ CMODE_M },
#else
{ 0 }, /* M */
#endif
#if defined (IRC_UNREAL) || defined (IRC_ULTIMATE3) || defined (IRC_PTLINK) || defined(IRC_RAGE2)
{ CMODE_N, 0, NULL, NULL },
#else
{ 0 }, /* N */
#endif
#if defined(IRC_BAHAMUT) || defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
{ CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL },
#else
{ 0 }, /* O */
#endif
{ 0 }, /* P */
#ifdef IRC_UNREAL
{ CMODE_Q, 0, NULL, NULL },
#else
{ 0 }, /* Q */
#endif
#ifndef IRC_HYBRID
{ CMODE_R, 0, NULL, NULL }, /* R */
#else
{ 0 },
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined (IRC_ULTIMATE3) || defined (IRC_PTLINK) || defined(IRC_RAGE2)
{ CMODE_S, 0, NULL, NULL },
#else
{ 0 }, /* S */
#endif
{ 0 }, /* T */
{ 0 }, /* U */
#ifdef IRC_UNREAL
{ CMODE_V, 0, NULL, NULL },
#else
{ 0 }, /* V */
#endif
{ 0 }, /* W */
{ 0 }, /* X */
{ 0 }, /* Y */
{ 0 }, /* Z */
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
#ifdef IRC_HYBRID
{ CMODE_a, 0, NULL, NULL },
#else
{ 0 }, /* a */
#endif
{ 0 }, /* b */
#if defined(IRC_BAHAMUT) || defined(IRC_UNREAL) || defined (IRC_PTLINK)
{ CMODE_c, 0, NULL, NULL },
#else
{ 0 }, /* c */
#endif
#ifdef IRC_PTLINK
{ CMODE_d, 0, NULL, NULL },
#else
{ 0 }, /* d */
#endif
{ 0 }, /* e */
#ifdef HAS_FMODE
{ CMODE_f, 0, set_flood, cs_set_flood },
#else
{ 0 }, /* f */
#endif
{ 0 }, /* g */
{ 0 }, /* h */
{ CMODE_i, 0, NULL, NULL },
{ 0 }, /* j */
{ CMODE_k, 0, set_key, cs_set_key },
{ CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit },
{ CMODE_m, 0, NULL, NULL },
{ CMODE_n, 0, NULL, NULL },
{ 0 }, /* o */
{ CMODE_p, 0, NULL, NULL },
#ifdef IRC_PTLINK
{ CMODE_q, 0, NULL, NULL },
#else
{ 0 }, /* q */
#endif
#ifndef IRC_HYBRID
{ CMODE_r, CBM_NO_MLOCK, NULL, NULL },
#else
{ 0 },
#endif
{ CMODE_s, 0, NULL, NULL },
{ CMODE_t, 0, NULL, NULL },
#ifdef IRC_UNREAL
{ CMODE_u, 0, NULL, NULL },
#else
{ 0 },
#endif
{ 0 }, /* v */
{ 0 }, /* w */
#ifdef IRC_ULTIMATE
{ CMODE_x },
#else
{ 0 }, /* x */
#endif
{ 0 }, /* y */
#ifdef IRC_UNREAL
{ CMODE_z, 0, NULL, NULL },
#else
{ 0 }, /* z */
#endif
{ 0 }, { 0 }, { 0 }, { 0 }
};
CBModeInfo cbmodeinfos[] = {
#if defined(IRC_HYBRID)
{ 'a', CMODE_a, 0, NULL, NULL },
#endif
#if defined(IRC_BAHAMUT) || defined(IRC_UNREAL) || defined(IRC_PTLINK) || defined(IRC_RAGE2)
{ 'c', CMODE_c, 0, NULL, NULL },
#endif
#if defined(IRC_PTLINK)
{ 'd', CMODE_d, 0, NULL, NULL },
#endif
#ifdef HAS_FMODE
{ 'f', CMODE_f, 0, get_flood, cs_get_flood },
#endif
{ 'i', CMODE_i, 0, NULL, NULL },
{ 'k', CMODE_k, 0, get_key, cs_get_key },
{ 'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit },
{ 'm', CMODE_m, 0, NULL, NULL },
{ 'n', CMODE_n, 0, NULL, NULL },
{ 'p', CMODE_p, 0, NULL, NULL },
#ifdef IRC_PTLINK
{ 'q', CMODE_q, 0, NULL, NULL },
#endif
#ifndef IRC_HYBRID
{ 'r', CMODE_r, 0, NULL, NULL },
#endif
{ 's', CMODE_s, 0, NULL, NULL },
{ 't', CMODE_t, 0, NULL, NULL },
#ifdef IRC_UNREAL
{ 'u', CMODE_u, 0, NULL, NULL },
#endif
#ifdef IRC_ULTIMATE
{ 'x', CMODE_x, 0, NULL, NULL },
#endif
#ifdef IRC_UNREAL
{ 'z', CMODE_z, 0, NULL, NULL },
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_PTLINK) || defined(IRC_RAGE2) || defined(IRC_VIAGRA)
{ 'A', CMODE_A, 0, NULL, NULL },
#endif
#if defined(IRC_UNREAL) || defined(IRC_RAGE2)
{ 'C', CMODE_C, 0, NULL, NULL },
#endif
#ifdef IRC_UNREAL
{ 'G', CMODE_G, 0, NULL, NULL },
#endif
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
{ 'H', CMODE_H, 0, NULL, NULL },
#endif
#ifdef IRC_ULTIMATE
{ 'I', CMODE_I, 0, NULL, NULL },
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_PTLINK) || defined(IRC_ULTIMATE3)
{ 'K', CMODE_K, 0, NULL, NULL },
#endif
#ifdef HAS_LMODE
{ 'L', CMODE_L, 0, get_redirect, cs_get_redirect },
#endif
#ifdef IRC_BAHAMUT
#ifndef IRC_ULTIMATE3
{ 'M', CMODE_M, 0, NULL, NULL },
#endif
#endif
#if defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_PTLINK) || defined(IRC_RAGE2)
{ 'N', CMODE_N, 0, NULL, NULL },
#endif
#if defined(IRC_BAHAMUT) || defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
{ 'O', CMODE_O, 0, NULL, NULL },
#endif
#ifdef IRC_UNREAL
{ 'Q', CMODE_Q, 0, NULL, NULL },
#endif
#ifndef IRC_HYBRID
{ 'R', CMODE_R, 0, NULL, NULL },
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_PTLINK) || defined(IRC_RAGE2)
{ 'S', CMODE_S, 0, NULL, NULL },
#endif
#ifdef IRC_UNREAL
{ 'V', CMODE_V, 0, NULL, NULL },
#endif
{ 0 }
};
static CMMode cmmodes[128] = {
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL },
{ NULL },
{ add_ban, del_ban },
{ NULL },
{ NULL },
#ifdef HAS_EXCEPT
{ add_exception, del_exception },
#endif
{ NULL },
{ NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL },
{ NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }, { NULL }
};
#if defined(IRC_BAHAMUT) || defined(IRC_HYBRID) || defined(IRC_PTLINK)
static char csmodes[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,
#if defined(IRC_ULTIMATE3) || defined(IRC_HYBRID)
'a', /* (33) ! Channel Admins */
#else
0,
#endif
0, 0, 0,
#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
'h', /* (37) % Channel halfops */
#else
0,
#endif
0, 0, 0, 0,
#if defined(IRC_RAGE2)
'a', /* * Channel Admins */
#else
0,
#endif
'v', 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#endif
static CUMode cumodes[128] = {
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
{ 0 },
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
{ CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op },
#else
#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
{ CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin },
#else
{ 0 }, /* a */
#endif
#endif
{ 0 }, /* b */
{ 0 }, /* c */
{ 0 }, /* d */
{ 0 }, /* e */
{ 0 }, /* f */
{ 0 }, /* g */
#ifdef HAS_HALFOP
{ CUS_HALFOP, 0, check_valid_op },
#else
{ 0 }, /* h */
#endif
{ 0 }, /* i */
{ 0 }, /* j */
{ 0 }, /* k */
{ 0 }, /* l */
{ 0 }, /* m */
{ 0 }, /* n */
{ CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op },
{ 0 }, /* p */
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
{ CUS_OWNER, 0, check_valid_op },
#else
{ 0 }, /* q */
#endif
{ 0 }, /* r */
{ 0 }, /* s */
{ 0 }, /* t */
{ 0 }, /* u */
{ CUS_VOICE, 0, NULL },
{ 0 }, /* w */
{ 0 }, /* x */
{ 0 }, /* y */
{ 0 }, /* z */
{ 0 }, { 0 }, { 0 }, { 0 }, { 0 }
};
/* *INDENT-ON* */
/*************************************************************************/
/**************************** External Calls *****************************/
/*************************************************************************/
@@ -453,7 +67,7 @@ void chan_deluser(User * user, Channel * c)
c->usercount--;
if (s_BotServ && c->ci && c->ci->bi && c->usercount == BSMinUsers - 1) {
send_cmd(c->ci->bi->nick, "PART %s", c->name);
anope_cmd_part(c->ci->bi->nick, c->name, NULL);
}
if (!c->users)
@@ -598,8 +212,8 @@ void chan_set_modes(const char *source, Channel * chan, int ac, char **av,
BotInfo *bi;
if ((bi = findbot(*av))) {
send_mode(bi->nick, chan->name, "+%c %s", mode,
bi->nick);
anope_cmd_mode(bi->nick, chan->name, "+%c %s", mode,
bi->nick);
continue;
}
}
@@ -665,7 +279,7 @@ void chan_set_user_status(Channel * chan, User * user, int16 status)
if (HelpChannel && status == CUS_OP
&& !stricmp(chan->name, HelpChannel))
change_user_mode(user, "+h", NULL);
common_svsmode(user, "+h", NULL);
for (uc = user->chans; uc; uc = uc->next) {
if (uc->chan == chan) {
@@ -752,26 +366,26 @@ void get_channel_stats(long *nrec, long *memuse)
mem += strlen(chan->topic) + 1;
if (chan->key)
mem += strlen(chan->key) + 1;
#ifdef HAS_FMODE
if (chan->flood)
mem += strlen(chan->flood) + 1;
#endif
#ifdef HAS_LMODE
if (chan->redirect)
mem += strlen(chan->redirect) + 1;
#endif
if (ircd->fmode) {
if (chan->flood)
mem += strlen(chan->flood) + 1;
}
if (ircd->Lmode) {
if (chan->redirect)
mem += strlen(chan->redirect) + 1;
}
mem += sizeof(char *) * chan->bansize;
for (j = 0; j < chan->bancount; j++) {
if (chan->bans[j])
mem += strlen(chan->bans[j]) + 1;
}
#ifdef HAS_EXCEPT
mem += sizeof(char *) * chan->exceptsize;
for (j = 0; j < chan->exceptcount; j++) {
if (chan->excepts[j])
mem += strlen(chan->excepts[j]) + 1;
if (ircd->except) {
mem += sizeof(char *) * chan->exceptsize;
for (j = 0; j < chan->exceptcount; j++) {
if (chan->excepts[j])
mem += strlen(chan->excepts[j]) + 1;
}
}
#endif
for (cu = chan->users; cu; cu = cu->next) {
mem += sizeof(*cu);
if (cu->ud) {
@@ -986,8 +600,6 @@ void do_part(const char *source, int ac, char **av)
/*************************************************************************/
#if defined(IRC_BAHAMUT) || defined(IRC_HYBRID) || defined(IRC_PTLINK)
/* Handle a SJOIN command.
On channel creation, syntax is:
@@ -1013,16 +625,15 @@ void do_sjoin(const char *source, int ac, char **av)
/* Double check to avoid unknown modes that need parameters */
if (ac >= 4 && ac <= 6) {
char *s, *end, cubuf[CHAN_MAX_SYMBOLS + 2], *end2,
*cumodes[CHAN_MAX_SYMBOLS + 1];
char *s, *end, cubuf[ircd->max_symbols + 2], *end2,
*cumodes[ircd->max_symbols + 1];
c = findchan(av[1]);
#ifndef IRC_HYBRID
#ifndef IRC_PTLINK
if (!c)
is_sqlined = check_chan_sqline(av[1]);
#endif
#endif
if (ircd->chansqline) {
if (!c)
is_sqlined = check_chan_sqline(av[1]);
}
cubuf[0] = '+';
cumodes[0] = cubuf;
@@ -1048,7 +659,7 @@ void do_sjoin(const char *source, int ac, char **av)
}
if (is_sqlined && !is_oper(user)) {
send_cmd(s_OperServ, "KICK %s %s :Q-Lined", av[1], s);
anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined");
} else {
if (!check_kick(user, av[1])) {
/* Make the user join; if the channel does not exist it
@@ -1094,14 +705,13 @@ void do_sjoin(const char *source, int ac, char **av)
return;
c = findchan(av[1]);
#ifndef IRC_HYBRID
#ifndef IRC_PTLINK
if (!c)
is_sqlined = check_chan_sqline(av[1]);
#endif
#endif
if (ircd->chansqline) {
if (!c)
is_sqlined = check_chan_sqline(av[1]);
}
if (is_sqlined && !is_oper(user)) {
send_cmd(s_OperServ, "KICK %s %s :Q-Lined", av[1], user->nick);
anope_cmd_kick(s_OperServ, av[1], user->nick, "Q-Lined");
} else {
c = join_user_update(user, c, av[1]);
c->creation_time = strtoul(av[0], NULL, 10);
@@ -1109,7 +719,6 @@ void do_sjoin(const char *source, int ac, char **av)
}
}
#endif
/*************************************************************************/
@@ -1119,34 +728,29 @@ void do_cmode(const char *source, int ac, char **av)
{
Channel *chan;
ChannelInfo *ci = NULL;
#ifdef IRC_BAHAMUT
/* Ultimate3 doesn't send TS on Mode - TSL */
#if !defined(IRC_ULTIMATE3)
int i;
char *t;
/* TSMODE for bahamut - leave this code out to break MODEs. -GD */
if (uplink_capab & CAPAB_TSMODE) {
for (i = 0; i < strlen(av[1]); i++) {
if (!isdigit(av[1][i]))
break;
}
if (av[1][i] == '\0') {
/* We have a valid TS field in av[1] now, so we can strip it off */
/* After we swap av[0] and av[1] ofcourse to not break stuff! :) */
t = av[0];
av[0] = av[1];
av[1] = t;
ac--;
av++;
} else {
alog("TSMODE enabled but MODE has no valid TS");
if (ircdcap->tsmode) {
/* TSMODE for bahamut - leave this code out to break MODEs. -GD */
if (uplink_capab & ircdcap->tsmode) {
for (i = 0; i < strlen(av[1]); i++) {
if (!isdigit(av[1][i]))
break;
}
if (av[1][i] == '\0') {
/* We have a valid TS field in av[1] now, so we can strip it off */
/* After we swap av[0] and av[1] ofcourse to not break stuff! :) */
t = av[0];
av[0] = av[1];
av[1] = t;
ac--;
av++;
} else {
alog("TSMODE enabled but MODE has no valid TS");
}
}
}
#endif
#endif
chan = findchan(av[0]);
if (!chan) {
@@ -1206,7 +810,7 @@ void do_topic(const char *source, int ac, char **av)
/**************************** Internal Calls *****************************/
/*************************************************************************/
static void add_ban(Channel * chan, char *mask)
void add_ban(Channel * chan, char *mask)
{
if (s_BotServ && BSSmartJoin && chan->ci && chan->ci->bi
&& chan->usercount >= BSMinUsers) {
@@ -1216,7 +820,7 @@ static void add_ban(Channel * chan, char *mask)
snprintf(botmask, sizeof(botmask), "%s!%s@%s", bi->nick, bi->user,
bi->host);
if (match_wild_nocase(mask, botmask)) {
send_mode(bi->nick, chan->name, "-b %s", mask);
anope_cmd_mode(bi->nick, chan->name, "-b %s", mask);
return;
}
}
@@ -1233,9 +837,7 @@ static void add_ban(Channel * chan, char *mask)
/*************************************************************************/
#ifdef HAS_EXCEPT
static void add_exception(Channel * chan, char *mask)
void add_exception(Channel * chan, char *mask)
{
if (chan->exceptcount >= chan->exceptsize) {
chan->exceptsize += 8;
@@ -1248,8 +850,6 @@ static void add_exception(Channel * chan, char *mask)
alog("debug: Added except %s to channel %s", mask, chan->name);
}
#endif
/*************************************************************************/
/* Add/remove a user to/from a channel, creating or deleting the channel as
@@ -1258,32 +858,22 @@ static void add_exception(Channel * chan, char *mask)
* Modified, so ignored users won't get any status via services -certus */
static void chan_adduser2(User * user, Channel * c)
void chan_adduser2(User * user, Channel * c)
{
struct c_userlist *u;
char *chan = c->name;
if (get_ignore(user->nick) == NULL) {
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
if (check_should_owner(user, chan)) {
if (ircd->owner && check_should_owner(user, chan)) {
chan_set_user_status(c, user, CUS_OWNER | CUS_OP);
} else
#endif
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2) || defined(IRC_PTLINK)
if (check_should_protect(user, chan)) {
} else if (ircd->protect && check_should_protect(user, chan)) {
chan_set_user_status(c, user, CUS_PROTECT | CUS_OP);
} else
#endif
if (check_should_op(user, chan)) {
} else if (check_should_op(user, chan)) {
chan_set_user_status(c, user, CUS_OP);
} else
#ifdef HAS_HALFOP
if (check_should_halfop(user, chan)) {
} else if (ircd->halfop && check_should_halfop(user, chan)) {
chan_set_user_status(c, user, CUS_HALFOP);
} else
#endif
if (check_should_voice(user, chan)) {
} else if (check_should_voice(user, chan)) {
chan_set_user_status(c, user, CUS_VOICE);
}
}
@@ -1323,8 +913,8 @@ static void chan_adduser2(User * user, Channel * c)
if (c->usercount >= BSMinUsers && (c->ci->botflags & BS_GREET)
&& user->na && user->na->nc->greet
&& check_access(user, c->ci, CA_GREET)) {
send_cmd(c->ci->bi->nick, "PRIVMSG %s :[%s] %s", c->name,
user->na->nick, user->na->nc->greet);
anope_cmd_privmsg(c->ci->bi->nick, c->name, "[%s] %s",
user->na->nick, user->na->nc->greet);
c->ci->bi->lastmsg = time(NULL);
}
}
@@ -1336,7 +926,7 @@ static void chan_adduser2(User * user, Channel * c)
chan_adduser, but splitted to make it more efficient to use for
SJOINs). */
static Channel *chan_create(const char *chan)
Channel *chan_create(char *chan)
{
Channel *c;
Channel **list;
@@ -1370,7 +960,7 @@ static Channel *chan_create(const char *chan)
/* This destroys the channel structure, freeing everything in it. */
static void chan_delete(Channel * c)
void chan_delete(Channel * c)
{
BanData *bd, *next;
int i;
@@ -1393,14 +983,14 @@ static void chan_delete(Channel * c)
if (c->key)
free(c->key);
#ifdef HAS_FMODE
if (c->flood)
free(c->flood);
#endif
#ifdef HAS_LMODE
if (c->redirect)
free(c->redirect);
#endif
if (ircd->fmode) {
if (c->flood)
free(c->flood);
}
if (ircd->Lmode) {
if (c->redirect)
free(c->redirect);
}
for (i = 0; i < c->bancount; ++i) {
if (c->bans[i])
@@ -1411,17 +1001,17 @@ static void chan_delete(Channel * c)
if (c->bansize)
free(c->bans);
#ifdef HAS_EXCEPT
for (i = 0; i < c->exceptcount; ++i) {
if (c->excepts[i])
free(c->excepts[i]);
else
alog("channel: BUG freeing %s: exceps[%d] is NULL!", c->name,
i);
if (ircd->except) {
for (i = 0; i < c->exceptcount; ++i) {
if (c->excepts[i])
free(c->excepts[i]);
else
alog("channel: BUG freeing %s: exceps[%d] is NULL!",
c->name, i);
}
if (c->exceptsize)
free(c->excepts);
}
if (c->exceptsize)
free(c->excepts);
#endif
if (c->next)
c->next->prev = c->prev;
@@ -1435,7 +1025,7 @@ static void chan_delete(Channel * c)
/*************************************************************************/
static void del_ban(Channel * chan, char *mask)
void del_ban(Channel * chan, char *mask)
{
char **s = chan->bans;
int i = 0;
@@ -1462,9 +1052,7 @@ static void del_ban(Channel * chan, char *mask)
/*************************************************************************/
#ifdef HAS_EXCEPT
static void del_exception(Channel * chan, char *mask)
void del_exception(Channel * chan, char *mask)
{
int i;
int reset = 0;
@@ -1486,29 +1074,23 @@ static void del_exception(Channel * chan, char *mask)
alog("debug: Deleted except %s to channel %s", mask, chan->name);
}
#endif
/*************************************************************************/
#ifdef HAS_FMODE
static char *get_flood(Channel * chan)
char *get_flood(Channel * chan)
{
return chan->flood;
}
#endif
/*************************************************************************/
static char *get_key(Channel * chan)
char *get_key(Channel * chan)
{
return chan->key;
}
/*************************************************************************/
static char *get_limit(Channel * chan)
char *get_limit(Channel * chan)
{
static char limit[16];
@@ -1521,18 +1103,14 @@ static char *get_limit(Channel * chan)
/*************************************************************************/
#ifdef HAS_LMODE
static char *get_redirect(Channel * chan)
char *get_redirect(Channel * chan)
{
return chan->redirect;
}
#endif
/*************************************************************************/
static Channel *join_user_update(User * user, Channel * chan, char *name)
Channel *join_user_update(User * user, Channel * chan, char *name)
{
struct u_chanlist *c;
@@ -1557,9 +1135,7 @@ static Channel *join_user_update(User * user, Channel * chan, char *name)
/*************************************************************************/
#ifdef HAS_FMODE
static void set_flood(Channel * chan, char *value)
void set_flood(Channel * chan, char *value)
{
if (chan->flood)
free(chan->flood);
@@ -1570,11 +1146,9 @@ static void set_flood(Channel * chan, char *value)
chan->flood ? chan->flood : "no flood settings");
}
#endif
/*************************************************************************/
static void set_key(Channel * chan, char *value)
void set_key(Channel * chan, char *value)
{
if (chan->key)
free(chan->key);
@@ -1587,7 +1161,7 @@ static void set_key(Channel * chan, char *value)
/*************************************************************************/
static void set_limit(Channel * chan, char *value)
void set_limit(Channel * chan, char *value)
{
chan->limit = value ? strtoul(value, NULL, 10) : 0;
@@ -1598,9 +1172,7 @@ static void set_limit(Channel * chan, char *value)
/*************************************************************************/
#ifdef HAS_LMODE
static void set_redirect(Channel * chan, char *value)
void set_redirect(Channel * chan, char *value)
{
if (chan->redirect)
free(chan->redirect);
@@ -1611,8 +1183,6 @@ static void set_redirect(Channel * chan, char *value)
chan->redirect ? chan->redirect : "no redirect");
}
#endif
void do_mass_mode(char *modes)
{
int ac, i;
@@ -1633,7 +1203,7 @@ void do_mass_mode(char *modes)
if (c->bouncy_modes) {
return;
} else {
send_mode(s_OperServ, c->name, "%s", modes);
anope_cmd_mode(s_OperServ, c->name, "%s", modes);
chan_set_modes(s_OperServ, c, ac, av, 1);
}
}
+390 -549
View File
File diff suppressed because it is too large Load Diff
+7 -11
View File
@@ -22,7 +22,7 @@
* command exists.
*/
Command *lookup_cmd(Command * list, const char *cmd)
Command *lookup_cmd(Command * list, char *cmd)
{
Command *c;
@@ -39,22 +39,20 @@ Command *lookup_cmd(Command * list, const char *cmd)
* privilege to do so; if not, print an appropriate error message.
*/
void run_cmd(const char *service, User * u, Command * list,
const char *cmd)
void run_cmd(char *service, User * u, Command * list, char *cmd)
{
Command *c = lookup_cmd(list, cmd);
do_run_cmd(service, u, c, cmd);
}
void mod_run_cmd(const char *service, User * u, CommandHash * cmdTable[],
void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[],
const char *cmd)
{
Command *c = findCommand(cmdTable, cmd);
do_run_cmd(service, u, c, cmd);
}
void do_run_cmd(const char *service, User * u, Command * c,
const char *cmd)
void do_run_cmd(char *service, User * u, Command * c, const char *cmd)
{
int retVal = 0;
Command *current;
@@ -97,8 +95,7 @@ void do_run_cmd(const char *service, User * u, Command * c,
/* Print a help message for the given command. */
void do_help_cmd(const char *service, User * u, Command * c,
const char *cmd)
void do_help_cmd(char *service, User * u, Command * c, const char *cmd)
{
Command *current;
int has_had_help = 0;
@@ -161,14 +158,13 @@ void do_help_cmd(const char *service, User * u, Command * c,
}
}
void help_cmd(const char *service, User * u, Command * list,
const char *cmd)
void help_cmd(char *service, User * u, Command * list, char *cmd)
{
Command *c = lookup_cmd(list, cmd);
do_help_cmd(service, u, c, cmd);
}
void mod_help_cmd(const char *service, User * u, CommandHash * cmdTable[],
void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[],
const char *cmd)
{
Command *c = findCommand(cmdTable, cmd);
+6 -5
View File
@@ -144,8 +144,8 @@ static dbFILE *open_db_write(const char *service, const char *filename,
static int walloped = 0;
if (!walloped) {
walloped++;
wallops(NULL, "Can't back up %s database %s", service,
filename);
anope_cmd_global(NULL, "Can't back up %s database %s", service,
filename);
}
errno = errno_save;
log_perror("Can't back up %s database %s", service, filename);
@@ -171,8 +171,8 @@ static dbFILE *open_db_write(const char *service, const char *filename,
static int walloped = 0;
if (!walloped) {
walloped++;
wallops(NULL, "Can't write to %s database %s", service,
filename);
anope_cmd_global(NULL, "Can't write to %s database %s",
service, filename);
}
errno = errno_save;
log_perror("Can't write to %s database %s", service, filename);
@@ -424,7 +424,8 @@ static void rename_database(char *name, char *ext)
snprintf(destpath, sizeof(destpath), "backups/%s.%s", name, ext);
if (rename(name, destpath) != 0) {
alog("Backup of %s failed.", name);
wallops(s_OperServ, "WARNING! Backup of %s failed.", name);
anope_cmd_global(s_OperServ, "WARNING! Backup of %s failed.",
name);
}
}
+1123
View File
File diff suppressed because it is too large Load Diff
+47 -110
View File
@@ -33,9 +33,6 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick,
HostCore *deleteHostCore(HostCore * head, HostCore * prev);
void delHostCore(char *nick);
static void send_on(char *nick, char *vIdent, char *vhost);
static void send_off(User * u);
char *getvIdent(char *nick);
char *getvHost(char *nick);
@@ -112,11 +109,11 @@ void hostserv(User * u, char *buf)
} else if (skeleton) {
notice_lang(s_HostServ, u, SERVICE_OFFLINE, s_HostServ);
} else {
#ifdef HAS_VHOST
mod_run_cmd(s_HostServ, u, HOSTSERV, cmd);
#else
notice_lang(s_HostServ, u, SERVICE_OFFLINE, s_HostServ);
#endif
if (ircd->vhost) {
mod_run_cmd(s_HostServ, u, HOSTSERV, cmd);
} else {
notice_lang(s_HostServ, u, SERVICE_OFFLINE, s_HostServ);
}
}
}
@@ -129,8 +126,8 @@ HostCore *createHostCorelist(HostCore * next, char *nick, char *vIdent,
next = malloc(sizeof(HostCore));
if (next == NULL) {
wallops(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
} else {
next->nick = malloc(sizeof(char) * strlen(nick) + 1);
next->vHost = malloc(sizeof(char) * strlen(vHost) + 1);
@@ -139,8 +136,8 @@ HostCore *createHostCorelist(HostCore * next, char *nick, char *vIdent,
next->vIdent = malloc(sizeof(char) * strlen(vIdent) + 1);
if ((next->nick == NULL) || (next->vHost == NULL)
|| (next->creator == NULL)) {
wallops(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
return NULL;
}
strcpy(next->nick, nick);
@@ -148,8 +145,8 @@ HostCore *createHostCorelist(HostCore * next, char *nick, char *vIdent,
strcpy(next->creator, creator);
if (vIdent) {
if ((next->vIdent == NULL)) {
wallops(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
return NULL;
}
strcpy(next->vIdent, vIdent);
@@ -208,8 +205,8 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick,
newCore = malloc(sizeof(HostCore));
if (newCore == NULL) {
wallops(s_HostServ,
"Unable to allocate memory to insert into the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to insert into the vHost LL, problems i sense..");
return NULL;
} else {
newCore->nick = malloc(sizeof(char) * strlen(nick) + 1);
@@ -219,8 +216,8 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick,
newCore->vIdent = malloc(sizeof(char) * strlen(vIdent) + 1);
if ((newCore->nick == NULL) || (newCore->vHost == NULL)
|| (newCore->creator == NULL)) {
wallops(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
return NULL;
}
strcpy(newCore->nick, nick);
@@ -228,8 +225,8 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick,
strcpy(newCore->creator, creator);
if (vIdent) {
if ((newCore->vIdent == NULL)) {
wallops(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
anope_cmd_global(s_HostServ,
"Unable to allocate memory to create the vHost LL, problems i sense..");
return NULL;
}
strcpy(newCore->vIdent, vIdent);
@@ -589,7 +586,7 @@ void load_hs_dbase_v3(dbFILE * f)
restore_db(f); \
log_perror("Write error on %s", HostDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
wallops(NULL, "Write error on %s: %s", HostDBName, \
anope_cmd_global(NULL, "Write error on %s: %s", HostDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
@@ -684,10 +681,10 @@ int do_setall(User * u)
}
}
}
#ifndef HAS_VIDENT
notice_lang(s_HostServ, u, HOST_NO_VIDENT);
return MOD_CONT;
#endif
if (!ircd->vident) {
notice_lang(s_HostServ, u, HOST_NO_VIDENT);
return MOD_CONT;
}
}
if (strlen(rawhostmask) < HOSTMAX - 1)
@@ -863,10 +860,10 @@ int do_set(User * u)
}
}
}
#ifndef HAS_VIDENT
notice_lang(s_HostServ, u, HOST_NO_VIDENT);
return MOD_CONT;
#endif
if (!ircd->vident) {
notice_lang(s_HostServ, u, HOST_NO_VIDENT);
return MOD_CONT;
}
}
if (strlen(rawhostmask) < HOSTMAX - 1)
snprintf(hostmask, HOSTMAX - 1, "%s", rawhostmask);
@@ -918,14 +915,14 @@ int do_on(User * u)
} else {
notice_lang(s_HostServ, u, HOST_ACTIVATED, vHost);
}
send_on(u->nick, vIdent, vHost);
#ifdef HAS_VHOST
u->vhost = sstrdup(vHost);
#endif
#ifdef HAS_VIDENT
if (vIdent)
u->vident = sstrdup(vIdent);
#endif
anope_cmd_vhost_on(u->nick, vIdent, vHost);
if (ircd->vhost) {
u->vhost = sstrdup(vHost);
}
if (ircd->vident) {
if (vIdent)
u->vident = sstrdup(vIdent);
}
set_lastmask(u);
}
} else {
@@ -951,14 +948,14 @@ int do_on_id(User * u)
} else {
notice_lang(s_HostServ, u, HOST_ACTIVATED, vHost);
}
send_on(u->nick, vIdent, vHost);
#ifdef HAS_VHOST
u->vhost = sstrdup(vHost);
#endif
#ifdef HAS_VIDENT
if (vIdent)
u->vident = sstrdup(vIdent);
#endif
anope_cmd_vhost_on(u->nick, vIdent, vHost);
if (ircd->vhost) {
u->vhost = sstrdup(vHost);
}
if (ircd->vident) {
if (vIdent)
u->vident = sstrdup(vIdent);
}
set_lastmask(u);
}
return MOD_CONT;
@@ -988,7 +985,7 @@ int do_del(User * u)
int do_off(User * u)
{
/* put any generic code here... :) */
send_off(u);
anope_cmd_vhost_off(u->nick);
return MOD_CONT;
}
@@ -1031,76 +1028,16 @@ void set_lastmask(User * u)
free(u->na->last_usermask);
u->na->last_usermask =
smalloc(strlen(GetIdent(u)) + strlen(GetHost(u)) + 2);
sprintf(u->na->last_usermask, "%s@%s", GetIdent(u), GetHost(u));
smalloc(strlen(common_get_vident(u)) +
strlen(common_get_vhost(u)) + 2);
sprintf(u->na->last_usermask, "%s@%s", common_get_vident(u),
common_get_vhost(u));
}
/*************************************************************************/
/* End of Generic Functions */
/*************************************************************************/
/*************************************************************************/
/* Start of Server Functions */
/*************************************************************************/
void send_on(char *nick, char *vIdent, char *vhost)
{
#ifdef IRC_UNREAL
if (vIdent) {
send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent);
}
send_cmd(ServerName, "CHGHOST %s %s", nick, vhost);
#endif
#ifdef IRC_VIAGRA
if (vIdent) {
send_cmd(NULL, "CHGIDENT %s %s", nick, vIdent);
}
send_cmd(NULL, "SVSMODE %s +x", nick);
send_cmd(NULL, "SVSCHGHOST %s %s", nick, vhost);
#endif
#ifdef IRC_ULTIMATE
if (vIdent) {
send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent);
}
send_cmd(s_HostServ, "SVSMODE %s +x", nick);
send_cmd(ServerName, "CHGHOST %s %s", nick, vhost);
#endif
#ifdef IRC_ULTIMATE3
send_cmd(s_HostServ, "SVSMODE %s +x", nick);
send_cmd(ServerName, "SETHOST %s %s", nick, vhost);
#endif
#ifdef IRC_RAGE2
send_cmd(s_HostServ, "SVSMODE %s +z", nick);
send_cmd(ServerName, "VHOST %s %s", nick, vhost);
#endif
}
/*************************************************************************/
void send_off(User * u)
{
#ifdef IRC_UNREAL
send_cmd(s_HostServ, "SVSMODE %s -xt", u->nick);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick);
/*
* tell them to type /mode nick +x to get their original
* host cloaking back
*/
#endif
#ifdef IRC_VIAGRA
send_cmd(NULL, "SVSMODE %s -x", u->nick);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick);
#endif
#ifdef IRC_ULTIMATE
/* UltimateIRCd 2.x does not allow users to control +x */
#endif
#ifdef IRC_ULTIMATE3
send_cmd(s_HostServ, "SVSMODE %s -x", u->nick);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick);
#endif
#ifdef IRC_RAGE2
send_cmd(s_HostServ, "SVSMODE %s -z", u->nick);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick);
#endif
}
/*************************************************************************/
/* End of Server Functions */
+1154
View File
File diff suppressed because it is too large Load Diff
+47 -160
View File
@@ -17,64 +17,9 @@
int servernum = 0;
extern void moduleAddMsgs(void);
extern void moduleAddIRCDMsgs(void);
/*************************************************************************/
/* Send a NICK command for the given pseudo-client. If `user' is NULL,
* send NICK commands for all the pseudo-clients.
*
* Now also sends MODE and SQLINE */
#if defined(IRC_HYBRID)
# define NICK(nick,name,modes) \
do { \
kill_user(NULL, (nick), "Nick used by Services"); \
send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", (nick), time(NULL), (modes), \
ServiceUser, ServiceHost, ServerName, (name)); \
} while (0)
#elif defined(IRC_ULTIMATE3)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", (nick), time(NULL), (modes), \
ServiceUser, ServiceHost, ServerName, (name)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#elif defined(IRC_RAGE2)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", (nick), time(NULL), ServiceUser, \
ServiceHost, ServerName, (modes), (name)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#elif defined(IRC_BAHAMUT)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", (nick), time(NULL), (modes), \
ServiceUser, ServiceHost, ServerName, (name)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#elif defined(IRC_UNREAL)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", (nick), time(NULL), \
ServiceUser, ServiceHost, ServerName, (modes), (name)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#elif defined(IRC_DREAMFORGE)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", (nick), time(NULL), \
ServiceUser, ServiceHost, ServerName, (name)); \
if (strcmp(modes, "+")) send_mode((nick), (nick), "%s", (modes)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#elif defined(IRC_PTLINK)
# define NICK(nick,name,modes) \
do { \
send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", (nick), time(NULL), \
(modes), ServiceUser, ServiceHost, ServiceHost, ServerName, (name)); \
send_cmd(NULL, "SQLINE %s :Reserved for services", (nick)); \
} while (0)
#endif
void introduce_user(const char *user)
{
@@ -87,98 +32,107 @@ void introduce_user(const char *user)
lasttimes[LTSIZE - 1] = time(NULL);
#undef LTSIZE
/* NickServ */
if (!user || stricmp(user, s_NickServ) == 0) {
EnforceQlinedNick(s_NickServ, NULL);
NICK(s_NickServ, desc_NickServ, NICKSERV_MODE);
anope_cmd_nick(s_NickServ, desc_NickServ, ircd->nickservmode);
}
/* ChanServ */
if (!user || stricmp(user, s_ChanServ) == 0) {
EnforceQlinedNick(s_ChanServ, NULL);
NICK(s_ChanServ, desc_ChanServ, CHANSERV_MODE);
anope_cmd_nick(s_ChanServ, desc_ChanServ, ircd->chanservmode);
}
#ifdef HAS_VHOST
if (s_HostServ && (!user || stricmp(user, s_HostServ) == 0)) {
if (s_HostServ && ircd->vhost
&& (!user || stricmp(user, s_HostServ) == 0)) {
EnforceQlinedNick(s_HostServ, NULL);
NICK(s_HostServ, desc_HostServ, HOSTSERV_MODE);
anope_cmd_nick(s_HostServ, desc_HostServ, ircd->hostservmode);
}
#endif
if (!user || stricmp(user, s_MemoServ) == 0) {
EnforceQlinedNick(s_MemoServ, NULL);
NICK(s_MemoServ, desc_MemoServ, MEMOSERV_MODE);
anope_cmd_nick(s_MemoServ, desc_MemoServ, ircd->memoservmode);
}
if (s_BotServ && (!user || stricmp(user, s_BotServ) == 0)) {
EnforceQlinedNick(s_BotServ, NULL);
NICK(s_BotServ, desc_BotServ, BOTSERV_MODE);
anope_cmd_nick(s_BotServ, desc_BotServ, ircd->botservmode);
}
if (!user || stricmp(user, s_HelpServ) == 0) {
EnforceQlinedNick(s_HelpServ, NULL);
NICK(s_HelpServ, desc_HelpServ, HELPSERV_MODE);
anope_cmd_nick(s_HelpServ, desc_HelpServ, ircd->helpservmode);
}
if (!user || stricmp(user, s_OperServ) == 0) {
EnforceQlinedNick(s_OperServ, NULL);
NICK(s_OperServ, desc_OperServ, OPERSERV_MODE);
anope_cmd_nick(s_OperServ, desc_OperServ, ircd->operservmode);
}
if (s_DevNull && (!user || stricmp(user, s_DevNull) == 0)) {
EnforceQlinedNick(s_DevNull, NULL);
NICK(s_DevNull, desc_DevNull, DEVNULL_MODE);
anope_cmd_nick(s_DevNull, desc_DevNull, ircd->devnullmode);
}
if (!user || stricmp(user, s_GlobalNoticer) == 0) {
EnforceQlinedNick(s_GlobalNoticer, NULL);
NICK(s_GlobalNoticer, desc_GlobalNoticer, GLOBAL_MODE);
anope_cmd_nick(s_GlobalNoticer, desc_GlobalNoticer,
ircd->globalmode);
}
/* We make aliases go online */
if (s_NickServAlias && (!user || stricmp(user, s_NickServAlias) == 0)) {
EnforceQlinedNick(s_NickServAlias, NULL);
NICK(s_NickServAlias, desc_NickServAlias, NICKSERV_ALIAS_MODE);
anope_cmd_nick(s_NickServAlias, desc_NickServAlias,
ircd->nickservaliasmode);
}
if (s_ChanServAlias && (!user || stricmp(user, s_ChanServAlias) == 0)) {
EnforceQlinedNick(s_ChanServAlias, NULL);
NICK(s_ChanServAlias, desc_ChanServAlias, CHANSERV_ALIAS_MODE);
anope_cmd_nick(s_ChanServAlias, desc_ChanServAlias,
ircd->chanservaliasmode);
}
if (s_MemoServAlias && (!user || stricmp(user, s_MemoServAlias) == 0)) {
EnforceQlinedNick(s_MemoServAlias, NULL);
NICK(s_MemoServAlias, desc_MemoServAlias, MEMOSERV_ALIAS_MODE);
anope_cmd_nick(s_MemoServAlias, desc_MemoServAlias,
ircd->memoservaliasmode);
}
if (s_BotServAlias && (!user || stricmp(user, s_BotServAlias) == 0)) {
EnforceQlinedNick(s_BotServAlias, NULL);
NICK(s_BotServAlias, desc_BotServAlias, BOTSERV_ALIAS_MODE);
anope_cmd_nick(s_BotServAlias, desc_BotServAlias,
ircd->botservaliasmode);
}
if (s_HelpServAlias && (!user || stricmp(user, s_HelpServAlias) == 0)) {
EnforceQlinedNick(s_HelpServAlias, NULL);
NICK(s_HelpServAlias, desc_HelpServAlias, HELPSERV_ALIAS_MODE);
anope_cmd_nick(s_HelpServAlias, desc_HelpServAlias,
ircd->helpservaliasmode);
}
if (s_OperServAlias && (!user || stricmp(user, s_OperServAlias) == 0)) {
EnforceQlinedNick(s_OperServAlias, NULL);
NICK(s_OperServAlias, desc_OperServAlias, OPERSERV_ALIAS_MODE);
anope_cmd_nick(s_OperServAlias, desc_OperServAlias,
ircd->operservaliasmode);
}
if (s_DevNullAlias && (!user || stricmp(user, s_DevNullAlias) == 0)) {
EnforceQlinedNick(s_DevNullAlias, NULL);
NICK(s_DevNullAlias, desc_DevNullAlias, DEVNULL_ALIAS_MODE);
anope_cmd_nick(s_DevNullAlias, desc_DevNullAlias,
ircd->devnullvaliasmode);
}
#ifdef HAS_VHOST
if (s_HostServAlias && (!user || stricmp(user, s_HostServAlias) == 0)) {
if (s_HostServAlias && ircd->vhost
&& (!user || stricmp(user, s_HostServAlias) == 0)) {
EnforceQlinedNick(s_HostServAlias, NULL);
NICK(s_HostServAlias, desc_HostServAlias, HOSTSERV_ALIAS_MODE);
anope_cmd_nick(s_HostServAlias, desc_HostServAlias,
ircd->hostservaliasmode);
}
#endif
if (s_GlobalNoticerAlias
&& (!user || stricmp(user, s_GlobalNoticerAlias) == 0)) {
EnforceQlinedNick(s_GlobalNoticerAlias, NULL);
NICK(s_GlobalNoticerAlias, desc_GlobalNoticerAlias,
GLOBAL_ALIAS_MODE);
anope_cmd_nick(s_GlobalNoticerAlias, desc_GlobalNoticerAlias,
ircd->globalaliasmode);
}
/* We make the bots go online */
@@ -192,8 +146,8 @@ void introduce_user(const char *user)
EnforceQlinedNick(bi->nick, s_BotServ);
if (!user || !stricmp(user, bi->nick))
NEWNICK(bi->nick, bi->user, bi->host, bi->real,
BOTSERV_BOTS_MODE, 1);
anope_cmd_bot_nick(bi->nick, bi->user, bi->host,
bi->real, ircd->botserv_bot_mode);
}
}
}
@@ -513,6 +467,9 @@ int init(int ac, char **av)
if (!read_config(0))
return -1;
/* Add IRCD Message handlers */
moduleAddIRCDMsgs();
/* Add Core MSG handles */
moduleAddMsgs();
@@ -735,75 +692,8 @@ int init(int ac, char **av)
RemotePort);
}
#ifdef IRC_UNREAL
send_cmd(NULL, "PROTOCTL NICKv2 VHP");
#endif
#if defined(IRC_ULTIMATE3)
if (servernum == 1)
send_cmd(NULL, "PASS %s :TS", RemotePassword);
else if (servernum == 2)
send_cmd(NULL, "PASS %s :TS", RemotePassword2);
else if (servernum == 3)
send_cmd(NULL, "PASS %s :TS", RemotePassword3);
send_cmd(NULL, "CAPAB NICKIP SSJ5 TS5 CLIENT");
#elif defined(IRC_RAGE2)
if (servernum == 1)
send_cmd(NULL, "PASS %s :TS", RemotePassword);
else if (servernum == 2)
send_cmd(NULL, "PASS %s :TS", RemotePassword2);
else if (servernum == 3)
send_cmd(NULL, "PASS %s :TS", RemotePassword3);
send_cmd(NULL, "CAPAB SSJ3 SN2 VHOST");
#elif defined(IRC_BAHAMUT)
if (servernum == 1)
send_cmd(NULL, "PASS %s :TS", RemotePassword);
else if (servernum == 2)
send_cmd(NULL, "PASS %s :TS", RemotePassword2);
else if (servernum == 3)
send_cmd(NULL, "PASS %s :TS", RemotePassword3);
send_cmd(NULL, "CAPAB NICKIP SSJOIN TS3 NOQUIT TSMODE UNCONNECT");
#elif defined(IRC_HYBRID)
if (servernum == 1)
send_cmd(NULL, "PASS %s :TS", RemotePassword);
else if (servernum == 2)
send_cmd(NULL, "PASS %s :TS", RemotePassword2);
else if (servernum == 3)
send_cmd(NULL, "PASS %s :TS", RemotePassword3);
send_cmd(NULL, "CAPAB TS5 EX IE HOPS HUB AOPS");
#elif defined(IRC_PTLINK)
if (servernum == 1)
send_cmd(NULL, "PASS %s :TS", RemotePassword);
else if (servernum == 2)
send_cmd(NULL, "PASS %s :TS", RemotePassword2);
else if (servernum == 3)
send_cmd(NULL, "PASS %s :TS", RemotePassword3);
#else
if (servernum == 1)
send_cmd(NULL, "PASS :%s", RemotePassword);
if (servernum == 2)
send_cmd(NULL, "PASS :%s", RemotePassword2);
if (servernum == 3)
send_cmd(NULL, "PASS :%s", RemotePassword3);
#endif
#ifdef IRC_PTLINK
send_cmd(NULL, "SERVER %s 1 Anope.Services%s :%s",
ServerName, version_number, ServerDesc);
#else
send_cmd(NULL, "SERVER %s 1 :%s", ServerName, ServerDesc);
#endif
#ifdef IRC_RAGE2
send_cmd(NULL, "SVINFO 5 5 0 %ld bluemoon 0", time(NULL));
#endif
#if defined(IRC_BAHAMUT) && !defined(IRC_RAGE2)
send_cmd(NULL, "SVINFO 3 1 0 :%ld", time(NULL));
#endif
#ifdef IRC_HYBRID
send_cmd(NULL, "SVSINFO 5 5 0 :%ld", time(NULL));
#endif
#ifdef IRC_PTLINK
send_cmd(NULL, "SVINFO 3 6 %lu", time(NULL));
send_cmd(NULL, "SVSINFO %lu %d", time(NULL), maxusercnt);
#endif
anope_cmd_connect(servernum);
sgets2(inbuf, sizeof(inbuf), servsock);
if (strnicmp(inbuf, "ERROR", 5) == 0) {
/* Close server socket first to stop wallops, since the other
@@ -815,20 +705,17 @@ int init(int ac, char **av)
/* Announce a logfile error if there was one */
if (openlog_failed) {
wallops(NULL, "Warning: couldn't open logfile: %s",
strerror(openlog_errno));
anope_cmd_global(NULL, "Warning: couldn't open logfile: %s",
strerror(openlog_errno));
}
/* Bring in our pseudo-clients */
introduce_user(NULL);
/* And hybrid needs Global joined in the logchan */
#ifdef IRC_HYBRID
if (logchan) {
send_cmd(NULL, "SJOIN %ld %s + :%s", time(NULL), LogChannel,
s_GlobalNoticer);
if (logchan && ircd->join2msg) {
anope_cmd_join(s_GlobalNoticer, LogChannel, time(NULL));
}
#endif
/**
* Load our delayed modeles - modules that are planing on making clients need to wait till now
+1 -2
View File
@@ -258,8 +258,7 @@ int strftime_lang(char *buf, int size, User * u, int format, struct tm *tm)
/* Send a syntax-error message to the user. */
void syntax_error(const char *service, User * u, const char *command,
int msgnum)
void syntax_error(char *service, User * u, char *command, int msgnum)
{
const char *str = getstring(u->na, msgnum);
notice_lang(service, u, SYNTAX_ERROR, str);
+3 -2
View File
@@ -248,7 +248,7 @@ void fatal(const char *fmt, ...)
if (nofork)
fprintf(stderr, "%sFATAL: %s\n", buf, buf2);
if (servsock >= 0)
wallops(NULL, "FATAL ERROR! %s", buf2);
anope_cmd_global(NULL, "FATAL ERROR! %s", buf2);
exit(1);
}
@@ -291,7 +291,8 @@ void fatal_perror(const char *fmt, ...)
fprintf(stderr, "%sFATAL: %s: %s\n", buf, buf2,
strerror(errno_save));
if (servsock >= 0)
wallops(NULL, "FATAL ERROR! %s: %s", buf2, strerror(errno_save));
anope_cmd_global(NULL, "FATAL ERROR! %s: %s", buf2,
strerror(errno_save));
exit(1);
}
+21 -20
View File
@@ -102,16 +102,18 @@ static void expire_all(void)
}
waiting = -25;
expire_akills();
#ifdef IRC_BAHAMUT
waiting = -26;
expire_sglines();
#endif
waiting = -28;
expire_sqlines();
#ifdef IRC_BAHAMUT
waiting = -27;
expire_szlines();
#endif
if (ircd->sgline) {
waiting = -26;
expire_sglines();
}
if (ircd->sqline) {
waiting = -28;
expire_sqlines();
}
if (ircd->szline) {
waiting = -27;
expire_szlines();
}
#ifndef STREAMLINED
expire_exceptions();
#endif
@@ -170,7 +172,7 @@ void save_databases(void)
waiting = -13;
}
/* Temporary fix to avoid unwanted timeouts... */
send_cmd(ServerName, "PONG %s", ServerName);
anope_cmd_pong(ServerName, ServerName);
if (s_BotServ) {
waiting = -14;
save_bs_rdb_dbase();
@@ -199,7 +201,7 @@ static void services_restart(void)
alog("Restarting");
if (!quitmsg)
quitmsg = "Restarting";
send_cmd(ServerName, "SQUIT %s :%s", ServerName, quitmsg);
anope_cmd_squit(ServerName, quitmsg);
disconn(servsock);
close_log();
#if defined(LINUX20) || defined(LINUX22)
@@ -236,7 +238,7 @@ static void services_shutdown(void)
quitmsg = "Terminating, reason unknown";
alog("%s", quitmsg);
if (started)
send_cmd(ServerName, "SQUIT %s :%s", ServerName, quitmsg);
anope_cmd_squit(ServerName, quitmsg);
disconn(servsock);
}
@@ -301,7 +303,7 @@ void sighandler(int signum)
inbuf[447] = '>';
inbuf[448] = 0;
}
wallops(NULL, "PANIC! buffer = %s\r\n", inbuf);
anope_cmd_global(NULL, "PANIC! buffer = %s\r\n", inbuf);
} else if (waiting < 0) {
/* This is static on the off-chance we run low on stack */
static char buf[BUFSIZE];
@@ -345,21 +347,20 @@ void sighandler(int signum)
case -25:
snprintf(buf, sizeof(buf), "expiring autokills");
break;
#ifdef IRC_BAHAMUT
case -26:
snprintf(buf, sizeof(buf), "expiring SGLINEs");
break;
case -27:
snprintf(buf, sizeof(buf), "expiring SZLINEs");
break;
#endif
case -28:
snprintf(buf, sizeof(buf), "expiring SQLINEs");
break;
default:
snprintf(buf, sizeof(buf), "waiting=%d", waiting);
}
wallops(NULL, "PANIC! %s (%s)", buf, strsignal(signum));
anope_cmd_global(NULL, "PANIC! %s (%s)", buf,
strsignal(signum));
alog("PANIC! %s (%s)", buf, strsignal(signum));
}
}
@@ -456,8 +457,8 @@ int main(int ac, char **av, char **envp)
if (!readonly && (save_data || t - last_update >= UpdateTimeout)) {
if (delayed_quit)
wallops(NULL,
"Updating databases on shutdown, please wait.");
anope_cmd_global(NULL,
"Updating databases on shutdown, please wait.");
save_databases();
@@ -510,7 +511,7 @@ int main(int ac, char **av, char **envp)
alog("Restarting");
if (!quitmsg)
quitmsg = "Restarting";
send_cmd(ServerName, "SQUIT %s :%s", ServerName, quitmsg);
anope_cmd_squit(ServerName, quitmsg);
disconn(servsock);
close_log();
#if defined(LINUX20) || defined(LINUX22)
+156 -1049
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1,3 +1,4 @@
/* Miscellaneous routines.
/* Miscellaneous routines.
*
* (C) 2003 Anope Team
@@ -709,3 +710,4 @@ int nickIsServices(char *nick)
return found;
}
+4 -2
View File
@@ -1,3 +1,4 @@
/* Modular support
/* Modular support
*
* (C) 2003 Anope Team
@@ -370,7 +371,7 @@ int loadModule(Module * m, User * u)
}
if (u) {
wallops(s_OperServ, "%s loaded module %s", u->nick, m->name);
anope_cmd_global(s_OperServ, "%s loaded module %s", u->nick, m->name);
notice_lang(s_OperServ, u, OPER_MODULE_LOADED, m->name);
}
addModule(m);
@@ -416,7 +417,7 @@ int unloadModule(Module * m, User * u)
return MOD_ERR_NOUNLOAD;
} else {
if (u) {
wallops(s_OperServ, "%s unloaded module %s", u->nick, m->name);
anope_cmd_global(s_OperServ, "%s unloaded module %s", u->nick, m->name);
notice_lang(s_OperServ, u, OPER_MODULE_UNLOADED, m->name);
}
delModule(m);
@@ -2023,3 +2024,4 @@ void moduleCleanStruct(ModuleData * moduleData[])
}
/* EOF */
+1 -1
View File
@@ -76,7 +76,7 @@ int my_privmsg(char *source, int ac, char **av)
void addClient(char *nick, char *realname)
{
NEWNICK(nick, "catserv", "meow.meow.land", realname, "+", 1);
anope_cmd_bot_nick(nick, "catserv", "meow.meow.land", realname, "+");
}
void delClient(void)
+2 -29
View File
@@ -1,3 +1,4 @@
/* MySQL functions.
/* MySQL functions.
*
* (C) 2003 Anope Team
@@ -418,16 +419,8 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
ciforbidby = db_mysql_quote(ci->forbidby);
ciforbidreason = db_mysql_quote(ci->forbidreason);
cimlock_key = db_mysql_quote(ci->mlock_key);
#ifdef HAS_FMODE
cimlock_flood = db_mysql_quote(ci->mlock_flood);
#else
cimlock_flood = NULL;
#endif
#ifdef HAS_LMODE
cimlock_redirect = db_mysql_quote(ci->mlock_redirect);
#else
cimlock_redirect = NULL;
#endif
cientrymsg = db_mysql_quote(ci->entry_message);
cibotnick = ci->bi ? db_mysql_quote(ci->bi->nick) : "";
@@ -455,16 +448,8 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
(int) ci->accesscount, (int) ci->akickcount,
(int) ci->mlock_on, (int) ci->mlock_off,
(int) ci->mlock_limit, cimlock_key,
#ifdef HAS_FMODE
cimlock_flood,
#else
"",
#endif
#ifdef HAS_LMODE
cimlock_redirect,
#else
"",
#endif
cientrymsg,
(int) ci->memos.memomax,
cibotnick,
@@ -502,16 +487,8 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
(int) ci->accesscount, (int) ci->akickcount,
(int) ci->mlock_on, (int) ci->mlock_off,
(int) ci->mlock_limit, cimlock_key,
#ifdef HAS_FMODE
cimlock_flood,
#else
"",
#endif
#ifdef HAS_LMODE
cimlock_redirect,
#else
"",
#endif
cientrymsg,
cibotnick,
(int) ci->botflags,
@@ -1330,13 +1307,8 @@ void db_mysql_load_cs_dbase(void)
ci->mlock_off = atoi(mysql_row[19]);
ci->mlock_limit = atoi(mysql_row[20]);
ci->mlock_key = sstrdup(mysql_row[21]);
#ifdef HAS_FMODE
ci->mlock_flood = sstrdup(mysql_row[22]);
#endif
#ifdef HAS_LMODE
ci->mlock_redirect = sstrdup(mysql_row[23]);
#endif
ci->memos.memomax = atoi(mysql_row[25]);
snprintf(sqlcmd, MAX_SQL_BUF,
"SELECT `number`,`flags`,`time`,`sender`,`text` FROM `anope_ms_info` WHERE `receiver` = '%s'",
@@ -1636,3 +1608,4 @@ void db_mysql_load_ns_dbase(void)
}
}
}
+2 -2
View File
@@ -1,3 +1,4 @@
/* News functions.
/* News functions.
*
* (C) 2003 Anope Team
@@ -96,7 +97,6 @@ struct newsmsgs msgarray[] = {
};
/* *INDENT-ON* */
static int *findmsgs(int16 type, char **typename)
{
int i;
@@ -209,7 +209,7 @@ void load_news()
restore_db(f); \
log_perror("Write error on %s", NewsDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
wallops(NULL, "Write error on %s: %s", NewsDBName, \
anope_cmd_global(NULL, "Write error on %s: %s", NewsDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
+160 -190
View File
@@ -857,7 +857,7 @@ void load_ns_dbase(void)
restore_db(f); \
log_perror("Write error on %s", NickDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
wallops(NULL, "Write error on %s: %s", NickDBName, \
anope_cmd_global(NULL, "Write error on %s: %s", NickDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
@@ -1070,8 +1070,10 @@ int validate_user(User * u)
if (na->last_usermask)
free(na->last_usermask);
na->last_usermask =
scalloc(strlen(GetIdent(u)) + strlen(GetHost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", GetIdent(u), GetHost(u));
scalloc(strlen(common_get_vident(u)) +
strlen(common_get_vhost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", common_get_vident(u),
common_get_vhost(u));
if (na->last_realname)
free(na->last_realname);
na->last_realname = sstrdup(u->realname);
@@ -1112,25 +1114,36 @@ void cancel_user(User * u)
if (na) {
if (na->status & NS_GUESTED) {
#ifdef HAS_SVSHOLD
if (UseSVSHOLD) {
send_cmd(ServerName, "SVSHOLD %s %d :%s", na->nick,
NSReleaseTimeout,
"Being held for registered user");
if (ircd->svshold) {
if (UseSVSHOLD) {
anope_cmd_svshold(na->nick);
} else {
if (ircd->svsnick) {
anope_cmd_guest_nick(u->nick, NSEnforcerUser,
NSEnforcerHost,
"Services Enforcer", "+");
add_ns_timeout(na, TO_RELEASE, NSReleaseTimeout);
} else {
anope_cmd_svskill(s_NickServ, u->nick,
"Killing to enforce nick");
}
}
} else {
#endif
NEWNICK(u->nick, NSEnforcerUser, NSEnforcerHost,
"Services Enforcer", "+", 0);
add_ns_timeout(na, TO_RELEASE, NSReleaseTimeout);
#ifdef HAS_SVSHOLD
if (ircd->svsnick) {
anope_cmd_guest_nick(u->nick, NSEnforcerUser,
NSEnforcerHost,
"Services Enforcer", "+");
add_ns_timeout(na, TO_RELEASE, NSReleaseTimeout);
} else {
anope_cmd_svskill(s_NickServ, u->nick,
"Killing to enforce nick");
}
}
#endif
na->status &= ~NS_TEMPORARY;
na->status |= NS_KILL_HELD;
} else {
na->status &= ~NS_TEMPORARY;
}
del_ns_timeout(na, TO_COLLIDE);
}
}
@@ -1275,39 +1288,34 @@ static int is_on_access(User * u, NickCore * nc)
{
int i;
char *buf;
#ifdef HAS_VHOST
char *buf2 = NULL;
#endif
if (nc->accesscount == 0)
return 0;
buf = scalloc(strlen(u->username) + strlen(u->host) + 2, 1);
sprintf(buf, "%s@%s", u->username, u->host);
#ifdef HAS_VHOST
if (u->vhost) {
buf2 = scalloc(strlen(u->username) + strlen(u->vhost) + 2, 1);
sprintf(buf2, "%s@%s", u->username, u->vhost);
if (ircd->vhost) {
if (u->vhost) {
buf2 = scalloc(strlen(u->username) + strlen(u->vhost) + 2, 1);
sprintf(buf2, "%s@%s", u->username, u->vhost);
}
}
#endif
for (i = 0; i < nc->accesscount; i++) {
if (match_wild_nocase(nc->access[i], buf)
#ifdef HAS_VHOST
|| (u->vhost ? match_wild_nocase(nc->access[i], buf2) : 0)
#endif
) {
|| (u->vhost ? match_wild_nocase(nc->access[i], buf2) : 0)) {
free(buf);
#ifdef HAS_VHOST
free(buf2);
#endif
if (ircd->vhost) {
free(buf2);
}
return 1;
}
}
free(buf);
#ifdef HAS_VHOST
free(buf2);
#endif
if (ircd->vhost) {
free(buf2);
}
return 0;
}
@@ -1587,12 +1595,7 @@ int delnick(NickAlias * na)
if (na->u) {
na->u->na = NULL;
#ifndef IRC_PTLINK
change_user_mode(na->u, "-r+d", "1");
#else
change_user_mode(na->u, "-r", NULL);
#endif
common_svsmode(na->u, ircd->modeonunreg, "1");
}
@@ -1661,9 +1664,7 @@ int delnick(NickAlias * na)
static void collide(NickAlias * na, int from_timeout)
{
#ifndef IRC_HYBRID
char guestnick[NICKMAX];
#endif
if (!from_timeout)
del_ns_timeout(na, TO_COLLIDE);
@@ -1676,15 +1677,16 @@ static void collide(NickAlias * na, int from_timeout)
* --Certus
*/
#ifdef IRC_HYBRID
kill_user(s_NickServ, na->nick, "Services nickname-enforcer kill");
#else
snprintf(guestnick, sizeof(guestnick), "%s%d", NSGuestNickPrefix,
guestnum++);
notice_lang(s_NickServ, na->u, FORCENICKCHANGE_CHANGING, guestnick);
send_cmd(NULL, "SVSNICK %s %s :%ld", na->nick, guestnick, time(NULL));
na->status |= NS_GUESTED;
#endif
if (ircd->svsnick) {
snprintf(guestnick, sizeof(guestnick), "%s%d", NSGuestNickPrefix,
guestnum++);
notice_lang(s_NickServ, na->u, FORCENICKCHANGE_CHANGING,
guestnick);
anope_cmd_svsnick(na->nick, guestnick, time(NULL));
na->status |= NS_GUESTED;
} else {
kill_user(s_NickServ, na->nick, "Services nickname-enforcer kill");
}
}
/*************************************************************************/
@@ -1695,12 +1697,15 @@ static void release(NickAlias * na, int from_timeout)
{
if (!from_timeout)
del_ns_timeout(na, TO_RELEASE);
#ifdef HAS_SVSHOLD
if (UseSVSHOLD)
send_cmd(ServerName, "SVSHOLD %s 0", na->nick);
else
#endif
send_cmd(na->nick, "QUIT");
if (ircd->svshold) {
if (UseSVSHOLD) {
anope_cmd_relase_svshold(na->nick);
} else {
anope_cmd_quit(na->nick, NULL);
}
} else {
anope_cmd_quit(na->nick, NULL);
}
na->status &= ~NS_KILL_HELD;
}
@@ -1959,7 +1964,7 @@ static int do_register(User * u)
} else if (u->na) { /* i.e. there's already such a nick regged */
if (u->na->status & NS_VERBOTEN) {
alog("%s: %s@%s tried to register FORBIDden nick %s",
s_NickServ, u->username, GetHost(u), u->nick);
s_NickServ, u->username, common_get_vhost(u), u->nick);
notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick);
} else {
notice_lang(s_NickServ, u, NICK_ALREADY_REGISTERED, u->nick);
@@ -2138,9 +2143,7 @@ static int do_confirm(User * u)
if (na) {
int i;
#if !defined(IRC_PTLINK)
char tsbuf[16];
#endif
#ifdef USE_ENCRYPTION
len = strlen(pass);
@@ -2173,8 +2176,10 @@ static int do_confirm(User * u)
na->last_realname = sstrdup("unknown");
} else {
na->last_usermask =
scalloc(strlen(GetIdent(u)) + strlen(GetHost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", GetIdent(u), GetHost(u));
scalloc(strlen(common_get_vident(u)) +
strlen(common_get_vhost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", common_get_vident(u),
common_get_vhost(u));
na->last_realname = sstrdup(u->realname);
}
na->time_registered = na->last_seen = time(NULL);
@@ -2188,7 +2193,7 @@ static int do_confirm(User * u)
u->na = na;
na->u = u;
alog("%s: '%s' registered by %s@%s (e-mail: %s)", s_NickServ,
u->nick, u->username, GetHost(u),
u->nick, u->username, common_get_vhost(u),
(email ? email : "none"));
notice_lang(s_NickServ, u, NICK_REGISTERED, u->nick,
na->nc->access[0]);
@@ -2196,12 +2201,13 @@ static int do_confirm(User * u)
notice_lang(s_NickServ, u, NICK_PASSWORD_IS, na->nc->pass);
#endif
u->lastnickreg = time(NULL);
#if !defined(IRC_PTLINK)
snprintf(tsbuf, sizeof(tsbuf), "%lu", u->timestamp);
change_user_mode(u, "+rd", tsbuf);
#else
change_user_mode(u, "+r", NULL);
#endif
if (ircd->modeonreg) {
if (ircd->tsonmode) {
common_svsmode(u, ircd->modeonreg, tsbuf);
} else {
common_svsmode(u, ircd->modeonreg, NULL);
}
}
} else {
notice_lang(s_NickServ, u, NICK_FORCE_REG, nr->nick);
@@ -2229,9 +2235,7 @@ static int do_group(User * u)
char *nick = strtok(NULL, " ");
char *pass = strtok(NULL, " ");
int i;
#if !defined(IRC_PTLINK)
char tsbuf[16];
#endif
if (NSEmailReg && (findrequestnick(u->nick))) {
notice_lang(s_NickServ, u, NICK_REQUESTED);
@@ -2253,7 +2257,7 @@ static int do_group(User * u)
notice_lang(s_NickServ, u, NICK_GROUP_PLEASE_WAIT, NSRegDelay);
} else if (u->na && (u->na->status & NS_VERBOTEN)) {
alog("%s: %s@%s tried to use GROUP from FORBIDden nick %s",
s_NickServ, u->username, GetHost(u), u->nick);
s_NickServ, u->username, common_get_vhost(u), u->nick);
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, u->nick);
} else if (u->na && NSNoGroupChange) {
notice_lang(s_NickServ, u, NICK_GROUP_CHANGE_DISABLED, s_NickServ);
@@ -2271,7 +2275,7 @@ static int do_group(User * u)
s_NickServ, s_NickServ);
} else if (check_password(pass, target->nc->pass) != 1) {
alog("%s: Failed GROUP for %s!%s@%s (invalid password)",
s_NickServ, u->nick, u->username, GetHost(u));
s_NickServ, u->nick, u->username, common_get_vhost(u));
notice_lang(s_NickServ, u, PASSWORD_INCORRECT);
bad_password(u);
} else {
@@ -2297,8 +2301,10 @@ static int do_group(User * u)
if (na) {
na->last_usermask =
scalloc(strlen(GetIdent(u)) + strlen(GetHost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", GetIdent(u), GetHost(u));
scalloc(strlen(common_get_vident(u)) +
strlen(common_get_vhost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", common_get_vident(u),
common_get_vhost(u));
na->last_realname = sstrdup(u->realname);
na->time_registered = na->last_seen = time(NULL);
na->status = NS_IDENTIFIED | NS_RECOGNIZED;
@@ -2325,16 +2331,18 @@ static int do_group(User * u)
rdb_close();
}
#endif
alog("%s: %s!%s@%s makes %s join group of %s (%s) (e-mail: %s)", s_NickServ, u->nick, u->username, GetHost(u), u->nick, target->nick, target->nc->display, (target->nc->email ? target->nc->email : "none"));
alog("%s: %s!%s@%s makes %s join group of %s (%s) (e-mail: %s)", s_NickServ, u->nick, u->username, common_get_vhost(u), u->nick, target->nick, target->nc->display, (target->nc->email ? target->nc->email : "none"));
notice_lang(s_NickServ, u, NICK_GROUP_JOINED, target->nick);
u->lastnickreg = time(NULL);
#if !defined(IRC_PTLINK)
snprintf(tsbuf, sizeof(tsbuf), "%lu", u->timestamp);
change_user_mode(u, "+rd", tsbuf);
#else
change_user_mode(u, "+r", NULL);
#endif
if (ircd->modeonreg) {
if (ircd->tsonmode) {
common_svsmode(u, ircd->modeonreg, tsbuf);
} else {
common_svsmode(u, ircd->modeonreg, NULL);
}
}
check_memos(u);
} else {
@@ -2363,9 +2371,9 @@ static int do_nickupdate(User * u)
na->last_realname = sstrdup(u->realname);
na->status |= NS_IDENTIFIED;
na->last_seen = time(NULL);
#ifdef HAS_VHOST
do_on_id(u);
#endif
if (ircd->vhost) {
do_on_id(u);
}
notice_lang(s_NickServ, u, NICK_UPDATE_SUCCESS, s_NickServ);
}
return MOD_CONT;
@@ -2379,9 +2387,7 @@ static int do_identify(User * u)
NickAlias *na;
NickRequest *nr;
int res;
#if !defined(IRC_PTLINK)
char tsbuf[16];
#endif
if (!pass) {
syntax_error(s_NickServ, u, "IDENTIFY", NICK_IDENTIFY_SYNTAX);
@@ -2395,7 +2401,7 @@ static int do_identify(User * u)
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
} else if (!(res = check_password(pass, na->nc->pass))) {
alog("%s: Failed IDENTIFY for %s!%s@%s", s_NickServ, u->nick,
u->username, GetHost(u));
u->username, common_get_vhost(u));
notice_lang(s_NickServ, u, PASSWORD_INCORRECT);
bad_password(u);
} else if (res == -1) {
@@ -2407,8 +2413,10 @@ static int do_identify(User * u)
if (na->last_usermask)
free(na->last_usermask);
na->last_usermask =
scalloc(strlen(GetIdent(u)) + strlen(GetHost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", GetIdent(u), GetHost(u));
scalloc(strlen(common_get_vident(u)) +
strlen(common_get_vhost(u)) + 2, 1);
sprintf(na->last_usermask, "%s@%s", common_get_vident(u),
common_get_vhost(u));
if (na->last_realname)
free(na->last_realname);
na->last_realname = sstrdup(u->realname);
@@ -2416,21 +2424,22 @@ static int do_identify(User * u)
na->status |= NS_IDENTIFIED;
na->last_seen = time(NULL);
#ifndef IRC_PTLINK
snprintf(tsbuf, sizeof(tsbuf), "%lu", u->timestamp);
change_user_mode(u, "+rd", tsbuf);
#else
change_user_mode(u, "+r", "");
#endif /* IRC_PTLINK */
if (ircd->modeonreg) {
if (ircd->tsonmode) {
common_svsmode(u, ircd->modeonreg, tsbuf);
} else {
common_svsmode(u, ircd->modeonreg, "");
}
}
alog("%s: %s!%s@%s identified for nick %s", s_NickServ, u->nick,
u->username, GetHost(u), u->nick);
u->username, common_get_vhost(u), u->nick);
notice_lang(s_NickServ, u, NICK_IDENTIFY_SUCCEEDED);
#ifdef HAS_VHOST
do_on_id(u);
#endif
if (ircd->vhost) {
do_on_id(u);
}
if (NSModeOnID) {
do_setmodes(u);
}
@@ -2462,19 +2471,14 @@ int should_mode_change(int16 status, int16 mode)
if (status & CUS_OP) {
return 0;
}
#ifdef HAS_HALFOP
if (status & CUS_HALFOP) {
return 0;
}
#endif
if (status & CUS_VOICE) {
return 0;
}
return 1;
break;
#ifdef HAS_HALFOP
case CUS_HALFOP:
if (status & CUS_OP) {
return 0;
@@ -2484,44 +2488,20 @@ int should_mode_change(int16 status, int16 mode)
}
return 1;
break;
#endif
#ifdef IRC_UNREAL
case CUS_OWNER:
if (status & CUS_OWNER) {
return 0;
if (ircd->owner) {
if (status & CUS_OWNER) {
return 0;
}
}
break;
case CUS_PROTECT:
if (status & CUS_OWNER) {
return 0;
}
if (status & CUS_PROTECT) {
return 0;
if (ircd->protect) {
if (status & CUS_PROTECT) {
return 0;
}
}
break;
#endif
#ifdef IRC_VIAGRA
case CUS_OWNER:
if (status & CUS_OWNER) {
return 0;
}
break;
case CUS_PROTECT:
if (status & CUS_OWNER) {
return 0;
}
if (status & CUS_PROTECT) {
return 0;
}
break;
#endif
#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
case CUS_PROTECT:
if (status & CUS_PROTECT) {
return 0;
}
break;
#endif
}
return 1;
}
@@ -2536,30 +2516,22 @@ static int do_setmodes(User * u)
for (uc = u->chans; uc; uc = uc->next) {
if ((c = uc->chan)) {
chan = c->name;
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA)
if (should_mode_change(uc->status, CUS_OWNER)
if (ircd->owner && should_mode_change(uc->status, CUS_OWNER)
&& check_should_owner(u, chan)) {
chan_set_user_status(c, u, CUS_OWNER);
} else
#endif
#if defined(IRC_UNREAL) || defined(IRC_VIAGRA) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2) || defined(IRC_PTLINK)
if (should_mode_change(uc->status, CUS_PROTECT)
&& check_should_protect(u, chan)) {
} else if (ircd->protect
&& should_mode_change(uc->status, CUS_PROTECT)
&& check_should_protect(u, chan)) {
chan_set_user_status(c, u, CUS_PROTECT);
} else
#endif
if (should_mode_change(uc->status, CUS_OP)
&& check_should_op(u, chan)) {
} else if (should_mode_change(uc->status, CUS_OP)
&& check_should_op(u, chan)) {
chan_set_user_status(c, u, CUS_OP);
} else
#ifdef HAS_HALFOP
if (should_mode_change(uc->status, CUS_HALFOP)
&& check_should_halfop(u, chan)) {
} else if (ircd->halfop
&& should_mode_change(uc->status, CUS_HALFOP)
&& check_should_halfop(u, chan)) {
chan_set_user_status(c, u, CUS_HALFOP);
} else
#endif
if (should_mode_change(uc->status, CUS_VOICE)
&& check_should_voice(u, chan)) {
} else if (should_mode_change(uc->status, CUS_VOICE)
&& check_should_voice(u, chan)) {
chan_set_user_status(c, u, CUS_VOICE);
}
}
@@ -2567,7 +2539,6 @@ static int do_setmodes(User * u)
return MOD_CONT;
}
/*************************************************************************/
static int do_logout(User * u)
@@ -2599,11 +2570,11 @@ static int do_logout(User * u)
u2->na->status &= ~(NS_IDENTIFIED | NS_RECOGNIZED);
}
change_user_mode(u2, "-r+d", "1");
common_svsmode(u2, "-r+d", "1");
u->isSuperAdmin = 0; /* Dont let people logout and remain a SuperAdmin */
alog("%s: %s!%s@%s logged out nickname %s", s_NickServ, u->nick,
u->username, GetHost(u), u2->nick);
u->username, common_get_vhost(u), u2->nick);
if (nick)
notice_lang(s_NickServ, u, NICK_LOGOUT_X_SUCCEEDED, nick);
@@ -2638,10 +2609,11 @@ static int do_drop(User * u)
if (readonly)
notice_lang(s_NickServ, u, READ_ONLY_MODE);
if (WallDrop)
wallops(s_NickServ, "\2%s\2 used DROP on \2%s\2",
u->nick, nick);
anope_cmd_global(s_NickServ,
"\2%s\2 used DROP on \2%s\2", u->nick,
nick);
alog("%s: %s!%s@%s dropped nickname %s (e-mail: %s)",
s_NickServ, u->nick, u->username, GetHost(u),
s_NickServ, u->nick, u->username, common_get_vhost(u),
nr->nick, nr->email);
delnickrequest(nr);
notice_lang(s_NickServ, u, NICK_X_DROPPED, nick);
@@ -2667,14 +2639,15 @@ static int do_drop(User * u)
notice_lang(s_NickServ, u, READ_ONLY_MODE);
alog("%s: %s!%s@%s dropped nickname %s (group %s) (e-mail: %s)",
s_NickServ, u->nick, u->username, GetHost(u), na->nick,
na->nc->display, (na->nc->email ? na->nc->email : "none"));
s_NickServ, u->nick, u->username, common_get_vhost(u),
na->nick, na->nc->display,
(na->nc->email ? na->nc->email : "none"));
delnick(na);
if (!is_mine) {
if (WallDrop)
wallops(s_NickServ, "\2%s\2 used DROP on \2%s\2", u->nick,
nick);
anope_cmd_global(s_NickServ, "\2%s\2 used DROP on \2%s\2",
u->nick, nick);
notice_lang(s_NickServ, u, NICK_X_DROPPED, nick);
} else {
if (nick)
@@ -2831,14 +2804,14 @@ static int do_set_password(User * u, NickCore * nc, char *param)
#endif
if (u->na && u->na->nc != nc && is_services_admin(u)) {
alog("%s: %s!%s@%s used SET PASSWORD as Services admin on %s (e-mail: %s)", s_NickServ, u->nick, u->username, GetHost(u), nc->display, (nc->email ? nc->email : "none"));
alog("%s: %s!%s@%s used SET PASSWORD as Services admin on %s (e-mail: %s)", s_NickServ, u->nick, u->username, common_get_vhost(u), nc->display, (nc->email ? nc->email : "none"));
if (WallSetpass)
wallops(s_NickServ,
"\2%s\2 used SET PASSWORD as Services admin on \2%s\2",
u->nick, nc->display);
anope_cmd_global(s_NickServ,
"\2%s\2 used SET PASSWORD as Services admin on \2%s\2",
u->nick, nc->display);
} else {
alog("%s: %s!%s@%s (e-mail: %s) changed its password.", s_NickServ,
u->nick, u->username, GetHost(u),
u->nick, u->username, common_get_vhost(u),
(nc->email ? nc->email : "none"));
}
return MOD_CONT;
@@ -2896,7 +2869,7 @@ static int do_set_email(User * u, NickCore * nc, char *param)
}
alog("%s: %s!%s@%s (e-mail: %s) changed its e-mail to %s.", s_NickServ,
u->nick, u->username, GetHost(u),
u->nick, u->username, common_get_vhost(u),
(nc->email ? nc->email : "none"), (param ? param : "none"));
if (nc->email)
@@ -3254,10 +3227,7 @@ static int do_info(User * u)
NickAlias *na;
NickRequest *nr = NULL;
int is_servadmin = is_services_admin(u);
#ifdef HAS_VHOST
char *vHost;
#endif
if (!nick) {
syntax_error(s_NickServ, u, "INFO", NICK_INFO_SYNTAX);
@@ -3374,8 +3344,7 @@ static int do_info(User * u)
notice_lang(s_NickServ, u, NICK_INFO_ICQ, na->nc->icq);
if (show_hidden) {
#ifdef HAS_VHOST
if (s_HostServ) {
if (s_HostServ && ircd->vhost) {
if (getvHost(na->nick) != NULL) {
vHost = smalloc(strlen(getvHost(na->nick)) + 2);
bzero(vHost, sizeof(vHost));
@@ -3385,7 +3354,6 @@ static int do_info(User * u)
free(vHost);
}
}
#endif
if (na->nc->greet)
notice_lang(s_NickServ, u, NICK_INFO_GREET, na->nc->greet);
@@ -3673,10 +3641,8 @@ static int do_alist(User * u)
min_level = ACCESS_SOP;
} else if (stricmp(lev, "AOP") == 0) {
min_level = ACCESS_AOP;
#ifdef HAS_HALFOP
} else if (stricmp(lev, "HOP") == 0) {
min_level = ACCESS_HOP;
#endif
} else if (stricmp(lev, "VOP") == 0) {
min_level = ACCESS_VOP;
} else {
@@ -3771,7 +3737,8 @@ static int do_recover(User * u)
notice_lang(s_NickServ, u, ACCESS_DENIED);
if (res == 0) {
alog("%s: RECOVER: invalid password for %s by %s!%s@%s",
s_NickServ, nick, u->nick, u->username, GetHost(u));
s_NickServ, nick, u->nick, u->username,
common_get_vhost(u));
bad_password(u);
}
}
@@ -3813,7 +3780,8 @@ static int do_release(User * u)
notice_lang(s_NickServ, u, ACCESS_DENIED);
if (res == 0) {
alog("%s: RELEASE: invalid password for %s by %s!%s@%s",
s_NickServ, nick, u->nick, u->username, GetHost(u));
s_NickServ, nick, u->nick, u->username,
common_get_vhost(u));
bad_password(u);
}
}
@@ -3860,7 +3828,8 @@ static int do_ghost(User * u)
notice_lang(s_NickServ, u, ACCESS_DENIED);
if (res == 0) {
alog("%s: GHOST: invalid password for %s by %s!%s@%s",
s_NickServ, nick, u->nick, u->username, GetHost(u));
s_NickServ, nick, u->nick, u->username,
common_get_vhost(u));
bad_password(u);
}
}
@@ -3916,7 +3885,7 @@ static int do_getemail(User * u)
return MOD_CONT;
}
alog("%s: %s!%s@%s used GETEMAIL on %s", s_NickServ, u->nick,
u->username, GetHost(u), email);
u->username, common_get_vhost(u), email);
for (i = 0; i < 1024; i++) {
for (nc = nclists[i]; nc; nc = nc->next) {
if (nc->email) {
@@ -3954,10 +3923,11 @@ static int do_getpass(User * u)
} else if (!(na = findnick(nick))) {
if ((nr = findrequestnick(nick))) {
alog("%s: %s!%s@%s used GETPASS on %s", s_NickServ, u->nick,
u->username, GetHost(u), nick);
u->username, common_get_vhost(u), nick);
if (WallGetpass)
wallops(s_NickServ, "\2%s\2 used GETPASS on \2%s\2",
u->nick, nick);
anope_cmd_global(s_NickServ,
"\2%s\2 used GETPASS on \2%s\2", u->nick,
nick);
notice_lang(s_NickServ, u, NICK_GETPASS_PASSCODE_IS, nick,
nr->passcode);
} else {
@@ -3972,10 +3942,10 @@ static int do_getpass(User * u)
notice_lang(s_NickServ, u, PERMISSION_DENIED);
} else {
alog("%s: %s!%s@%s used GETPASS on %s", s_NickServ, u->nick,
u->username, GetHost(u), nick);
u->username, common_get_vhost(u), nick);
if (WallGetpass)
wallops(s_NickServ, "\2%s\2 used GETPASS on \2%s\2", u->nick,
nick);
anope_cmd_global(s_NickServ, "\2%s\2 used GETPASS on \2%s\2",
u->nick, nick);
notice_lang(s_NickServ, u, NICK_GETPASS_PASSWORD_IS, nick,
na->nc->pass);
}
@@ -4031,7 +4001,7 @@ static int do_sendpass(User * u)
MailEnd(mail);
alog("%s: %s!%s@%s used SENDPASS on %s", s_NickServ, u->nick,
u->username, GetHost(u), nick);
u->username, common_get_vhost(u), nick);
notice_lang(s_NickServ, u, NICK_SENDPASS_OK, nick);
}
#endif
@@ -4081,8 +4051,8 @@ static int do_forbid(User * u)
}
if (WallForbid)
wallops(s_NickServ, "\2%s\2 used FORBID on \2%s\2", u->nick,
nick);
anope_cmd_global(s_NickServ, "\2%s\2 used FORBID on \2%s\2",
u->nick, nick);
alog("%s: %s set FORBID for nick %s", s_NickServ, u->nick, nick);
notice_lang(s_NickServ, u, NICK_FORBID_SUCCEEDED, nick);
+349 -337
View File
File diff suppressed because it is too large Load Diff
+15 -21
View File
@@ -48,7 +48,7 @@ SList pxqueue;
pthread_mutex_t queuemut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t queuecond = PTHREAD_COND_INITIALIZER;
#if !defined(HAS_NICKIP) && !defined(HAVE_GETHOSTBYNAME_R6) && !defined(HAVE_GETHOSTBYNAME_R5) && !defined(HAVE_GETHOSTBYNAME_R3)
#if !defined(HAVE_GETHOSTBYNAME_R6) && !defined(HAVE_GETHOSTBYNAME_R5) && !defined(HAVE_GETHOSTBYNAME_R3)
pthread_mutex_t resmut = PTHREAD_MUTEX_INITIALIZER;
#endif
@@ -64,9 +64,7 @@ static void proxy_queue_signal(void);
static void proxy_queue_unlock(void);
static void proxy_queue_wait(void);
static int proxy_read(int s, char *buf, size_t buflen);
#ifndef HAS_NICKIP
static uint32 proxy_resolve(char *host);
#endif
static int proxy_scan(uint32 ip);
static void *proxy_thread_main(void *arg);
@@ -126,12 +124,12 @@ void get_proxy_stats(long *nrec, long *memuse)
static void proxy_akill(char *host)
{
s_akill("*", host, s_OperServ, time(NULL),
time(NULL) + (ProxyExpire ? ProxyExpire : 86400 * 2),
ProxyAkillReason);
anope_cmd_akill("*", host, s_OperServ, time(NULL),
time(NULL) + (ProxyExpire ? ProxyExpire : 86400 * 2),
ProxyAkillReason);
if (WallProxy)
wallops(s_OperServ, "Insecure proxy \2%s\2 has been AKILLed.",
host);
anope_cmd_global(s_OperServ,
"Insecure proxy \2%s\2 has been AKILLed.", host);
}
/*************************************************************************/
@@ -173,7 +171,7 @@ static void proxy_cache_del(HostCache * hc)
alog("debug: Deleting %s from host cache", hc->host);
if (hc->status > HC_NORMAL)
s_rakill("*", hc->host);
anope_cmd_remove_akill("*", hc->host);
if (hc->next)
hc->next->prev = hc->prev;
@@ -239,9 +237,9 @@ int proxy_check(char *nick, char *host, uint32 ip)
notice(s_GlobalNoticer, nick, *message);
hc = proxy_cache_add(host);
#ifdef HAS_NICKIP
hc->ip = htonl(ip);
#endif
if (ircd->nickip) {
hc->ip = htonl(ip);
}
hc->status = HC_QUEUED;
proxy_queue_lock();
@@ -439,8 +437,6 @@ static int proxy_read(int s, char *buf, size_t buflen)
/* Resolves hostnames in a thread safe manner */
#ifndef HAS_NICKIP
static uint32 proxy_resolve(char *host)
{
struct hostent *hentp = NULL;
@@ -485,8 +481,6 @@ static uint32 proxy_resolve(char *host)
return ip;
}
#endif
/*************************************************************************/
/* Scans the given host for proxy */
@@ -685,11 +679,11 @@ static void *proxy_thread_main(void *arg)
alog("debug: Scanning host %s for proxy", hc->host);
}
}
#ifndef HAS_NICKIP
/* Test if it's an IP, and if not try to resolve the hostname */
if ((hc->ip = aton(hc->host)) == INADDR_NONE)
hc->ip = proxy_resolve(hc->host);
#endif
if (!ircd->nickip) {
/* Test if it's an IP, and if not try to resolve the hostname */
if ((hc->ip = aton(hc->host)) == INADDR_NONE)
hc->ip = proxy_resolve(hc->host);
}
status = proxy_scan(hc->ip);
if (debug) {
+1217
View File
File diff suppressed because it is too large Load Diff
+1273
View File
File diff suppressed because it is too large Load Diff
+47 -91
View File
@@ -46,9 +46,7 @@ void vsend_cmd(const char *source, const char *fmt, va_list args)
/*************************************************************************/
/* Send out a WALLOPS (a GLOBOPS on ircd.dal). */
void wallops(const char *source, const char *fmt, ...)
void notice_server(char *source, Server * s, char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
@@ -56,17 +54,16 @@ void wallops(const char *source, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
#ifdef IRC_HYBRID
send_cmd(source ? source : ServerName, "WALLOPS :%s", buf);
#else
send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf);
#endif
if (UsePrivmsg) {
anope_cmd_serv_privmsg(source, s->name, buf);
} else {
anope_cmd_serv_notice(source, s->name, buf);
}
}
/*************************************************************************/
/* Send a NOTICE from the given source to the given nick. */
void notice(const char *source, const char *dest, const char *fmt, ...)
void notice_user(char *source, User * u, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
@@ -74,48 +71,17 @@ void notice(const char *source, const char *dest, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
send_cmd(source, "%s %s :%s", (UsePrivmsg ? "PRIVMSG" : "NOTICE"),
dest, buf);
}
/*************************************************************************/
void notice_server(const char *source, Server * s, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
#ifdef IRC_HYBRID
send_cmd(source, "%s $$%s :%s", (UsePrivmsg ? "PRIVMSG" : "NOTICE"),
s->name, buf);
#else
send_cmd(source, "%s $%s :%s", (UsePrivmsg ? "PRIVMSG" : "NOTICE"),
s->name, buf);
#endif
}
/*************************************************************************/
void notice_user(const char *source, User * u, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
send_cmd(source, "%s %s :%s",
(UsePrivmsg && (!u->na || (u->na->nc->flags & NI_MSG)) ?
"PRIVMSG" : "NOTICE"), u->nick, buf);
if (UsePrivmsg && (!u->na || (u->na->nc->flags & NI_MSG))) {
anope_cmd_privmsg2(source, u->nick, buf);
} else {
anope_cmd_notice2(source, u->nick, buf);
}
}
/*************************************************************************/
/* Send a NULL-terminated array of text as NOTICEs. */
void notice_list(const char *source, const char *dest, const char **text)
void notice_list(char *source, char *dest, char **text)
{
while (*text) {
/* Have to kludge around an ircII bug here: if a notice includes
@@ -123,9 +89,9 @@ void notice_list(const char *source, const char *dest, const char **text)
* with a single space.
*/
if (**text)
notice(source, dest, *text);
anope_cmd_notice2(source, dest, *text);
else
notice(source, dest, " ");
anope_cmd_notice2(source, dest, " ");
text++;
}
}
@@ -133,7 +99,7 @@ void notice_list(const char *source, const char *dest, const char **text)
/*************************************************************************/
/* Send a message in the user's selected language to the user using NOTICE. */
void notice_lang(const char *source, User * dest, int message, ...)
void notice_lang(char *source, User * dest, int message, ...)
{
va_list args;
char buf[4096]; /* because messages can be really big */
@@ -153,12 +119,11 @@ void notice_lang(const char *source, User * dest, int message, ...)
s += strcspn(s, "\n");
if (*s)
*s++ = 0;
send_cmd(source, "%s %s :%s", (UsePrivmsg
&& (!dest->na || (dest->na->nc->
flags &
NI_MSG)) ?
"PRIVMSG" : "NOTICE"),
dest->nick, *t ? t : " ");
if (UsePrivmsg && (!dest->na || (dest->na->nc->flags & NI_MSG))) {
anope_cmd_privmsg2(source, dest->nick, *t ? t : " ");
} else {
anope_cmd_notice2(source, dest->nick, *t ? t : " ");
}
}
}
@@ -168,7 +133,7 @@ void notice_lang(const char *source, User * dest, int message, ...)
* to simplify letting help messages display the name of the pseudoclient
* that's sending them.
*/
void notice_help(const char *source, User * dest, int message, ...)
void notice_help(char *source, User * dest, int message, ...)
{
va_list args;
char buf[4096], buf2[4096], outbuf[BUFSIZE];
@@ -195,19 +160,36 @@ void notice_help(const char *source, User * dest, int message, ...)
*s++ = 0;
strscpy(outbuf, t, sizeof(outbuf));
strnrepl(outbuf, sizeof(outbuf), "\1\1", source);
send_cmd(source, "%s %s :%s",
(UsePrivmsg
&& (!dest->na
|| (dest->na->nc->
flags & NI_MSG)) ? "PRIVMSG" : "NOTICE"),
dest->nick, *outbuf ? outbuf : " ");
if (UsePrivmsg && (!dest->na || (dest->na->nc->flags & NI_MSG))) {
anope_cmd_privmsg2(source, dest->nick, *outbuf ? outbuf : " ");
} else {
anope_cmd_notice2(source, dest->nick, *outbuf ? outbuf : " ");
}
}
}
/*************************************************************************/
/* Send a NOTICE from the given source to the given nick. */
void notice(char *source, char *dest, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
if (UsePrivmsg) {
anope_cmd_privmsg2(source, dest, buf);
} else {
anope_cmd_notice2(source, dest, buf);
}
}
/*************************************************************************/
/* Send a PRIVMSG from the given source to the given nick. */
void privmsg(const char *source, const char *dest, const char *fmt, ...)
void privmsg(char *source, char *dest, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
@@ -215,31 +197,5 @@ void privmsg(const char *source, const char *dest, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
send_cmd(source, "PRIVMSG %s :%s", dest, buf);
anope_cmd_privmsg2(source, dest, buf);
}
/*************************************************************************/
/* Sends a MODE from the given source on the given nick */
void send_mode(const char *source, const char *on, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
#ifdef IRC_BAHAMUT
/* Ultimate3 doesn't send TS Mode - doing so will cause modes not to send */
/* btw - this is used by channel setting was well - TSL */
#if !defined(IRC_ULTIMATE3)
if (uplink_capab & CAPAB_TSMODE)
send_cmd(source, "MODE %s 0 %s", on, buf);
else
#endif
#endif
send_cmd(source, "MODE %s %s", on, buf);
}
/*************************************************************************/
+124 -43
View File
@@ -16,9 +16,7 @@
Server *servlist = NULL;
Server *me_server = NULL;
#ifdef IRC_BAHAMUT
uint16 uplink_capab;
#endif
uint32 uplink_capab;
/* For first_server / next_server */
static Server *server_cur;
@@ -112,10 +110,8 @@ Server *new_server(Server * uplink, const char *name, const char *desc,
static void delete_server(Server * serv, const char *quitreason)
{
Server *s, *snext;
#ifdef IRC_BAHAMUT
User *u, *unext;
NickAlias *na;
#endif
if (!serv) {
alog("delete_server() called with NULL arg!");
@@ -125,32 +121,32 @@ static void delete_server(Server * serv, const char *quitreason)
if (debug)
alog("delete_server() called for %s", serv->name);
#ifdef IRC_BAHAMUT
if (uplink_capab & CAPAB_NOQUIT) {
u = firstuser();
while (u) {
unext = nextuser();
if (u->server == serv) {
if ((na = u->na) && !(na->status & NS_VERBOTEN)
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
na->last_seen = time(NULL);
if (na->last_quit)
free(na->last_quit);
na->last_quit =
(quitreason ? sstrdup(quitreason) : NULL);
}
if (ircdcap->noquit) {
if (uplink_capab & ircdcap->noquit) {
u = firstuser();
while (u) {
unext = nextuser();
if (u->server == serv) {
if ((na = u->na) && !(na->status & NS_VERBOTEN)
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
na->last_seen = time(NULL);
if (na->last_quit)
free(na->last_quit);
na->last_quit =
(quitreason ? sstrdup(quitreason) : NULL);
}
#ifndef STREAMLINED
if (LimitSessions)
del_session(u->host);
if (LimitSessions)
del_session(u->host);
#endif
delete_user(u);
delete_user(u);
}
u = unext;
}
u = unext;
if (debug >= 2)
alog("delete_server() cleared all users");
}
if (debug >= 2)
alog("delete_server() cleared all users");
}
#endif
s = serv->links;
while (s) {
@@ -215,17 +211,23 @@ void do_server(const char *source, int ac, char **av)
s = me_server;
else
s = findserver(servlist, source);
#ifdef IRC_PTLINK
if (ac < 4)
alog("Malformed SERVER received (less than 4 params)");
else
new_server(s, av[0], av[3], 0);
#else
if (ac < 3)
alog("Malformed SERVER received (less than 3 params)");
else
new_server(s, av[0], av[2], 0);
#endif
if (ircd->numservargs == 4) {
if (ac < 4)
alog("Malformed SERVER received (less than 4 params)");
else
new_server(s, av[0], av[3], 0);
}
if (ircd->numservargs == 7) {
if (ac < 7)
alog("Malformed SERVER received (less than 7 params)");
else
new_server(s, av[0], av[6], 0);
} else {
if (ac < 3)
alog("Malformed SERVER received (less than 3 params)");
else
new_server(s, av[0], av[2], 0);
}
}
/*************************************************************************/
@@ -245,15 +247,94 @@ void do_squit(const char *source, int ac, char **av)
snprintf(buf, sizeof(buf), "%s %s", s->name,
(s->uplink ? s->uplink->name : ""));
#ifdef IRC_BAHAMUT
if ((s->uplink == me_server) && (uplink_capab & CAPAB_UNCONNECT)) {
if (debug)
alog("debuf: Sending UNCONNECT SQUIT for %s", s->name);
send_cmd(ServerName, "SQUIT %s :%s", s->name, buf);
if (ircdcap->unconnect) {
if ((s->uplink == me_server)
&& (uplink_capab & ircdcap->unconnect)) {
if (debug)
alog("debuf: Sending UNCONNECT SQUIT for %s", s->name);
/* need to fix */
anope_cmd_squit(s->name, buf);
}
}
#endif
delete_server(s, buf);
}
void capab_parse(int ac, char **av)
{
int i;
for (i = 0; i < ac; i++) {
if (!stricmp(av[i], "NOQUIT")) {
uplink_capab |= CAPAB_NOQUIT;
}
if (!stricmp(av[i], "TSMODE")) {
uplink_capab |= CAPAB_TSMODE;
}
if (!stricmp(av[i], "UNCONNECT")) {
uplink_capab |= CAPAB_UNCONNECT;
}
if (!stricmp(av[i], "NICKIP")) {
uplink_capab |= CAPAB_NICKIP;
}
if (!stricmp(av[i], "SSJOIN")) {
uplink_capab |= CAPAB_NSJOIN;
}
if (!stricmp(av[i], "ZIP")) {
uplink_capab |= CAPAB_ZIP;
}
if (!stricmp(av[i], "BURST")) {
uplink_capab |= CAPAB_BURST;
}
if (!stricmp(av[i], "TS5")) {
uplink_capab |= CAPAB_TS5;
}
if (!stricmp(av[i], "TS3")) {
uplink_capab |= CAPAB_TS3;
}
if (!stricmp(av[i], "DKEY")) {
uplink_capab |= CAPAB_DKEY;
}
if (!stricmp(av[i], "PT4")) {
uplink_capab |= CAPAB_PT4;
}
if (!stricmp(av[i], "SCS")) {
uplink_capab |= CAPAB_SCS;
}
if (!stricmp(av[i], "QS")) {
uplink_capab |= CAPAB_QS;
}
if (!stricmp(av[i], "UID")) {
uplink_capab |= CAPAB_UID;
}
if (!stricmp(av[i], "KNOCK")) {
uplink_capab |= CAPAB_KNOCK;
}
if (!stricmp(av[i], "CLIENT")) {
uplink_capab |= CAPAB_CLIENT;
}
if (!stricmp(av[i], "IPV6")) {
uplink_capab |= CAPAB_IPV6;
}
if (!stricmp(av[i], "SSJ5")) {
uplink_capab |= CAPAB_SSJ5;
}
if (!stricmp(av[i], "SN2")) {
uplink_capab |= CAPAB_SN2;
}
if (!stricmp(av[i], "TOK1")) {
uplink_capab |= CAPAB_TOKEN;
}
if (!stricmp(av[i], "TOKEN")) {
uplink_capab |= CAPAB_TOKEN;
}
if (!stricmp(av[i], "VHOST")) {
uplink_capab |= CAPAB_VHOST;
}
if (!stricmp(av[i], "SSJ3")) {
uplink_capab |= CAPAB_SSJ3;
}
}
}
/* EOF */
+13 -17
View File
@@ -219,7 +219,7 @@ static Session *findsession(const char *host)
* Returns 1 if the host was added or 0 if the user was killed.
*/
int add_session(const char *nick, const char *host)
int add_session(char *nick, char *host)
{
Session *session, **list;
Exception *exception;
@@ -245,12 +245,8 @@ int add_session(const char *nick, const char *host)
/* We don't use kill_user() because a user stucture has not yet
* been created. Simply kill the user. -TheShadow
*/
#ifdef IRC_BAHAMUT
send_cmd(NULL, "SVSKILL %s :Session limit exceeded", nick);
#else
send_cmd(s_OperServ, "KILL %s :%s (Session limit exceeded)",
nick, s_OperServ);
#endif
kill_user(s_OperServ, nick, "Session limit exceeded");
session->hits++;
if (MaxSessionKill && session->hits >= MaxSessionKill) {
char akillmask[BUFSIZE];
@@ -258,9 +254,9 @@ int add_session(const char *nick, const char *host)
add_akill(NULL, akillmask, s_OperServ,
time(NULL) + SessionAutoKillExpiry,
"Session limit exceeded");
wallops(s_OperServ,
"Added a temporary AKILL for \2%s\2 due to excessive connections",
akillmask);
anope_cmd_global(s_OperServ,
"Added a temporary AKILL for \2%s\2 due to excessive connections",
akillmask);
}
return 0;
} else {
@@ -292,9 +288,9 @@ void del_session(const char *host)
session = findsession(host);
if (!session) {
wallops(s_OperServ,
"WARNING: Tried to delete non-existant session: \2%s",
host);
anope_cmd_global(s_OperServ,
"WARNING: Tried to delete non-existant session: \2%s",
host);
alog("session: Tried to delete non-existant session: %s", host);
return;
}
@@ -337,9 +333,9 @@ void expire_exceptions(void)
if (exceptions[i].expires == 0 || exceptions[i].expires > now)
continue;
if (WallExceptionExpire)
wallops(s_OperServ,
"Session limit exception for %s has expired.",
exceptions[i].mask);
anope_cmd_global(s_OperServ,
"Session limit exception for %s has expired.",
exceptions[i].mask);
free(exceptions[i].mask);
free(exceptions[i].reason);
nexceptions--;
@@ -429,7 +425,7 @@ void load_exceptions()
restore_db(f); \
log_perror("Write error on %s", ExceptionDBName); \
if (time(NULL) - lastwarn > WarningTimeout) { \
wallops(NULL, "Write error on %s: %s", ExceptionDBName, \
anope_cmd_global(NULL, "Write error on %s: %s", ExceptionDBName, \
strerror(errno)); \
lastwarn = time(NULL); \
} \
+1318
View File
File diff suppressed because it is too large Load Diff
+1427
View File
File diff suppressed because it is too large Load Diff
+1340
View File
File diff suppressed because it is too large Load Diff
+1434
View File
File diff suppressed because it is too large Load Diff
+144 -385
View File
@@ -20,53 +20,6 @@ User *userlist[1024];
int32 usercnt = 0, opcnt = 0, maxusercnt = 0;
time_t maxusertime;
static unsigned long umodes[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
UMODE_P,
#else
0,
#endif
0,
#if defined(IRC_BAHAMUT) || defined(IRC_ULTIMATE)
UMODE_R,
#else
0,
#endif
0, 0, 0, 0, 0, 0, 0,
#ifdef IRC_ULTIMATE3
UMODE_Z,
#else
0,
#endif
0, 0, 0, 0, 0,
0, UMODE_a, 0, 0, 0, 0, 0,
#ifdef IRC_DREAMFORGE
UMODE_g,
#else
0,
#endif
UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o,
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
UMODE_p,
#else
0,
#endif
0, UMODE_r, 0, 0, 0, 0, UMODE_w,
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_VIAGRA) || defined(IRC_RAGE2)
UMODE_x,
#else
0,
#endif
0,
0,
0, 0, 0, 0, 0
};
/*************************************************************************/
/*************************************************************************/
@@ -138,9 +91,7 @@ static void change_user_nick(User * user, const char *nick)
/*************************************************************************/
#ifdef HAS_VHOST
static void update_host(User * user)
void update_host(User * user)
{
if (user->na && (nick_identified(user)
|| (!(user->na->nc->flags & NI_SECURE)
@@ -149,22 +100,20 @@ static void update_host(User * user)
free(user->na->last_usermask);
user->na->last_usermask =
smalloc(strlen(GetIdent(user)) + strlen(GetHost(user)) + 2);
sprintf(user->na->last_usermask, "%s@%s", GetIdent(user),
GetHost(user));
smalloc(strlen(common_get_vident(user)) +
strlen(common_get_vhost(user)) + 2);
sprintf(user->na->last_usermask, "%s@%s", common_get_vident(user),
common_get_vhost(user));
}
if (debug)
alog("debug: %s changes its host to %s", user->nick,
GetHost(user));
common_get_vhost(user));
}
#endif
/*************************************************************************/
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_VIAGRA) || defined(IRC_PTLINK) || defined(IRC_RAGE2)
/* Change the (virtual) hostname of a user. */
void change_user_host(User * user, const char *host)
@@ -181,10 +130,8 @@ void change_user_host(User * user, const char *host)
update_host(user);
}
#endif
/*************************************************************************/
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_VIAGRA) || defined(IRC_PTLINK)
/* Change the realname of a user. */
void change_user_realname(User * user, const char *realname)
@@ -222,150 +169,17 @@ void change_user_username(User * user, const char *username)
free(user->na->last_usermask);
user->na->last_usermask =
smalloc(strlen(GetIdent(user)) + strlen(GetHost(user)) + 2);
sprintf(user->na->last_usermask, "%s@%s", GetIdent(user),
GetHost(user));
smalloc(strlen(common_get_vident(user)) +
strlen(common_get_vhost(user)) + 2);
sprintf(user->na->last_usermask, "%s@%s", common_get_vident(user),
common_get_vhost(user));
}
if (debug)
alog("debug: %s changes its username to %s", user->nick, username);
}
#endif
/*************************************************************************/
void set_umode(User * user, int ac, char **av)
{
int add = 1; /* 1 if adding modes, 0 if deleting */
char *modes = av[0];
ac--;
if (debug)
alog("debug: Changing mode for %s to %s", user->nick, modes);
while (*modes) {
add ? (user->mode |= umodes[(int) *modes]) : (user->mode &=
~umodes[(int)
*modes]);
switch (*modes++) {
case '+':
add = 1;
break;
case '-':
add = 0;
break;
#if defined(IRC_BAHAMUT) && !defined(IRC_ULTIMATE3) && !defined(IRC_VIAGRA) && !defined(IRC_RAGE2)
case 'a':
if (add && !is_services_admin(user)) {
send_cmd(ServerName, "SVSMODE %s -a", user->nick);
user->mode &= ~UMODE_a;
}
break;
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
case 'a':
if (add && !is_services_oper(user)) {
send_cmd(ServerName, "SVSMODE %s -a", user->nick);
user->mode &= ~UMODE_a;
}
break;
case 'P':
if (add && !is_services_admin(user)) {
send_cmd(ServerName, "SVSMODE %s -P", user->nick);
user->mode &= ~UMODE_P;
}
break;
#endif
#if defined(IRC_ULTIMATE)
case 'R':
if (add && !is_services_root(user)) {
send_cmd(ServerName, "SVSMODE %s -R", user->nick);
user->mode &= ~UMODE_R;
}
break;
#endif
#if defined(IRC_ULTIMATE3)
case 'Z':
if (add && !is_services_root(user)) {
send_cmd(ServerName, "SVSMODE %s -Z", user->nick);
user->mode &= ~UMODE_Z;
}
break;
#endif
case 'd':
if (ac == 0) {
#if !defined(IRC_ULTIMATE) && !defined(IRC_UNREAL)
alog("user: umode +d with no parameter (?) for user %s",
user->nick);
#endif
break;
}
ac--;
av++;
user->svid = strtoul(*av, NULL, 0);
break;
case 'o':
if (add) {
opcnt++;
if (WallOper)
wallops(s_OperServ, "\2%s\2 is now an IRC operator.",
user->nick);
display_news(user, NEWS_OPER);
#if defined(IRC_PTLINK)
if (is_services_admin(user)) {
send_cmd(ServerName, "SVSMODE %s +a", user->nick);
user->mode |= UMODE_a;
}
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3) || defined(IRC_RAGE2)
if (is_services_oper(user)) {
send_cmd(ServerName, "SVSMODE %s +a", user->nick);
user->mode |= UMODE_a;
}
#endif
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
if (is_services_admin(user)) {
send_cmd(ServerName, "SVSMODE %s +P", user->nick);
user->mode |= UMODE_P;
}
#endif
#ifdef IRC_ULTIMATE
if (is_services_root(user)) {
send_cmd(ServerName, "SVSMODE %s +R", user->nick);
user->mode |= UMODE_R;
}
#endif
#ifdef IRC_ULTIMATE3
if (is_services_root(user)) {
send_cmd(ServerName, "SVSMODE %s +Z", user->nick);
user->mode |= UMODE_Z;
}
#endif
} else {
opcnt--;
}
break;
case 'r':
if (add && !nick_identified(user)) {
send_cmd(ServerName, "SVSMODE %s -r", user->nick);
user->mode &= ~UMODE_r;
}
break;
#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_ULTIMATE3) || defined(IRC_VIAGRA) || defined(IRC_RAGE2)
case 'x':
update_host(user);
break;
#endif
}
}
}
/*************************************************************************/
@@ -377,16 +191,16 @@ void delete_user(User * user)
struct u_chaninfolist *ci, *ci2;
if (LogUsers) {
#ifdef HAS_VHOST
alog("LOGUSERS: %s (%s@%s => %s) (%s) left the network (%s).",
user->nick, user->username, user->host,
(user->vhost ? user->vhost : "(none)"), user->realname,
user->server->name);
#else
alog("LOGUSERS: %s (%s@%s) (%s) left the network (%s).",
user->nick, user->username, user->host,
user->realname, user->server->name);
#endif
if (ircd->vhost) {
alog("LOGUSERS: %s (%s@%s => %s) (%s) left the network (%s).",
user->nick, user->username, user->host,
(user->vhost ? user->vhost : "(none)"), user->realname,
user->server->name);
} else {
alog("LOGUSERS: %s (%s@%s) (%s) left the network (%s).",
user->nick, user->username, user->host,
user->realname, user->server->name);
}
}
if (debug >= 2)
@@ -398,10 +212,10 @@ void delete_user(User * user)
alog("debug: delete_user(): free user data");
free(user->username);
free(user->host);
#ifdef HAS_VHOST
if (user->vhost)
free(user->vhost);
#endif
if (ircd->vhost) {
if (user->vhost)
free(user->vhost);
}
free(user->realname);
if (debug >= 2)
alog("debug: delete_user(): remove from channels");
@@ -466,10 +280,10 @@ void get_user_stats(long *nusers, long *memuse)
mem += strlen(user->username) + 1;
if (user->host)
mem += strlen(user->host) + 1;
#ifdef HAS_VHOST
if (user->vhost)
mem += strlen(user->vhost) + 1;
#endif
if (ircd->vhost) {
if (user->vhost)
mem += strlen(user->vhost) + 1;
}
if (user->realname)
mem += strlen(user->realname) + 1;
if (user->server->name)
@@ -540,7 +354,8 @@ User *nextuser(void)
/* Handle a server NICK command. */
User *do_nick(const char *source, char *nick, char *username, char *host,
char *server, char *realname, time_t ts, uint32 svid, ...)
char *server, char *realname, time_t ts, uint32 svid,
uint32 ip, char *vhost, char *uid)
{
User *user;
@@ -551,32 +366,18 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
char mask[USERMAX + HOSTMAX + 2];
if (!*source) {
#ifdef HAS_NICKIP
char ipbuf[16];
struct in_addr addr;
uint32 ip;
#endif
#ifdef HAS_VHOST
char *vhost = NULL;
#endif
#if defined(HAS_NICKIP) || defined(HAS_NICKVHOST)
va_list args;
va_start(args, svid);
#endif
#ifdef HAS_NICKIP
ip = va_arg(args, uint32);
#endif
#ifdef HAS_NICKVHOST
vhost = va_arg(args, char *);
if (!strcmp(vhost, "*")) {
vhost = NULL;
if (debug)
alog("debug: new user with no vhost in NICK command: %s",
nick);
if (ircd->nickvhost) {
if (vhost) {
if (!strcmp(vhost, "*")) {
vhost = NULL;
if (debug)
alog("debug: new user with no vhost in NICK command: %s", nick);
}
}
}
#endif
/* This is a new user; create a User structure for it. */
if (debug)
@@ -586,33 +387,35 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
/**
* Ugly swap routine for Flop's bug :)
**/
tmp = strchr(realname, '%');
while (tmp) {
*tmp = '-';
if (realname) {
tmp = strchr(realname, '%');
while (tmp) {
*tmp = '-';
tmp = strchr(realname, '%');
}
}
/**
* End of ugly swap
**/
#ifdef HAS_NICKIP
addr.s_addr = htonl(ip);
ntoa(addr, ipbuf, sizeof(ipbuf));
#endif
if (ircd->nickip) {
addr.s_addr = htonl(ip);
ntoa(addr, ipbuf, sizeof(ipbuf));
}
#ifdef HAS_NICKVHOST
# ifdef HAS_NICKIP
alog("LOGUSERS: %s (%s@%s => %s) (%s) [%s] connected to the network (%s).", nick, username, host, vhost, realname, ipbuf, server);
# else
alog("LOGUSERS: %s (%s@%s => %s) (%s) connected to the network (%s).", nick, username, host, vhost, realname, server);
# endif
#else
# ifdef HAS_NICKIP
alog("LOGUSERS: %s (%s@%s) (%s) [%s] connected to the network (%s).", nick, username, host, realname, ipbuf, server);
# else
alog("LOGUSERS: %s (%s@%s) (%s) connected to the network (%s).", nick, username, host, realname, server);
# endif
#endif
if (ircd->nickvhost) {
if (ircd->nickip) {
alog("LOGUSERS: %s (%s@%s => %s) (%s) [%s] connected to the network (%s).", nick, username, host, vhost, realname, ipbuf, server);
} else {
alog("LOGUSERS: %s (%s@%s => %s) (%s) connected to the network (%s).", nick, username, host, vhost, realname, server);
}
} else {
if (ircd->nickip) {
alog("LOGUSERS: %s (%s@%s) (%s) [%s] connected to the network (%s).", nick, username, host, realname, ipbuf, server);
} else {
alog("LOGUSERS: %s (%s@%s) (%s) connected to the network (%s).", nick, username, host, realname, server);
}
}
}
/* We used to ignore the ~ which a lot of ircd's use to indicate no
@@ -628,17 +431,7 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
* as such, create a user_struct, and if the client is removed, we'll delete it again when the QUIT notice
* comes in from the ircd.
**/
if (check_akill(nick, username, host,
#ifdef HAS_NICKVHOST
vhost,
#else
NULL,
#endif
#ifdef HAS_NICKIP
ipbuf)) {
#else
NULL)) {
#endif
if (check_akill(nick, username, host, vhost, ipbuf)) {
/* return NULL; */
}
@@ -654,30 +447,20 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
time(NULL) + dotime(DefConAKILL),
DefConAkillReason ? DefConAkillReason :
"DEFCON AKILL");
if (check_akill(nick, username, host,
#ifdef HAS_NICKVHOST
vhost,
#else
NULL,
#endif
#ifdef HAS_NICKIP
ipbuf)) {
#else
NULL)) {
#endif
if (check_akill(nick, username, host, vhost, ipbuf)) {
/* return NULL; */
}
}
#ifdef IRC_BAHAMUT
/* Next for SGLINEs */
if (check_sgline(nick, realname))
return NULL;
#endif
/* And for SQLINEs */
if (check_sqline(nick, 0))
return NULL;
if (ircd->sgline) {
/* Next for SGLINEs */
if (check_sgline(nick, realname))
return NULL;
}
if (ircd->sqline) {
/* And for SQLINEs */
if (check_sqline(nick, 0))
return NULL;
}
#ifndef STREAMLINED
/* Now check for session limits */
if (LimitSessions && !add_session(nick, host))
@@ -686,12 +469,9 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
/* And finally, for proxy ;) */
#ifdef USE_THREADS
# ifdef HAS_NICKIP
if (ProxyDetect && proxy_check(nick, host, ip))
# else
if (ProxyDetect && proxy_check(nick, host, 0))
# endif
if (ProxyDetect && proxy_check(nick, host, ip)) {
return NULL;
}
#endif
/* Allocate User structure and fill it in. */
@@ -702,10 +482,8 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
user->realname = sstrdup(realname);
user->timestamp = ts;
user->my_signon = time(NULL);
#ifdef HAS_VHOST
user->vhost = vhost ? sstrdup(vhost) : sstrdup(host);
#endif
user->uid = uid; /* p10 stuff */
if (CheckClones) {
/* Check to see if it looks like clones. */
@@ -731,14 +509,9 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
} else if (svid != 1) {
/* Resets the svid because it doesn't match */
user->svid = 1;
#ifdef IRC_BAHAMUT
send_cmd(ServerName, "SVSMODE %s %lu +d 1", user->nick,
user->timestamp);
#else
#ifndef IRC_PTLINK
send_cmd(ServerName, "SVSMODE %s +d 1", user->nick);
#endif
#endif
anope_cmd_svid_umode(user->nick, user->timestamp);
} else {
user->svid = 1;
}
@@ -746,6 +519,7 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
} else {
/* An old user changing nicks. */
user = finduser(source);
if (!user) {
alog("user: NICK from nonexistent nick %s", source);
return NULL;
@@ -755,13 +529,11 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
alog("debug: %s changes nick to %s", source, nick);
if (LogUsers) {
#ifdef HAS_VHOST
alog("LOGUSERS: %s (%s@%s => %s) (%s) changed his nick to %s (%s).", user->nick, user->username, user->host, (user->vhost ? user->vhost : "(none)"), user->realname, nick, user->server->name);
#else
alog("LOGUSERS: %s (%s@%s) (%s) changed his nick to %s (%s).",
user->nick, user->username, user->host,
user->realname, nick, user->server->name);
#endif
if (ircd->vhost) {
alog("LOGUSERS: %s (%s@%s => %s) (%s) changed his nick to %s (%s).", user->nick, user->username, user->host, (user->vhost ? user->vhost : "(none)"), user->realname, nick, user->server->name);
} else {
alog("LOGUSERS: %s (%s@%s) (%s) changed his nick to %s (%s).", user->nick, user->username, user->host, user->realname, nick, user->server->name);
}
}
user->timestamp = ts;
@@ -791,17 +563,14 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
if (!nc_changed && (user->na))
user->na->status |= status;
else {
#if !defined(IRC_BAHAMUT) && !defined(IRC_PTLINK)
/* Because on Bahamut it would be already -r */
change_user_mode(user, "-r+d", "1");
#else
change_user_mode(user, "+d", "1");
#endif
anope_cmd_nc_change(user);
}
}
if (!is_oper(user) && check_sqline(user->nick, 1))
return NULL;
if (ircd->sqline) {
if (!is_oper(user) && check_sqline(user->nick, 1))
return NULL;
}
} /* if (!*source) */
@@ -814,6 +583,7 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
if (nc_changed || !nick_recognized(user)) {
if (validate_user(user))
check_memos(user);
} else {
if (nick_identified(user)) {
user->na->last_seen = time(NULL);
@@ -821,44 +591,29 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
if (user->na->last_usermask)
free(user->na->last_usermask);
user->na->last_usermask =
smalloc(strlen(GetIdent(user)) + strlen(GetHost(user)) +
2);
sprintf(user->na->last_usermask, "%s@%s", GetIdent(user),
GetHost(user));
smalloc(strlen(common_get_vident(user)) +
strlen(common_get_vhost(user)) + 2);
sprintf(user->na->last_usermask, "%s@%s",
common_get_vident(user), common_get_vhost(user));
#ifdef IRC_PTLINK
change_user_mode(user, "+r", NULL);
#endif
#if !defined(IRC_BAHAMUT) && !defined(IRC_PTLINK)
if (user->svid != user->timestamp) {
char tsbuf[16];
snprintf(tsbuf, sizeof(tsbuf), "%lu", user->timestamp);
change_user_mode(user, "+rd", tsbuf);
} else {
change_user_mode(user, "+r", NULL);
}
#endif
alog("%s: %s!%s@%s automatically identified for nick %s",
s_NickServ, user->nick, user->username, GetHost(user),
user->nick);
}
}
/* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
#ifdef IRC_BAHAMUT
if (nick_identified(user)) {
if (user->svid != user->timestamp) {
char tsbuf[16];
snprintf(tsbuf, sizeof(tsbuf), "%lu", user->timestamp);
change_user_mode(user, "+rd", tsbuf);
} else {
change_user_mode(user, "+r", NULL);
anope_cmd_svid_umode2(user, tsbuf);
alog("%s: %s!%s@%s automatically identified for nick %s",
s_NickServ, user->nick, user->username,
common_get_vhost(user), user->nick);
}
}
/* Bahamut sets -r on every nick changes, so we must test it even if nc_changed == 0 */
if (ircd->check_nick_id) {
if (nick_identified(user)) {
char tsbuf[16];
snprintf(tsbuf, sizeof(tsbuf), "%lu", user->timestamp);
anope_cmd_svid_umode3(user, tsbuf);
}
}
#endif
return user;
}
@@ -877,8 +632,8 @@ void do_umode(const char *source, int ac, char **av)
if (stricmp(source, av[0]) != 0) {
alog("user: MODE %s %s from different nick %s!", av[0], av[1],
source);
wallops(NULL, "%s attempted to change mode %s for %s", source,
av[1], av[0]);
anope_cmd_global(NULL, "%s attempted to change mode %s for %s",
source, av[1], av[0]);
return;
}
@@ -889,7 +644,7 @@ void do_umode(const char *source, int ac, char **av)
return;
}
set_umode(user, ac - 1, &av[1]);
anope_set_umode(user, ac - 1, &av[1]);
}
/*************************************************************************/
@@ -932,22 +687,22 @@ void do_quit(const char *source, int ac, char **av)
* av[1] = reason
*/
void do_kill(const char *source, int ac, char **av)
void do_kill(char *nick, char *msg)
{
User *user;
NickAlias *na;
user = finduser(av[0]);
user = finduser(nick);
if (!user)
return;
if (debug)
alog("debug: %s killed", av[0]);
alog("debug: %s killed", nick);
if ((na = user->na) && (!(na->status & NS_VERBOTEN))
&& (na->status & (NS_IDENTIFIED | NS_RECOGNIZED))) {
na->last_seen = time(NULL);
if (na->last_quit)
free(na->last_quit);
na->last_quit = *av[1] ? sstrdup(av[1]) : NULL;
na->last_quit = *msg ? sstrdup(msg) : NULL;
}
#ifndef STREAMLINED
@@ -960,15 +715,16 @@ void do_kill(const char *source, int ac, char **av)
/*************************************************************************/
/*************************************************************************/
#if defined(IRC_ULTIMATE) || defined(IRC_ULTIMATE3)
/* Is the given user protected from kicks and negative mode changes? */
int is_protected(User * user)
{
return (user->mode & UMODE_p);
if (ircd->protectedumode) {
return (user->mode & ircd->protectedumode);
} else {
return 0;
}
}
#endif
/*************************************************************************/
@@ -982,7 +738,6 @@ int is_oper(User * user)
/*************************************************************************/
/*************************************************************************/
#ifdef HAS_EXCEPT
/* Is the given user ban-excepted? */
int is_excepted(ChannelInfo * ci, User * user)
{
@@ -993,6 +748,10 @@ int is_excepted(ChannelInfo * ci, User * user)
if (!ci->c)
return 0;
if (!ircd->except) {
return 0;
}
count = ci->c->exceptcount;
excepts = scalloc(sizeof(char *) * count, 1);
memcpy(excepts, ci->c->excepts, sizeof(char *) * count);
@@ -1018,6 +777,10 @@ int is_excepted_mask(ChannelInfo * ci, char *mask)
if (!ci->c)
return 0;
if (!ircd->except) {
return 0;
}
count = ci->c->exceptcount;
excepts = scalloc(sizeof(char *) * count, 1);
memcpy(excepts, ci->c->excepts, sizeof(char *) * count);
@@ -1031,7 +794,7 @@ int is_excepted_mask(ChannelInfo * ci, char *mask)
return isexcepted;
}
#endif
/*************************************************************************/
/* Does the user's usermask match the given mask (either nick!user@host or
@@ -1061,17 +824,11 @@ int match_usermask(const char *mask, User * user)
result = match_wild_nocase(nick, user->nick)
&& match_wild_nocase(username, user->username)
&& (match_wild_nocase(host, user->host)
#ifdef HAS_VHOST
|| match_wild_nocase(host, user->vhost)
#endif
);
|| match_wild_nocase(host, user->vhost));
} else {
result = match_wild_nocase(username, user->username)
&& (match_wild_nocase(host, user->host)
#ifdef HAS_VHOST
|| match_wild_nocase(host, user->vhost)
#endif
);
|| match_wild_nocase(host, user->vhost));
}
free(mask2);
@@ -1125,38 +882,40 @@ void split_usermask(const char *mask, char **nick, char **user,
char *create_mask(User * u)
{
char *mask, *s, *end;
int ulen = strlen(GetIdent(u));
int ulen = strlen(common_get_vident(u));
/* Get us a buffer the size of the username plus hostname. The result
* will never be longer than this (and will often be shorter), thus we
* can use strcpy() and sprintf() safely.
*/
end = mask = smalloc(ulen + strlen(GetHost(u)) + 3);
end = mask = smalloc(ulen + strlen(common_get_vhost(u)) + 3);
end += sprintf(end, "%s%s@",
(ulen <
(*(GetIdent(u)) ==
(*(common_get_vident(u)) ==
'~' ? USERMAX + 1 : USERMAX) ? "*" : ""),
(*(GetIdent(u)) ==
'~' ? GetIdent(u) + 1 : GetIdent(u)));
(*(common_get_vident(u)) ==
'~' ? common_get_vident(u) +
1 : common_get_vident(u)));
if (strspn(GetHost(u), "0123456789.") == strlen(GetHost(u))
&& (s = strchr(GetHost(u), '.'))
if (strspn(common_get_vhost(u), "0123456789.") ==
strlen(common_get_vhost(u))
&& (s = strchr(common_get_vhost(u), '.'))
&& (s = strchr(s + 1, '.'))
&& (s = strchr(s + 1, '.'))
&& (!strchr(s + 1, '.'))) { /* IP addr */
s = sstrdup(GetHost(u));
s = sstrdup(common_get_vhost(u));
*strrchr(s, '.') = 0;
sprintf(end, "%s.*", s);
free(s);
} else {
if ((s = strchr(GetHost(u), '.')) && strchr(s + 1, '.')) {
s = sstrdup(strchr(GetHost(u), '.') - 1);
if ((s = strchr(common_get_vhost(u), '.')) && strchr(s + 1, '.')) {
s = sstrdup(strchr(common_get_vhost(u), '.') - 1);
*s = '*';
strcpy(end, s);
free(s);
} else {
strcpy(end, GetHost(u));
strcpy(end, common_get_vhost(u));
}
}
return mask;
+1349
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -8,10 +8,14 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="5"
VERSION_BUILD="325"
VERSION_BUILD="327"
# $Log$
#
# BUILD : 1.7.5 (327)
# BUGS : none
# NOTES : Merged anope-capab into main trunk...
#
# BUILD : 1.7.5 (325)
# BUGS : 128 139 146 147 148
# NOTES : Applied patch supplied by Trystan to fix bugs listed above.