diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/protocol/bahamut.h | 94 | ||||
-rw-r--r-- | src/protocol/charybdis.h | 81 | ||||
-rwxr-xr-x | src/protocol/inspircd11.h | 87 | ||||
-rw-r--r-- | src/protocol/ratbox.h | 75 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 893 | ||||
-rw-r--r-- | src/protocol/unreal32.h | 125 |
6 files changed, 484 insertions, 871 deletions
diff --git a/src/protocol/bahamut.h b/src/protocol/bahamut.h deleted file mode 100644 index 200dc3d6a..000000000 --- a/src/protocol/bahamut.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Bahamut functions - * - * (C) 2003-2008 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. - * - * - */ - -/*************************************************************************/ - -#define UMODE_a 0x00000001 /* umode +a - Services Admin */ -#define UMODE_h 0x00000002 /* umode +h - Helper */ -#define UMODE_i 0x00000004 /* umode +i - Invisible */ -#define UMODE_o 0x00000008 /* umode +o - Oper */ -#define UMODE_r 0x00000010 /* umode +r - registered nick */ -#define UMODE_w 0x00000020 /* umode +w - Get wallops */ -#define UMODE_A 0x00000040 /* umode +A - Server Admin */ -#define UMODE_x 0x00000080 /* umode +x - Squelch with notice */ -#define UMODE_X 0x00000100 /* umode +X - Squelch without notice */ -#define UMODE_F 0x00000200 /* umode +F - no cptr->since message rate throttle */ -#define UMODE_j 0x00000400 /* umode +j - client rejection notices */ -#define UMODE_K 0x00000800 /* umode +K - U: lined server kill messages */ -#define UMODE_O 0x00001000 /* umode +O - Local Oper */ -#define UMODE_s 0x00002000 /* umode +s - Server notices */ -#define UMODE_c 0x00004000 /* umode +c - Client connections/exits */ -#define UMODE_k 0x00008000 /* umode +k - Server kill messages */ -#define UMODE_f 0x00010000 /* umode +f - Server flood messages */ -#define UMODE_y 0x00020000 /* umode +y - Stats/links */ -#define UMODE_d 0x00040000 /* umode +d - Debug info */ -#define UMODE_g 0x00080000 /* umode +g - Globops */ -#define UMODE_b 0x00100000 /* umode +b - Chatops */ -#define UMODE_n 0x00200000 /* umode +n - Routing Notices */ -#define UMODE_m 0x00400000 /* umode +m - spambot notices */ -#define UMODE_e 0x00800000 /* umode +e - oper notices for the above +D */ -#define UMODE_D 0x01000000 /* umode +D - Hidden dccallow umode */ -#define UMODE_I 0x02000000 /* umode +I - invisible oper (masked) */ -#define UMODE_R 0x80000000 /* unmode +R - No non registered msgs */ - -#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 CMODE_c 0x00000400 /* Colors can't be used */ -#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */ -#define CMODE_j 0x00001000 /* join throttle */ -#define CMODE_O 0x00008000 /* Only opers can join */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -class BahamutIRCdProto : public IRCDProto { - void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(BotInfo *, const char *, const char *); - void SendKickInternal(BotInfo *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); - public: - void SendSVSNOOP(const char *, int); - void SendAkillDel(const char *, const char *); - void SendTopic(BotInfo *, const char *, const char *, const char *, time_t); - void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); - void SendSVSMode(User *, int, const char **); - void SendGuestNick(const char *, const char *, const char *, const char *, const char *); - void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); - void SendBotOp(const char *, const char *); - void SendJoin(BotInfo *, const char *, time_t); - void SendSQLineDel(const char *); - void SendSQLine(const char *, const char *); - void SendConnect(); - void SendSVSHold(const char *); - void SendSVSHoldDel(const char *); - void SendSGLineDel(const char *); - void SendSZLineDel(const char *); - void SendSZLine(const char *, const char *, const char *); - void SendSGLine(const char *, const char *); - void SendBanDel(const char *, const char *); - void SendSVSModeChan(const char *, const char *, const char *); - void SendSVID(const char *, time_t); - void SendUnregisteredNick(User *); - void SendSVID3(User *, const char *); - void SendEOB(); - void SendServer(const char *, int, const char *); - void ProcessUsermodes(User *, int, const char **); - int IsFloodModeParamValid(const char *); -} ircd_proto; diff --git a/src/protocol/charybdis.h b/src/protocol/charybdis.h deleted file mode 100644 index a43e3a2da..000000000 --- a/src/protocol/charybdis.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Ratbox IRCD functions - * - * (C) 2003-2008 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. - * - * - */ - -#define UMODE_a 0x00000001 /* umode a - admin */ -#define UMODE_g 0x00000002 /* umode g - caller ID */ -#define UMODE_i 0x00000004 /* umode i - invisible */ -#define UMODE_o 0x00000008 /* umode o - operator */ -#define UMODE_z 0x00000010 /* umode u - operwall */ -#define UMODE_w 0x00000020 /* umode w - wallops */ -#define UMODE_s 0x00000040 /* umode s - server notices */ -#define UMODE_Q 0x00000080 /* umode Q - block forwarding */ -#define UMODE_R 0x00000200 /* umode R - reject messages from unauthenticated users */ -#define UMODE_S 0x00000400 /* umode S - network service */ -#define UMODE_l 0x00020000 /* umode l - locops */ - - -#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 -#define CMODE_l 0x00000080 -#define CMODE_f 0x00000100 -#define CMODE_c 0x00000200 -#define CMODE_r 0x00000400 -#define CMODE_P 0x00000800 -#define CMODE_g 0x00001000 -#define CMODE_z 0x00002000 -#define CMODE_j 0x00004000 -#define CMODE_F 0x00008000 -#define CMODE_L 0x00010000 -#define CMODE_Q 0x00020000 - -#define DEFAULT_MLOCK CMODE_n | CMODE_t - - -class CharybdisProto : public IRCDTS6Proto { - void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(BotInfo *, const char *, const char *); - void SendKickInternal(BotInfo *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); - void SendQuitInternal(BotInfo *, const char *); - void SendPartInternal(BotInfo *, const char *, const char *); - void SendGlobopsInternal(const char *, const char *); - void SendNumericInternal(const char *, int, const char *, const char *); - public: - void SendAkillDel(const char *, const char *); - void SendVhostDel(User *); - void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); - void SendSVSMode(User *, int, const char **); - void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); - void SendBotOp(const char *, const char *); - void SendPong(const char *, const char *); - void SendJoin(BotInfo *, const char *, time_t); - void SendSQLineDel(const char *); - void SendInvite(BotInfo *, const char *, const char *); - void SendSQLine(const char *, const char *); - void SendForceNickChange(const char *, const char *, time_t); - void SendVhost(const char *, const char *, const char *); - void SendConnect(); - void SendSVSHold(const char *); - void SendSVSHoldDel(const char *); - void SendSGLineDel(const char *); - void SendSGLine(const char *, const char *); - void SendServer(const char *, int, const char *); - void ProcessUsermodes(User *, int, const char **); - int IsNickValid(const char *); - int IsFloodModeParamValid(const char *); -} ircd_proto; diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h deleted file mode 100755 index 7988071eb..000000000 --- a/src/protocol/inspircd11.h +++ /dev/null @@ -1,87 +0,0 @@ -/* inspircd beta 6 functions - * - * (C) 2003-2008 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. - * - * - */ - -/*************************************************************************/ - -#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 - -class InspIRCdProto : public IRCDProto { - void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(BotInfo *, const char *, const char *); - void SendKickInternal(BotInfo *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); - void SendNumericInternal(const char *, int, const char *, const char *); - public: - void SendAkillDel(const char *, const char *); - void SendTopic(BotInfo *, const char *, const char *, const char *, time_t); - void SendVhostDel(User *); - void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); - void SendSVSMode(User *, int, const char **); - void SendGuestNick(const char *, const char *, const char *, const char *, const char *); - void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); - void SendBotOp(const char *, const char *); - void SendJoin(BotInfo *, const char *, time_t); - void SendSQLineDel(const char *); - void SendSQLine(const char *, const char *); - void SendSquit(const char *, const char *); - void SendVhost(const char *, const char *, const char *); - void SendConnect(); - void SendSVSHold(const char *); - void SendSVSHoldDel(const char *); - void SendSZLineDel(const char *); - void SendSZLine(const char *, const char *, const char *); - void SendUnregisteredNick(User *); - void SendSVID2(User *, const char *); - void SendSVSJoin(const char *, const char *, const char *, const char *); - void SendSVSPart(const char *, const char *, const char *); - void SendEOB(); - void SendServer(const char *, int, const char *); - void ProcessUsermodes(User *, int, const char **); - int IsFloodModeParamValid(const char *); -} ircd_proto; diff --git a/src/protocol/ratbox.h b/src/protocol/ratbox.h deleted file mode 100644 index 5687d2698..000000000 --- a/src/protocol/ratbox.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Ratbox IRCD functions - * - * (C) 2003-2008 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. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_C 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_z 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_s 0x00000040 -#define UMODE_c 0x00000080 -#define UMODE_r 0x00000100 -#define UMODE_k 0x00000200 -#define UMODE_f 0x00000400 -#define UMODE_y 0x00000800 -#define UMODE_d 0x00001000 -#define UMODE_n 0x00002000 -#define UMODE_x 0x00004000 -#define UMODE_u 0x00008000 -#define UMODE_b 0x00010000 -#define UMODE_l 0x00020000 -#define UMODE_g 0x00040000 -#define UMODE_Z 0x00080000 - -#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 -#define CMODE_l 0x00000080 - - -#define DEFAULT_MLOCK CMODE_n | CMODE_t - - -class RatboxProto : public IRCDTS6Proto { - void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(BotInfo *, const char *, const char *); - void SendKickInternal(BotInfo *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); - void SendQuitInternal(BotInfo *, const char *); - void SendPartInternal(BotInfo *, const char *, const char *); - void SendGlobopsInternal(const char *, const char *); - void SendNumericInternal(const char *, int, const char *, const char *); - public: - void SendAkillDel(const char *, const char *); - void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); - void SendSVSMode(User *, int, const char **); - void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); - void SendBotOp(const char *, const char *); - void SendPong(const char *, const char *); - void SendJoin(BotInfo *, const char *, time_t); - void SendSQLineDel(const char *); - void SendInvite(BotInfo *, const char *, const char *); - void SendSQLine(const char *, const char *); - void SendForceNickChange(const char *, const char *, time_t) { } // Ratbox doesn't have an SVSNICK command - void SendConnect(); - void SendSGLineDel(const char *); - void SendSGLine(const char *, const char *); - void SendServer(const char *, int, const char *); - void ProcessUsermodes(User *, int, const char **); - int IsNickValid(const char *); -} ircd_proto; diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 850034731..9e27ec7c6 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -15,7 +15,74 @@ #include "services.h" #include "pseudo.h" -#include "unreal32.h" + + +/* User Modes */ +#define UMODE_a 0x00000001 /* a Services Admin */ +#define UMODE_h 0x00000002 /* h Available for help (HelpOp) */ +#define UMODE_i 0x00000004 /* i Invisible (not shown in /who) */ +#define UMODE_o 0x00000008 /* o Global IRC Operator */ +#define UMODE_r 0x00000010 /* r Identifies the nick as being registered */ +#define UMODE_w 0x00000020 /* w Can listen to wallop messages */ +#define UMODE_A 0x00000040 /* A Server Admin */ +#define UMODE_N 0x00000080 /* N Network Administrator */ +#define UMODE_O 0x00000100 /* O Local IRC Operator */ +#define UMODE_C 0x00000200 /* C Co-Admin */ +#define UMODE_d 0x00000400 /* d Makes it so you can not receive channel PRIVMSGs */ +#define UMODE_p 0x00000800 /* Hides the channels you are in in a /whois reply */ +#define UMODE_q 0x00001000 /* q Only U:Lines can kick you (Services Admins Only) */ +#define UMODE_s 0x00002000 /* s Can listen to server notices */ +#define UMODE_t 0x00004000 /* t Says you are using a /vhost */ +#define UMODE_v 0x00008000 /* v Receives infected DCC Send Rejection notices */ +#define UMODE_z 0x00010000 /* z Indicates that you are an SSL client */ +#define UMODE_B 0x00020000 /* B Marks you as being a Bot */ +#define UMODE_G 0x00040000 /* G Filters out all the bad words per configuration */ +#define UMODE_H 0x00080000 /* H Hide IRCop Status (IRCop Only) */ +#define UMODE_S 0x00100000 /* S services client */ +#define UMODE_V 0x00200000 /* V Marks you as a WebTV user */ +#define UMODE_W 0x00400000 /* W Lets you see when people do a /whois on you */ +#define UMODE_T 0x00800000 /* T Prevents you from receiving CTCPs */ +#define UMODE_g 0x20000000 /* g Can send & read globops and locops */ +#define UMODE_x 0x40000000 /* x Gives user a hidden hostname */ +#define UMODE_R 0x80000000 /* Allows you to only receive PRIVMSGs/NOTICEs from registered (+r) users */ + + +/*************************************************************************/ + +/* 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_R 0x00000100 /* Only identified users can join */ +#define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_c 0x00000400 +#define CMODE_A 0x00000800 +/* #define CMODE_H 0x00001000 Was now +I may not join, but Unreal Removed it and it will not set in 3.2 */ +#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_T 0x02000000 +#define CMODE_M 0x04000000 + + +/* Default Modes with MLOCK */ + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r IRCDVar myIrcd[] = { {"UnrealIRCd 3.2.x", /* ircd name */ @@ -415,165 +482,23 @@ CUMode myCumodes[128] = { }; -void UnrealIRCdProto::ProcessUsermodes(User *user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - --ac; - if (!user || !modes) return; /* Prevent NULLs from doing bad things */ - if (debug) alog("debug: Changing mode for %s to %s", user->nick, modes); - while (*modes) { - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD */ - if (add) user->mode |= umodes[static_cast<int>(*modes)]; - else user->mode &= ~umodes[static_cast<int>(*modes)]; - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac <= 0) break; - --ac; - ++av; - if (av) user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - ++opcnt; - if (WallOper) ircdproto->SendGlobops(s_OperServ, "\2%s\2 is now an IRC operator.", user->nick); - display_news(user, NEWS_OPER); - } - else --opcnt; - break; - case 'a': - if (UnRestrictSAdmin) break; - if (add && !is_services_admin(user)) { - common_svsmode(user, "-a", NULL); - user->mode &= ~UMODE_a; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - } - } -} - - - - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -/* SVSNOOP */ -void UnrealIRCdProto::SendSVSNOOP(const char *server, int set) -{ - send_cmd(NULL, "%s %s %s", send_token("SVSNOOP", "f"), server, set ? "+" : "-"); -} - -void UnrealIRCdProto::SendAkillDel(const char *user, const char *host) -{ - send_cmd(NULL, "%s - G %s %s %s", send_token("TKL", "BD"), user, host, s_OperServ); -} - -void UnrealIRCdProto::SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) -{ - send_cmd(whosets->nick, "%s %s %s %lu :%s", send_token("TOPIC", ")"), chan, whosetit, static_cast<unsigned long>(when), topic); -} - -void UnrealIRCdProto::SendVhostDel(User *u) -{ - if (UseSVS2MODE) send_cmd(s_HostServ, "%s %s -xt", send_token("SVS2MODE", "v"), u->nick); - else send_cmd(s_HostServ, "%s %s -xt", send_token("SVSMODE", "n"), u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, myIrcd->vhostchar); -} - -void UnrealIRCdProto::SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) -{ - // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = expires - time(NULL); - if (timeleft > 172800) timeleft = 172800; - send_cmd(NULL, "%s + G %s %s %s %ld %ld :%s", send_token("TKL", "BD"), user, host, who, static_cast<long>(time(NULL) + timeleft), static_cast<long>(when), reason); -} - -/* -** svskill -** parv[0] = servername -** parv[1] = client -** parv[2] = kill message -*/ -void UnrealIRCdProto::SendSVSKillInternal(const char *source, const char *user, const char *buf) -{ - if (!source || !user || !buf) return; - send_cmd(source, "%s %s :%s", send_token("SVSKILL", "h"), user, buf); -} - -/* - * m_svsmode() added by taz +/* svswatch * parv[0] - sender - * parv[1] - username to change mode for - * parv[2] - modes to change - * parv[3] - Service Stamp (if mode == d) + * parv[1] - target nick + * parv[2] - parameters */ -void UnrealIRCdProto::SendSVSMode(User *u, int ac, const char **av) -{ - if (ac >= 1) { - if (!u || !av[0]) return; - if (UseSVS2MODE) send_cmd(ServerName, "%s %s %s", send_token("SVS2MODE", "v"), u->nick, merge_args(ac, av)); - else send_cmd(ServerName, "%s %s %s", send_token("SVSMODE", "n"), u->nick, merge_args(ac, av)); - } -} - -void UnrealIRCdProto::SendGuestNick(const char *nick, const char *user, const char *host, const char *real, const char *modes) -{ - send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s %s%s :%s", send_token("NICK", "&"), nick, static_cast<long>(time(NULL)), user, host, ServerName, modes, host, - myIrcd->nickip ? " *" : " ", real); -} - -void UnrealIRCdProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) -{ - if (!buf) return; - send_cmd(source->nick, "%s %s %s", send_token("MODE", "G"), dest, buf); -} - -void UnrealIRCdProto::SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s %s%s :%s", send_token("NICK", "&"), nick, static_cast<long>(time(NULL)), user, host, ServerName, modes, host, - myIrcd->nickip ? " *" : " ", real); - SendSQLine(nick, "Reserved for services"); -} - -void UnrealIRCdProto::SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) -{ - if (buf) send_cmd(source->nick, "%s %s %s :%s", send_token("KICK", "H"), chan, user, buf); - else send_cmd(source->nick, "%s %s %s", send_token("KICK", "H"), chan, user); -} - -void UnrealIRCdProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) +void unreal_cmd_svswatch(const char *sender, const char *nick, const char *parm) { - if (!buf) return; - send_cmd(source->nick, "%s @%s :%s", send_token("NOTICE", "B"), dest, buf); + send_cmd(sender, "%s %s :%s", send_token("SVSWATCH", "Bw"), nick, + parm); } - -void UnrealIRCdProto::SendBotOp(const char *nick, const char *chan) +void unreal_cmd_netinfo(int ac, const char **av) { - SendMode(findbot(nick), chan, "%s %s %s", myIrcd->botchanumode, nick, nick); + send_cmd(NULL, "%s %ld %ld %d %s 0 0 0 :%s", + send_token("NETINFO", "AO"), (long int) maxusercnt, + (long int) time(NULL), atoi(av[2]), av[3], av[7]); } - /* PROTOCTL */ /* NICKv2 = Nick Version 2 @@ -616,31 +541,6 @@ void unreal_cmd_pass(const char *pass) send_cmd(NULL, "PASS :%s", pass); } -/* SERVER name hop descript */ -/* Unreal 3.2 actually sends some info about itself in the descript area */ -void UnrealIRCdProto::SendServer(const char *servname, int hop, const char *descript) -{ - if (Numeric) send_cmd(NULL, "SERVER %s %d :U0-*-%s %s", servname, hop, Numeric, descript); - else send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -/* JOIN */ -void UnrealIRCdProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) -{ - send_cmd(ServerName, "%s !%s %s :%s", send_token("SJOIN", "~"), base64enc(static_cast<long>(chantime)), channel, user->nick); - /* send_cmd(user, "%s %s", send_token("JOIN", "C"), channel); */ -} - -/* unsqline -** parv[0] = sender -** parv[1] = nickmask -*/ -void UnrealIRCdProto::SendSQLineDel(const char *user) -{ - if (!user) return; - send_cmd(NULL, "%s %s", send_token("UNSQLINE", "d"), user); -} - /* CHGHOST */ void unreal_cmd_chghost(const char *nick, const char *vhost) { @@ -661,77 +561,428 @@ void unreal_cmd_chgident(const char *nick, const char *vIdent) vIdent); } -/* SQLINE */ -/* -** parv[0] = sender -** parv[1] = nickmask -** parv[2] = reason -** -** - Unreal will translate this to TKL for us -** -*/ -void UnrealIRCdProto::SendSQLine(const char *mask, const char *reason) -{ - if (!mask || !reason) return; - send_cmd(NULL, "%s %s :%s", send_token("SQLINE", "c"), mask, reason); -} -/* -** svso -** parv[0] = sender prefix -** parv[1] = nick -** parv[2] = options -*/ -void UnrealIRCdProto::SendSVSO(const char *source, const char *nick, const char *flag) -{ - if (!source || !nick || !flag) return; - send_cmd(source, "%s %s %s", send_token("SVSO", "BB"), nick, flag); -} -/* NICK <newnick> */ -void UnrealIRCdProto::SendChangeBotNick(BotInfo *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) return; - send_cmd(oldnick->nick, "%s %s %ld", send_token("NICK", "&"), newnick, static_cast<long>(time(NULL))); -} +class UnrealIRCdProto : public IRCDProto +{ + void ProcessUsermodes(User *user, int ac, const char **av) + { + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + --ac; + if (!user || !modes) return; /* Prevent NULLs from doing bad things */ + if (debug) alog("debug: Changing mode for %s to %s", user->nick, modes); + while (*modes) { + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD */ + if (add) user->mode |= umodes[static_cast<int>(*modes)]; + else user->mode &= ~umodes[static_cast<int>(*modes)]; + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'd': + if (ac <= 0) break; + --ac; + ++av; + if (av) user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + ++opcnt; + if (WallOper) ircdproto->SendGlobops(s_OperServ, "\2%s\2 is now an IRC operator.", user->nick); + display_news(user, NEWS_OPER); + } + else --opcnt; + break; + case 'a': + if (UnRestrictSAdmin) break; + if (add && !is_services_admin(user)) { + common_svsmode(user, "-a", NULL); + user->mode &= ~UMODE_a; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + case 'x': + update_host(user); + } + } + } -/* Functions that use serval cmd functions */ -void UnrealIRCdProto::SendVhost(const char *nick, const char *vIdent, const char *vhost) -{ - if (!nick) return; - if (vIdent) unreal_cmd_chgident(nick, vIdent); - unreal_cmd_chghost(nick, vhost); -} + /* SVSNOOP */ + void SendSVSNOOP(const char *server, int set) + { + send_cmd(NULL, "%s %s %s", send_token("SVSNOOP", "f"), server, set ? "+" : "-"); + } + + void SendAkillDel(const char *user, const char *host) + { + send_cmd(NULL, "%s - G %s %s %s", send_token("TKL", "BD"), user, host, s_OperServ); + } + + void SendTopic(BotInfo *whosets, const char *chan, const char *whosetit, const char *topic, time_t when) + { + send_cmd(whosets->nick, "%s %s %s %lu :%s", send_token("TOPIC", ")"), chan, whosetit, static_cast<unsigned long>(when), topic); + } + + void SendVhostDel(User *u) + { + if (UseSVS2MODE) send_cmd(s_HostServ, "%s %s -xt", send_token("SVS2MODE", "v"), u->nick); + else send_cmd(s_HostServ, "%s %s -xt", send_token("SVSMODE", "n"), u->nick); + notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, myIrcd->vhostchar); + } + + void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) + { + // Calculate the time left before this would expire, capping it at 2 days + time_t timeleft = expires - time(NULL); + if (timeleft > 172800) timeleft = 172800; + send_cmd(NULL, "%s + G %s %s %s %ld %ld :%s", send_token("TKL", "BD"), user, host, who, static_cast<long>(time(NULL) + timeleft), static_cast<long>(when), reason); + } + + /* + ** svskill + ** parv[0] = servername + ** parv[1] = client + ** parv[2] = kill message + */ + void SendSVSKillInternal(const char *source, const char *user, const char *buf) + { + if (!source || !user || !buf) return; + send_cmd(source, "%s %s :%s", send_token("SVSKILL", "h"), user, buf); + } + + /* + * m_svsmode() added by taz + * parv[0] - sender + * parv[1] - username to change mode for + * parv[2] - modes to change + * parv[3] - Service Stamp (if mode == d) + */ + void SendSVSMode(User *u, int ac, const char **av) + { + if (ac >= 1) { + if (!u || !av[0]) return; + if (UseSVS2MODE) send_cmd(ServerName, "%s %s %s", send_token("SVS2MODE", "v"), u->nick, merge_args(ac, av)); + else send_cmd(ServerName, "%s %s %s", send_token("SVSMODE", "n"), u->nick, merge_args(ac, av)); + } + } + + void SendGuestNick(const char *nick, const char *user, const char *host, const char *real, const char *modes) + { + send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s %s%s :%s", send_token("NICK", "&"), nick, static_cast<long>(time(NULL)), user, host, ServerName, modes, host, + myIrcd->nickip ? " *" : " ", real); + } + + void SendModeInternal(BotInfo *source, const char *dest, const char *buf) + { + if (!buf) return; + send_cmd(source->nick, "%s %s %s", send_token("MODE", "G"), dest, buf); + } + + void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes) + { + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s %s%s :%s", send_token("NICK", "&"), nick, static_cast<long>(time(NULL)), user, host, ServerName, modes, host, + myIrcd->nickip ? " *" : " ", real); + SendSQLine(nick, "Reserved for services"); + } + + void SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) + { + if (buf) send_cmd(source->nick, "%s %s %s :%s", send_token("KICK", "H"), chan, user, buf); + else send_cmd(source->nick, "%s %s %s", send_token("KICK", "H"), chan, user); + } + + void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) + { + if (!buf) return; + send_cmd(source->nick, "%s @%s :%s", send_token("NOTICE", "B"), dest, buf); + } + + void SendBotOp(const char *nick, const char *chan) + { + SendMode(findbot(nick), chan, "%s %s %s", myIrcd->botchanumode, nick, nick); + } -void UnrealIRCdProto::SendConnect() + /* SERVER name hop descript */ + /* Unreal 3.2 actually sends some info about itself in the descript area */ + void SendServer(const char *servname, int hop, const char *descript) + { + if (Numeric) send_cmd(NULL, "SERVER %s %d :U0-*-%s %s", servname, hop, Numeric, descript); + else send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); + } + + /* JOIN */ + void SendJoin(BotInfo *user, const char *channel, time_t chantime) + { + send_cmd(ServerName, "%s !%s %s :%s", send_token("SJOIN", "~"), base64enc(static_cast<long>(chantime)), channel, user->nick); + /* send_cmd(user, "%s %s", send_token("JOIN", "C"), channel); */ + } + + /* unsqline + ** parv[0] = sender + ** parv[1] = nickmask + */ + void SendSQLineDel(const char *user) + { + if (!user) return; + send_cmd(NULL, "%s %s", send_token("UNSQLINE", "d"), user); + } + + + /* SQLINE */ + /* + ** parv[0] = sender + ** parv[1] = nickmask + ** parv[2] = reason + ** + ** - Unreal will translate this to TKL for us + ** + */ + void SendSQLine(const char *mask, const char *reason) + { + if (!mask || !reason) return; + send_cmd(NULL, "%s %s :%s", send_token("SQLINE", "c"), mask, reason); + } + + /* + ** svso + ** parv[0] = sender prefix + ** parv[1] = nick + ** parv[2] = options + */ + void SendSVSO(const char *source, const char *nick, const char *flag) + { + if (!source || !nick || !flag) return; + send_cmd(source, "%s %s %s", send_token("SVSO", "BB"), nick, flag); + } + + /* NICK <newnick> */ + void SendChangeBotNick(BotInfo *oldnick, const char *newnick) + { + if (!oldnick || !newnick) return; + send_cmd(oldnick->nick, "%s %s %ld", send_token("NICK", "&"), newnick, static_cast<long>(time(NULL))); + } + + /* Functions that use serval cmd functions */ + + void SendVhost(const char *nick, const char *vIdent, const char *vhost) + { + if (!nick) return; + if (vIdent) unreal_cmd_chgident(nick, vIdent); + unreal_cmd_chghost(nick, vhost); + } + + void SendConnect() + { + if (Numeric) me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, Numeric); + else me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + unreal_cmd_capab(); + if (servernum == 1) unreal_cmd_pass(RemotePassword); + else if (servernum == 2) unreal_cmd_pass(RemotePassword2); + else if (servernum == 3) unreal_cmd_pass(RemotePassword3); + SendServer(ServerName, 1, ServerDesc); + } + + /* SVSHOLD - set */ + void SendSVSHold(const char *nick) + { + send_cmd(NULL, "%s + Q H %s %s %ld %ld :%s", send_token("TKL", "BD"), nick, ServerName, static_cast<long>(time(NULL) + NSReleaseTimeout), + static_cast<long>(time(NULL)), "Being held for registered user"); + } + + /* SVSHOLD - release */ + void SendSVSHoldDel(const char *nick) + { + send_cmd(NULL, "%s - Q * %s %s", send_token("TKL", "BD"), nick, ServerName); + } + + /* UNSGLINE */ + /* + * SVSNLINE - :realname mask + */ + void SendSGLineDel(const char *mask) + { + send_cmd(NULL, "%s - :%s", send_token("SVSNLINE", "BR"), mask); + } + + /* UNSZLINE */ + void SendSZLineDel(const char *mask) + { + send_cmd(NULL, "%s - Z * %s %s", send_token("TKL", "BD"), mask, s_OperServ); + } + + /* SZLINE */ + void SendSZLine(const char *mask, const char *reason, const char *whom) + { + send_cmd(NULL, "%s + Z * %s %s %ld %ld :%s", send_token("TKL", "BD"), mask, whom, static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), reason); + } + + /* SGLINE */ + /* + * SVSNLINE + reason_where_is_space :realname mask with spaces + */ + void SendSGLine(const char *mask, const char *reason) + { + char edited_reason[BUFSIZE]; + strlcpy(edited_reason, reason, BUFSIZE); + strnrepl(edited_reason, BUFSIZE, " ", "_"); + send_cmd(NULL, "%s + %s :%s", send_token("SVSNLINE", "BR"), edited_reason, mask); + } + + /* SVSMODE -b */ + void SendBanDel(const char *name, const char *nick) + { + SendSVSModeChan(name, "-b", nick); + } + + + /* SVSMODE channel modes */ + + void SendSVSModeChan(const char *name, const char *mode, const char *nick) + { + if (nick) send_cmd(ServerName, "%s %s %s %s", send_token("SVSMODE", "n"), name, mode, nick); + else send_cmd(ServerName, "%s %s %s", send_token("SVSMODE", "n"), name, mode); + } + + + /* SVSMODE +d */ + /* sent if svid is something weird */ + void SendSVID(const char *nick, time_t ts) + { + if (UseSVS2MODE) send_cmd(ServerName, "%s %s +d 1", send_token("SVS2MODE", "v"), nick); + else send_cmd(ServerName, "%s %s +d 1", send_token("SVSMODE", "n"), nick); + } + + /* SVSMODE +d */ + /* nc_change was = 1, and there is no na->status */ + void SendUnregisteredNick(User *u) + { + common_svsmode(u, "-r+d", "1"); + } + + /* SVSMODE +r */ + void SendSVID2(User *u, const char *ts) + { + if (u->svid != u->timestamp) common_svsmode(u, "+rd", ts); + else common_svsmode(u, "+r", NULL); + } + + + /* svsjoin + parv[0] - sender + parv[1] - nick to make join + parv[2] - channel to join + parv[3] - (optional) channel key(s) + */ + /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken + when coming from a none TOKEN'd server + */ + void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param) + { + if (param) send_cmd(source, "%s %s %s :%s", send_token("SVSJOIN", "BX"), nick, chan, param); + else send_cmd(source, "%s %s :%s", send_token("SVSJOIN", "BX"), nick, chan); + } + + /* svspart + parv[0] - sender + parv[1] - nick to make part + parv[2] - channel(s) to part + */ + void SendSVSPart(const char *source, const char *nick, const char *chan) + { + send_cmd(source, "%s %s :%s", send_token("SVSPART", "BT"), nick, chan); + } + + void SendSWhois(const char *source, const char *who, const char *mask) + { + send_cmd(source, "%s %s :%s", send_token("SWHOIS", "BA"), who, mask); + } + + void SendEOB() + { + send_cmd(ServerName, "%s", send_token("EOS", "ES")); + } + + + /* check if +f mode is valid for the ircd */ + /* borrowed part of the new check from channels.c in Unreal */ + int IsFloodModeParamValid(const char *value) + { + char *dp, *end; + /* NEW +F */ + char xbuf[256], *p, *p2, *x = xbuf + 1; + int v; + if (!value) return 0; + if (*value != ':' && strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0 && *dp == ':' && *(++dp) && strtoul(dp, &end, 10) > 0 && !*end) return 1; + else { + /* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */ + strncpy(xbuf, value, sizeof(xbuf)); + p2 = strchr(xbuf + 1, ']'); + if (!p2) return 0; + *p2 = '\0'; + if (*(p2 + 1) != ':') return 0; + for (x = strtok(xbuf + 1, ","); x; x = strtok(NULL, ",")) { + /* <number><1 letter>[optional: '#'+1 letter] */ + p = x; + while (isdigit(*p)) ++p; + if (!*p || !(*p == 'c' || *p == 'j' || *p == 'k' || *p == 'm' || *p == 'n' || *p == 't')) continue; /* continue instead of break for forward compatability. */ + *p = '\0'; + v = atoi(x); + if (v < 1 || v > 999) return 0; + ++p; + } + return 1; + } + } + + /* + 1 = valid nick + 0 = nick is in valid + */ + int IsNickValid(const char *nick) + { + if (!stricmp("ircd", nick) || !stricmp("irc", nick)) + return 0; + return 1; + } + + int IsChannelValid(const char *chan) + { + if (strchr(chan, ':')) return 0; + return 1; + } + +} ircd_proto; + + + +/* Event: PROTOCTL */ +int anope_event_capab(const char *source, int ac, const char **av) { - if (Numeric) me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, Numeric); - else me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - unreal_cmd_capab(); - if (servernum == 1) unreal_cmd_pass(RemotePassword); - else if (servernum == 2) unreal_cmd_pass(RemotePassword2); - else if (servernum == 3) unreal_cmd_pass(RemotePassword3); - SendServer(ServerName, 1, ServerDesc); + capab_parse(ac, av); + return MOD_CONT; } /* Events */ - int anope_event_ping(const char *source, int ac, const char **av) { if (ac < 1) return MOD_CONT; - ircd_proto.SendPong(ac > 1 ? av[1] : ServerName, av[0]); + ircdproto->SendPong(ac > 1 ? av[1] : ServerName, av[0]); return MOD_CONT; } -void unreal_cmd_netinfo(int ac, const char **av) -{ - send_cmd(NULL, "%s %ld %ld %d %s 0 0 0 :%s", - send_token("NETINFO", "AO"), (long int) maxusercnt, - (long int) time(NULL), atoi(av[2]), av[3], av[7]); -} - /* netinfo * argv[0] = max global count * argv[1] = time of end sync @@ -1116,89 +1367,6 @@ int anope_event_whois(const char *source, int ac, const char **av) return MOD_CONT; } -/* SVSHOLD - set */ -void UnrealIRCdProto::SendSVSHold(const char *nick) -{ - send_cmd(NULL, "%s + Q H %s %s %ld %ld :%s", send_token("TKL", "BD"), nick, ServerName, static_cast<long>(time(NULL) + NSReleaseTimeout), - static_cast<long>(time(NULL)), "Being held for registered user"); -} - -/* SVSHOLD - release */ -void UnrealIRCdProto::SendSVSHoldDel(const char *nick) -{ - send_cmd(NULL, "%s - Q * %s %s", send_token("TKL", "BD"), nick, ServerName); -} - -/* UNSGLINE */ -/* - * SVSNLINE - :realname mask -*/ -void UnrealIRCdProto::SendSGLineDel(const char *mask) -{ - send_cmd(NULL, "%s - :%s", send_token("SVSNLINE", "BR"), mask); -} - -/* UNSZLINE */ -void UnrealIRCdProto::SendSZLineDel(const char *mask) -{ - send_cmd(NULL, "%s - Z * %s %s", send_token("TKL", "BD"), mask, s_OperServ); -} - -/* SZLINE */ -void UnrealIRCdProto::SendSZLine(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "%s + Z * %s %s %ld %ld :%s", send_token("TKL", "BD"), mask, whom, static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), reason); -} - -/* SGLINE */ -/* - * SVSNLINE + reason_where_is_space :realname mask with spaces -*/ -void UnrealIRCdProto::SendSGLine(const char *mask, const char *reason) -{ - char edited_reason[BUFSIZE]; - strlcpy(edited_reason, reason, BUFSIZE); - strnrepl(edited_reason, BUFSIZE, " ", "_"); - send_cmd(NULL, "%s + %s :%s", send_token("SVSNLINE", "BR"), edited_reason, mask); -} - -/* SVSMODE -b */ -void UnrealIRCdProto::SendBanDel(const char *name, const char *nick) -{ - SendSVSModeChan(name, "-b", nick); -} - - -/* SVSMODE channel modes */ - -void UnrealIRCdProto::SendSVSModeChan(const char *name, const char *mode, const char *nick) -{ - if (nick) send_cmd(ServerName, "%s %s %s %s", send_token("SVSMODE", "n"), name, mode, nick); - else send_cmd(ServerName, "%s %s %s", send_token("SVSMODE", "n"), name, mode); -} - - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void UnrealIRCdProto::SendSVID(const char *nick, time_t ts) -{ - if (UseSVS2MODE) send_cmd(ServerName, "%s %s +d 1", send_token("SVS2MODE", "v"), nick); - else send_cmd(ServerName, "%s %s +d 1", send_token("SVSMODE", "n"), nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void UnrealIRCdProto::SendUnregisteredNick(User *u) -{ - common_svsmode(u, "-r+d", "1"); -} - -/* SVSMODE +r */ -void UnrealIRCdProto::SendSVID2(User *u, const char *ts) -{ - if (u->svid != u->timestamp) common_svsmode(u, "+rd", ts); - else common_svsmode(u, "+r", NULL); -} int anope_event_error(const char *source, int ac, const char **av) { @@ -1213,31 +1381,6 @@ int anope_event_error(const char *source, int ac, const char **av) return MOD_CONT; } -/* svsjoin - parv[0] - sender - parv[1] - nick to make join - parv[2] - channel to join - parv[3] - (optional) channel key(s) -*/ -/* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken - when coming from a none TOKEN'd server -*/ -void UnrealIRCdProto::SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param) -{ - if (param) send_cmd(source, "%s %s %s :%s", send_token("SVSJOIN", "BX"), nick, chan, param); - else send_cmd(source, "%s %s :%s", send_token("SVSJOIN", "BX"), nick, chan); -} - -/* svspart - parv[0] - sender - parv[1] - nick to make part - parv[2] - channel(s) to part -*/ -void UnrealIRCdProto::SendSVSPart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "%s %s :%s", send_token("SVSPART", "BT"), nick, chan); -} - int anope_event_sdesc(const char *source, int ac, const char **av) { Server *s; @@ -1256,74 +1399,6 @@ int anope_event_sjoin(const char *source, int ac, const char **av) return MOD_CONT; } -void UnrealIRCdProto::SendSWhois(const char *source, const char *who, const char *mask) -{ - send_cmd(source, "%s %s :%s", send_token("SWHOIS", "BA"), who, mask); -} - -void UnrealIRCdProto::SendEOB() -{ - send_cmd(ServerName, "%s", send_token("EOS", "ES")); -} - -/* svswatch - * parv[0] - sender - * parv[1] - target nick - * parv[2] - parameters - */ -void unreal_cmd_svswatch(const char *sender, const char *nick, const char *parm) -{ - send_cmd(sender, "%s %s :%s", send_token("SVSWATCH", "Bw"), nick, - parm); -} - -/* check if +f mode is valid for the ircd */ -/* borrowed part of the new check from channels.c in Unreal */ -int UnrealIRCdProto::IsFloodModeParamValid(const char *value) -{ - char *dp, *end; - /* NEW +F */ - char xbuf[256], *p, *p2, *x = xbuf + 1; - int v; - if (!value) return 0; - if (*value != ':' && strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0 && *dp == ':' && *(++dp) && strtoul(dp, &end, 10) > 0 && !*end) return 1; - else { - /* '['<number><1 letter>[optional: '#'+1 letter],[next..]']'':'<number> */ - strncpy(xbuf, value, sizeof(xbuf)); - p2 = strchr(xbuf + 1, ']'); - if (!p2) return 0; - *p2 = '\0'; - if (*(p2 + 1) != ':') return 0; - for (x = strtok(xbuf + 1, ","); x; x = strtok(NULL, ",")) { - /* <number><1 letter>[optional: '#'+1 letter] */ - p = x; - while (isdigit(*p)) ++p; - if (!*p || !(*p == 'c' || *p == 'j' || *p == 'k' || *p == 'm' || *p == 'n' || *p == 't')) continue; /* continue instead of break for forward compatability. */ - *p = '\0'; - v = atoi(x); - if (v < 1 || v > 999) return 0; - ++p; - } - return 1; - } -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int UnrealIRCdProto::IsNickValid(const char *nick) -{ - if (!stricmp("ircd", nick) || !stricmp("irc", nick)) return 0; - return 1; -} - -int UnrealIRCdProto::IsChannelValid(const char *chan) -{ - if (strchr(chan, ':')) return 0; - return 1; -} - /* *INDENT-OFF* */ void moduleAddIRCDMsgs(void) { Message *m; diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h deleted file mode 100644 index 594780d3e..000000000 --- a/src/protocol/unreal32.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Unreal IRCD 3.2.x functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@unreal.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. - * - * - */ - -/*************************************************************************/ - -/* User Modes */ -#define UMODE_a 0x00000001 /* a Services Admin */ -#define UMODE_h 0x00000002 /* h Available for help (HelpOp) */ -#define UMODE_i 0x00000004 /* i Invisible (not shown in /who) */ -#define UMODE_o 0x00000008 /* o Global IRC Operator */ -#define UMODE_r 0x00000010 /* r Identifies the nick as being registered */ -#define UMODE_w 0x00000020 /* w Can listen to wallop messages */ -#define UMODE_A 0x00000040 /* A Server Admin */ -#define UMODE_N 0x00000080 /* N Network Administrator */ -#define UMODE_O 0x00000100 /* O Local IRC Operator */ -#define UMODE_C 0x00000200 /* C Co-Admin */ -#define UMODE_d 0x00000400 /* d Makes it so you can not receive channel PRIVMSGs */ -#define UMODE_p 0x00000800 /* Hides the channels you are in in a /whois reply */ -#define UMODE_q 0x00001000 /* q Only U:Lines can kick you (Services Admins Only) */ -#define UMODE_s 0x00002000 /* s Can listen to server notices */ -#define UMODE_t 0x00004000 /* t Says you are using a /vhost */ -#define UMODE_v 0x00008000 /* v Receives infected DCC Send Rejection notices */ -#define UMODE_z 0x00010000 /* z Indicates that you are an SSL client */ -#define UMODE_B 0x00020000 /* B Marks you as being a Bot */ -#define UMODE_G 0x00040000 /* G Filters out all the bad words per configuration */ -#define UMODE_H 0x00080000 /* H Hide IRCop Status (IRCop Only) */ -#define UMODE_S 0x00100000 /* S services client */ -#define UMODE_V 0x00200000 /* V Marks you as a WebTV user */ -#define UMODE_W 0x00400000 /* W Lets you see when people do a /whois on you */ -#define UMODE_T 0x00800000 /* T Prevents you from receiving CTCPs */ -#define UMODE_g 0x20000000 /* g Can send & read globops and locops */ -#define UMODE_x 0x40000000 /* x Gives user a hidden hostname */ -#define UMODE_R 0x80000000 /* Allows you to only receive PRIVMSGs/NOTICEs from registered (+r) users */ - - -/*************************************************************************/ - -/* 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_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ -#define CMODE_c 0x00000400 -#define CMODE_A 0x00000800 -/* #define CMODE_H 0x00001000 Was now +I may not join, but Unreal Removed it and it will not set in 3.2 */ -#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_T 0x02000000 -#define CMODE_M 0x04000000 - - -/* Default Modes with MLOCK */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -class UnrealIRCdProto : public IRCDProto { - void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(BotInfo *, const char *, const char *); - void SendKickInternal(BotInfo *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); - public: - void SendSVSNOOP(const char *, int); - void SendAkillDel(const char *, const char *); - void SendTopic(BotInfo *, const char *, const char *, const char *, time_t); - void SendVhostDel(User *); - void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); - void SendSVSMode(User *, int, const char **); - void SendGuestNick(const char *, const char *, const char *, const char *, const char *); - void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); - void SendBotOp(const char *, const char *); - void SendJoin(BotInfo *, const char *, time_t); - void SendSQLineDel(const char *); - void SendSQLine(const char *, const char *); - void SendSVSO(const char *, const char *, const char *); - void SendChangeBotNick(BotInfo *, const char *); - void SendVhost(const char *, const char *, const char *); - void SendConnect(); - void SendSVSHold(const char *); - void SendSVSHoldDel(const char *); - void SendSGLineDel(const char *); - void SendSZLineDel(const char *); - void SendSZLine(const char *, const char *, const char *); - void SendSGLine(const char *, const char *); - void SendBanDel(const char *, const char *); - void SendSVSModeChan(const char *, const char *, const char *); - void SendSVID(const char *, time_t); - void SendUnregisteredNick(User *); - void SendSVID2(User *, const char *); - void SendSVSJoin(const char *, const char *, const char *, const char *); - void SendSVSPart(const char *, const char *, const char *); - void SendSWhois(const char *, const char *, const char *); - void SendEOB(); - void SendServer(const char *, int, const char *); - void ProcessUsermodes(User *, int, const char **); - int IsNickValid(const char *); - int IsChannelValid(const char *); - int IsFloodModeParamValid(const char *); -} ircd_proto; |