diff options
author | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-09-29 20:19:18 +0000 |
---|---|---|
committer | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-09-29 20:19:18 +0000 |
commit | 676b8eaf7fcec02ad2583dc0bcc531942b65068e (patch) | |
tree | d8405dc99f4b8a50935452374b7afc983dfde641 /src | |
parent | b6f83ea4db94339449c05be946477b729e9b991a (diff) |
BUILD : 1.7.5 (362) BUGS : 17 143 147 166 172 173 NOTES : Applied patch 927 provided by Trystan.
git-svn-id: svn://svn.anope.org/anope/trunk@362 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@233 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 4 | ||||
-rw-r--r-- | src/actions.c | 16 | ||||
-rw-r--r-- | src/bahamut.c | 196 | ||||
-rw-r--r-- | src/base64.c | 125 | ||||
-rw-r--r-- | src/botserv.c | 80 | ||||
-rw-r--r-- | src/channels.c | 214 | ||||
-rw-r--r-- | src/chanserv.c | 74 | ||||
-rw-r--r-- | src/config.c | 13 | ||||
-rw-r--r-- | src/dreamforge.c | 132 | ||||
-rw-r--r-- | src/hostserv.c | 7 | ||||
-rw-r--r-- | src/hybrid.c | 242 | ||||
-rw-r--r-- | src/init.c | 31 | ||||
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/memoserv.c | 3 | ||||
-rw-r--r-- | src/messages.c | 25 | ||||
-rw-r--r-- | src/misc.c | 58 | ||||
-rw-r--r-- | src/modules.c | 20 | ||||
-rw-r--r-- | src/modules/ircd_catserv.c | 9 | ||||
-rw-r--r-- | src/mysql.c | 1 | ||||
-rw-r--r-- | src/nickserv.c | 38 | ||||
-rw-r--r-- | src/operserv.c | 15 | ||||
-rw-r--r-- | src/ptlink.c | 365 | ||||
-rw-r--r-- | src/rageircd.c | 173 | ||||
-rw-r--r-- | src/servers.c | 63 | ||||
-rw-r--r-- | src/ultimate2.c | 235 | ||||
-rw-r--r-- | src/ultimate3.c | 213 | ||||
-rw-r--r-- | src/unreal31.c | 84 | ||||
-rw-r--r-- | src/unreal32.c | 657 | ||||
-rw-r--r-- | src/users.c | 68 | ||||
-rw-r--r-- | src/viagra.c | 211 |
30 files changed, 2874 insertions, 503 deletions
diff --git a/src/Makefile b/src/Makefile index 7db726aa3..dd672c721 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,13 @@ MYSQL_OBJ = $(MYSQL:.c=.o) RDB_OBJ = $(RDB:.c=.o) -OBJS = actions.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \ +OBJS = actions.o base64.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 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 \ +SRCS = actions.c base64.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 proxy.c send.c servers.c sessions.c slist.c sockutil.c \ diff --git a/src/actions.c b/src/actions.c index a863eae76..1cfcdf2e1 100644 --- a/src/actions.c +++ b/src/actions.c @@ -113,12 +113,16 @@ void common_unban(ChannelInfo * ci, char *nick) int count, i; char *av[3], **bans; User *u; + char *host; - if (!ci || !ci->c || !ci->bi || !nick) + if (!ci || !ci->c || !nick) return; + if (!(u = finduser(nick))) return; + host = host_resolve(u->host); + if (ircd->svsmode_unban) { anope_cmd_unban(ci->name, nick); } else { @@ -131,7 +135,15 @@ void common_unban(ChannelInfo * ci, char *nick) 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); + do_cmode(whosends(ci), 3, av); + } + if (host) { + if (match_userip(bans[i], u, host)) { + anope_cmd_mode(whosends(ci), ci->name, "-b %s", + bans[i]); + av[2] = bans[i]; + do_cmode(whosends(ci), 3, av); + } } } free(bans); diff --git a/src/bahamut.c b/src/bahamut.c index 468d3be46..e54627faf 100644 --- a/src/bahamut.c +++ b/src/bahamut.c @@ -91,6 +91,9 @@ IRCDVar ircd[] = { 1, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 1, /* validate - to the #:# standard */ } , {NULL} @@ -195,29 +198,55 @@ void anope_set_umode(User * user, int ac, char **av) } - - 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, - 0, - 0, - UMODE_R, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - 0, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, 0, 0, /* A B C */ + UMODE_D, 0, UMODE_F, /* D E F */ + 0, 0, UMODE_I, /* G H I */ + 0, UMODE_K, 0, /* J K L */ + 0, 0, UMODE_O, /* M N O */ + 0, 0, UMODE_R, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, UMODE_X, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, UMODE_b, UMODE_c, /* a b c */ + UMODE_d, UMODE_e, UMODE_f, /* d e f */ + UMODE_g, UMODE_h, UMODE_i, /* g h i */ + UMODE_j, UMODE_k, 0, /* j k l */ + UMODE_m, UMODE_n, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, 0, /* s t u */ + 0, 0, UMODE_x, /* v w x */ + UMODE_y, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; char csmodes[128] = { @@ -505,7 +534,7 @@ int anope_event_os(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_OperServ, av[0]); return MOD_CONT; } @@ -514,7 +543,7 @@ int anope_event_ns(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_NickServ, av[0]); return MOD_CONT; } @@ -523,7 +552,7 @@ int anope_event_ms(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_MemoServ, av[0]); return MOD_CONT; } @@ -532,7 +561,7 @@ int anope_event_hs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_HostServ, av[0]); return MOD_CONT; } @@ -541,7 +570,7 @@ int anope_event_cs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_ChanServ, av[0]); return MOD_CONT; } @@ -570,7 +599,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", NULL); addCoreMessage(IRCD,m); + m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); @@ -582,7 +611,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); @@ -590,7 +619,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m); @@ -607,6 +636,9 @@ void moduleAddIRCDMsgs(void) { m = createMessage("UNSGLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("UNSZLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + m = createMessage("LUSERSLOCK",anope_event_luserslock); addCoreMessage(IRCD,m); + m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); } @@ -646,6 +678,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + /* SGLINE */ void anope_cmd_sgline(char *mask, char *reason) { @@ -760,6 +797,11 @@ void anope_cmd_svsmode(User * u, int ac, char **av) } /* SQUIT */ +/* + * parv[0] = sender prefix + * parv[1] = server name + * parv[2] = comment +*/ void anope_cmd_squit(char *servname, char *message) { send_cmd(servname, "SQUIT %s :%s", servname, message); @@ -783,9 +825,18 @@ void anope_cmd_connect(int servernum) anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); anope_cmd_svinfo(); + anope_cmd_burst(); } -/* SVINFO */ + +/* + * SVINFO + * parv[0] = sender prefix + * parv[1] = TS_CURRENT for the server + * parv[2] = TS_MIN for the server + * parv[3] = server is standalone or connected to non-TS only + * parv[4] = server's idea of UTC time + */ void anope_cmd_svinfo() { send_cmd(NULL, "SVINFO 3 1 0 :%ld", time(NULL)); @@ -806,7 +857,8 @@ void anope_cmd_server(char *servname, int hop, char *descript) /* CAPAB */ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB NICKIP SSJOIN TS3 NOQUIT TSMODE UNCONNECT"); + send_cmd(NULL, + "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3"); } /* EVENT : SERVER */ @@ -818,7 +870,7 @@ int anope_event_server(char *source, int ac, char **av) uplink = sstrdup(av[0]); } - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1233,6 +1285,7 @@ void anope_cmd_211(const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, ServiceUser, ServiceHost, ServerName, name); anope_cmd_sqline(nick, "Reserved for services"); @@ -1340,6 +1393,7 @@ void anope_cmd_351(char *source) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, user, host, ServerName, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1443,4 +1497,80 @@ int anope_event_sqline(char *source, int ac, char **av) } +int anope_event_gnotice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Can not find any reference to these in Bahamut */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Can not find any reference to these in Bahamut */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + + +void anope_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void anope_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +int anope_event_burst(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + if (s) { + s->sync = 1; + } + } + return MOD_CONT; +} + +int anope_event_luserslock(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + + #endif diff --git a/src/base64.c b/src/base64.c new file mode 100644 index 000000000..f17550bba --- /dev/null +++ b/src/base64.c @@ -0,0 +1,125 @@ +/* base64 routines. + * + * (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. + * + * + */ + +/* + This is borrowed from Unreal +*/ + +#include "services.h" + +static char *int_to_base64(long); +static long base64_to_int(char *); + +char *base64enc(long i) +{ + if (i < 0) + return ("0"); + return int_to_base64(i); +} + +long base64dec(char *b64) +{ + if (b64) + return base64_to_int(b64); + else + return 0; +} + +/* ':' and '#' and '&' and '+' and '@' must never be in this table. */ +/* these tables must NEVER CHANGE! >) */ +char int6_to_base64_map[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', + 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '{', '}' +}; + +char base64_to_int6_map[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, + -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, -1, 63, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static char *int_to_base64(long val) +{ + /* 32/6 == max 6 bytes for representation, + * +1 for the null, +1 for byte boundaries + */ + static char base64buf[8]; + long i = 7; + + base64buf[i] = '\0'; + + /* Temporary debugging code.. remove before 2038 ;p. + * This might happen in case of 64bit longs (opteron/ia64), + * if the value is then too large it can easily lead to + * a buffer underflow and thus to a crash. -- Syzop + */ + if (val > 2147483647L) { + abort(); + } + + do { + base64buf[--i] = int6_to_base64_map[val & 63]; + } + while (val >>= 6); + + return base64buf + i; +} + +static long base64_to_int(char *b64) +{ + int v = base64_to_int6_map[(u_char) * b64++]; + + if (!b64) + return 0; + + while (*b64) { + v <<= 6; + v += base64_to_int6_map[(u_char) * b64++]; + } + + return v; +} + +long base64dects(char *ts) +{ + char *token; + + if (!ts) { + return 0; + } + token = myStrGetToken(ts, '!', 1); + + if (!token) { + return strtoul(ts, NULL, 10);; + } + return base64dec(token); +} diff --git a/src/botserv.c b/src/botserv.c index 03fdafdf5..d38ab917c 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -1236,46 +1236,9 @@ static int do_bot(User * u) **/ /* Check whether it's a services client's nick and return if so - Certus */ + /* use nickIsServices reduce the total number lines of code - TSL */ - if ((s_NickServ && (stricmp(nick, s_NickServ) == 0)) - || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_ChanServ && (stricmp(nick, s_ChanServ) == 0)) - || (s_ChanServAlias - && !stricmp(nick, s_ChanServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_MemoServ && (stricmp(nick, s_MemoServ) == 0)) - || (s_MemoServAlias - && !stricmp(nick, s_MemoServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_BotServ && (stricmp(nick, s_BotServ) == 0)) - || (s_BotServAlias - && !stricmp(nick, s_BotServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HelpServ && (stricmp(nick, s_HelpServ) == 0)) - || (s_HelpServAlias - && !stricmp(nick, s_HelpServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_OperServ && (stricmp(nick, s_OperServ) == 0)) - || (s_OperServAlias - && !stricmp(nick, s_OperServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else - if ((s_GlobalNoticer - && (stricmp(nick, s_GlobalNoticer) == 0)) - || (s_GlobalNoticerAlias - && !stricmp(nick, s_GlobalNoticerAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HostServ && (stricmp(nick, s_HostServ) == 0)) - || (s_HostServAlias - && !stricmp(nick, s_HostServAlias))) { + if (nickIsServices(nick, 0)) { notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); return MOD_CONT; } @@ -1342,43 +1305,8 @@ static int do_bot(User * u) } /* Check whether it's a services client's nick and return if so - Certus */ - if ((s_NickServ && !stricmp(nick, s_NickServ)) - || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_ChanServ && !stricmp(nick, s_ChanServ)) - || (s_ChanServAlias - && !stricmp(nick, s_ChanServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_MemoServ && !stricmp(nick, s_MemoServ)) - || (s_MemoServAlias - && !stricmp(nick, s_MemoServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_BotServ && !stricmp(nick, s_BotServ)) - || (s_BotServAlias - && !stricmp(nick, s_BotServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HelpServ && !stricmp(nick, s_HelpServ)) - || (s_HelpServAlias - && !stricmp(nick, s_HelpServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_OperServ && !stricmp(nick, s_OperServ)) - || (s_OperServAlias - && !stricmp(nick, s_OperServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_GlobalNoticer && !stricmp(nick, s_GlobalNoticer)) - || (s_GlobalNoticerAlias - && !stricmp(nick, s_GlobalNoticerAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HostServ && !stricmp(nick, s_HostServ)) - || (s_HostServAlias - && !stricmp(nick, s_HostServAlias))) { + /* use nickIsServices() to reduce the number of lines of code - TSL */ + if (nickIsServices(nick, 0)) { notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); return MOD_CONT; } diff --git a/src/channels.c b/src/channels.c index ebee50403..2b871853d 100644 --- a/src/channels.c +++ b/src/channels.c @@ -21,11 +21,13 @@ Channel *chanlist[1024]; void add_ban(Channel * chan, char *mask); void add_exception(Channel * chan, char *mask); +void add_invite(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); +void del_invite(Channel * chan, char *mask); char *get_flood(Channel * chan); char *get_key(Channel * chan); char *get_limit(Channel * chan); @@ -390,6 +392,13 @@ void get_channel_stats(long *nrec, long *memuse) mem += strlen(chan->excepts[j]) + 1; } } + if (ircd->invitemode) { + mem += sizeof(char *) * chan->invitesize; + for (j = 0; j < chan->invitecount; j++) { + if (chan->invite[j]) + mem += strlen(chan->invite[j]) + 1; + } + } for (cu = chan->users; cu; cu = cu->next) { mem += sizeof(*cu); if (cu->ud) { @@ -618,22 +627,48 @@ void do_part(const char *source, int ac, char **av) av[0] = timestamp av[1] = user + ============================================================ + + Unreal SJOIN + + On Connect there is + SJOIN !11LkOb #ircops +nt :@Trystan + + av[0] = time stamp (base64) + av[1] = channel + av[2] = modes + av[3] = users + bans + + On Channel Creation or a User joins an existing + Luna.NomadIrc.Net SJOIN !11LkW9 #akill :@Trystan + Luna.NomadIrc.Net SJOIN !11LkW9 #akill :Trystan` + + av[0] = time stamp (base64) + av[1] = channel + av[2] = users + */ void do_sjoin(const char *source, int ac, char **av) { Channel *c; User *user; + char *s, *end, cubuf[ircd->max_symbols + 2], *end2, + *cumodes[ircd->max_symbols + 1]; + int is_sqlined = 0; + int ts = 0; + + if (ircd->sjb64) { + ts = base64dects(av[0]); + } else { + ts = strtoul(av[0], NULL, 10); + } /* Double check to avoid unknown modes that need parameters */ if (ac >= 4 && ac <= 6) { - char *s, *end, cubuf[ircd->max_symbols + 2], *end2, - *cumodes[ircd->max_symbols + 1]; - c = findchan(av[1]); - if (ircd->chansqline) { if (!c) is_sqlined = check_chan_sqline(av[1]); @@ -651,6 +686,26 @@ void do_sjoin(const char *source, int ac, char **av) *end = 0; end2 = cubuf + 1; + +#ifdef SJOINBANNCHAR + if (*s == SJOINBANNCHAR) { + add_ban(c, myStrGetToken(s, SJOINBANNCHAR, 1)); + if (!end) + break; + s = end + 1; + continue; + } +#endif +#ifdef SJOINEXCEPTIONCHAR + if (*s == SJOINEXCEPTIONCHAR) { + add_exception(c, myStrGetToken(s, SJOINEXCEPTIONCHAR, 1)); + if (!end) + break; + s = end + 1; + continue; + } +#endif + while (csmodes[(int) *s] != 0) *end2++ = csmodes[(int) *s++]; *end2 = 0; @@ -693,10 +748,75 @@ void do_sjoin(const char *source, int ac, char **av) if (c) { /* Set the timestamp */ - c->creation_time = strtoul(av[0], NULL, 10); + c->creation_time = ts; /* We now update the channel mode. */ chan_set_modes(source, c, ac - 3, &av[2], 1); } + + /* Unreal just had to be different */ + } else if (ac == 3) { + c = findchan(av[1]); + if (ircd->chansqline) { + if (!c) + is_sqlined = check_chan_sqline(av[1]); + } + + cubuf[0] = '+'; + cumodes[0] = cubuf; + + /* We make all the users join */ + s = av[2]; /* Users are always the last element */ + + while (*s) { + end = strchr(s, ' '); + if (end) + *end = 0; + + end2 = cubuf + 1; + + while (csmodes[(int) *s] != 0) + *end2++ = csmodes[(int) *s++]; + *end2 = 0; + + user = finduser(s); + if (!user) { + alog("user: SJOIN for nonexistent user %s on %s", s, + av[1]); + return; + } + + if (is_sqlined && !is_oper(user)) { + 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 + * will be created there. This ensures that the channel + * is not created to be immediately destroyed, and + * that the locked key or topic is not shown to anyone + * who joins the channel when empty. + */ + c = join_user_update(user, c, av[1]); + + /* We update user mode on the channel */ + if (end2 - cubuf > 1) { + int i; + + for (i = 1; i < end2 - cubuf; i++) + cumodes[i] = user->nick; + chan_set_modes(source, c, 1 + (end2 - cubuf - 1), + cumodes, 1); + } + } + } + + if (!end) + break; + s = end + 1; + } + + if (c) { + c->creation_time = ts; + } } else if (ac == 2) { user = finduser(source); if (!user) { @@ -718,7 +838,7 @@ void do_sjoin(const char *source, int ac, char **av) 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); + c->creation_time = ts; } } } @@ -786,7 +906,16 @@ void do_cmode(const char *source, int ac, char **av) void do_topic(const char *source, int ac, char **av) { Channel *c = findchan(av[0]); - time_t topic_time = strtoul(av[2], NULL, 10); + int ts; + time_t topic_time; + + if (ircd->sjb64) { + ts = base64dects(av[0]); + } else { + ts = strtoul(av[0], NULL, 10); + } + + topic_time = ts; if (!c) { alog("channel: TOPIC %s for nonexistent channel %s", @@ -856,6 +985,21 @@ void add_exception(Channel * chan, char *mask) /*************************************************************************/ +void add_invite(Channel * chan, char *mask) +{ + if (chan->invitecount >= chan->invitesize) { + chan->invitesize += 8; + chan->invite = + srealloc(chan->invite, sizeof(char *) * chan->invitesize); + } + chan->invite[chan->invitecount++] = sstrdup(mask); + + if (debug) + alog("debug: Added invite %s to channel %s", mask, chan->name); +} + +/*************************************************************************/ + /* Add/remove a user to/from a channel, creating or deleting the channel as * necessary. If creating the channel, restore mode lock and topic as * necessary. Also check for auto-opping and auto-voicing. @@ -1012,13 +1156,25 @@ void chan_delete(Channel * c) if (c->excepts[i]) free(c->excepts[i]); else - alog("channel: BUG freeing %s: exceps[%d] is NULL!", + alog("channel: BUG freeing %s: excepts[%d] is NULL!", c->name, i); } if (c->exceptsize) free(c->excepts); } + if (ircd->invitemode) { + for (i = 0; i < c->invitecount; ++i) { + if (c->invite[i]) + free(c->invite[i]); + else + alog("channel: BUG freeing %s: invite[%d] is NULL!", + c->name, i); + } + if (c->invitesize) + free(c->invite); + } + if (c->next) c->next->prev = c->prev; if (c->prev) @@ -1037,6 +1193,11 @@ void del_ban(Channel * chan, char *mask) int i = 0; AutoKick *akick; + /* Sanity check as it seems some IRCD will just send -b without a mask */ + if (!mask) { + return; + } + while (i < chan->bancount && strcmp(*s, mask) != 0) { i++; s++; @@ -1063,6 +1224,11 @@ void del_exception(Channel * chan, char *mask) int i; int reset = 0; + /* Sanity check as it seems some IRCD will just send -e without a mask */ + if (!mask) { + return; + } + for (i = 0; i < chan->exceptcount; i++) { if ((!reset) && (stricmp(chan->excepts[i], mask) == 0)) { free(chan->excepts[i]); @@ -1082,6 +1248,36 @@ void del_exception(Channel * chan, char *mask) /*************************************************************************/ +void del_invite(Channel * chan, char *mask) +{ + int i; + int reset = 0; + + /* Sanity check as it seems some IRCD will just send -I without a mask */ + if (!mask) { + return; + } + + for (i = 0; i < chan->invitecount; i++) { + if ((!reset) && (stricmp(chan->invite[i], mask) == 0)) { + free(chan->invite[i]); + reset = 1; + } + if (reset) + chan->invite[i] = + (i == chan->invitecount) ? NULL : chan->invite[i + 1]; + } + + if (reset) + chan->invitecount--; + + if (debug) + alog("debug: Deleted invite %s to channel %s", mask, chan->name); +} + + +/*************************************************************************/ + char *get_flood(Channel * chan) { return chan->flood; @@ -1148,7 +1344,7 @@ void set_flood(Channel * chan, char *value) chan->flood = value ? sstrdup(value) : NULL; if (debug) - alog("debug: Flood of channel %s set to %s", chan->name, + alog("debug: Flood mode for channel %s set to %s", chan->name, chan->flood ? chan->flood : "no flood settings"); } diff --git a/src/chanserv.c b/src/chanserv.c index e210ac5ac..712c22560 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2038,20 +2038,37 @@ int delchan(ChannelInfo * ci) int i; NickCore *nc = ci->founder; + if (debug >= 2) { + alog("debug: delchan removing %s", ci->name); + } + if (ci->bi) { ci->bi->chancount--; } + + if (debug >= 2) { + alog("debug: delchan top of removing the bot"); + } if (ci->c) { if (ci->bi && ci->c->usercount >= BSMinUsers) { anope_cmd_part(ci->bi->nick, ci->c->name, NULL); } ci->c->ci = NULL; } + if (debug >= 2) { + alog("debug: delchan() Bot has been removed moving on"); + } #ifdef USE_RDB + if (debug >= 2) { + alog("debug: delchan() rdb updating"); + } if (rdb_open()) { rdb_cs_delchan(ci); rdb_close(); } + if (debug >= 2) { + alog("debug: delchan() rdb done"); + } #endif if (ci->next) ci->next->prev = ci->prev; @@ -2079,6 +2096,9 @@ int delchan(ChannelInfo * ci) free(ci->forbidreason); if (ci->access) free(ci->access); + if (debug >= 2) { + alog("debug: delchan() top of the akick list"); + } for (i = 0; i < ci->akickcount; i++) { if (!(ci->akick[i].flags & AK_ISNICK) && ci->akick[i].u.mask) free(ci->akick[i].u.mask); @@ -2087,10 +2107,16 @@ int delchan(ChannelInfo * ci) if (ci->akick[i].creator) free(ci->akick[i].creator); } + if (debug >= 2) { + alog("debug: delchan() done with the akick list"); + } if (ci->akick) free(ci->akick); if (ci->levels) free(ci->levels); + if (debug >= 2) { + alog("debug: delchan() top of the memo list"); + } if (ci->memos.memos) { for (i = 0; i < ci->memos.memocount; i++) { if (ci->memos.memos[i].text) @@ -2099,21 +2125,38 @@ int delchan(ChannelInfo * ci) } free(ci->memos.memos); } + if (debug >= 2) { + alog("debug: delchan() done with the memo list"); + } if (ci->ttb) free(ci->ttb); + + if (debug >= 2) { + alog("debug: delchan() top of the badword list"); + } for (i = 0; i < ci->bwcount; i++) { if (ci->badwords[i].word) free(ci->badwords[i].word); } if (ci->badwords) free(ci->badwords); + if (debug >= 2) { + alog("debug: delchan() done with the badword list"); + } + + if (debug >= 2) { + alog("debug: delchan() calling on moduleCleanStruct()"); + } moduleCleanStruct(&ci->moduleData); free(ci); if (nc) nc->channelcount--; + if (debug >= 2) { + alog("debug: delchan() all done"); + } return 1; } @@ -2342,16 +2385,11 @@ char *cs_get_redirect(ChannelInfo * ci) void cs_set_flood(ChannelInfo * ci, char *value) { - char *dp, *end; - if (ci->mlock_flood) free(ci->mlock_flood); /* This looks ugly, but it works ;) */ - if (value && *value != ':' - && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0) - && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0) - && (*end == 0)) { + if (anope_flood_mode_check(value)) { ci->mlock_flood = sstrdup(value); } else { ci->mlock_on &= ~ircd->chan_fmode; @@ -5645,6 +5683,30 @@ static int do_clear(User * u) } notice_lang(s_ChanServ, u, CHAN_CLEARED_EXCEPTS, chan); free(excepts); + + } else if (ircd->invitemode && stricmp(what, "invites") == 0) { + char *av[3]; + int i; + + /* Save original except info */ + int count = c->invitecount; + char **invites = scalloc(sizeof(char *) * count, 1); + for (i = 0; i < count; i++) + invites[i] = sstrdup(c->invite[i]); + + for (i = 0; i < count; i++) { + av[0] = sstrdup(chan); + av[1] = sstrdup("-I"); + av[2] = invites[i]; + anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1], av[2]); + do_cmode(s_ChanServ, 3, av); + free(av[2]); + free(av[1]); + free(av[0]); + } + notice_lang(s_ChanServ, u, CHAN_CLEARED_INVITES, chan); + free(invites); + } else if (stricmp(what, "modes") == 0) { char buf[BUFSIZE], *end = buf; char *argv[2]; diff --git a/src/config.c b/src/config.c index 8bbbd077d..31dc59fa7 100644 --- a/src/config.c +++ b/src/config.c @@ -117,6 +117,8 @@ int DumpCore; int LogUsers; int NickRegDelay; int UseSVSHOLD; +int UseTokens; +int UseSVS2MODE; int UseMail; char *SendMailPath; @@ -622,6 +624,8 @@ Directive directives[] = { {"UserKey2", {{PARAM_POSINT, PARAM_RELOAD, &UserKey2}}}, {"UserKey3", {{PARAM_POSINT, PARAM_RELOAD, &UserKey3}}}, {"UseSVSHOLD", {{PARAM_SET, PARAM_RELOAD, &UseSVSHOLD}}}, + {"UseSVS2MODE", {{PARAM_SET, PARAM_RELOAD, &UseSVS2MODE}}}, + {"UseTokens", {{PARAM_SET, 0, &UseTokens}}}, {"WallAkillExpire", {{PARAM_SET, PARAM_RELOAD, &WallAkillExpire}}}, {"WallBadOS", {{PARAM_SET, PARAM_RELOAD, &WallBadOS}}}, {"WallDrop", {{PARAM_SET, PARAM_RELOAD, &WallDrop}}}, @@ -941,7 +945,7 @@ int read_config(int reload) CHECK(RemoteServer2); } if (!reload) { - if (LocalHost) { + if (LocalHost && RemoteServer) { if ((!stricmp(LocalHost, RemoteServer)) && LocalPort == RemotePort) { printf @@ -1319,6 +1323,13 @@ int read_config(int reload) CHECK(DefconMessage); } + if (UseTokens) { + if (!ircd->token) { + alog("Anope does not support TOKENS for this ircd setting unsetting UseToken"); + UseTokens = 0; + } + } + /** * If they try to enable any email registration option, * make sure they have everything else they need too... diff --git a/src/dreamforge.c b/src/dreamforge.c index 6cdec5745..7ec4fd081 100644 --- a/src/dreamforge.c +++ b/src/dreamforge.c @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 0, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -185,27 +189,56 @@ void anope_set_umode(User * user, int ac, char **av) } } + 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, - 0, - 0, - 0, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - UMODE_g, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, 0, 0, /* A B C */ + 0, 0, 0, /* D E F */ + 0, 0, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, 0, UMODE_O, /* M N O */ + 0, 0, 0, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, 0, UMODE_c, /* a b c */ + 0, 0, UMODE_f, /* d e f */ + UMODE_g, UMODE_h, UMODE_i, /* g h i */ + 0, UMODE_k, 0, /* j k l */ + 0, 0, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, 0, /* s t u */ + 0, 0, 0, /* v w x */ + 0, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; char csmodes[128] = { @@ -447,6 +480,10 @@ void moduleAddIRCDMsgs(void) { m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("PROTOCTL", anope_event_capab); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + } @@ -469,6 +506,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_remove_akill(char *user, char *host) { send_cmd(NULL, "RAKILL %s %s", host, user); @@ -563,6 +605,7 @@ void anope_pong(char *servname) void anope_cmd_connect(int servernum) { + anope_cmd_capab(); if (servernum == 1) anope_cmd_pass(RemotePassword); if (servernum == 2) @@ -578,6 +621,11 @@ void anope_cmd_pass(char *pass) send_cmd(NULL, "PASS :%s", pass); } +void anope_cmd_capab() +{ + send_cmd(NULL, "PROTOCTL NOQUIT"); +} + void anope_cmd_bot_chan_mode(char *nick, char *chan) { anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); @@ -1016,6 +1064,7 @@ void anope_cmd_211(const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), ServiceUser, ServiceHost, ServerName, name); anope_cmd_mode(nick, nick, "%s", modes); @@ -1049,7 +1098,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1127,6 +1176,7 @@ void anope_cmd_pong(char *servname, char *who) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), user, host, ServerName, real); anope_cmd_mode(nick, "MODE %s %s", nick, modes); @@ -1245,4 +1295,44 @@ void anope_cmd_chg_nick(char *oldnick, char *newnick) send_cmd(oldnick, "NICK %s", newnick); } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +void anope_cmd_eob() +{ + /* Not supported */ +} + #endif diff --git a/src/hostserv.c b/src/hostserv.c index 4c862e8b3..94e8354f8 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -33,9 +33,6 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick, HostCore *deleteHostCore(HostCore * head, HostCore * prev); void delHostCore(char *nick); -char *getvIdent(char *nick); -char *getvHost(char *nick); - int is_host_setter(User * u); int is_host_remover(User * u); @@ -881,6 +878,10 @@ int do_set(User * u) tmp_time = time(NULL); if ((na = findnick(nick))) { + if (na->status & NS_VERBOTEN) { + notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick); + return MOD_CONT; + } alog("vHost for user \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick); addHostCore(nick, vIdent, hostmask, u->nick, tmp_time); if (vIdent) { diff --git a/src/hybrid.c b/src/hybrid.c index b769d7a8e..1247af6ee 100644 --- a/src/hybrid.c +++ b/src/hybrid.c @@ -40,7 +40,7 @@ IRCDVar ircd[] = { "+io", /* Global alias mode */ "+", /* Used by BotServ Bots */ 3, /* Chan Max Symbols */ - "aiklmnpst", /* Modes to Remove */ + "-aiklmnpst", /* Modes to Remove */ "+o", /* Channel Umode used by Botserv bots */ 0, /* SVSNICK */ 0, /* Vhost */ @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 0, /* On nick change check if they could be identified */ 0, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -96,7 +100,7 @@ IRCDVar ircd[] = { IRCDCAPAB ircdcap[] = { { - 0, /* NOQUIT */ + CAPAB_NOQUIT, /* NOQUIT */ 0, /* TSMODE */ 0, /* UNCONNECT */ 0, /* NICKIP */ @@ -189,36 +193,65 @@ void anope_set_umode(User * user, int ac, char **av) } 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, - 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, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + 0, 0, 0, /* A B C */ + 0, 0, 0, /* D E F */ + 0, 0, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, 0, 0, /* M N O */ + 0, 0, 0, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, UMODE_b, UMODE_c, /* a b c */ + UMODE_d, 0, UMODE_f, /* d e f */ + UMODE_g, 0, UMODE_i, /* g h i */ + 0, UMODE_k, UMODE_l, /* j k l */ + 0, UMODE_n, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, UMODE_u, /* s t u */ + 0, UMODE_w, UMODE_x, /* v w x */ + UMODE_y, /* y */ + UMODE_z, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; + 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, - 'a', /* (33) ! Channel Admins */ + 'a', /* (33) ! */ 0, 0, 0, - 0, + 'h', 0, 0, 0, 0, 0, @@ -232,22 +265,44 @@ char csmodes[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - 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}, + {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}, /* BCD */ + {NULL}, {NULL}, {NULL}, /* EFG */ + {NULL}, /* H */ + {add_invite, del_invite}, + {NULL}, /* J */ + {NULL}, {NULL}, {NULL}, /* KLM */ + {NULL}, {NULL}, {NULL}, /* NOP */ + {NULL}, {NULL}, {NULL}, /* QRS */ + {NULL}, {NULL}, {NULL}, /* TUV */ + {NULL}, {NULL}, {NULL}, /* WXY */ + {NULL}, /* Z */ + {NULL}, {NULL}, /* (char 91 - 92) */ + {NULL}, {NULL}, {NULL}, /* (char 93 - 95) */ + {NULL}, /* ` (char 96) */ + {NULL}, /* a (char 97) */ {add_ban, del_ban}, {NULL}, {NULL}, @@ -465,7 +520,7 @@ void anope_cmd_global(char *source, const char *fmt, ...) return; } - send_cmd(source ? source : ServerName, "WALLOPS :%s", buf); + send_cmd(source ? source : ServerName, "OPERWALL :%s", buf); } @@ -538,14 +593,14 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("NOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); @@ -553,8 +608,6 @@ void moduleAddIRCDMsgs(void) { m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); - m = createMessage("STATS", m_stats); addCoreMessage(IRCD,m); - m = createMessage("TIME", m_time); addCoreMessage(IRCD,m); m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); m = createMessage("USER", NULL); addCoreMessage(IRCD,m); m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); @@ -575,8 +628,9 @@ void moduleAddIRCDMsgs(void) { m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - - + m = createMessage("EOB", anope_event_eob); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); } /* *INDENT-ON* */ @@ -605,6 +659,11 @@ void anope_cmd_svsnoop(char *server, int set) /* does not support */ } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_sgline(char *mask, char *reason) { /* does not support */ @@ -718,9 +777,30 @@ void anope_cmd_svinfo() } /* CAPAB */ +/* + QS - Can handle quit storm removal + EX - Can do channel +e exemptions + CHW - Can do channel wall @# + LL - Can do lazy links + IE - Can do invite exceptions + EOB - Can do EOB message + KLN - Can do KLINE message + GLN - Can do GLINE message + HOPS - can do half ops (+h) + HUB - This server is a HUB + AOPS - Can do anon ops (+a) + UID - Can do UIDs + ZIP - Can do ZIPlinks + ENC - Can do ENCrypted links + KNOCK - supports KNOCK + TBURST - supports TBURST + PARA - supports invite broadcasting for +p + ENCAP - ? +*/ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB TS5 EX IE HOPS HUB AOPS"); + send_cmd(NULL, + "CAPAB :QS EX CHW IE EOB KLN GLN HOPS HUB AOPS KNOCK TBURST PARA"); } /* PASS */ @@ -738,6 +818,7 @@ void anope_cmd_server(char *servname, int hop, char *descript) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, time(NULL), modes, user, host, ServerName, real); @@ -799,6 +880,21 @@ int anope_event_kick(char *source, int ac, char **av) return MOD_CONT; } +int anope_event_eob(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (s) { + s->sync = 1; + } + return MOD_CONT; +} + +void anope_cmd_eob() +{ + send_cmd(ServerName, "EOB"); +} + int anope_event_join(char *source, int ac, char **av) { @@ -849,7 +945,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1106,6 +1202,7 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *mode) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, time(NULL), mode, ServiceUser, ServiceHost, ServerName, (name)); } @@ -1150,7 +1247,7 @@ void anope_cmd_notice_ops(char *source, char *dest, const char *fmt, ...) void anope_cmd_bot_chan_mode(char *nick, char *chan) { - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); } /* QUIT */ @@ -1317,4 +1414,51 @@ int anope_event_pass(char *source, int ac, char **av) return MOD_CONT; } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_notice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +int anope_event_error(char *source, int ac, char **av) +{ + if (ac >= 1) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} + + + #endif diff --git a/src/init.c b/src/init.c index 2ff23d437..486c54e82 100644 --- a/src/init.c +++ b/src/init.c @@ -34,103 +34,85 @@ void introduce_user(const char *user) /* NickServ */ if (!user || stricmp(user, s_NickServ) == 0) { - EnforceQlinedNick(s_NickServ, NULL); anope_cmd_nick(s_NickServ, desc_NickServ, ircd->nickservmode); } /* ChanServ */ if (!user || stricmp(user, s_ChanServ) == 0) { - EnforceQlinedNick(s_ChanServ, NULL); anope_cmd_nick(s_ChanServ, desc_ChanServ, ircd->chanservmode); } if (s_HostServ && ircd->vhost && (!user || stricmp(user, s_HostServ) == 0)) { - EnforceQlinedNick(s_HostServ, NULL); anope_cmd_nick(s_HostServ, desc_HostServ, ircd->hostservmode); } if (!user || stricmp(user, s_MemoServ) == 0) { - EnforceQlinedNick(s_MemoServ, NULL); anope_cmd_nick(s_MemoServ, desc_MemoServ, ircd->memoservmode); } if (s_BotServ && (!user || stricmp(user, s_BotServ) == 0)) { - EnforceQlinedNick(s_BotServ, NULL); anope_cmd_nick(s_BotServ, desc_BotServ, ircd->botservmode); } if (!user || stricmp(user, s_HelpServ) == 0) { - EnforceQlinedNick(s_HelpServ, NULL); anope_cmd_nick(s_HelpServ, desc_HelpServ, ircd->helpservmode); } if (!user || stricmp(user, s_OperServ) == 0) { - EnforceQlinedNick(s_OperServ, NULL); anope_cmd_nick(s_OperServ, desc_OperServ, ircd->operservmode); } if (s_DevNull && (!user || stricmp(user, s_DevNull) == 0)) { - EnforceQlinedNick(s_DevNull, NULL); anope_cmd_nick(s_DevNull, desc_DevNull, ircd->devnullmode); } if (!user || stricmp(user, s_GlobalNoticer) == 0) { - EnforceQlinedNick(s_GlobalNoticer, NULL); 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); anope_cmd_nick(s_NickServAlias, desc_NickServAlias, ircd->nickservaliasmode); } if (s_ChanServAlias && (!user || stricmp(user, s_ChanServAlias) == 0)) { - EnforceQlinedNick(s_ChanServAlias, NULL); anope_cmd_nick(s_ChanServAlias, desc_ChanServAlias, ircd->chanservaliasmode); } if (s_MemoServAlias && (!user || stricmp(user, s_MemoServAlias) == 0)) { - EnforceQlinedNick(s_MemoServAlias, NULL); anope_cmd_nick(s_MemoServAlias, desc_MemoServAlias, ircd->memoservaliasmode); } if (s_BotServAlias && (!user || stricmp(user, s_BotServAlias) == 0)) { - EnforceQlinedNick(s_BotServAlias, NULL); anope_cmd_nick(s_BotServAlias, desc_BotServAlias, ircd->botservaliasmode); } if (s_HelpServAlias && (!user || stricmp(user, s_HelpServAlias) == 0)) { - EnforceQlinedNick(s_HelpServAlias, NULL); anope_cmd_nick(s_HelpServAlias, desc_HelpServAlias, ircd->helpservaliasmode); } if (s_OperServAlias && (!user || stricmp(user, s_OperServAlias) == 0)) { - EnforceQlinedNick(s_OperServAlias, NULL); anope_cmd_nick(s_OperServAlias, desc_OperServAlias, ircd->operservaliasmode); } if (s_DevNullAlias && (!user || stricmp(user, s_DevNullAlias) == 0)) { - EnforceQlinedNick(s_DevNullAlias, NULL); anope_cmd_nick(s_DevNullAlias, desc_DevNullAlias, ircd->devnullvaliasmode); } if (s_HostServAlias && ircd->vhost && (!user || stricmp(user, s_HostServAlias) == 0)) { - EnforceQlinedNick(s_HostServAlias, NULL); anope_cmd_nick(s_HostServAlias, desc_HostServAlias, ircd->hostservaliasmode); } if (s_GlobalNoticerAlias && (!user || stricmp(user, s_GlobalNoticerAlias) == 0)) { - EnforceQlinedNick(s_GlobalNoticerAlias, NULL); anope_cmd_nick(s_GlobalNoticerAlias, desc_GlobalNoticerAlias, ircd->globalaliasmode); } @@ -143,8 +125,6 @@ void introduce_user(const char *user) for (i = 0; i < 256; i++) for (bi = botlists[i]; bi; bi = bi->next) { - EnforceQlinedNick(bi->nick, s_BotServ); - if (!user || !stricmp(user, bi->nick)) anope_cmd_bot_nick(bi->nick, bi->user, bi->host, bi->real, ircd->botserv_bot_mode); @@ -152,8 +132,6 @@ void introduce_user(const char *user) } } -#undef NICK - /*************************************************************************/ /* Set GID if necessary. Return 0 if successful (or if RUNGROUP not @@ -345,8 +323,8 @@ static int parse_options(int ac, char **av) is44 = 1; #endif } else if (!strcmp(s, "version")) { - fprintf(stdout, "Anope-%s %s -- %s\n", version_number, - version_flags, version_build); + fprintf(stdout, "Anope-%s %s %s -- %s\n", version_number, + ircd->name, version_flags, version_build); exit(EXIT_SUCCESS); } else if (!strcmp(s, "help")) { fprintf(stdout, "Anope-%s %s -- %s\n", version_number, @@ -663,7 +641,8 @@ int init(int ac, char **av) } #endif /* Make myself known to myself in the serverlist */ - me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME); + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); /* Connect to the remote server */ servsock = conn(RemoteServer, RemotePort, LocalHost, LocalPort); @@ -721,6 +700,8 @@ int init(int ac, char **av) anope_cmd_join(s_GlobalNoticer, LogChannel, time(NULL)); } + anope_cmd_eob(); + /** * Load our delayed modeles - modules that are planing on making clients need to wait till now * where as modules wanting to modify our ircd connection messages need to load eariler :| diff --git a/src/main.c b/src/main.c index 15660e2fc..f61d4f355 100644 --- a/src/main.c +++ b/src/main.c @@ -503,8 +503,9 @@ int main(int ac, char **av, char **envp) int errno_save = errno; quitmsg = scalloc(BUFSIZE, 1); if (quitmsg) { - snprintf(quitmsg, BUFSIZE, "Read error from server: %s", - strerror(errno_save)); + snprintf(quitmsg, BUFSIZE, + "Read error from server: %s (error num: %d)", + strerror(errno_save), errno_save); } else { quitmsg = "Read error from server"; } diff --git a/src/memoserv.c b/src/memoserv.c index 716f1a1bc..131c48d48 100644 --- a/src/memoserv.c +++ b/src/memoserv.c @@ -1003,6 +1003,9 @@ static int do_info(User * u) if (!na) { notice_lang(s_MemoServ, u, NICK_X_NOT_REGISTERED, name); return MOD_CONT; + } else if (na->status & NS_VERBOTEN) { + notice_lang(s_MemoServ, u, NICK_X_FORBIDDEN, name); + return MOD_CONT; } mi = &na->nc->memos; hardmax = na->nc->flags & NI_MEMO_HARDMAX ? 1 : 0; diff --git a/src/messages.c b/src/messages.c index 335fc1093..571a0ea2b 100644 --- a/src/messages.c +++ b/src/messages.c @@ -49,25 +49,8 @@ int m_kill(char *nick, char *msg) BotInfo *bi; /* Recover if someone kills us. */ - if (stricmp(nick, s_OperServ) == 0 || - (s_OperServAlias && stricmp(nick, s_OperServAlias) == 0) || - stricmp(nick, s_NickServ) == 0 || - (s_NickServAlias && stricmp(nick, s_NickServAlias) == 0) || - stricmp(nick, s_ChanServ) == 0 || - (s_ChanServAlias && stricmp(nick, s_ChanServAlias) == 0) || - stricmp(nick, s_MemoServ) == 0 || - (s_MemoServAlias && stricmp(nick, s_MemoServAlias) == 0) || - (s_HostServ && stricmp(nick, s_HostServ) == 0) || - (s_HostServAlias && stricmp(nick, s_HostServAlias) == 0) || - (s_BotServ && stricmp(nick, s_BotServ) == 0) || - (s_BotServAlias && stricmp(nick, s_BotServAlias) == 0) || - stricmp(nick, s_HelpServ) == 0 || - (s_HelpServAlias && stricmp(nick, s_HelpServAlias) == 0) || - (s_DevNull && stricmp(nick, s_DevNull) == 0) || - (s_DevNullAlias && stricmp(nick, s_DevNullAlias) == 0) || - stricmp(nick, s_GlobalNoticer) == 0 || - (s_GlobalNoticerAlias && stricmp(nick, s_GlobalNoticerAlias) == 0) - ) { + /* use nickIsServices() to reduce the number of lines of code - TSL */ + if (nickIsServices(nick, 0)) { if (!readonly && !skeleton) introduce_user(nick); } else if (s_BotServ && (bi = findbot(nick))) { @@ -138,6 +121,10 @@ int m_privmsg(char *source, char *receiver, char *msg) return MOD_CONT; } + if (!*receiver || !receiver || !msg) { + return MOD_CONT; + } + if (*receiver == '#') { if (s_BotServ && (ci = cs_findchan(receiver))) if (!(ci->flags & CI_VERBOTEN) && ci->c && ci->bi) /* Some paranoia checks */ diff --git a/src/misc.c b/src/misc.c index be34f3bf6..ec9e4944a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -663,7 +663,7 @@ void EnforceQlinedNick(char *nick, char *killer) } } -int nickIsServices(char *nick) +int nickIsServices(char *nick, int bot) { int found = 0; @@ -704,7 +704,7 @@ int nickIsServices(char *nick) else if (s_GlobalNoticerAlias && (stricmp(nick, s_GlobalNoticerAlias) == 0)) found++; - else if (s_BotServ) { + else if (s_BotServ && bot) { BotInfo *bi; int i; for (i = 0; i < 256; i++) { @@ -831,4 +831,58 @@ u_int32_t getrandom32(void) return val; } +char *send_token(char *token1, char *token2) +{ + if (UseTokens && ircd->token && ircdcap->token) { + return token2; + } + else { + return token1; + } +} + +int myNumToken(const char *str, const char dilim) +{ + int len, idx, counter = 0, start_pos = 0; + if (!str) { + return 0; + } + len = strlen(str); + for (idx = 0; idx <= len; idx++) { + if ((str[idx] == dilim) || (idx == len)) { + start_pos = idx + 1; + counter++; + } + } + return counter; +} + + +char *host_resolve(char *host) +{ + struct hostent *hentp = NULL; + uint32 ip = INADDR_NONE; + char ipbuf[16]; + char *ipreturn; + struct in_addr addr; + + ipreturn = NULL; + + hentp = gethostbyname(host); + + if (hentp) { + memcpy(&ip, hentp->h_addr, sizeof(hentp->h_length)); + addr.s_addr = ip; + ntoa(addr, ipbuf, sizeof(ipbuf)); + ipreturn = strdup(ipbuf); + if (debug) { + alog("Resolved %s to %s",host, ipbuf); + } + return ipreturn; + } + else { + return ipreturn; + } +} + diff --git a/src/modules.c b/src/modules.c index 7321c43b9..fede2de3c 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1054,10 +1054,24 @@ Message *findMessage(MessageHash * msgTable[], const char *name) idx = CMD_HASH(name); for (current = msgTable[idx]; current; current = current->next) { - if (stricmp(name, current->name) == 0) { - return current->m; + if (UseTokens) { + if (ircd->tokencaseless) { + if (stricmp(name, current->name) == 0) { + return current->m; + } + } + else { + if (strcmp(name, current->name) == 0) { + return current->m; + } + } + } + else { + if (stricmp(name, current->name) == 0) { + return current->m; + } } - } + } return NULL; } diff --git a/src/modules/ircd_catserv.c b/src/modules/ircd_catserv.c index 05a3f997d..17aede270 100644 --- a/src/modules/ircd_catserv.c +++ b/src/modules/ircd_catserv.c @@ -27,7 +27,14 @@ int AnopeInit(int argc, char **argv) { Message *msg = NULL; int status; +#ifdef IRC_UNREAL32 + msg = createMessage("PRIVMSG", my_privmsg); + if (UseTokens) { + msg = createMessage("!", my_privmsg); + } +#else msg = createMessage("PRIVMSG", my_privmsg); +#endif status = moduleAddMessage(msg, MOD_HEAD); if (status == MOD_ERR_OK) { addClient(s_CatServ, "meow!"); @@ -81,7 +88,7 @@ void addClient(char *nick, char *realname) void delClient(void) { - send_cmd(s_CatServ, "QUIT :Module Unloaded!"); + anope_cmd_quit(s_CatServ, "QUIT :Module Unloaded!"); } void addMessageList(void) diff --git a/src/mysql.c b/src/mysql.c index d0771faa0..97df90b2f 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -58,6 +58,7 @@ int db_mysql_init() } else { do_mysql = 1; alog("MySQL has been enabled."); + alog("MySQL client version %s.",mysql_get_client_info()); } /* The following configuration options are required. diff --git a/src/nickserv.c b/src/nickserv.c index d3232e9f1..23d0e2738 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -33,7 +33,6 @@ unsigned int guestnum; /* Current guest number */ extern char *getvHost(char *nick); -static int is_on_access(User * u, NickCore * nc); void alpha_insert_alias(NickAlias * na); void insert_core(NickCore * nc); void insert_requestnick(NickRequest * nr); @@ -41,7 +40,6 @@ static NickAlias *makenick(const char *nick); static NickRequest *makerequest(const char *nick); static NickAlias *makealias(const char *nick, NickCore * nc); static void change_core_display(NickCore * nc, char *newdisplay); -static int group_identified(User * u, NickCore * nc); static void collide(NickAlias * na, int from_timeout); static void release(NickAlias * na, int from_timeout); @@ -1188,7 +1186,7 @@ int nick_recognized(User * u) /* Returns whether a user is identified AND in the group nc */ -static int group_identified(User * u, NickCore * nc) +int group_identified(User * u, NickCore * nc) { return nick_identified(u) && u->na->nc == nc; } @@ -1302,7 +1300,7 @@ NickCore *findcore(const char *nick) /* Is the given user's address on the given nick's access list? Return 1 * if so, 0 if not. */ -static int is_on_access(User * u, NickCore * nc) +int is_on_access(User * u, NickCore * nc) { int i; char *buf; @@ -2499,6 +2497,12 @@ static int do_identify(User * u) /* Enable nick tracking if enabled */ if (NSNickTracking) nsStartNickTracking(u); + + /* Clear any timers */ + if (na->nc->flags & NI_KILLPROTECT) { + del_ns_timeout(na, TO_COLLIDE); + } + } return MOD_CONT; } @@ -2614,7 +2618,9 @@ static int do_logout(User * u) u2->na->status &= ~(NS_IDENTIFIED | NS_RECOGNIZED); } - common_svsmode(u2, "-r+d", "1"); + if (ircd->modeonreg) { + common_svsmode(u2, ircd->modeonreg, "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, @@ -2628,6 +2634,12 @@ static int do_logout(User * u) /* Stop nick tracking if enabled */ if (NSNickTracking) nsStopNickTracking(u); + + /* Clear any timers again */ + if (u->na->nc->flags & NI_KILLPROTECT) { + del_ns_timeout(u->na, TO_COLLIDE); + } + } return MOD_CONT; } @@ -3286,7 +3298,7 @@ static int do_info(User * u) s_NickServ, nr->nick); } } - } else if (nickIsServices(nick)) { + } else if (nickIsServices(nick, 1)) { notice_lang(s_NickServ, u, NICK_X_IS_SERVICES, nick); } else { notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick); @@ -3390,12 +3402,14 @@ static int do_info(User * u) if (show_hidden) { if (s_HostServ && ircd->vhost) { if (getvHost(na->nick) != NULL) { - vHost = smalloc(strlen(getvHost(na->nick)) + 2); - bzero(vHost, sizeof(vHost)); - snprintf(vHost, strlen(getvHost(na->nick)) + 2, "%s", - getvHost(na->nick)); - notice_lang(s_NickServ, u, NICK_INFO_VHOST, vHost); - free(vHost); + if (ircd->vident && getvIdent(na->nick) != NULL) { + notice_lang(s_NickServ, u, NICK_INFO_VHOST2, + getvIdent(na->nick), + getvHost(na->nick)); + } else { + notice_lang(s_NickServ, u, NICK_INFO_VHOST, + getvHost(na->nick)); + } } } if (na->nc->greet) diff --git a/src/operserv.c b/src/operserv.c index 92130c790..a6e5e10ac 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -3100,13 +3100,12 @@ static int do_sqline(User * u) notice_lang(s_OperServ, u, USERHOST_MASK_TOO_WIDE, mask); return MOD_CONT; } - if (ircd->chansqline) { - /* Channel SQLINEs are only supported on Bahamut servers */ - if (*mask == '#') { - notice_lang(s_OperServ, u, - OPER_SQLINE_CHANNELS_UNSUPPORTED); - return MOD_CONT; - } + + /* Channel SQLINEs are only supported on Bahamut servers */ + if (*mask == '#' && !ircd->chansqline) { + notice_lang(s_OperServ, u, + OPER_SQLINE_CHANNELS_UNSUPPORTED); + return MOD_CONT; } deleted = add_sqline(u, mask, u->nick, expires, reason); @@ -4460,7 +4459,7 @@ static int do_jupe(User * u) anope_cmd_squit(jserver, rbuf); anope_cmd_server(jserver, 1, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); if (WallOSJupe) anope_cmd_global(s_OperServ, "\2%s\2 used JUPE on \2%s\2", diff --git a/src/ptlink.c b/src/ptlink.c index e0acf3711..7000988ed 100644 --- a/src/ptlink.c +++ b/src/ptlink.c @@ -40,7 +40,7 @@ IRCDVar ircd[] = { "+io", /* Global alias mode */ "+", /* Used by BotServ Bots */ 2, /* Chan Max Symbols */ - "-cdfiklmnpqstRS", /* Modes to Remove */ + "-inpsmtCRKOASdcqBNfkl", /* Modes to Remove */ "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 1, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -129,26 +133,54 @@ IRCDCAPAB ircdcap[] = { 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, - 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, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, UMODE_B, 0, /* A B C */ + 0, 0, 0, /* D E F */ + 0, UMODE_H, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, UMODE_N, UMODE_O, /* M N O */ + 0, 0, UMODE_R, /* P Q R */ + UMODE_S, UMODE_T, 0, /* S T U */ + 0, 0, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, 0, 0, /* a b c */ + 0, 0, 0, /* d e f */ + 0, UMODE_h, UMODE_i, /* g h i */ + 0, 0, 0, /* j k l */ + 0, 0, UMODE_o, /* m n o */ + UMODE_p, 0, UMODE_r, /* p q r */ + UMODE_s, 0, 0, /* s t u */ + UMODE_v, UMODE_w, 0, /* v w x */ + UMODE_y, /* y */ + UMODE_z, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; char csmodes[128] = { @@ -212,7 +244,7 @@ CBMode cbmodes[128] = { {0}, {0}, /* A */ {0}, /* B */ - {0}, /* C */ + {CMODE_C, 0, NULL, NULL}, {0}, /* D */ {0}, /* E */ {0}, /* F */ @@ -281,6 +313,7 @@ CBModeInfo cbmodeinfos[] = { {'s', CMODE_s, 0, NULL, NULL}, {'t', CMODE_t, 0, NULL, NULL}, {'A', CMODE_A, 0, NULL, NULL}, + {'C', CMODE_C, 0, NULL, NULL}, {'K', CMODE_K, 0, NULL, NULL}, {'N', CMODE_N, 0, NULL, NULL}, {'R', CMODE_R, 0, NULL, NULL}, @@ -343,6 +376,16 @@ void anope_cmd_bot_chan_mode(char *nick, char *chan) nick); } +/* + :%s SJOIN %lu %s %s %s :%s + parv[0] = sender + parv[1] = channel TS (channel creation time) + parv[2] = channel + parv[3] = modes + n arguments (key and/or limit) + ... [n] = if(key and/or limit) mode arguments + parv[4+n] = flags+nick list (all in one parameter) + NOTE: ignore channel modes if we already have the channel with a gr +*/ int anope_event_sjoin(char *source, int ac, char **av) { do_sjoin(source, ac, av); @@ -355,6 +398,11 @@ int anope_event_sjoin(char *source, int ac, char **av) * that case serives will *NOT* modify it's internal record for the vhost. We * need to address this in the future. */ +/* + :%s NEWMASK %s + parv[0] = sender + parv[1] = new mask (if no '@', hostname is assumed) +*/ int anope_event_newmask(char *source, int ac, char **av) { User *u; @@ -387,7 +435,24 @@ int anope_event_newmask(char *source, int ac, char **av) return MOD_CONT; } - +/* + NICK %s %d %lu %s %s %s %s %s :%s + parv[1] = nickname + parv[2] = hopcount + parv[3] = nick TS (nick introduction time) + parv[4] = umodes + parv[5] = username + parv[6] = hostname + parv[7] = spoofed hostname + parv[8] = server + parv[9] = nick info +*/ +/* + Change NICK + parv[0] = old nick + parv[1] = new nick + parv[2] = TS (timestamp from user's server when nick changed was received) +*/ int anope_event_nick(char *source, int ac, char **av) { User *user; @@ -404,13 +469,21 @@ int anope_event_nick(char *source, int ac, char **av) return MOD_CONT; } +/* + :%s SERVER %s %d %s :%s + parv[0] = server from where the server was introduced to us + parv[1] = server name + parv[2] = hop count (1 wen are directly connected) + parv[3] = server version + parv[4] = server description +*/ int anope_event_server(char *source, int ac, char **av) { char *uplink; if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[3], NULL); return MOD_CONT; } @@ -431,29 +504,25 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("NOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", NULL); addCoreMessage(IRCD,m); + m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); - m = createMessage("STATS", m_stats); addCoreMessage(IRCD,m); - m = createMessage("TIME", m_time); addCoreMessage(IRCD,m); m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); m = createMessage("USER", NULL); addCoreMessage(IRCD,m); m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - - /* DALnet specific messages */ m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); @@ -472,6 +541,10 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); m = createMessage("SVSINFO", anope_event_svsinfo); addCoreMessage(IRCD,m); m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + } /* *INDENT-ON* */ @@ -494,16 +567,40 @@ int anope_event_capab(char *source, int ac, char **av) return MOD_CONT; } +/* + :%s SQLINE %s :%s + parv[0] = sender + parv[1] = sqlined nick/mask + parv[2] = reason +*/ void anope_cmd_sqline(char *mask, char *reason) { send_cmd(NULL, "SQLINE %s :%s", mask, reason); } +/* + :%s SVSADMIN %s :%s + parv[0] = sender (services client) + parv[1] = target server + parv[2] = operation + operations: + noopers - remove existing opers and disable o:lines +*/ void anope_cmd_svsnoop(char *server, int set) { send_cmd(NULL, "SVSADMIN %s :%s", server, set ? "noopers" : "rehash"); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + +/* + :%s UNGLINE %s + parv[0] = sender (server if on network synchronization) + parv[1] = glined usert@host mask or ALL to remove all glines +*/ void anope_cmd_remove_akill(char *user, char *host) { send_cmd(NULL, "UNGLINE %s@%s", user, host); @@ -520,6 +617,11 @@ void anope_topic(char *whosets, char *chan, char *whosetit, char *topic, send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, when, topic); } +/* + :%s UNSQLINE %s + parv[0] = sender + parv[1] = sqlined nick/mask +*/ void anope_cmd_unsqline(char *user) { send_cmd(NULL, "UNSQLINE %s", user); @@ -530,6 +632,14 @@ void anope_cmd_join(char *user, char *channel, time_t chantime) send_cmd(user, "JOIN %s", channel); } +/* + :%s GLINE %s %lu %s %s + parv[0] = sender (server if on network synchronization) + parv[1] = glined usert@host mask + parv[2] = gline duration time (seconds) + parv[3] = who added the gline + parv[4] = reason +*/ void anope_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason) { @@ -560,7 +670,14 @@ void anope_cmd_svskill(char *source, char *user, const char *fmt, ...) send_cmd(source, "KILL %s :%s", user, buf); } - +/* + :%s SVSMODE %s %s :%s + parv[0] = sender (services client) + parv[1] = target client nick + parv[2] = mode changes + parv[3] = extra parameter ( if news setting mode(+n) ) + e.g.: :NickServ SVSMODE Lamego +rn 1991234 +*/ void anope_cmd_svsmode(User * u, int ac, char **av) { send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], @@ -587,27 +704,56 @@ void anope_cmd_connect(int servernum) anope_cmd_pass(RemotePassword2); else if (servernum == 3) anope_cmd_pass(RemotePassword3); + + anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); anope_cmd_svinfo(); anope_cmd_svsinfo(); } +/* + SVINFO %d %d + parv[0] = server name + parv[1] = minimum supported protocol version (3) + parv[2] = current supported protocol version (6) +*/ void anope_cmd_svinfo() { send_cmd(NULL, "SVINFO 3 6 %lu", time(NULL)); } +/* + SVSINFO %lu %d + parv[0] = sender (server name) + parv[1] = local services data TS + parv[1] = max global users +*/ void anope_cmd_svsinfo() { send_cmd(NULL, "SVSINFO %lu %d", time(NULL), maxusercnt); } -/* PASS */ +/* + PASS %s :TS + parv[1] = connection password + (TS indicates this is server uses TS protocol and SVINFO will be sent + for protocol compatibility checking) +*/ void anope_cmd_pass(char *pass) { send_cmd(NULL, "PASS %s :TS", pass); } +/* + CAPAB :%s + parv[1] = capability list +*/ +void anope_cmd_capab() +{ + send_cmd(NULL, "CAPAB :QS PTS4"); +} + + void anope_cmd_server(char *servname, int hop, char *descript) { send_cmd(NULL, "SERVER %s %d Anope.Services%s :%s", servname, hop, @@ -638,6 +784,14 @@ int anope_event_whois(char *source, int ac, char **av) return MOD_CONT; } +/* + :%s TOPIC %s %s %lu :%s + parv[0] = sender prefix + parv[1] = channel + parv[2] = topic nick + parv[3] = topic time + parv[4] = topic text +*/ int anope_event_topic(char *source, int ac, char **av) { if (ac != 4) @@ -662,7 +816,12 @@ int anope_event_quit(char *source, int ac, char **av) return MOD_CONT; } - +/* + :%s MODE %s :%s + parv[0] = sender + parv[1] = target nick (==sender) + parv[2] = mode change string +*/ int anope_event_mode(char *source, int ac, char **av) { if (ac < 2) @@ -1024,8 +1183,21 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) send_cmd(source, "MODE %s %s", dest, buf); } +/* + NICK %s %d %lu %s %s %s %s %s :%s + parv[1] = nickname + parv[2] = hopcount + parv[3] = nick TS (nick introduction time) + parv[4] = umodes + parv[5] = username + parv[6] = hostname + parv[7] = spoofed hostname + parv[8] = server + parv[9] = nick info +*/ void anope_cmd_nick(char *nick, char *name, char *mode) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, time(NULL), mode, ServiceUser, ServiceHost, ServiceHost, ServerName, name); @@ -1094,6 +1266,14 @@ void anope_cmd_part(char *nick, char *chan, const char *fmt, ...) } } +/* + :%s TOPIC %s %s %lu :%s + parv[0] = sender prefix + parv[1] = channel + parv[2] = topic nick + parv[3] = topic time + parv[4] = topic text +*/ void anope_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when) { @@ -1228,6 +1408,7 @@ int anope_event_away(char *source, int ac, char **av) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, time(NULL), modes, user, host, host, ServerName, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1253,31 +1434,56 @@ void anope_cmd_release_svshold(char *nick) /* Not Supported by this IRCD */ } -/* UNSGLINE */ +/* +:%s UNSXLINE %s + parv[0] = sender + parv[1] = info ban mask +*/ void anope_cmd_unsgline(char *mask) { /* Not Supported by this IRCD */ } -/* UNSZLINE */ +/* +:%s UNZLINE %s + parv[0] = sender + parv[1] = zlined host +*/ void anope_cmd_unszline(char *mask) { /* Not Supported by this IRCD */ } -/* SZLINE */ +/* +:%s ZLINE %s :%s + parv[0] = sender + parv[1] = zlined host + parv[2] = time + parv[3] = reason +*/ void anope_cmd_szline(char *mask, char *reason) { /* Not Supported by this IRCD */ } -/* SGLINE */ +/* +:%s SXLINE :%s:%s + parv[0] = sender + parv[1] = info ban mask:reason +*/ void anope_cmd_sgline(char *mask, char *reason) { /* Not Supported by this IRCD */ } /* SVSNICK */ +/* + :%s SVSNICK %s %s + parv[0] = sender (services client) + parv[1] = target client nick + parv[2] = new nick + e.g.: :NickServ SVSNICK Smiler 67455223 _Smiler- +*/ void anope_cmd_svsnick(char *source, char *guest, time_t when) { if (!source || !guest) { @@ -1332,6 +1538,12 @@ void anope_cmd_svid_umode3(User * u, char *ts) } /* NICK <newnick> */ +/* + :%s NICK %s %lu + parv[0] = old nick + parv[1] = new nick + parv[2] = TS (timestamp from user's server when nick changed was received) +*/ void anope_cmd_chg_nick(char *oldnick, char *newnick) { if (!oldnick || !newnick) { @@ -1341,5 +1553,82 @@ void anope_cmd_chg_nick(char *oldnick, char *newnick) send_cmd(oldnick, "NICK %s", newnick); } +/* + :%s SVSJOIN %s :%s + parv[0] = sender (services client) + parv[1] = target client nick + parv[2] = channels list + :ChanServ SVSJOIN mynick 4163321 #Chan1,#Chan2 +*/ +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSJOIN %s :%s", nick, chan); +} + +/* + :%s SVSPART %s :%s + parv[0] = sender (services client) + parv[1] = target client nick + parv[2] = channels list + e.g.: :ChanServ SVSPART mynick 4163321 #Chan1,#Chan2 +*/ +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSPART %s :%s", nick, chan); +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_notice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + char *dp, *end; + + if (value && *value != ':' + && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0) + && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0) + && (*end == 0)) { + return 1; + } else { + return 0; + } +} + +void anope_cmd_eob() +{ + /* not supported */ +} #endif diff --git a/src/rageircd.c b/src/rageircd.c index 109cead4f..3b09a4a35 100644 --- a/src/rageircd.c +++ b/src/rageircd.c @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 1, 0, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 1, /* +I support */ }, {NULL} }; @@ -174,20 +178,43 @@ char csmodes[128] = { 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}, + {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}, /* BCD */ + {NULL}, {NULL}, {NULL}, /* EFG */ + {NULL}, /* H */ + {add_invite, del_invite}, + {NULL}, /* J */ + {NULL}, {NULL}, {NULL}, /* KLM */ + {NULL}, {NULL}, {NULL}, /* NOP */ + {NULL}, {NULL}, {NULL}, /* QRS */ + {NULL}, {NULL}, {NULL}, /* TUV */ + {NULL}, {NULL}, {NULL}, /* WXY */ + {NULL}, /* Z */ + {NULL}, {NULL}, /* (char 91 - 92) */ + {NULL}, {NULL}, {NULL}, /* (char 93 - 95) */ + {NULL}, /* ` (char 96) */ + {NULL}, /* a (char 97) */ {add_ban, del_ban}, {NULL}, {NULL}, @@ -434,6 +461,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); + m = createMessage("482", anope_event_482); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); @@ -455,7 +483,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_globops); addCoreMessage(IRCD,m); m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); @@ -483,10 +511,41 @@ void moduleAddIRCDMsgs(void) { m = createMessage("VHOST", anope_event_vhost); addCoreMessage(IRCD,m); m = createMessage("MYID", anope_event_myid); addCoreMessage(IRCD,m); m = createMessage("GNOTICE", anope_event_notice); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + } /* *INDENT-ON* */ +int anope_event_error(char *source, int ac, char **av) +{ + if (ac >= 1) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} + + +int anope_event_burst(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (ac > 1) { + /* for future use - start burst */ + } else { + if (s) { + s->sync = 1; + } + } + return MOD_CONT; +} + void anope_cmd_sqline(char *mask, char *reason) { if (!mask || !reason) { @@ -515,6 +574,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_sgline(char *mask, char *reason) { send_cmd(NULL, "SGLINE %d :%s:%s", strlen(mask), mask, reason); @@ -635,6 +699,7 @@ void anope_cmd_connect(int servernum) anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); anope_cmd_svinfo(); + anope_cmd_burst(); } void anope_cmd_svinfo() @@ -644,7 +709,7 @@ void anope_cmd_svinfo() void anope_cmd_capab() { - send_cmd(NULL, "CAPAB SSJ3 SN2 VHOST"); + send_cmd(NULL, "CAPAB BURST UNCONNECT SSJ3 SN2 VHOST"); } void anope_cmd_server(char *servname, int hop, char *descript) @@ -1117,49 +1182,55 @@ void anope_cmd_211(const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, time(NULL), ServiceUser, ServiceHost, ServerName, modes, name); anope_cmd_sqline(nick, "Reserved for services"); } +/* EVENT : OS */ int anope_event_os(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_OperServ, av[0]); return MOD_CONT; } +/* EVENT : NS */ int anope_event_ns(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_NickServ, av[0]); return MOD_CONT; } +/* EVENT : MS */ int anope_event_ms(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_MemoServ, av[0]); return MOD_CONT; } +/* EVENT : HS */ int anope_event_hs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_HostServ, av[0]); return MOD_CONT; } +/* EVENT : CS */ int anope_event_cs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_ChanServ, av[0]); return MOD_CONT; } @@ -1186,6 +1257,7 @@ void anope_cmd_quit(char *source, const char *fmt, ...) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, time(NULL), user, host, ServerName, modes, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1207,7 +1279,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1236,6 +1308,12 @@ int anope_event_whois(char *source, int ac, char **av) return MOD_CONT; } + +int anope_event_482(char *source, int ac, char **av) +{ + return MOD_CONT; +} + int anope_event_topic(char *source, int ac, char **av) { if (ac != 4) @@ -1442,4 +1520,55 @@ int anope_event_sqline(char *source, int ac, char **av) return MOD_CONT; } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Find no reference to it in the code and docs */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Find no reference to it in the code and docs */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_globops(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +void anope_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void anope_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + + #endif diff --git a/src/servers.c b/src/servers.c index d69ac9afd..4d6a7f461 100644 --- a/src/servers.c +++ b/src/servers.c @@ -67,7 +67,7 @@ Server *next_server(int flags) */ Server *new_server(Server * uplink, const char *name, const char *desc, - uint16 flags) + uint16 flags, char *suid) { Server *serv; @@ -78,6 +78,8 @@ Server *new_server(Server * uplink, const char *name, const char *desc, serv->desc = sstrdup(desc); serv->flags = flags; serv->uplink = uplink; + serv->suid = suid; + serv->sync = -1; serv->links = NULL; serv->prev = NULL; @@ -197,18 +199,41 @@ Server *findserver(Server * s, const char *name) return s; } +/* + Not Synced = -1 + Error = 0 + Synced = 1 +*/ + +int anope_check_sync(const char *name) +{ + Server *s; + s = findserver(servlist, name); + + if (!s) { + return 0; + } + if (s->sync) { + return s->sync; + } else { + return 0; + } +} + /*************************************************************************/ /* :<introducing server> SERVER <servername> <hops> :<description> */ -void do_server(const char *source, int ac, char **av) +void do_server(const char *source, char *servername, char *hops, + char *descript, char *numeric) { - Server *s; + Server *s, *s2; if (debug) { if (!*source) { - alog("debug: Server introduced (%s)", av[0]); + alog("debug: Server introduced (%s)", servername); } else { - alog("debug: Server introduced (%s) from %s", av[0], source); + alog("debug: Server introduced (%s) from %s", servername, + source); } } @@ -216,23 +241,8 @@ void do_server(const char *source, int ac, char **av) s = me_server; else s = findserver(servlist, source); - 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); - } + + new_server(s, servername, descript, 0, numeric); } /*************************************************************************/ @@ -293,6 +303,10 @@ void capab_parse(int ac, char **av) } if (!stricmp(s, "NICKIP")) { uplink_capab |= CAPAB_NICKIP; + /* Update the struct so that we know we can get NICKIP */ + if (!ircd->nickip) { + ircd->nickip = 1; + } } if (!stricmp(s, "SSJOIN")) { uplink_capab |= CAPAB_NSJOIN; @@ -352,6 +366,11 @@ void capab_parse(int ac, char **av) uplink_capab |= CAPAB_SSJ3; } + if (!stricmp(s, "SJB64")) { + uplink_capab |= CAPAB_SJB64; + + } + if (!stricmp(s, "CHANMODES")) { uplink_capab |= CAPAB_CHANMODE; if (tmp) { diff --git a/src/ultimate2.c b/src/ultimate2.c index d9777b8ca..127e2acd5 100644 --- a/src/ultimate2.c +++ b/src/ultimate2.c @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 0, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 1, /* We support TOKENS */ + 0, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -564,47 +568,175 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("6", anope_event_away); addCoreMessage(IRCD,m); + } m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("*", NULL); addCoreMessage(IRCD,m); + } m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("C", anope_event_join); addCoreMessage(IRCD,m); + } m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("H", anope_event_kick); addCoreMessage(IRCD,m); + } m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(".", anope_event_kill); addCoreMessage(IRCD,m); + } m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("G", anope_event_mode); addCoreMessage(IRCD,m); + } m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("F", anope_event_motd); addCoreMessage(IRCD,m); + } m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("&", anope_event_nick); addCoreMessage(IRCD,m); + } m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("B", anope_event_notice); addCoreMessage(IRCD,m); + } m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("D", anope_event_part); addCoreMessage(IRCD,m); + } m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("<", anope_event_pass); addCoreMessage(IRCD,m); + } m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("9", anope_event_ping); addCoreMessage(IRCD,m); + } m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!", anope_event_privmsg); addCoreMessage(IRCD,m); + } m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(",", anope_event_quit); addCoreMessage(IRCD,m); + } m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("'", anope_event_server); addCoreMessage(IRCD,m); + } m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("-", anope_event_squit); addCoreMessage(IRCD,m); + } m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(")", anope_event_topic); addCoreMessage(IRCD,m); + } m = createMessage("USER", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("%", NULL); addCoreMessage(IRCD,m); + } m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("=", NULL); addCoreMessage(IRCD,m); + } m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("#", anope_event_whois); addCoreMessage(IRCD,m); + } m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("V", NULL); addCoreMessage(IRCD,m); + } m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("]", NULL); addCoreMessage(IRCD,m); + } m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("Z", NULL); addCoreMessage(IRCD,m); + } m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("[", NULL); addCoreMessage(IRCD,m); + } m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("Y", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("U", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSKILL", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("h", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("n", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("e", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("f", NULL); addCoreMessage(IRCD,m); + } + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("c", anope_event_sqline); addCoreMessage(IRCD,m); + } m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("d", NULL); addCoreMessage(IRCD,m); + } m = createMessage("PROTOCTL", anope_event_capab); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("_", anope_event_capab); addCoreMessage(IRCD,m); + } m = createMessage("CHGHOST", anope_event_chghost); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!<", anope_event_chghost); addCoreMessage(IRCD,m); + } m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); - m = createMessage("CHGNAME", anope_event_chgname); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!=", anope_event_chgident); addCoreMessage(IRCD,m); + } m = createMessage("NETINFO", anope_event_netinfo); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("u", anope_event_netinfo); addCoreMessage(IRCD,m); + } m = createMessage("SNETINFO", anope_event_snetinfo); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!1", anope_event_snetinfo); addCoreMessage(IRCD,m); + } m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!8", anope_event_sethost); addCoreMessage(IRCD,m); + } m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!9", anope_event_setident); addCoreMessage(IRCD,m); + } m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!;", anope_event_setname); addCoreMessage(IRCD,m); + } m = createMessage("VCTRL", anope_event_vctrl); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!I", anope_event_vctrl); addCoreMessage(IRCD,m); + } + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + + } /* *INDENT-ON* */ @@ -626,6 +758,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_remove_akill(char *user, char *host) { send_cmd(NULL, "RAKILL %s %s", host, user); @@ -694,6 +831,7 @@ void anope_cmd_svsmode(User * u, int ac, char **av) void anope_cmd_connect(int servernum) { + anope_cmd_capab(); if (servernum == 1) anope_cmd_pass(RemotePassword); if (servernum == 2) @@ -703,6 +841,15 @@ void anope_cmd_connect(int servernum) anope_cmd_server(ServerName, 1, ServerDesc); } +void anope_cmd_capab() +{ + if (UseTokens) { + send_cmd(NULL, "PROTOCTL NOQUIT TOKEN SILENCE KNOCK"); + } else { + send_cmd(NULL, "PROTOCTL NOQUIT SILENCE KNOCK"); + } +} + /* PASS */ void anope_cmd_pass(char *pass) @@ -1131,7 +1278,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1261,6 +1408,7 @@ void anope_cmd_serv_privmsg(char *source, char *dest, char *msg) void anope_cmd_nick(char *nick, char *name, char *mode) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), ServiceUser, ServiceHost, ServerName, name); anope_cmd_mode(nick, nick, "%s", mode); @@ -1315,9 +1463,10 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), user, host, ServerName, real); - anope_cmd_mode(nick, "MODE %s %s", nick, modes); + anope_cmd_mode(nick, nick, "%s", modes); anope_cmd_sqline(nick, "Reserved for services"); } @@ -1452,4 +1601,82 @@ int anope_event_snetinfo(char *source, int ac, char **av) return MOD_CONT; } +int anope_event_sqline(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +/* +** svsjoin +** +** parv[0] - sender +** parv[1] - nick to make join +** parv[2] - channel(s) to join +*/ +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSJOIN %s %s", nick, chan); +} + +/* +** svspart +** +** parv[0] - sender +** parv[1] - nick to make part +** parv[2] - channel(s) to part +*/ +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSPART %s %s", nick, chan); +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +void anope_cmd_eob() +{ + /* not supported */ +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + char *dp, *end; + + if (value && *value != ':' + && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0) + && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0) + && (*end == 0)) { + return 1; + } else { + return 0; + } +} + +int anope_event_error(char *source, int ac, char **av) +{ + if (av[0]) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} + #endif diff --git a/src/ultimate3.c b/src/ultimate3.c index 05b524db5..96197c674 100644 --- a/src/ultimate3.c +++ b/src/ultimate3.c @@ -40,7 +40,7 @@ IRCDVar ircd[] = { "+io", /* Global alias mode */ "+S", /* Used by BotServ Bots */ 5, /* Chan Max Symbols */ - "-iklmnpstRKAO", /* Modes to Remove */ + "-iklmnpqstRKAO", /* Modes to Remove */ "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -89,8 +89,9 @@ IRCDVar ircd[] = { 1, /* On nick change check if they could be identified */ 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ - 1, /* No Knock requires +i */ - NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 1, /* validate - to the #:# standard */ }, {NULL} }; @@ -221,26 +222,54 @@ void anope_set_umode(User * user, int ac, char **av) } 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, - UMODE_P, - 0, - 0, - 0, 0, 0, 0, 0, 0, 0, - UMODE_Z, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - 0, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - UMODE_p, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - UMODE_x, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, 0, 0, /* A B C */ + UMODE_D, 0, 0, /* D E F */ + 0, 0, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, 0, UMODE_0, /* M N O */ + UMODE_P, 0, 0, /* P Q R */ + UMODE_S, 0, 0, /* S T U */ + 0, UMODE_W, 0, /* V W X */ + 0, /* Y */ + UMODE_Z, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, 0, 0, /* a b c */ + UMODE_d, 0, 0, /* d e f */ + 0, UMODE_h, UMODE_i, /* g h i */ + 0, 0, 0, /* j k l */ + 0, 0, UMODE_o, /* m n o */ + UMODE_p, 0, UMODE_r, /* p q r */ + 0, 0, 0, /* s t u */ + 0, UMODE_w, UMODE_x, /* v w x */ + 0, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; @@ -346,7 +375,7 @@ CBMode cbmodes[128] = { {CMODE_n, 0, NULL, NULL}, {0}, /* o */ {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ + {CMODE_q, 0, NULL, NULL}, {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, {CMODE_s, 0, NULL, NULL}, {CMODE_t, 0, NULL, NULL}, @@ -367,6 +396,7 @@ CBModeInfo cbmodeinfos[] = { {'m', CMODE_m, 0, NULL, NULL}, {'n', CMODE_n, 0, NULL, NULL}, {'p', CMODE_p, 0, NULL, NULL}, + {'q', CMODE_q, 0, NULL, NULL}, {'r', CMODE_r, 0, NULL, NULL}, {'s', CMODE_s, 0, NULL, NULL}, {'t', CMODE_t, 0, NULL, NULL}, @@ -535,7 +565,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); @@ -583,11 +613,17 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); m = createMessage("NETINFO", NULL); addCoreMessage(IRCD,m); m = createMessage("GCONNECT", NULL); addCoreMessage(IRCD,m); - m = createMessage("NETGLOBAL", NULL); addCoreMessage(IRCD,m); + m = createMessage("NETGLOBAL", anope_event_netglobal); addCoreMessage(IRCD,m); m = createMessage("CHATOPS", NULL); addCoreMessage(IRCD,m); m = createMessage("NETCTRL", anope_event_netctrl); addCoreMessage(IRCD,m); m = createMessage("CLIENT", anope_event_client); addCoreMessage(IRCD,m); m = createMessage("SMODE", NULL); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + m = createMessage("SMODE", anope_event_mode); addCoreMessage(IRCD,m); } /* *INDENT-ON* */ @@ -621,6 +657,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_sgline(char *mask, char *reason) { send_cmd(NULL, "SGLINE %d :%s:%s", strlen(mask), mask, reason); @@ -758,43 +799,48 @@ int anope_event_mode(char *source, int ac, char **av) return MOD_CONT; } +/* EVENT : OS */ int anope_event_os(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_OperServ, av[0]); return MOD_CONT; } +/* EVENT : NS */ int anope_event_ns(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_NickServ, av[0]); return MOD_CONT; } +/* EVENT : MS */ int anope_event_ms(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_MemoServ, av[0]); return MOD_CONT; } +/* EVENT : HS */ int anope_event_hs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_HostServ, av[0]); return MOD_CONT; } +/* EVENT : CS */ int anope_event_cs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_ChanServ, av[0]); return MOD_CONT; } @@ -909,7 +955,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -968,6 +1014,7 @@ void anope_cmd_376(char *source) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, time(NULL), modes, ServiceUser, ServiceHost, ServerName, name); @@ -1002,6 +1049,7 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, time(NULL), modes, user, host, ServerName, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1144,7 +1192,8 @@ void anope_cmd_quit(char *source, const char *fmt, ...) /* PROTOCTL */ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB NICKIP SSJ5 TS5 CLIENT"); + send_cmd(NULL, + "CAPAB TS5 NOQUIT SSJ5 BURST UNCONNECT TSMODE NICKIP CLIENT"); } /* PASS */ @@ -1499,6 +1548,8 @@ void anope_cmd_connect(int servernum) } anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); + anope_cmd_svinfo(); + anope_cmd_burst(); } /* SVSHOLD - set */ @@ -1530,7 +1581,7 @@ void anope_cmd_nc_change(User * u) /* SVSMODE +d */ void anope_cmd_svid_umode2(User * u, char *ts) { - /* not used by bahamut ircds */ + // not used by bahamut ircds } void anope_cmd_svid_umode3(User * u, char *ts) @@ -1549,6 +1600,19 @@ int anope_event_svinfo(char *source, int ac, char **av) return MOD_CONT; } +/* + * SVINFO + * parv[0] = sender prefix + * parv[1] = TS_CURRENT for the server + * parv[2] = TS_MIN for the server + * parv[3] = server is standalone or connected to non-TS only + * parv[4] = server's idea of UTC time + */ +void anope_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 3 0 :%ld", time(NULL)); +} + int anope_event_pass(char *source, int ac, char **av) { /* currently not used but removes the message : unknown message from server */ @@ -1579,4 +1643,85 @@ int anope_event_sqline(char *source, int ac, char **av) return MOD_CONT; } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + + +void anope_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +void anope_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +int anope_event_error(char *source, int ac, char **av) +{ + if (ac >= 1) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} + +int anope_event_burst(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + if (s) { + s->sync = 1; + } + } + return MOD_CONT; +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_netglobal(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + + #endif diff --git a/src/unreal31.c b/src/unreal31.c index 4fcd64b0a..80e5bb62b 100644 --- a/src/unreal31.c +++ b/src/unreal31.c @@ -91,6 +91,9 @@ IRCDVar ircd[] = { 0, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support Unreal TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 1, /* validate - to the #:# standard */ }, {NULL} }; @@ -451,6 +454,18 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m); m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("O", anope_event_rehash); addCoreMessage(IRCD,m); + } + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("@", anope_event_admin); addCoreMessage(IRCD,m); + } + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AJ", anope_event_credits); addCoreMessage(IRCD,m); + } } /* *INDENT-ON* */ @@ -467,6 +482,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_remove_akill(char *user, char *host) { send_cmd(NULL, "TKL - G %s %s %s", user, host, s_OperServ); @@ -547,6 +567,7 @@ void anope_cmd_376(char *source) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, time(NULL), ServiceUser, ServiceHost, ServerName, modes, name); anope_cmd_sqline(nick, "Reserved for services"); @@ -580,6 +601,7 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, time(NULL), user, host, ServerName, modes, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1356,7 +1378,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1455,4 +1477,64 @@ void anope_cmd_svid_umode3(User * u, char *ts) /* not used */ } +/* svsjoin + parv[0] - sender + parv[1] - nick to make join + parv[2] - channel(s) to join +*/ +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSJOIN %s :%s", nick, chan); +} + +/* svspart + parv[0] - sender + parv[1] - nick to make part + parv[2] - channel(s) to part +*/ +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSPART %s :%s", nick, chan); +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* Can anyone tell me if 3.1 has this? */ +} + +void anope_cmd_eob() +{ + /* Can anyone tell me if 3.1 has this? */ +} + + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + char *dp, *end; + + if (value && *value != ':' + && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0) + && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0) + && (*end == 0)) { + return 1; + } else { + return 0; + } +} + #endif diff --git a/src/unreal32.c b/src/unreal32.c index 753ca5b39..0c942677e 100644 --- a/src/unreal32.c +++ b/src/unreal32.c @@ -91,6 +91,10 @@ IRCDVar ircd[] = { 0, /* On nick change check if they could be identified */ 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 1, /* We support Unreal TOKENS */ + 0, /* TOKENS are CASE Sensitive */ + 1, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ }, {NULL} }; @@ -129,30 +133,58 @@ IRCDCAPAB ircdcap[] = { } }; + 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, - 0, - 0, - 0, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - UMODE_g, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - UMODE_x, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, UMODE_B, UMODE_C, /* A B C */ + 0, 0, 0, /* D E F */ + UMODE_G, UMODE_H, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, UMODE_N, UMODE_O, /* M N O */ + 0, 0, UMODE_R, /* P Q R */ + UMODE_S, UMODE_T, 0, /* S T U */ + UMODE_V, UMODE_W, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, 0, 0, /* a b c */ + UMODE_d, 0, 0, /* d e f */ + UMODE_g, UMODE_h, UMODE_i, /* g h i */ + 0, 0, 0, /* j k l */ + 0, 0, UMODE_o, /* m n o */ + UMODE_p, UMODE_q, UMODE_r, /* p q r */ + UMODE_s, UMODE_t, 0, /* s t u */ + UMODE_v, UMODE_w, UMODE_x, /* v w x */ + 0, /* y */ + UMODE_z, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; - 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, @@ -160,9 +192,10 @@ char csmodes[128] = { 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, - 0, + 'h', /* (37) % Channel halfops */ + 'b', /* (38) & Channel halfops */ + 0, 0, 0, + 'q', 'v', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -171,7 +204,7 @@ 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, 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, 'a', 'a', 0 }; CMMode cmmodes[128] = { @@ -219,12 +252,12 @@ CBMode cbmodes[128] = { {0}, /* E */ {0}, /* F */ {CMODE_G, 0, NULL, NULL}, - {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, {0}, /* I */ {0}, /* J */ {CMODE_K, 0, NULL, NULL}, {CMODE_L, 0, set_redirect, cs_set_redirect}, - {0}, /* M */ + {CMODE_M, 0, NULL, NULL}, /* M */ {CMODE_N, 0, NULL, NULL}, {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, {0}, /* P */ @@ -285,9 +318,9 @@ CBModeInfo cbmodeinfos[] = { {'A', CMODE_A, 0, NULL, NULL}, {'C', CMODE_C, 0, NULL, NULL}, {'G', CMODE_G, 0, NULL, NULL}, - {'H', CMODE_H, 0, NULL, NULL}, {'K', CMODE_K, 0, NULL, NULL}, {'L', CMODE_L, 0, get_redirect, cs_get_redirect}, + {'M', CMODE_M, 0, NULL, NULL}, {'N', CMODE_N, 0, NULL, NULL}, {'O', CMODE_O, 0, NULL, NULL}, {'Q', CMODE_Q, 0, NULL, NULL}, @@ -353,6 +386,11 @@ void anope_set_umode(User * user, int ac, char **av) ac--; + if (!user || !modes) { + /* Prevent NULLs from doing bad things */ + return; + } + if (debug) alog("debug: Changing mode for %s to %s", user->nick, modes); @@ -393,7 +431,13 @@ void anope_set_umode(User * user, int ac, char **av) break; case 'r': if (add && !nick_identified(user)) { - send_cmd(ServerName, "SVSMODE %s -r", user->nick); + if (UseSVS2MODE) { + send_cmd(ServerName, "%s %s -r", + send_token("SVS2MODE", "v"), user->nick); + } else { + send_cmd(ServerName, "%s %s -r", + send_token("SVSMODE", "n"), user->nick); + } user->mode &= ~UMODE_r; } break; @@ -411,49 +455,214 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("6", anope_event_away); addCoreMessage(IRCD,m); + } m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("C", anope_event_join); addCoreMessage(IRCD,m); + } m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("H", anope_event_kick); addCoreMessage(IRCD,m); + } m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(".", anope_event_kill); addCoreMessage(IRCD,m); + } m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("G", anope_event_mode); addCoreMessage(IRCD,m); + } m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("F", anope_event_motd); addCoreMessage(IRCD,m); + } m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("&", anope_event_nick); addCoreMessage(IRCD,m); + } m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("B", anope_event_notice); addCoreMessage(IRCD,m); + } m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("D", anope_event_part); addCoreMessage(IRCD,m); + } m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("8", anope_event_ping); addCoreMessage(IRCD,m); + } m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("!", anope_event_privmsg); addCoreMessage(IRCD,m); + } m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(",", anope_event_quit); addCoreMessage(IRCD,m); + } m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("'", anope_event_server); addCoreMessage(IRCD,m); + } m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("-", anope_event_squit); addCoreMessage(IRCD,m); + } m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage(")", anope_event_topic); addCoreMessage(IRCD,m); + } m = createMessage("USER", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("%", NULL); addCoreMessage(IRCD,m); + } m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("=", NULL); addCoreMessage(IRCD,m); + } m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("#", anope_event_whois); addCoreMessage(IRCD,m); + } m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("V", NULL); addCoreMessage(IRCD,m); + } + m = createMessage("GLOBOPS", anope_event_globops); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("]", anope_event_globops); addCoreMessage(IRCD,m); + } m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("Z", NULL); addCoreMessage(IRCD,m); + } m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("[", NULL); addCoreMessage(IRCD,m); + } m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("Y", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("U", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSKILL", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("h", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("n", NULL); addCoreMessage(IRCD,m); + } + m = createMessage("SVS2MODE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("v", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("e", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("f", NULL); addCoreMessage(IRCD,m); + } m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("c", NULL); addCoreMessage(IRCD,m); + } m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("d", NULL); addCoreMessage(IRCD,m); + } m = createMessage("PROTOCTL", anope_event_capab); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("_", anope_event_capab); addCoreMessage(IRCD,m); + } m = createMessage("CHGHOST", anope_event_chghost); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AL", anope_event_chghost); addCoreMessage(IRCD,m); + } m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AZ", anope_event_chgident); addCoreMessage(IRCD,m); + } m = createMessage("CHGNAME", anope_event_chgname); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("BK", anope_event_chgname); addCoreMessage(IRCD,m); + } m = createMessage("NETINFO", anope_event_netinfo); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AO", anope_event_netinfo); addCoreMessage(IRCD,m); + } m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AA", anope_event_sethost); addCoreMessage(IRCD,m); + } m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AD", anope_event_setident); addCoreMessage(IRCD,m); + } m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AE", anope_event_setname); addCoreMessage(IRCD,m); + } m = createMessage("TKL", anope_event_tkl); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("BD", anope_event_tkl); addCoreMessage(IRCD,m); + } m = createMessage("EOS", anope_event_eos); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("ES", anope_event_eos); addCoreMessage(IRCD,m); + } m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("<", anope_event_pass); addCoreMessage(IRCD,m); + } m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("5", anope_event_error); addCoreMessage(IRCD,m); + } + /* SMO has no token */ m = createMessage("SMO", anope_event_smo); addCoreMessage(IRCD,m); + m = createMessage("UMODE2", anope_event_umode2); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("|", anope_event_umode2); addCoreMessage(IRCD,m); + } + m = createMessage("SWHOIS", anope_event_swhois); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("BA", anope_event_swhois); addCoreMessage(IRCD,m); + } + m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("~", anope_event_sjoin); addCoreMessage(IRCD,m); + } + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("O", anope_event_rehash); addCoreMessage(IRCD,m); + } + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("@", anope_event_admin); addCoreMessage(IRCD,m); + } + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AJ", anope_event_credits); addCoreMessage(IRCD,m); + } + m = createMessage("SDESC", anope_event_sdesc); addCoreMessage(IRCD,m); + if (UseTokens) { + m = createMessage("AG", anope_event_sdesc); addCoreMessage(IRCD,m); + } + /* The none token version of these is in messages.c */ + if (UseTokens) { + m = createMessage("2", m_stats); addCoreMessage(IRCD,m); + m = createMessage(">", m_time); addCoreMessage(IRCD,m); + m = createMessage("+", m_version); addCoreMessage(IRCD,m); + } } /* *INDENT-ON* */ @@ -469,32 +678,52 @@ int anope_event_capab(char *source, int ac, char **av) /* SVSNOOP */ void anope_cmd_svsnoop(char *server, int set) { - send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); + send_cmd(NULL, "%s %s %s", send_token("SVSNOOP", "f"), server, + (set ? "+" : "-")); +} + +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); } void anope_cmd_remove_akill(char *user, char *host) { - send_cmd(NULL, "TKL - G %s %s %s", user, host, s_OperServ); + send_cmd(NULL, "%s - G %s %s %s", send_token("TKL", "BD"), user, host, + s_OperServ); } void anope_cmd_topic(char *whosets, char *chan, char *whosetit, char *topic, time_t when) { - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, when, topic); + send_cmd(whosets, "%s %s %s %lu :%s", send_token("TOPIC", ")"), chan, + whosetit, when, topic); } void anope_cmd_vhost_off(char *nick) { - send_cmd(s_HostServ, "SVSMODE %s -xt", nick); + if (UseSVS2MODE) { + send_cmd(s_HostServ, "%s %s -xt", send_token("SVS2MODE", "v"), + nick); + } else { + send_cmd(s_HostServ, "%s %s -xt", send_token("SVSMODE", "n"), + nick); + } } void anope_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason) { - send_cmd(NULL, "TKL + G %s %s %s %ld %ld :%s", user, host, who, - time(NULL) + 86400 * 2, when, reason); + send_cmd(NULL, "%s + G %s %s %s %ld %ld :%s", send_token("TKL", "BD"), + user, host, who, time(NULL) + 86400 * 2, when, reason); } +/* +** svskill +** parv[0] = servername +** parv[1] = client +** parv[2] = kill message +*/ void anope_cmd_svskill(char *source, char *user, const char *fmt, ...) { va_list args; @@ -513,13 +742,32 @@ void anope_cmd_svskill(char *source, char *user, const char *fmt, ...) return; } - send_cmd(source, "SVSKILL %s :%s", user, buf); + 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 anope_cmd_svsmode(User * u, int ac, char **av) { - send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], - (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); + if (ac > 1) { + if (!u || !av[0]) { + return; + } + if (UseSVS2MODE) { + send_cmd(ServerName, "%s %s %s%s%s", + send_token("SVS2MODE", "v"), u->nick, av[0], + (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); + } else { + send_cmd(ServerName, "%s %s %s%s%s", + send_token("SVSMODE", "n"), u->nick, av[0], + (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); + } + } } /* 372 */ @@ -547,16 +795,19 @@ void anope_cmd_376(char *source) void anope_cmd_nick(char *nick, char *name, char *modes) { - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, time(NULL), - ServiceUser, ServiceHost, ServerName, modes, name); + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s * :%s", + send_token("NICK", "&"), nick, time(NULL), ServiceUser, + ServiceHost, ServerName, modes, name); anope_cmd_sqline(nick, "Reserved for services"); } void anope_cmd_guest_nick(char *nick, char *user, char *host, char *real, char *modes) { - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, time(NULL), - user, host, ServerName, modes, real); + send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s * :%s", + send_token("NICK", "&"), nick, time(NULL), user, host, + ServerName, modes, real); } void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) @@ -574,14 +825,16 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) return; } - send_cmd(source, "MODE %s %s", dest, buf); + send_cmd(source, "%s %s %s", send_token("MODE", "G"), dest, buf); } void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, time(NULL), - user, host, ServerName, modes, real); + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s * :%s", + send_token("NICK", "&"), nick, time(NULL), user, host, + ServerName, modes, real); anope_cmd_sqline(nick, "Reserved for services"); } @@ -599,9 +852,10 @@ void anope_cmd_kick(char *source, char *chan, char *user, const char *fmt, } if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); + send_cmd(source, "%s %s %s :%s", send_token("KICK", "H"), chan, + user, buf); } else { - send_cmd(source, "KICK %s %s", chan, user); + send_cmd(source, "%s %s %s", send_token("KICK", "H"), chan, user); } } @@ -620,7 +874,7 @@ void anope_cmd_notice_ops(char *source, char *dest, const char *fmt, ...) return; } - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); + send_cmd(NULL, "%s @%s :%s", send_token("NOTICE", "B"), dest, buf); } @@ -642,13 +896,14 @@ void anope_cmd_notice(char *source, char *dest, const char *fmt, ...) if (UsePrivmsg) { anope_cmd_privmsg2(source, dest, buf); } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); + send_cmd(source, "%s %s :%s", send_token("NOTICE", "B"), dest, + buf); } } void anope_cmd_notice2(char *source, char *dest, char *msg) { - send_cmd(source, "NOTICE %s :%s", dest, msg); + send_cmd(source, "%s %s :%s", send_token("NOTICE", "B"), dest, msg); } void anope_cmd_privmsg(char *source, char *dest, const char *fmt, ...) @@ -666,22 +921,22 @@ void anope_cmd_privmsg(char *source, char *dest, const char *fmt, ...) return; } - send_cmd(source, "PRIVMSG %s :%s", dest, buf); + send_cmd(source, "%s %s :%s", send_token("PRIVMSG", "!"), dest, buf); } void anope_cmd_privmsg2(char *source, char *dest, char *msg) { - send_cmd(source, "PRIVMSG %s :%s", dest, msg); + send_cmd(source, "%s %s :%s", send_token("PRIVMSG", "!"), dest, msg); } void anope_cmd_serv_notice(char *source, char *dest, char *msg) { - send_cmd(source, "NOTICE $%s :%s", dest, msg); + send_cmd(source, "%s $%s :%s", send_token("NOTICE", "B"), dest, msg); } void anope_cmd_serv_privmsg(char *source, char *dest, char *msg) { - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); + send_cmd(source, "%s $%s :%s", send_token("PRIVMSG", "!"), dest, msg); } void anope_cmd_bot_chan_mode(char *nick, char *chan) @@ -710,20 +965,36 @@ void anope_cmd_quit(char *source, const char *fmt, ...) } if (buf) { - send_cmd(source, "QUIT :%s", buf); + send_cmd(source, "%s :%s", send_token("QUIT", ","), buf); } else { - send_cmd(source, "QUIT"); + send_cmd(source, "%s", send_token("QUIT", ",")); } } /* PROTOCTL */ -void anope_cmd_protoctl() +/* + NICKv2 = Nick Version 2 + VHP = Sends hidden host + UMODE2 = sends UMODE2 on user modes + NICKIP = Sends IP on NICK + TOKEN = Use tokens to talk + SJ3 = Supports SJOIN + NOQUIT = No Quit + TKLEXT = Extended TKL we don't use it but best to have it + SJB64 = Base64 encoded time stamps + VL = Version Info + NS = Numeric Server + +*/ +void anope_cmd_capab() { - /* - See Unreal's protoctl.txt for reference - VHP - Send hostnames in NICKv2 even if not sethosted - */ - send_cmd(NULL, "PROTOCTL NICKv2 VHP"); + if (UseTokens) { + send_cmd(NULL, + "PROTOCTL NICKv2 VHP UMODE2 NICKIP TOKEN SJOIN SJOIN2 SJ3 NOQUIT TKLEXT SJB64"); + } else { + send_cmd(NULL, + "PROTOCTL NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT SJB64"); + } } /* PASS */ @@ -742,7 +1013,7 @@ void anope_cmd_server(char *servname, int hop, char *descript) /* PONG */ void anope_cmd_pong(char *servname, char *who) { - send_cmd(servname, "PONG %s", who); + send_cmd(servname, "%s %s", send_token("PONG", "9"), who); } /* JOIN */ @@ -750,16 +1021,19 @@ void anope_cmd_pong(char *servname, char *who) we get it in the common function call */ void anope_cmd_join(char *user, char *channel, time_t chantime) { - send_cmd(user, "JOIN %s", channel); + send_cmd(user, "%s %s", send_token("JOIN", "C"), channel); } -/* UNSQLINE */ +/* unsqline +** parv[0] = sender +** parv[1] = nickmask +*/ void anope_cmd_unsqline(char *user) { if (!user) { return; } - send_cmd(NULL, "UNSQLINE %s", user); + send_cmd(NULL, "%s %s", send_token("UNSQLINE", "d"), user); } /* CHGHOST */ @@ -768,7 +1042,8 @@ void anope_cmd_chghost(char *nick, char *vhost) if (!nick || !vhost) { return; } - send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); + send_cmd(ServerName, "%s %s %s", send_token("CHGHOST", "AL"), nick, + vhost); } /* CHGIDENT */ @@ -777,7 +1052,8 @@ void anope_cmd_chgident(char *nick, char *vIdent) if (!nick || !vIdent) { return; } - send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); + send_cmd(ServerName, "%s %s %s", send_token("CHGIDENT", "AZ"), nick, + vIdent); } /* INVITE */ @@ -787,7 +1063,7 @@ void anope_cmd_invite(char *source, char *chan, char *nick) return; } - send_cmd(source, "INVITE %s %s", nick, chan); + send_cmd(source, "%s %s %s", send_token("INVITE", "*"), nick, chan); } /* PART */ @@ -808,9 +1084,9 @@ void anope_cmd_part(char *nick, char *chan, const char *fmt, ...) } if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); + send_cmd(nick, "%s %s :%s", send_token("PART", "D"), chan, buf); } else { - send_cmd(nick, "PART %s", chan); + send_cmd(nick, "%s %s", send_token("PART", "D"), chan); } } @@ -1025,17 +1301,26 @@ void anope_cmd_global(char *source, const char *fmt, ...) return; } - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); + send_cmd(source ? source : ServerName, "%s :%s", + send_token("GLOBOPS", "]"), buf); } /* SQLINE */ +/* +** parv[0] = sender +** parv[1] = nickmask +** parv[2] = reason +** +** - Unreal will translate this to TKL for us +** +*/ void anope_cmd_sqline(char *mask, char *reason) { if (!mask || !reason) { return; } - send_cmd(NULL, "SQLINE %s :%s", mask, reason); + send_cmd(NULL, "%s %s :%s", send_token("SQLINE", "c"), mask, reason); } /* SQUIT */ @@ -1045,17 +1330,23 @@ void anope_cmd_squit(char *servname, char *message) return; } - send_cmd(servname, "SQUIT %s :%s", servname, message); + send_cmd(servname, "%s %s :%s", send_token("SQUIT", "-"), servname, + message); } -/* SVSO */ +/* +** svso +** parv[0] = sender prefix +** parv[1] = nick +** parv[2] = options +*/ void anope_cmd_svso(char *source, char *nick, char *flag) { if (!source || !nick || !flag) { return; } - send_cmd(source, "SVSO %s %s", nick, flag); + send_cmd(source, "%s %s %s", send_token("SVSO", "BB"), nick, flag); } /* NICK <newnick> */ @@ -1065,16 +1356,23 @@ void anope_cmd_chg_nick(char *oldnick, char *newnick) return; } - send_cmd(oldnick, "NICK %s", newnick); + send_cmd(oldnick, "%s %s", send_token("NICK", "&"), newnick); } /* SVSNICK */ +/* +** parv[0] = sender +** parv[1] = old nickname +** parv[2] = new nickname +** parv[3] = timestamp +*/ void anope_cmd_svsnick(char *source, char *guest, time_t when) { if (!source || !guest) { return; } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, when); + send_cmd(NULL, "%S %s %s :%ld", send_token("SVSNICK", "e"), source, + guest, when); } /* Functions that use serval cmd functions */ @@ -1096,7 +1394,7 @@ void anope_cmd_connect(int servernum) servernum = 1; } - anope_cmd_protoctl(); + anope_cmd_capab(); if (servernum == 1) { anope_cmd_pass(RemotePassword); } @@ -1137,8 +1435,8 @@ int anope_event_netinfo(char *source, int ac, char **av) void anope_cmd_netinfo(int ac, char **av) { - send_cmd(NULL, "NETINFO 0 %d %d %s 0 0 0 :%s", atoi(av[1]), - atoi(av[2]), av[3], av[7]); + send_cmd(NULL, "%s 0 %d %d %s 0 0 0 :%s", send_token("NETINFO", "AO"), + atoi(av[1]), atoi(av[2]), av[3], av[7]); } /* TKL @@ -1162,6 +1460,11 @@ int anope_event_tkl(char *source, int ac, char **av) int anope_event_eos(char *source, int ac, char **av) { + Server *s; + s = findserver(servlist, source); + if (s) { + s->sync = 1; + } return MOD_CONT; } @@ -1246,6 +1549,20 @@ int anope_event_mode(char *source, int ac, char **av) return MOD_CONT; } +/* Unreal sends USER modes with this */ +/* + umode2 + parv[0] - sender + parv[1] - modes to change +*/ +int anope_event_umode2(char *source, int ac, char **av) +{ + if (ac < 1) + return MOD_CONT; + + do_umode2(source, ac, av); + return MOD_CONT; +} int anope_event_kill(char *source, int ac, char **av) { @@ -1395,6 +1712,11 @@ int anope_event_sethost(char *source, int ac, char **av) ** parv[0] = new nickname ** parv[1] = hopcount */ +/* + do_nick(const char *source, char *nick, char *username, char *host, + char *server, char *realname, time_t ts, uint32 svid, + uint32 ip, char *vhost, char *uid) +*/ int anope_event_nick(char *source, int ac, char **av) { User *user; @@ -1409,7 +1731,17 @@ int anope_event_nick(char *source, int ac, char **av) */ do_nick(source, av[0], av[3], av[4], av[5], av[6], strtoul(av[2], NULL, 10), 0, 0, "*", NULL); + + } else if (ac == 11) { + user = do_nick(source, av[0], av[3], av[4], av[5], av[10], + strtoul(av[2], NULL, 10), strtoul(av[6], NULL, + 0), + base64dec(av[9]), av[8], NULL); + if (user) + anope_set_umode(user, 1, &av[7]); + } else { + /* NON NICKIP */ user = do_nick(source, av[0], av[3], av[4], av[5], av[9], strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0), 0, av[8], @@ -1446,10 +1778,18 @@ int anope_event_chghost(char *source, int ac, char **av) int anope_event_server(char *source, int ac, char **av) { char *uplink; + char *desc; + char *vl; + char *numeric; if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + + vl = myStrGetToken(av[2], ' ', 0); + numeric = myStrGetToken(vl, '-', 2); + desc = myStrGetTokenRemainder(av[2], ' ', 1); + do_server(source, av[0], av[1], desc, numeric); + return MOD_CONT; } @@ -1523,7 +1863,13 @@ void anope_cmd_unban(char *name, char *nick) /* sent if svid is something weird */ void anope_cmd_svid_umode(char *nick, time_t ts) { - send_cmd(ServerName, "SVSMODE %s +d 1", nick); + 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 */ @@ -1545,7 +1891,7 @@ void anope_cmd_svid_umode2(User * u, char *ts) void anope_cmd_svid_umode3(User * u, char *ts) { - /* not used */ + // not used } int anope_event_error(char *source, int ac, char **av) @@ -1568,4 +1914,145 @@ int anope_event_smo(char *source, int ac, char **av) return MOD_CONT; } +/* svsjoin + parv[0] - sender + parv[1] - nick to make join + parv[2] - channel(s) to join + parv[3] - (optional) channel key(s) + - current we do not support the keys part +*/ +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + send_cmd(source, "%s %s :%s", send_token("SVSJOIN", "BR"), nick, chan); +} + +/* svspart + parv[0] - sender + parv[1] - nick to make part + parv[2] - channel(s) to part +*/ +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + send_cmd(source, "%s %s :%s", send_token("SVSPART", "BT"), nick, chan); +} + +int anope_event_globops(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_swhois(char *source, int ac, char **av) +{ + return MOD_CONT; +} + + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + + +int anope_event_sdesc(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + + if (s) { + s->desc = av[0]; + } + + return MOD_CONT; +} + + +int anope_event_sjoin(char *source, int ac, char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + send_cmd(source, "SWHOIS %s :%s", who, mask); +} + +void anope_cmd_eob() +{ + send_cmd(ServerName, "EOS"); +} + + +/* svswatch + * parv[0] - sender + * parv[1] - target nick + * parv[2] - parameters + */ +void anope_cmd_svswatch(char *sender, char *nick, char *parm) +{ + send_cmd(sender, "SVSWATCH %s :%s", nick, parm); +} + +/* check if +f mode is valid for the ircd */ +/* borrowed part of the new check from channels.c in Unreal */ +int anope_flood_mode_check(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) != 0) && (strtoul(dp, &end, 10) > 0) + && (*end == 0)) { + 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 == '\0') + || !((*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; + } +} + #endif diff --git a/src/users.c b/src/users.c index a3b4fa8fe..bcbc56b69 100644 --- a/src/users.c +++ b/src/users.c @@ -383,6 +383,12 @@ User *do_nick(const char *source, char *nick, char *username, char *host, if (debug) alog("debug: new user: %s", nick); + if (ircd->nickip && ip) { + addr.s_addr = htonl(ip); + ntoa(addr, ipbuf, sizeof(ipbuf)); + } + + if (LogUsers) { /** * Ugly swap routine for Flop's bug :) @@ -398,11 +404,6 @@ User *do_nick(const char *source, char *nick, char *username, char *host, * End of ugly swap **/ - if (ircd->nickip) { - addr.s_addr = htonl(ip); - ntoa(addr, ipbuf, sizeof(ipbuf)); - } - 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); @@ -647,6 +648,24 @@ void do_umode(const char *source, int ac, char **av) anope_set_umode(user, ac - 1, &av[1]); } +/* Handle a UMODE2 command for a user. + * av[0] = modes + */ + +void do_umode2(const char *source, int ac, char **av) +{ + User *user; + + user = finduser(source); + if (!user) { + alog("user: MODE %s for nonexistent nick %s: %s", av[0], source, + merge_args(ac, av)); + return; + } + + anope_set_umode(user, ac - 1, &av[0]); +} + /*************************************************************************/ /* Handle a QUIT command. @@ -835,6 +854,45 @@ int match_usermask(const char *mask, User * user) return result; } + +/*************************************************************************/ + +/* simlar to match_usermask, except here we pass the host as the IP */ + +int match_userip(const char *mask, User * user, char *iphost) +{ + char *mask2 = sstrdup(mask); + char *nick, *username, *host; + int result; + + if (strchr(mask2, '!')) { + nick = strtok(mask2, "!"); + username = strtok(NULL, "@"); + } else { + nick = NULL; + username = strtok(mask2, "@"); + } + host = strtok(NULL, ""); + if (!username || !host) { + free(mask2); + return 0; + } + + if (nick) { + result = match_wild_nocase(nick, user->nick) + && match_wild_nocase(username, user->username) + && (match_wild_nocase(host, iphost) + || match_wild_nocase(host, user->vhost)); + } else { + result = match_wild_nocase(username, user->username) + && (match_wild_nocase(host, iphost) + || match_wild_nocase(host, user->vhost)); + } + + free(mask2); + return result; +} + /*************************************************************************/ /* Split a usermask up into its constitutent parts. Returned strings are diff --git a/src/viagra.c b/src/viagra.c index 528db9dd5..9a4cd1393 100644 --- a/src/viagra.c +++ b/src/viagra.c @@ -89,6 +89,9 @@ IRCDVar ircd[] = { 1, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 1, /* validate - to the #:# standard */ } , {NULL} @@ -222,7 +225,7 @@ char csmodes[128] = { 0, 0, 0, 0, 0, - 0, + 'h', 0, 0, 0, 0, 0, 'v', 0, 0, 0, 0, @@ -474,7 +477,11 @@ int anope_event_chgident(char *source, int ac, char **av) return MOD_CONT; } - +/* + * sethost + * parv[0] = sender + * parv[1] = newhost + */ int anope_event_sethost(char *source, int ac, char **av) { User *u; @@ -555,6 +562,69 @@ int anope_event_436(char *source, int ac, char **av) return MOD_CONT; } +int anope_event_notice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_svinfo(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +/* + * gnotice + * parv[0] = sender prefix + * parv[1] = message text + */ +int anope_event_gnotice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_sqline(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_burst(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + if (s) { + s->sync = 1; + } + } + return MOD_CONT; +} + +int anope_event_tctrl(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +/* + * error + * parv[0] = sender prefix + * parv[*] = parameters + */ +int anope_event_error(char *source, int ac, char **av) +{ + if (ac >= 1) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} /* *INDENT-OFF* */ void moduleAddIRCDMsgs(void) { @@ -563,16 +633,16 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("NOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", NULL); addCoreMessage(IRCD,m); + m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); @@ -583,7 +653,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); @@ -591,9 +661,8 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); - m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m); m = createMessage("HS", anope_event_hs); addCoreMessage(IRCD,m); @@ -604,7 +673,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SGLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); m = createMessage("SS", NULL); addCoreMessage(IRCD,m); - m = createMessage("SVINFO", NULL); addCoreMessage(IRCD,m); + m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); m = createMessage("SZLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("UNSGLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("UNSZLINE", NULL); addCoreMessage(IRCD,m); @@ -615,6 +684,12 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m); m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m); m = createMessage("VS", anope_event_vs); addCoreMessage(IRCD,m); + m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m); + m = createMessage("TCTRL", anope_event_tctrl); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("SNOTICE", anope_event_snotice); addCoreMessage(IRCD,m); } /* *INDENT-ON* */ @@ -650,6 +725,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_sgline(char *mask, char *reason) { send_cmd(NULL, "SGLINE %d :%s:%s", strlen(mask), mask, reason); @@ -714,6 +794,16 @@ void anope_cmd_join(char *user, char *channel, time_t chantime) send_cmd(user, "SJOIN %ld %s", chantime, channel); } + +/* + * m_akill() + * parv[1]=host + * parv[2]=user + * parv[3]=length + * parv[4]=akiller + * parv[5]=time set + * parv[6]=reason + */ void anope_cmd_akill(char *user, char *host, char *who, time_t when, time_t expires, char *reason) { @@ -721,6 +811,14 @@ void anope_cmd_akill(char *user, char *host, char *who, time_t when, time(NULL), reason); } + +/* + * svskill + * parv[0] = servername + * parv[1] = client + * parv[2] = nick stamp + * parv[3] = kill message + */ void anope_cmd_svskill(char *source, char *user, const char *fmt, ...) { va_list args; @@ -836,18 +934,26 @@ void anope_cmd_connect(int servernum) anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); anope_cmd_svinfo(); + anope_cmd_burst(); } -/* SVINFO */ +/* + * svinfo + * parv[0] = sender prefix + * parv[1] = TS_CURRENT for the server + * parv[2] = TS_MIN for the server + * parv[3] = server is standalone or connected to non-TS only + * parv[4] = server's idea of UTC time + */ void anope_cmd_svinfo() { - send_cmd(NULL, "SVINFO 3 1 0 :%ld", time(NULL)); + send_cmd(NULL, "SVINFO 5 3 0 :%ld", time(NULL)); } /* CAPAB */ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB NICKIP SSJOIN TS3 NOQUIT TSMODE UNCONNECT"); + send_cmd(NULL, "CAPAB TS5 NOQUIT SSJOIN BURST UNCONNECT NICKIP"); } /* PASS */ @@ -862,43 +968,48 @@ void anope_cmd_server(char *servname, int hop, char *descript) send_cmd(NULL, "SERVER %s %d :%s", ServerName, hop, ServerDesc); } +/* EVENT : OS */ int anope_event_os(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_OperServ, av[0]); return MOD_CONT; } +/* EVENT : NS */ int anope_event_ns(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_NickServ, av[0]); return MOD_CONT; } +/* EVENT : MS */ int anope_event_ms(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_MemoServ, av[0]); return MOD_CONT; } +/* EVENT : HS */ int anope_event_hs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_HostServ, av[0]); return MOD_CONT; } +/* EVENT : CS */ int anope_event_cs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_ChanServ, av[0]); return MOD_CONT; } @@ -909,7 +1020,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) { uplink = sstrdup(av[0]); } - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1321,6 +1432,7 @@ void anope_cmd_351(char *source) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, user, host, ServerName, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1348,6 +1460,7 @@ void anope_cmd_kick(char *source, char *chan, char *user, const char *fmt, void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, ServiceUser, ServiceHost, ServerName, name); anope_cmd_sqline(nick, "Reserved for services"); @@ -1474,4 +1587,66 @@ void anope_cmd_chg_nick(char *oldnick, char *newnick) send_cmd(oldnick, "NICK %s", newnick); } +/* + * svsjoin + * parv[0] = sender + * parv[1] = nick to make join + * parv[2] = channel(s) to join + */ +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSJOIN %s :%s", nick, chan); +} + +/* + * svspart + * parv[0] = sender + * parv[1] = nick to make part + * parv[2] = channel(s) to part + */ +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + send_cmd(source, "SVSPART %s :%s", nick, chan); +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_snotice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +void anope_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void anope_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + #endif |