From 792b705757dc01a9b12c3bb4f0b8855c25dbde07 Mon Sep 17 00:00:00 2001 From: "Robin Burchell w00t@inspircd.org" Date: Tue, 30 Sep 2008 18:45:10 +0000 Subject: Remove some older protocol modules, mark a number of others obsolete. Some may be rescued later on. Fix problems with anopesmtp and db-merger tool, mark epona2anope obsolete. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1203 5417fbe8-f217-4b02-8779-1006273d7864 --- src/protocol/Makefile.win32 | 4 +- src/protocol/dreamforge.c | 1383 --------------------------- src/protocol/dreamforge.h | 114 --- src/protocol/hybrid.c | 1566 ------------------------------- src/protocol/hybrid.h | 118 --- src/protocol/inspircd10.c | 1707 --------------------------------- src/protocol/inspircd10.h | 136 --- src/protocol/obsolete/hybrid.c | 1566 +++++++++++++++++++++++++++++++ src/protocol/obsolete/hybrid.h | 118 +++ src/protocol/obsolete/plexus3.c | 1853 ++++++++++++++++++++++++++++++++++++ src/protocol/obsolete/plexus3.h | 115 +++ src/protocol/obsolete/ptlink.c | 1799 +++++++++++++++++++++++++++++++++++ src/protocol/obsolete/ptlink.h | 154 +++ src/protocol/obsolete/rageircd.c | 1678 +++++++++++++++++++++++++++++++++ src/protocol/obsolete/rageircd.h | 117 +++ src/protocol/obsolete/solidircd.c | 1709 +++++++++++++++++++++++++++++++++ src/protocol/obsolete/solidircd.h | 141 +++ src/protocol/obsolete/ultimate3.c | 1817 +++++++++++++++++++++++++++++++++++ src/protocol/obsolete/ultimate3.h | 127 +++ src/protocol/obsolete/viagra.c | 1715 +++++++++++++++++++++++++++++++++ src/protocol/obsolete/viagra.h | 136 +++ src/protocol/plexus2.c | 1871 ------------------------------------- src/protocol/plexus2.h | 127 --- src/protocol/plexus3.c | 1853 ------------------------------------ src/protocol/plexus3.h | 115 --- src/protocol/ptlink.c | 1799 ----------------------------------- src/protocol/ptlink.h | 154 --- src/protocol/rageircd.c | 1678 --------------------------------- src/protocol/rageircd.h | 117 --- src/protocol/shadowircd.c | 1823 ------------------------------------ src/protocol/shadowircd.h | 145 --- src/protocol/solidircd.c | 1709 --------------------------------- src/protocol/solidircd.h | 141 --- src/protocol/ultimate2.c | 1733 ---------------------------------- src/protocol/ultimate2.h | 122 --- src/protocol/ultimate3.c | 1817 ----------------------------------- src/protocol/ultimate3.h | 127 --- src/protocol/unreal31.c | 1591 ------------------------------- src/protocol/unreal31.h | 127 --- src/protocol/viagra.c | 1715 --------------------------------- src/protocol/viagra.h | 136 --- src/tools/Makefile | 2 +- src/tools/Makefile.win32 | 2 +- src/tools/anopesmtp.c | 6 +- src/tools/db-merger.c | 58 +- src/tools/epona2anope.c | 856 ----------------- src/tools/obsolete/epona2anope.c | 856 +++++++++++++++++ 47 files changed, 13937 insertions(+), 24816 deletions(-) delete mode 100644 src/protocol/dreamforge.c delete mode 100644 src/protocol/dreamforge.h delete mode 100644 src/protocol/hybrid.c delete mode 100644 src/protocol/hybrid.h delete mode 100644 src/protocol/inspircd10.c delete mode 100644 src/protocol/inspircd10.h create mode 100644 src/protocol/obsolete/hybrid.c create mode 100644 src/protocol/obsolete/hybrid.h create mode 100644 src/protocol/obsolete/plexus3.c create mode 100644 src/protocol/obsolete/plexus3.h create mode 100644 src/protocol/obsolete/ptlink.c create mode 100644 src/protocol/obsolete/ptlink.h create mode 100644 src/protocol/obsolete/rageircd.c create mode 100644 src/protocol/obsolete/rageircd.h create mode 100644 src/protocol/obsolete/solidircd.c create mode 100644 src/protocol/obsolete/solidircd.h create mode 100644 src/protocol/obsolete/ultimate3.c create mode 100644 src/protocol/obsolete/ultimate3.h create mode 100644 src/protocol/obsolete/viagra.c create mode 100644 src/protocol/obsolete/viagra.h delete mode 100644 src/protocol/plexus2.c delete mode 100644 src/protocol/plexus2.h delete mode 100644 src/protocol/plexus3.c delete mode 100644 src/protocol/plexus3.h delete mode 100644 src/protocol/ptlink.c delete mode 100644 src/protocol/ptlink.h delete mode 100644 src/protocol/rageircd.c delete mode 100644 src/protocol/rageircd.h delete mode 100644 src/protocol/shadowircd.c delete mode 100644 src/protocol/shadowircd.h delete mode 100644 src/protocol/solidircd.c delete mode 100644 src/protocol/solidircd.h delete mode 100644 src/protocol/ultimate2.c delete mode 100644 src/protocol/ultimate2.h delete mode 100644 src/protocol/ultimate3.c delete mode 100644 src/protocol/ultimate3.h delete mode 100644 src/protocol/unreal31.c delete mode 100644 src/protocol/unreal31.h delete mode 100644 src/protocol/viagra.c delete mode 100644 src/protocol/viagra.h delete mode 100644 src/tools/epona2anope.c create mode 100644 src/tools/obsolete/epona2anope.c (limited to 'src') diff --git a/src/protocol/Makefile.win32 b/src/protocol/Makefile.win32 index 32e3ae1d5..3a71ff2ff 100644 --- a/src/protocol/Makefile.win32 +++ b/src/protocol/Makefile.win32 @@ -1,7 +1,7 @@ include ../../Makefile.inc.win32 -SRCS=bahamut.c charybdis.c dreamforge.c hybrid.c inspircd10.c inspircd11.c plexus2.c plexus3.c ptlink.c rageircd.c \ - ratbox.c shadowircd.c solidircd.c ultimate2.c ultimate3.c unreal31.c unreal32.c viagra.c +SRCS=bahamut.c charybdis.c inspircd11.c \ + ratbox.c shadowircd.c unreal32.c OBJECTS= $(SRCS:.c=.dll) CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include" diff --git a/src/protocol/dreamforge.c b/src/protocol/dreamforge.c deleted file mode 100644 index 02fd2311f..000000000 --- a/src/protocol/dreamforge.c +++ /dev/null @@ -1,1383 +0,0 @@ -/* DreamForge IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "dreamforge.h" - -IRCDVar myIrcd[] = { - {"DreamForge 4.6.7", /* ircd name */ - "+o", /* nickserv mode */ - "+o", /* chanserv mode */ - "+o", /* memoserv mode */ - "+", /* hostserv mode */ - "+io", /* operserv mode */ - "+o", /* botserv mode */ - "+h", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+io", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+h", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+", /* Used by BotServ Bots */ - 2, /* Chan Max Symbols */ - "-iklmnpstR", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 0, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - NULL, /* Mode to set for chan admin */ - NULL, /* Mode to unset for chan admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "+d", /* Mode on Nick Change */ - 0, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 0, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 0, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 1, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 1, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 0, /* vidents */ - 0, /* svshold */ - 1, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 0, /* VHOST ON NICK */ - 0, /* Change RealName */ - 0, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - 0, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* Mode */ - 0, /* Mode */ - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - NULL, /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - 0, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - CAPAB_TOKEN, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - -void dreamforge_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - } - } -} - - -unsigned long umodes[128] = { - 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, UMODE_w, 0, /* v w x */ - 0, /* y */ - 0, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - -char myCsmodes[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, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {0}, /* M */ - {0}, /* N */ - {0}, /* O */ - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {0}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -int anope_event_nick(const char *source, int ac, const char **av) -{ - if (ac != 2) { - do_nick(source, av[0], av[3], av[4], av[5], av[7], - strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0), 0, NULL, - NULL); - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", anope_event_null); 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", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", anope_event_null); 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_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); - - -} - -/* *INDENT-ON* */ - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -void dreamforge_cmd_sqline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -void DreamForgeProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void dreamforge_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void DreamForgeProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - -void dreamforge_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -/* PART */ -void dreamforge_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - - -void dreamforge_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -void dreamforge_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "JOIN %s", channel); -} - -void dreamforge_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s :%s", host, user, reason); -} - - -void dreamforge_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - send_cmd(source, "KILL %s :%s", user, buf); -} - -void dreamforge_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], - (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); -} - - -void dreamforge_cmd_squit(const char *servname, const char *message) -{ - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -void anope_pong(char *servname) -{ - send_cmd(servname, "PONG %s", servname); -} - -/* PASS */ -void dreamforge_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS :%s", pass); -} - -void dreamforge_cmd_capab() -{ - send_cmd(NULL, "PROTOCTL NOQUIT"); -} - -/* SERVER name hop descript */ -void dreamforge_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -void dreamforge_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - dreamforge_cmd_capab(); - if (servernum == 1) - dreamforge_cmd_pass(RemotePassword); - if (servernum == 2) - dreamforge_cmd_pass(RemotePassword2); - if (servernum == 3) - dreamforge_cmd_pass(RemotePassword3); - dreamforge_cmd_server(ServerName, 1, ServerDesc); -} - -void dreamforge_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); -} - - - -/* GLOBOPS */ -void dreamforge_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -void dreamforge_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "MODE %s %s", dest, buf); -} - -void dreamforge_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void dreamforge_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - dreamforge_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void dreamforge_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void dreamforge_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void dreamforge_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void dreamforge_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void dreamforge_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -void dreamforge_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); - -} - -/* QUIT */ -void dreamforge_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -/* 391 */ -void dreamforge_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void dreamforge_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void dreamforge_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void dreamforge_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void dreamforge_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void dreamforge_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void dreamforge_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void dreamforge_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void dreamforge_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void dreamforge_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void dreamforge_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void dreamforge_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void dreamforge_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), ServiceUser, ServiceHost, ServerName, - name); - anope_cmd_mode(nick, nick, "%s", modes); - dreamforge_cmd_sqline(nick, "Reserved for services"); -} - -void dreamforge_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - dreamforge_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -void dreamforge_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void dreamforge_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void dreamforge_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void dreamforge_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -/* INVITE */ -void dreamforge_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* PONG */ -void dreamforge_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -void dreamforge_cmd_bot_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), user, host, ServerName, real); - anope_cmd_mode(nick, nick, "MODE %s", modes); - dreamforge_cmd_sqline(nick, "Reserved for services"); -} - -/* SVSHOLD - set */ -void dreamforge_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void dreamforge_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* UNSGLINE */ -void dreamforge_cmd_unsgline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* UNSZLINE */ -void dreamforge_cmd_unszline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* SZLINE */ -void dreamforge_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - /* Not Supported by this IRCD */ -} - -/* SGLINE */ -void dreamforge_cmd_sgline(const char *mask, const char *reason) -{ - /* Not Supported by this IRCD */ -} - -/* SVSNICK */ -void dreamforge_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -void dreamforge_cmd_guest_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), user, host, ServerName, real); - anope_cmd_mode(nick, nick, "MODE %s", modes); -} - -void dreamforge_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void dreamforge_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - /* Not Supported by this IRCD */ -} - -void dreamforge_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void dreamforge_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -void dreamforge_cmd_vhost_off(User * u) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void dreamforge_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s +d 1", nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void dreamforge_cmd_nc_change(User * u) -{ - common_svsmode(u, "-r+d", "1"); -} - -/* SVSMODE +r */ -void dreamforge_cmd_svid_umode2(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -void dreamforge_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -/* NICK */ -void dreamforge_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -void dreamforge_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Not Supported by this IRCD */ -} - -void dreamforge_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Not Supported by this IRCD */ -} - -void dreamforge_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int dreamforge_flood_mode_check(const char *value) -{ - return 0; -} - -void dreamforge_cmd_eob() -{ - /* Not supported */ -} - -void dreamforge_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - dreamforge_cmd_squit(jserver, rbuf); - dreamforge_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void dreamforge_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int dreamforge_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int dreamforge_valid_chan(const char *chan) -{ - /* no hard coded invalid chan */ - return 1; -} - - -void dreamforge_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - - char *s; - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(dreamforge_cmd_topic); - pmodule_cmd_vhost_off(dreamforge_cmd_vhost_off); - pmodule_cmd_akill(dreamforge_cmd_akill); - pmodule_cmd_svskill(dreamforge_cmd_svskill); - pmodule_cmd_svsmode(dreamforge_cmd_svsmode); - pmodule_cmd_372(dreamforge_cmd_372); - pmodule_cmd_372_error(dreamforge_cmd_372_error); - pmodule_cmd_375(dreamforge_cmd_375); - pmodule_cmd_376(dreamforge_cmd_376); - pmodule_cmd_nick(dreamforge_cmd_nick); - pmodule_cmd_guest_nick(dreamforge_cmd_guest_nick); - pmodule_cmd_mode(dreamforge_cmd_mode); - pmodule_cmd_bot_nick(dreamforge_cmd_bot_nick); - pmodule_cmd_kick(dreamforge_cmd_kick); - pmodule_cmd_notice_ops(dreamforge_cmd_notice_ops); - pmodule_cmd_notice(dreamforge_cmd_notice); - pmodule_cmd_notice2(dreamforge_cmd_notice2); - pmodule_cmd_privmsg(dreamforge_cmd_privmsg); - pmodule_cmd_privmsg2(dreamforge_cmd_privmsg2); - pmodule_cmd_serv_notice(dreamforge_cmd_serv_notice); - pmodule_cmd_serv_privmsg(dreamforge_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(dreamforge_cmd_bot_chan_mode); - pmodule_cmd_351(dreamforge_cmd_351); - pmodule_cmd_quit(dreamforge_cmd_quit); - pmodule_cmd_pong(dreamforge_cmd_pong); - pmodule_cmd_join(dreamforge_cmd_join); - pmodule_cmd_unsqline(dreamforge_cmd_unsqline); - pmodule_cmd_invite(dreamforge_cmd_invite); - pmodule_cmd_part(dreamforge_cmd_part); - pmodule_cmd_391(dreamforge_cmd_391); - pmodule_cmd_250(dreamforge_cmd_250); - pmodule_cmd_307(dreamforge_cmd_307); - pmodule_cmd_311(dreamforge_cmd_311); - pmodule_cmd_312(dreamforge_cmd_312); - pmodule_cmd_317(dreamforge_cmd_317); - pmodule_cmd_219(dreamforge_cmd_219); - pmodule_cmd_401(dreamforge_cmd_401); - pmodule_cmd_318(dreamforge_cmd_318); - pmodule_cmd_242(dreamforge_cmd_242); - pmodule_cmd_243(dreamforge_cmd_243); - pmodule_cmd_211(dreamforge_cmd_211); - pmodule_cmd_global(dreamforge_cmd_global); - pmodule_cmd_global_legacy(dreamforge_cmd_global_legacy); - pmodule_cmd_sqline(dreamforge_cmd_sqline); - pmodule_cmd_squit(dreamforge_cmd_squit); - pmodule_cmd_svso(dreamforge_cmd_svso); - pmodule_cmd_chg_nick(dreamforge_cmd_chg_nick); - pmodule_cmd_svsnick(dreamforge_cmd_svsnick); - pmodule_cmd_vhost_on(dreamforge_cmd_vhost_on); - pmodule_cmd_connect(dreamforge_cmd_connect); - pmodule_cmd_svshold(dreamforge_cmd_svshold); - pmodule_cmd_release_svshold(dreamforge_cmd_release_svshold); - pmodule_cmd_unsgline(dreamforge_cmd_unsgline); - pmodule_cmd_unszline(dreamforge_cmd_unszline); - pmodule_cmd_szline(dreamforge_cmd_szline); - pmodule_cmd_sgline(dreamforge_cmd_sgline); - pmodule_cmd_unban(dreamforge_cmd_unban); - pmodule_cmd_svsmode_chan(dreamforge_cmd_svsmode_chan); - pmodule_cmd_svid_umode(dreamforge_cmd_svid_umode); - pmodule_cmd_nc_change(dreamforge_cmd_nc_change); - pmodule_cmd_svid_umode2(dreamforge_cmd_svid_umode2); - pmodule_cmd_svid_umode3(dreamforge_cmd_svid_umode3); - pmodule_cmd_svsjoin(dreamforge_cmd_svsjoin); - pmodule_cmd_svspart(dreamforge_cmd_svspart); - pmodule_cmd_swhois(dreamforge_cmd_swhois); - pmodule_cmd_eob(dreamforge_cmd_eob); - pmodule_flood_mode_check(dreamforge_flood_mode_check); - pmodule_cmd_jupe(dreamforge_cmd_jupe); - pmodule_valid_nick(dreamforge_valid_nick); - pmodule_valid_chan(dreamforge_valid_chan); - pmodule_cmd_ctcp(dreamforge_cmd_ctcp); - pmodule_set_umode(dreamforge_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("DreamForge 4.6.7"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/dreamforge.h b/src/protocol/dreamforge.h deleted file mode 100644 index 304b30d2f..000000000 --- a/src/protocol/dreamforge.h +++ /dev/null @@ -1,114 +0,0 @@ -/* DreamForge IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 /* Services Admin */ -#define UMODE_h 0x00000002 /* Help system operator */ -#define UMODE_i 0x00000004 /* makes user invisible */ -#define UMODE_o 0x00000008 /* Operator */ -#define UMODE_r 0x00000010 /* Nick set by services as registered */ -#define UMODE_w 0x00000020 /* send wallops to them */ -#define UMODE_A 0x00000040 /* Admin */ -#define UMODE_O 0x00000080 /* Local operator */ -#define UMODE_s 0x00000100 /* server notices such as kill */ -#define UMODE_k 0x00000200 /* Show server-kills... */ -#define UMODE_c 0x00000400 /* Show client information */ -#define UMODE_f 0x00000800 /* Receive flood warnings */ -#define UMODE_g 0x80000000 /* Shows some global messages */ - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void dreamforge_set_umode(User * user, int ac, const char **av); -void dreamforge_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void dreamforge_cmd_vhost_off(User * u); -void dreamforge_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void dreamforge_cmd_svskill(const char *source, const char *user, const char *buf); -void dreamforge_cmd_svsmode(User * u, int ac, const char **av); -void dreamforge_cmd_372(const char *source, const char *msg); -void dreamforge_cmd_372_error(const char *source); -void dreamforge_cmd_375(const char *source); -void dreamforge_cmd_376(const char *source); -void dreamforge_cmd_nick(const char *nick, const char *name, const char *modes); -void dreamforge_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void dreamforge_cmd_mode(const char *source, const char *dest, const char *buf); -void dreamforge_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void dreamforge_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void dreamforge_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void dreamforge_cmd_notice(const char *source, const char *dest, const char *buf); -void dreamforge_cmd_notice2(const char *source, const char *dest, const char *msg); -void dreamforge_cmd_privmsg(const char *source, const char *dest, const char *buf); -void dreamforge_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void dreamforge_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void dreamforge_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void dreamforge_cmd_bot_chan_mode(const char *nick, const char *chan); -void dreamforge_cmd_351(const char *source); -void dreamforge_cmd_quit(const char *source, const char *buf); -void dreamforge_cmd_pong(const char *servname, const char *who); -void dreamforge_cmd_join(const char *user, const char *channel, time_t chantime); -void dreamforge_cmd_unsqline(const char *user); -void dreamforge_cmd_invite(const char *source, const char *chan, const char *nick); -void dreamforge_cmd_part(const char *nick, const char *chan, const char *buf); -void dreamforge_cmd_391(const char *source, const char *timestr); -void dreamforge_cmd_250(const char *buf); -void dreamforge_cmd_307(const char *buf); -void dreamforge_cmd_311(const char *buf); -void dreamforge_cmd_312(const char *buf); -void dreamforge_cmd_317(const char *buf); -void dreamforge_cmd_219(const char *source, const char *letter); -void dreamforge_cmd_401(const char *source, const char *who); -void dreamforge_cmd_318(const char *source, const char *who); -void dreamforge_cmd_242(const char *buf); -void dreamforge_cmd_243(const char *buf); -void dreamforge_cmd_211(const char *buf); -void dreamforge_cmd_global(const char *source, const char *buf); -void dreamforge_cmd_global_legacy(const char *source, const char *fmt); -void dreamforge_cmd_sqline(const char *mask, const char *reason); -void dreamforge_cmd_squit(const char *servname, const char *message); -void dreamforge_cmd_svso(const char *source, const char *nick, const char *flag); -void dreamforge_cmd_chg_nick(const char *oldnick, const char *newnick); -void dreamforge_cmd_svsnick(const char *source, const char *guest, time_t when); -void dreamforge_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void dreamforge_cmd_connect(int servernum); -void dreamforge_cmd_svshold(const char *nick); -void dreamforge_cmd_release_svshold(const char *nick); -void dreamforge_cmd_unsgline(const char *mask); -void dreamforge_cmd_unszline(const char *mask); -void dreamforge_cmd_szline(const char *mask, const char *reason, const char *whom); -void dreamforge_cmd_sgline(const char *mask, const char *reason); -void dreamforge_cmd_unban(const char *name, const char *nick); -void dreamforge_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void dreamforge_cmd_svid_umode(const char *nick, time_t ts); -void dreamforge_cmd_nc_change(User * u); -void dreamforge_cmd_svid_umode2(User * u, const char *ts); -void dreamforge_cmd_svid_umode3(User * u, const char *ts); -void dreamforge_cmd_eob(); -int dreamforge_flood_mode_check(const char *value); -void dreamforge_cmd_jupe(const char *jserver, const char *who, const char *reason); -int dreamforge_valid_nick(const char *nick); -void dreamforge_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class DreamForgeProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/hybrid.c b/src/protocol/hybrid.c deleted file mode 100644 index e04a6c54a..000000000 --- a/src/protocol/hybrid.c +++ /dev/null @@ -1,1566 +0,0 @@ -/* Hybrid IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "hybrid.h" - -IRCDVar myIrcd[] = { - {"HybridIRCd 7.*", /* ircd name */ - "+o", /* nickserv mode */ - "+o", /* chanserv mode */ - "+o", /* memoserv mode */ - NULL, /* hostserv mode */ - "+aio", /* operserv mode */ - "+o", /* botserv mode */ - "+h", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+io", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - NULL, /* hostserv alias mode */ - "+aio", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+h", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+", /* Used by BotServ Bots */ - 3, /* Chan Max Symbols */ - "-ailmnpst", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 0, /* SVSNICK */ - 0, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - NULL, /* Mode to set for admin */ - NULL, /* Mode to unset for admin */ - NULL, /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - NULL, /* Mode on UnReg */ - NULL, /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 1, /* Join 2 Set */ - 1, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 0, /* Chan Reg */ - 0, /* Channel Mode */ - 0, /* vidents */ - 0, /* svshold */ - 0, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* UMODE */ - 0, /* O:LINE */ - 0, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_p, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - 0, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* +f Mode */ - 0, /* +L Mode */ - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - NULL, /* vhost char */ - 0, /* ts6 */ - 0, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - 0, /* BURST */ - CAPAB_TS5, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - CAPAB_QS, /* QS */ - CAPAB_UID, /* UID */ - CAPAB_KNOCK, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - - - -void hybrid_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - send_cmd(ServerName, "SVSMODE %s -r", user->nick); - user->mode &= ~UMODE_r; - } - break; - - } - } -} - -unsigned long umodes[128] = { - 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 myCsmodes[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) ! */ - 0, 0, 0, - 'h', - 0, 0, 0, 0, - 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {0}, /* M */ - {0}, /* N */ - {0}, /* O */ - {0}, /* P */ - {0}, /* Q */ - {0}, - {0}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {CMODE_a, 0, NULL, NULL}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {0}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'a', CMODE_a, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {0} -}; - - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void hybrid_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - hybrid_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void hybrid_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void hybrid_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void hybrid_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void hybrid_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $$%s :%s", dest, msg); -} - -void hybrid_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $$%s :%s", dest, msg); -} - - -void hybrid_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "OPERWALL :%s", buf); -} - -/* GLOBOPS - to handle old WALLOPS */ -void hybrid_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt); -} - -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -int anope_event_nick(const char *source, int ac, const char **av) -{ - if (ac != 2) { - User *user = do_nick(source, av[0], av[4], av[5], av[6], av[7], - strtoul(av[2], NULL, 10), 0, 0, NULL, NULL); - if (user) - anope_set_umode(user, 1, &av[3]); - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac == 4) { - do_topic(source, ac, av); - } else { - Channel *c = findchan(av[0]); - time_t topic_time = time(NULL); - - if (!c) { - if (debug) { - alog("debug: TOPIC %s for nonexistent channel %s", - merge_args(ac - 1, av + 1), av[0]); - } - return MOD_CONT; - } - - if (check_topiclock(c, topic_time)) - return MOD_CONT; - - if (c->topic) { - free(c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[1]) - c->topic = sstrdup(av[1]); - - strscpy(c->topic_setter, source, sizeof(c->topic_setter)); - c->topic_time = topic_time; - - record_topic(av[0]); - - if (ac > 1 && *av[1]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - } - return MOD_CONT; -} - -int anope_event_tburst(const char *source, int ac, const char **av) -{ - if (ac != 5) - return MOD_CONT; - - av[0] = av[1]; - av[1] = av[3]; - av[3] = av[4]; - do_topic(source, 4, av); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", 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", 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); - 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("TBURST", anope_event_tburst); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_null); addCoreMessage(IRCD,m); - 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* */ - - -void hybrid_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(ServerName, "RESV * %s :%s", mask, reason); -} -void hybrid_cmd_unsgline(const char *mask) -{ - if (!mask) { - return; - } - - send_cmd(ServerName, "UNXLINE * %s", mask); -} - -void hybrid_cmd_unszline(const char *mask) -{ - /* Does not support */ -} -void hybrid_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - /* Does not support */ -} - -void hybrid_cmd_svsadmin(const char *server, int set) -{ -} - -void hybrid_cmd_sgline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(ServerName, "XLINE * %s 0 :%s", mask, reason); -} - -void HybridIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - /* hybrid seems to support UNKLINE -Certus */ - send_cmd(s_OperServ, "UNKLINE * %s %s", user, host); -} - -void hybrid_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s :%s", chan, topic); -} - -void hybrid_cmd_vhost_off(User * u) -{ - /* does not support vhosting */ -} - -void hybrid_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - /* does not support vhosting */ -} - -void hybrid_cmd_unsqline(const char *user) -{ - if (!user) { - return; - } - - send_cmd(ServerName, "UNRESV * %s", user); -} - -void hybrid_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime, channel, - user); -} - -/* -oper: the nick of the oper performing the kline -target.server: the server(s) this kline is destined for -duration: the duration if a tkline, 0 if permanent. -user: the 'user' portion of the kline -host: the 'host' portion of the kline -reason: the reason for the kline. -*/ - -void hybrid_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(s_OperServ, "KLINE * %ld %s %s :%s", - (long int) (expires - (long) time(NULL)), user, host, reason); -} - -void hybrid_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - send_cmd(source, "KILL %s :%s", user, buf); -} - - -void hybrid_cmd_svsmode(User * u, int ac, const char **av) -{ - /* Hybrid does not support SVSMODE */ -} - -/* - * 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 hybrid_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 5 5 0 :%ld", (long int) time(NULL)); -} - -/* 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 hybrid_cmd_capab() -{ - send_cmd(NULL, - "CAPAB :QS EX CHW IE KLN GLN HOPS HUB AOPS KNOCK TBURST PARA"); -} - -/* PASS */ -void hybrid_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -/* SERVER name hop descript */ -void hybrid_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} -void hybrid_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) - hybrid_cmd_pass(RemotePassword); - else if (servernum == 2) - hybrid_cmd_pass(RemotePassword2); - else if (servernum == 3) - hybrid_cmd_pass(RemotePassword3); - - hybrid_cmd_capab(); - hybrid_cmd_server(ServerName, 1, ServerDesc); - hybrid_cmd_svinfo(); -} - -void hybrid_cmd_svsinfo() -{ - /* not used */ -} - - - -void hybrid_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); - -} - -void hybrid_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - hybrid_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - -int anope_event_eob(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver(servlist, source); - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - - return MOD_CONT; -} - -void hybrid_cmd_eob() -{ -/* send_cmd(ServerName, "EOB"); */ -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - -void hybrid_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void hybrid_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void hybrid_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void hybrid_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -/* 391 */ -void hybrid_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void hybrid_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void hybrid_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void hybrid_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void hybrid_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void hybrid_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void hybrid_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void hybrid_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void hybrid_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void hybrid_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void hybrid_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void hybrid_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void hybrid_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "MODE %s %s", dest, buf); -} - -void hybrid_cmd_nick(const char *nick, const char *name, const char *mode) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, - (long int) time(NULL), mode, ServiceUser, ServiceHost, - ServerName, (name)); -} - -void hybrid_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void hybrid_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - -void hybrid_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); -} - -/* QUIT */ -void hybrid_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -/* PONG */ -void hybrid_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* INVITE */ -void hybrid_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* SQUIT */ -void hybrid_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - -void hybrid_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - int argvsize = 8; - int argc; - const char **argv; - char *str; - - if (ac < 1) - return MOD_CONT; - - /* We get the params as one arg, we should split it for capab_parse */ - argv = (const char **)scalloc(argvsize, sizeof(const char *)); - argc = 0; - while ((str = myStrGetToken(av[0], ' ', argc))) { - if (argc == argvsize) { - argvsize += 8; - argv = (const char **)srealloc(argv, argvsize * sizeof(const char *)); - } - argv[argc] = str; - argc++; - } - - capab_parse(argc, argv); - - /* Free our built ac/av */ - for (argvsize = 0; argvsize < argc; argvsize++) { - free((char *)argv[argvsize]); - } - free((char **)argv); - - return MOD_CONT; -} - -/* SVSHOLD - set */ -void hybrid_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void hybrid_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSNICK */ -void hybrid_cmd_svsnick(const char *nick, const char *newnick, time_t when) -{ - /* Not Supported by this IRCD */ -} - -void hybrid_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); -} - -void hybrid_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void hybrid_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void hybrid_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void hybrid_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s +d 1", nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void hybrid_cmd_nc_change(User * u) -{ - /* not used */ -} - -/* SVSMODE +d */ -void hybrid_cmd_svid_umode2(User * u, const char *ts) -{ - /* not used */ -} - - -void hybrid_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -/* NICK */ -void hybrid_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* - * 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 - */ -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -void hybrid_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Not Supported by this IRCD */ -} - -void hybrid_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Not Supported by this IRCD */ -} - -void hybrid_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_invite(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int hybrid_flood_mode_check(const char *value) -{ - return 0; -} - -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void hybrid_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - hybrid_cmd_squit(jserver, rbuf); - hybrid_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int hybrid_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int hybrid_valid_chan(const char *chan) -{ - /* no hard coded invalid chans */ - return 1; -} - - -void hybrid_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(hybrid_cmd_topic); - pmodule_cmd_vhost_off(hybrid_cmd_vhost_off); - pmodule_cmd_akill(hybrid_cmd_akill); - pmodule_cmd_svskill(hybrid_cmd_svskill); - pmodule_cmd_svsmode(hybrid_cmd_svsmode); - pmodule_cmd_372(hybrid_cmd_372); - pmodule_cmd_372_error(hybrid_cmd_372_error); - pmodule_cmd_375(hybrid_cmd_375); - pmodule_cmd_376(hybrid_cmd_376); - pmodule_cmd_nick(hybrid_cmd_nick); - pmodule_cmd_guest_nick(hybrid_cmd_guest_nick); - pmodule_cmd_mode(hybrid_cmd_mode); - pmodule_cmd_bot_nick(hybrid_cmd_bot_nick); - pmodule_cmd_kick(hybrid_cmd_kick); - pmodule_cmd_notice_ops(hybrid_cmd_notice_ops); - pmodule_cmd_notice(hybrid_cmd_notice); - pmodule_cmd_notice2(hybrid_cmd_notice2); - pmodule_cmd_privmsg(hybrid_cmd_privmsg); - pmodule_cmd_privmsg2(hybrid_cmd_privmsg2); - pmodule_cmd_serv_notice(hybrid_cmd_serv_notice); - pmodule_cmd_serv_privmsg(hybrid_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(hybrid_cmd_bot_chan_mode); - pmodule_cmd_351(hybrid_cmd_351); - pmodule_cmd_quit(hybrid_cmd_quit); - pmodule_cmd_pong(hybrid_cmd_pong); - pmodule_cmd_join(hybrid_cmd_join); - pmodule_cmd_unsqline(hybrid_cmd_unsqline); - pmodule_cmd_invite(hybrid_cmd_invite); - pmodule_cmd_part(hybrid_cmd_part); - pmodule_cmd_391(hybrid_cmd_391); - pmodule_cmd_250(hybrid_cmd_250); - pmodule_cmd_307(hybrid_cmd_307); - pmodule_cmd_311(hybrid_cmd_311); - pmodule_cmd_312(hybrid_cmd_312); - pmodule_cmd_317(hybrid_cmd_317); - pmodule_cmd_219(hybrid_cmd_219); - pmodule_cmd_401(hybrid_cmd_401); - pmodule_cmd_318(hybrid_cmd_318); - pmodule_cmd_242(hybrid_cmd_242); - pmodule_cmd_243(hybrid_cmd_243); - pmodule_cmd_211(hybrid_cmd_211); - pmodule_cmd_global(hybrid_cmd_global); - pmodule_cmd_global_legacy(hybrid_cmd_global_legacy); - pmodule_cmd_sqline(hybrid_cmd_sqline); - pmodule_cmd_squit(hybrid_cmd_squit); - pmodule_cmd_svso(hybrid_cmd_svso); - pmodule_cmd_chg_nick(hybrid_cmd_chg_nick); - pmodule_cmd_svsnick(hybrid_cmd_svsnick); - pmodule_cmd_vhost_on(hybrid_cmd_vhost_on); - pmodule_cmd_connect(hybrid_cmd_connect); - pmodule_cmd_svshold(hybrid_cmd_svshold); - pmodule_cmd_release_svshold(hybrid_cmd_release_svshold); - pmodule_cmd_unsgline(hybrid_cmd_unsgline); - pmodule_cmd_unszline(hybrid_cmd_unszline); - pmodule_cmd_szline(hybrid_cmd_szline); - pmodule_cmd_sgline(hybrid_cmd_sgline); - pmodule_cmd_unban(hybrid_cmd_unban); - pmodule_cmd_svsmode_chan(hybrid_cmd_svsmode_chan); - pmodule_cmd_svid_umode(hybrid_cmd_svid_umode); - pmodule_cmd_nc_change(hybrid_cmd_nc_change); - pmodule_cmd_svid_umode2(hybrid_cmd_svid_umode2); - pmodule_cmd_svid_umode3(hybrid_cmd_svid_umode3); - pmodule_cmd_svsjoin(hybrid_cmd_svsjoin); - pmodule_cmd_svspart(hybrid_cmd_svspart); - pmodule_cmd_swhois(hybrid_cmd_swhois); - pmodule_cmd_eob(hybrid_cmd_eob); - pmodule_flood_mode_check(hybrid_flood_mode_check); - pmodule_cmd_jupe(hybrid_cmd_jupe); - pmodule_valid_nick(hybrid_valid_nick); - pmodule_valid_chan(hybrid_valid_chan); - pmodule_cmd_ctcp(hybrid_cmd_ctcp); - pmodule_set_umode(hybrid_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("Hybrid IRCd 7.0"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/hybrid.h b/src/protocol/hybrid.h deleted file mode 100644 index 42a4fabaf..000000000 --- a/src/protocol/hybrid.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Hybrid IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 /* Admin status */ -#define UMODE_b 0x00000080 /* See bot and drone flooding notices */ -#define UMODE_c 0x00000100 /* Client connection/quit notices */ -#define UMODE_d 0x00000200 /* See debugging notices */ -#define UMODE_f 0x00000400 /* See I: line full notices */ -#define UMODE_g 0x00000800 /* Server Side Ignore */ -#define UMODE_i 0x00000004 /* Not shown in NAMES or WHO unless you share a channel */ -#define UMODE_k 0x00001000 /* See server generated KILL messages */ -#define UMODE_l 0x00002000 /* See LOCOPS messages */ -#define UMODE_n 0x00004000 /* See client nick changes */ -#define UMODE_o 0x00000008 /* Operator status */ -#define UMODE_r 0x00000010 /* See rejected client notices */ -#define UMODE_s 0x00008000 /* See general server notices */ -#define UMODE_u 0x00010000 /* See unauthorized client notices */ -#define UMODE_w 0x00000020 /* See server generated WALLOPS */ -#define UMODE_x 0x00020000 /* See remote server connection and split notices */ -#define UMODE_y 0x00040000 /* See LINKS, STATS (if configured), TRACE notices */ -#define UMODE_z 0x00080000 /* See oper generated WALLOPS */ - -#define CMODE_i 0x00000001 /* Invite only */ -#define CMODE_m 0x00000002 /* Users without +v/h/o cannot send text to the channel */ -#define CMODE_n 0x00000004 /* Users must be in the channel to send text to it */ -#define CMODE_p 0x00000008 /* Private is obsolete, this now restricts KNOCK */ -#define CMODE_s 0x00000010 /* The channel does not show up on NAMES or LIST */ -#define CMODE_t 0x00000020 /* Only chanops can change the topic */ -#define CMODE_k 0x00000040 /* Key/password for the channel. */ -#define CMODE_l 0x00000080 /* Limit the number of users in a channel */ -#define CMODE_a 0x00000400 /* Anonymous ops, chanops are hidden */ - - -#define DEFAULT_MLOCK CMODE_n | CMODE_t - -void hybrid_set_umode(User * user, int ac, const char **av); -void hybrid_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void hybrid_cmd_vhost_off(User * u); -void hybrid_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void hybrid_cmd_svskill(const char *source, const char *user, const char *buf); -void hybrid_cmd_svsmode(User * u, int ac, const char **av); -void hybrid_cmd_372(const char *source, const char *msg); -void hybrid_cmd_372_error(const char *source); -void hybrid_cmd_375(const char *source); -void hybrid_cmd_376(const char *source); -void hybrid_cmd_nick(const char *nick, const char *name, const char *modes); -void hybrid_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void hybrid_cmd_mode(const char *source, const char *dest, const char *buf); -void hybrid_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void hybrid_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void hybrid_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void hybrid_cmd_notice(const char *source, const char *dest, const char *buf); -void hybrid_cmd_notice2(const char *source, const char *dest, const char *msg); -void hybrid_cmd_privmsg(const char *source, const char *dest, const char *buf); -void hybrid_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void hybrid_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void hybrid_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void hybrid_cmd_bot_chan_mode(const char *nick, const char *chan); -void hybrid_cmd_351(const char *source); -void hybrid_cmd_quit(const char *source, const char *buf); -void hybrid_cmd_pong(const char *servname, const char *who); -void hybrid_cmd_join(const char *user, const char *channel, time_t chantime); -void hybrid_cmd_unsqline(const char *user); -void hybrid_cmd_invite(const char *source, const char *chan, const char *nick); -void hybrid_cmd_part(const char *nick, const char *chan, const char *buf); -void hybrid_cmd_391(const char *source, const char *timestr); -void hybrid_cmd_250(const char *buf); -void hybrid_cmd_307(const char *buf); -void hybrid_cmd_311(const char *buf); -void hybrid_cmd_312(const char *buf); -void hybrid_cmd_317(const char *buf); -void hybrid_cmd_219(const char *source, const char *letter); -void hybrid_cmd_401(const char *source, const char *who); -void hybrid_cmd_318(const char *source, const char *who); -void hybrid_cmd_242(const char *buf); -void hybrid_cmd_243(const char *buf); -void hybrid_cmd_211(const char *buf); -void hybrid_cmd_global(const char *source, const char *buf); -void hybrid_cmd_global_legacy(const char *source, const char *fmt); -void hybrid_cmd_sqline(const char *mask, const char *reason); -void hybrid_cmd_squit(const char *servname, const char *message); -void hybrid_cmd_svso(const char *source, const char *nick, const char *flag); -void hybrid_cmd_chg_nick(const char *oldnick, const char *newnick); -void hybrid_cmd_svsnick(const char *source, const char *guest, time_t when); -void hybrid_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void hybrid_cmd_connect(int servernum); -void hybrid_cmd_svshold(const char *nick); -void hybrid_cmd_release_svshold(const char *nick); -void hybrid_cmd_unsgline(const char *mask); -void hybrid_cmd_unszline(const char *mask); -void hybrid_cmd_szline(const char *mask, const char *reason, const char *whom); -void hybrid_cmd_sgline(const char *mask, const char *reason); -void hybrid_cmd_unban(const char *name, const char *nick); -void hybrid_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void hybrid_cmd_svid_umode(const char *nick, time_t ts); -void hybrid_cmd_nc_change(User * u); -void hybrid_cmd_svid_umode2(User * u, const char *ts); -void hybrid_cmd_svid_umode3(User * u, const char *ts); -void hybrid_cmd_eob(); -int hybrid_flood_mode_check(const char *value); -void hybrid_cmd_jupe(const char *jserver, const char *who, const char *reason); -int hybrid_valid_nick(const char *nick); -void hybrid_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class HybridIRCdProto : public IRCDProtoNew { - public: - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/inspircd10.c b/src/protocol/inspircd10.c deleted file mode 100644 index 0f738aefd..000000000 --- a/src/protocol/inspircd10.c +++ /dev/null @@ -1,1707 +0,0 @@ -/* inspircd beta 6+ functions - * - * (C) 2005 Craig Edwards - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#include "services.h" -#include "pseudo.h" -#include "inspircd10.h" - -#ifndef _WIN32 -#include -#include -#include -#endif - -#ifdef _WIN32 -#include "winsock.h" -int inet_aton (const char *name, struct in_addr *addr) -{ - uint32 a = inet_addr (name); - addr->s_addr = a; - return a != (uint32)-1; -} -#endif - -IRCDVar myIrcd[] = { - {"InspIRCd 1.0", /* ircd name */ - "+o", /* nickserv mode */ - "+o", /* chanserv mode */ - "+o", /* memoserv mode */ - "+o", /* hostserv mode */ - "+io", /* operserv mode */ - "+o", /* botserv mode */ - "+o", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+io", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+io", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+o", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+s", /* Used by BotServ Bots */ - 5, /* Chan Max Symbols */ - "-cilmnpstuzACGHKNOQRSV", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 1, /* Has Owner */ - "+q", /* Mode to set for an owner */ - "-q", /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+r", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r", /* Mode on UnReg */ - "-r", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 4, /* Number of server args */ - 0, /* Join 2 Set */ - 1, /* Join 2 Message */ - 0, /* Has exceptions +e */ - 1, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 1, /* Has Protect */ - 1, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 0, /* vidents */ - 0, /* svshold */ - 0, /* time stamp on mode */ - 0, /* NICKIP */ - 1, /* O:LINE */ - 0, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_K, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 0, /* +f */ - 1, /* +L */ - CMODE_f, - CMODE_L, - 0, - 1, /* No Knock requires +i */ - NULL, /* CAPAB Chan Modes */ - 0, /* We support inspircd TOKENS */ - 1, /* TOKENS are CASE inSensitive */ - 0, /* TIME STAMPS are BASE64 */ - 0, /* +I support */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - 0, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - CAPAB_SSJ3, /* SSJ3 */ - CAPAB_NICK2, /* NICK2 */ - 0, /* UMODE2 */ - CAPAB_VL, /* VL */ - CAPAB_TLKEXT, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, - 0, 0} -}; - -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 -}; - - -char myCsmodes[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, - 'h', /* (37) % Channel halfops */ - 0, - 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, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a', 0 -}; - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {NULL, NULL}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - - -CBMode myCbmodes[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}, - {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* B */ - {CMODE_C, 0, NULL, NULL}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {CMODE_G, 0, NULL, NULL}, /* G */ - {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {CMODE_L, 0, set_redirect, cs_set_redirect}, - {0}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {CMODE_Q, 0, NULL, NULL}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {CMODE_V, 0, NULL, NULL}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {CMODE_f, 0, set_flood, cs_set_flood}, - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {CMODE_u, 0, NULL, NULL}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {CMODE_z, 0, NULL, NULL}, - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'f', CMODE_f, 0, get_flood, cs_get_flood}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'u', CMODE_u, 0, NULL, NULL}, - {'z', CMODE_z, 0, NULL, NULL}, - {'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}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'Q', CMODE_Q, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {'V', CMODE_V, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {CUS_OWNER, 0, check_valid_op}, - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - -void inspircd_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - if (WallOper) { - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - } - display_news(user, NEWS_OPER); - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","!protect","!deprotect","AUTOPROTECT","+a","-a"); - - m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); - m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", anope_event_null); 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", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("CAPAB", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("PART", anope_event_part); 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SAMODE", anope_event_samode); addCoreMessage(IRCD,m); - m = createMessage("SANICK", anope_event_sanick); addCoreMessage(IRCD,m); - m = createMessage("SAJOIN", anope_event_sajoin); addCoreMessage(IRCD,m); - m = createMessage("SAPART", anope_event_sapart); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode) ;addCoreMessage(IRCD,m); - m = createMessage("QLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("ELINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("ZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("ADDLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("FHOST", anope_event_chghost); addCoreMessage(IRCD,m); - m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); - m = createMessage("FNAME", anope_event_chgname); addCoreMessage(IRCD,m); - m = createMessage("METADATA", anope_event_null); addCoreMessage(IRCD,m); - 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); - m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); - m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); - m = createMessage("FJOIN", anope_event_fjoin); addCoreMessage(IRCD,m); - m = createMessage("FMODE", anope_event_fmode); addCoreMessage(IRCD,m); - m = createMessage("FTOPIC", anope_event_ftopic); addCoreMessage(IRCD,m); - m = createMessage("VERSION", anope_event_version); addCoreMessage(IRCD,m); - m = createMessage("OPERTYPE", anope_event_opertype); addCoreMessage(IRCD,m); - m = createMessage("IDLE", anope_event_idle); addCoreMessage(IRCD,m); -} - -/* *INDENT-ON* */ - -void inspircd_cmd_svsadmin(const char *server, int set) -{ - /* Not Supported by this IRCD */ -} - -void InspIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(s_OperServ, "GLINE %s@%s", user, host); -} - -void inspircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "FTOPIC %s %lu %s :%s", chan, (unsigned long int) when, whosetit, topic); -} - -void inspircd_cmd_vhost_off(User * u) -{ - send_cmd(s_HostServ, "MODE %s -x", u->nick); -} - -void inspircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(ServerName, "ADDLINE G %s@%s %s %ld %ld :%s", user, host, who, (long int) when, (long int) 86400 * 2, reason); -} - -void inspircd_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - send_cmd(source, "KILL %s :%s", user, buf); -} - -void inspircd_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(s_NickServ, "MODE %s %s%s%s", u->nick, av[0], (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); -} - - -void inspircd_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void inspircd_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void inspircd_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void inspircd_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -void inspircd_cmd_nick(const char *nick, const char *name, const char *modes) -{ - /* :test.chatspike.net NICK 1133519355 Brain synapse.brainbox.winbot.co.uk netadmin.chatspike.net ~brain +xwsioS 10.0.0.2 :Craig Edwards */ - send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,ServiceHost,ServiceHost,ServiceUser,modes,name); - send_cmd(ServerName, "OPERTYPE Service"); -} - -void inspircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,host,host,user,modes,real); -} - -void inspircd_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - send_cmd(source ? source : s_OperServ, "MODE %s %s", dest, buf); -} - -int anope_event_version(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_idle(const char *source, int ac, const char **av) -{ - if (ac == 1) - { - send_cmd(av[0],"IDLE %s %ld 0",source,(long int) time(NULL)); - } - return MOD_CONT; -} - -int anope_event_ftopic(const char *source, int ac, const char **av) -{ - /* :source FTOPIC channel ts setby :topic */ - const char* temp; - if (ac < 4) - return MOD_CONT; - temp = av[1]; /* temp now holds ts */ - av[1] = av[2]; /* av[1] now holds set by */ - av[2] = temp; /* av[2] now holds ts */ - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_opertype(const char *source, int ac, const char **av) -{ - /* opertype is equivalent to mode +o because servers - dont do this directly */ - User* u; - u = finduser(source); - if (u && !is_oper(u)) { - const char* newav[2]; - newav[0] = source; - newav[1] = "+o"; - return anope_event_mode(source, 2, newav); - } - else return MOD_CONT; -} - -int anope_event_fmode(const char *source, int ac, const char **av) -{ - /* :source FMODE #test +nt */ - if (ac != 2) - return MOD_CONT; - return anope_event_mode(source, ac, av); -} - -int anope_event_samode(const char *source, int ac, const char **av) -{ - /* :source SAMODE targets modes */ - if (ac < 2) - return MOD_CONT; - return anope_event_mode(source, ac, av); - return MOD_CONT; -} - -int anope_event_sanick(const char *source, int ac, const char **av) -{ - /* :source SANICK old new */ - if (ac != 2) - return MOD_CONT; - do_nick(av[0], av[1], NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); - return MOD_CONT; -} - -int anope_event_sajoin(const char *source, int ac, const char **av) -{ - const char* newav[1]; - if (ac != 2) - return MOD_CONT; - newav[0] = av[1]; - do_join(av[0], 1, newav); - return MOD_CONT; -} - -int anope_event_sapart(const char *source, int ac, const char **av) -{ - const char* newav[1]; - if (ac < 2) - return MOD_CONT; - newav[0] = av[1]; - do_part(av[0], 1, newav); - return MOD_CONT; -} - -int anope_event_fjoin(const char *source, int ac, const char **av) -{ - const char* newav[127]; - char people[1024]; - int i = 0; - - if (ac < 3) - return MOD_CONT; - - newav[0] = av[1]; - newav[1] = av[0]; - newav[2] = "+"; - newav[3] = people; - - *people = '\0'; - - for (i = 2; i < ac; i++) - { - if (i > 2) - strncat(people," ",1023); - strncat(people,av[i],1023); - } - do_sjoin(source, 4, newav); - return MOD_CONT; -} - -void inspircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s",(long int) time(NULL),nick,host,host,user,modes,real); - send_cmd(ServerName, "OPERTYPE Bot"); -} - -void inspircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s :%s", chan, user, user); - } -} - -void inspircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "NOTICE @%s :%s", dest, buf); -} - - -void inspircd_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - inspircd_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void inspircd_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void inspircd_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void inspircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void inspircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void inspircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - - -void inspircd_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); -} - -void inspircd_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* QUIT */ -void inspircd_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT :Exiting"); - } -} - -/* PROTOCTL */ -void inspircd_cmd_protoctl() -{ -} - -static char currentpass[1024]; - -/* PASS */ -void inspircd_cmd_pass(const char *pass) -{ - strncpy(currentpass,pass,1024); -} - -/* SERVER services-dev.chatspike.net password 0 :Description here */ -void inspircd_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(ServerName, "SERVER %s %s %d :%s", servname, currentpass, hop, descript); -} - -/* PONG */ -void inspircd_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* JOIN */ -/* Althought inspircd 3.2 does not need the timestamp others do so - we get it in the common function call */ -void inspircd_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "JOIN %s", channel); -} - -/* UNSQLINE */ -void inspircd_cmd_unsqline(const char *user) -{ - if (!user) { - return; - } - send_cmd(s_OperServ, "QLINE %s", user); -} - -/* CHGHOST */ -void inspircd_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(s_OperServ,"CHGHOST %s %s", nick, vhost); -} - -/* CHGIDENT */ -void inspircd_cmd_chgident(const char *nick, const char *vIdent) -{ - if (!nick || !vIdent) { - return; - } - send_cmd(s_OperServ, "CHGIDENT %s %s", nick, vIdent); -} - -/* INVITE */ -void inspircd_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* PART */ -void inspircd_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s :Leaving", chan); - } -} - -/* 391 */ -void inspircd_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void inspircd_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void inspircd_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void inspircd_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void inspircd_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void inspircd_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void inspircd_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void inspircd_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void inspircd_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void inspircd_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void inspircd_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void inspircd_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -/* GLOBOPS */ -void inspircd_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* SQLINE */ -void inspircd_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(ServerName, "ADDLINE Q %s %s %ld 0 :%s", mask, s_OperServ, (long int) time(NULL), reason); -} - -/* SQUIT */ -void inspircd_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(ServerName, "SQUIT %s :%s", servname, message); -} - -/* SVSO */ -void inspircd_cmd_svso(const char *source, const char *nick, const char *flag) -{ -} - -/* NICK */ -void inspircd_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* SVSNICK */ -void inspircd_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - /* Please note that inspircd will now echo back a nickchange for this SVSNICK */ - send_cmd(ServerName, "SVSNICK %s %s :%lu", source, guest, (unsigned long)when); -} - -/* Functions that use serval cmd functions */ - -void inspircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - if (!nick) { - return; - } - if (vIdent) { - inspircd_cmd_chgident(nick, vIdent); - } - inspircd_cmd_chghost(nick, vhost); -} - -void inspircd_cmd_connect(int servernum) -{ - if (servernum == 1) { - inspircd_cmd_pass(RemotePassword); - } - if (servernum == 2) { - inspircd_cmd_pass(RemotePassword2); - } - if (servernum == 3) { - inspircd_cmd_pass(RemotePassword3); - } - inspircd_cmd_server(ServerName, 0, ServerDesc); - send_cmd(NULL,"BURST"); - send_cmd(ServerName, "VERSION :Anope-%s %s :%s - %s -- %s", version_number, ServerName, ircd->name, version_flags, version_build); - - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); -} - -/* Events */ - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - /* ((ac > 1) ? av[1] : ServerName) */ - inspircd_cmd_pong(ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -/* Taken from hybrid.c, topic syntax is identical */ - -int anope_event_topic(const char *source, int ac, const char **av) -{ - Channel *c = findchan(av[0]); - time_t topic_time = time(NULL); - - if (!c) { - if (debug) { - alog("debug: TOPIC %s for nonexistent channel %s", - merge_args(ac - 1, av + 1), av[0]); - } - return MOD_CONT; - } - - if (check_topiclock(c, topic_time)) - return MOD_CONT; - - if (c->topic) { - free(c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[1]) - c->topic = sstrdup(av[1]); - - strscpy(c->topic_setter, source, sizeof(c->topic_setter)); - c->topic_time = topic_time; - - record_topic(av[0]); - - if (ac > 1 && *av[1]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - /* InspIRCd lets opers change another - users modes, we have to kludge this - as it slightly breaks RFC1459 - */ - if (!strcasecmp(source,av[0])) - { - do_umode(source, ac, av); - } - else - { - do_umode(av[0], ac, av); - } - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -int anope_event_setname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_chgname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: FNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_setident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETIDENT for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetIdent(av[0]); - return MOD_CONT; -} -int anope_event_chgident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGIDENT for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetIdent(av[1]); - return MOD_CONT; -} - -int anope_event_sethost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[0]); - return MOD_CONT; -} - - -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - struct in_addr addy; - uint32* ad = (uint32*)&addy; - - if (ac != 1) { - if (ac == 8) { - inet_aton(av[6],&addy); - user = do_nick("", av[1], /* nick */ - av[4], /* username */ - av[2], /* realhost */ - source, /* server */ - av[7], /* realname */ - strtoul(av[0], NULL, 10), - 0, - htonl(*ad), - av[3], - NULL); - if (user) - anope_set_umode(user, 1, &av[5]); - } - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - 0, 0, 0, NULL, NULL); - } - return MOD_CONT; -} - - -int anope_event_chghost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: FHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[0]); - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -/* SVSHOLD - set */ -void inspircd_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void inspircd_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* UNSGLINE */ -void inspircd_cmd_unsgline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* UNSZLINE */ -void inspircd_cmd_unszline(const char *mask) -{ - send_cmd(s_OperServ, "ZLINE %s", mask); -} - -/* SZLINE */ -void inspircd_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(ServerName, "ADDLINE Z %s %s %ld 0 :%s", mask, whom, (long int) time(NULL), reason); -} - -/* SGLINE */ -void inspircd_cmd_sgline(const char *mask, const char *reason) -{ - /* Not Supported by this IRCD */ -} - -void inspircd_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void inspircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void inspircd_cmd_svid_umode(const char *nick, time_t ts) -{ - if (debug) - alog("debug: common_svsmode(0)"); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void inspircd_cmd_nc_change(User * u) -{ - if (debug) - alog("debug: common_svsmode(1)"); - common_svsmode(u, "-r", NULL); -} - -/* SVSMODE +r */ -void inspircd_cmd_svid_umode2(User * u, const char *ts) -{ - if (debug) - alog("debug: common_svsmode(2)"); - common_svsmode(u, "+r", NULL); -} - -void inspircd_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -void inspircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - send_cmd(source, "SAJOIN %s %s", nick, chan); -} - -void inspircd_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "SAPART %s %s", nick, chan); -} - -void inspircd_cmd_swhois(const char *source, const char *who, const char *mask) -{ -} - -void inspircd_cmd_eob() -{ - send_cmd(NULL,"ENDBURST"); -} - - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int inspircd_flood_mode_check(const 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 inspircd_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - inspircd_cmd_squit(jserver, rbuf); - inspircd_cmd_server(jserver, 1, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void inspircd_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : s_OperServ, "GLOBOPS :%s", fmt); -} - -int inspircd_valid_nick(const char *nick) -{ - return 1; -} - -int inspircd_valid_chan(const char *chan) -{ - return 1; -} - - -void inspircd_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s\1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(inspircd_cmd_topic); - pmodule_cmd_vhost_off(inspircd_cmd_vhost_off); - pmodule_cmd_akill(inspircd_cmd_akill); - pmodule_cmd_svskill(inspircd_cmd_svskill); - pmodule_cmd_svsmode(inspircd_cmd_svsmode); - pmodule_cmd_372(inspircd_cmd_372); - pmodule_cmd_372_error(inspircd_cmd_372_error); - pmodule_cmd_375(inspircd_cmd_375); - pmodule_cmd_376(inspircd_cmd_376); - pmodule_cmd_nick(inspircd_cmd_nick); - pmodule_cmd_guest_nick(inspircd_cmd_guest_nick); - pmodule_cmd_mode(inspircd_cmd_mode); - pmodule_cmd_bot_nick(inspircd_cmd_bot_nick); - pmodule_cmd_kick(inspircd_cmd_kick); - pmodule_cmd_notice_ops(inspircd_cmd_notice_ops); - pmodule_cmd_notice(inspircd_cmd_notice); - pmodule_cmd_notice2(inspircd_cmd_notice2); - pmodule_cmd_privmsg(inspircd_cmd_privmsg); - pmodule_cmd_privmsg2(inspircd_cmd_privmsg2); - pmodule_cmd_serv_notice(inspircd_cmd_serv_notice); - pmodule_cmd_serv_privmsg(inspircd_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(inspircd_cmd_bot_chan_mode); - pmodule_cmd_351(inspircd_cmd_351); - pmodule_cmd_quit(inspircd_cmd_quit); - pmodule_cmd_pong(inspircd_cmd_pong); - pmodule_cmd_join(inspircd_cmd_join); - pmodule_cmd_unsqline(inspircd_cmd_unsqline); - pmodule_cmd_invite(inspircd_cmd_invite); - pmodule_cmd_part(inspircd_cmd_part); - pmodule_cmd_391(inspircd_cmd_391); - pmodule_cmd_250(inspircd_cmd_250); - pmodule_cmd_307(inspircd_cmd_307); - pmodule_cmd_311(inspircd_cmd_311); - pmodule_cmd_312(inspircd_cmd_312); - pmodule_cmd_317(inspircd_cmd_317); - pmodule_cmd_219(inspircd_cmd_219); - pmodule_cmd_401(inspircd_cmd_401); - pmodule_cmd_318(inspircd_cmd_318); - pmodule_cmd_242(inspircd_cmd_242); - pmodule_cmd_243(inspircd_cmd_243); - pmodule_cmd_211(inspircd_cmd_211); - pmodule_cmd_global(inspircd_cmd_global); - pmodule_cmd_global_legacy(inspircd_cmd_global_legacy); - pmodule_cmd_sqline(inspircd_cmd_sqline); - pmodule_cmd_squit(inspircd_cmd_squit); - pmodule_cmd_svso(inspircd_cmd_svso); - pmodule_cmd_chg_nick(inspircd_cmd_chg_nick); - pmodule_cmd_svsnick(inspircd_cmd_svsnick); - pmodule_cmd_vhost_on(inspircd_cmd_vhost_on); - pmodule_cmd_connect(inspircd_cmd_connect); - pmodule_cmd_svshold(inspircd_cmd_svshold); - pmodule_cmd_release_svshold(inspircd_cmd_release_svshold); - pmodule_cmd_unsgline(inspircd_cmd_unsqline); - pmodule_cmd_unszline(inspircd_cmd_unszline); - pmodule_cmd_szline(inspircd_cmd_szline); - pmodule_cmd_sgline(inspircd_cmd_sgline); - pmodule_cmd_unban(inspircd_cmd_unban); - pmodule_cmd_svsmode_chan(inspircd_cmd_svsmode_chan); - pmodule_cmd_svid_umode(inspircd_cmd_svid_umode); - pmodule_cmd_nc_change(inspircd_cmd_nc_change); - pmodule_cmd_svid_umode2(inspircd_cmd_svid_umode2); - pmodule_cmd_svid_umode3(inspircd_cmd_svid_umode3); - pmodule_cmd_svsjoin(inspircd_cmd_svsjoin); - pmodule_cmd_svspart(inspircd_cmd_svspart); - pmodule_cmd_swhois(inspircd_cmd_swhois); - pmodule_cmd_eob(inspircd_cmd_eob); - pmodule_flood_mode_check(inspircd_flood_mode_check); - pmodule_cmd_jupe(inspircd_cmd_jupe); - pmodule_valid_nick(inspircd_valid_nick); - pmodule_valid_chan(inspircd_valid_chan); - pmodule_cmd_ctcp(inspircd_cmd_ctcp); - pmodule_set_umode(inspircd_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("inspircdIRCd 1.0"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set("+f"); - pmodule_ircd_flood_mode_char_remove("-f"); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/inspircd10.h b/src/protocol/inspircd10.h deleted file mode 100644 index 301ebd2d2..000000000 --- a/src/protocol/inspircd10.h +++ /dev/null @@ -1,136 +0,0 @@ -/* inspircd beta 6 functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_g 0x80000000 -#define UMODE_x 0x40000000 - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_c 0x00000400 -#define CMODE_A 0x00000800 -#define CMODE_H 0x00001000 -#define CMODE_K 0x00002000 -#define CMODE_L 0x00004000 -#define CMODE_O 0x00008000 -#define CMODE_Q 0x00010000 -#define CMODE_S 0x00020000 -#define CMODE_V 0x00040000 -#define CMODE_f 0x00080000 -#define CMODE_G 0x00100000 -#define CMODE_C 0x00200000 -#define CMODE_u 0x00400000 -#define CMODE_z 0x00800000 -#define CMODE_N 0x01000000 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void inspircd_set_umode(User * user, int ac, const char **av); -void inspircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void inspircd_cmd_vhost_off(User * u); -void inspircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void inspircd_cmd_svskill(const char *source, const char *user, const char *buf); -void inspircd_cmd_svsmode(User * u, int ac, const char **av); -void inspircd_cmd_372(const char *source, const char *msg); -void inspircd_cmd_372_error(const char *source); -void inspircd_cmd_375(const char *source); -void inspircd_cmd_376(const char *source); -void inspircd_cmd_nick(const char *nick, const char *name, const char *modes); -void inspircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void inspircd_cmd_mode(const char *source, const char *dest, const char *buf); -void inspircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void inspircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void inspircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void inspircd_cmd_notice(const char *source, const char *dest, const char *buf); -void inspircd_cmd_notice2(const char *source, const char *dest, const char *msg); -void inspircd_cmd_privmsg(const char *source, const char *dest, const char *buf); -void inspircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void inspircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void inspircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void inspircd_cmd_bot_chan_mode(const char *nick, const char *chan); -void inspircd_cmd_351(const char *source); -void inspircd_cmd_quit(const char *source, const char *buf); -void inspircd_cmd_pong(const char *servname, const char *who); -void inspircd_cmd_join(const char *user, const char *channel, time_t chantime); -void inspircd_cmd_unsqline(const char *user); -void inspircd_cmd_invite(const char *source, const char *chan, const char *nick); -void inspircd_cmd_part(const char *nick, const char *chan, const char *buf); -void inspircd_cmd_391(const char *source, const char *timestr); -void inspircd_cmd_250(const char *buf); -void inspircd_cmd_307(const char *buf); -void inspircd_cmd_311(const char *buf); -void inspircd_cmd_312(const char *buf); -void inspircd_cmd_317(const char *buf); -void inspircd_cmd_219(const char *source, const char *letter); -void inspircd_cmd_401(const char *source, const char *who); -void inspircd_cmd_318(const char *source, const char *who); -void inspircd_cmd_242(const char *buf); -void inspircd_cmd_243(const char *buf); -void inspircd_cmd_211(const char *buf); -void inspircd_cmd_global(const char *source, const char *buf); -void inspircd_cmd_global_legacy(const char *source, const char *fmt); -void inspircd_cmd_sqline(const char *mask, const char *reason); -void inspircd_cmd_squit(const char *servname, const char *message); -void inspircd_cmd_svso(const char *source, const char *nick, const char *flag); -void inspircd_cmd_chg_nick(const char *oldnick, const char *newnick); -void inspircd_cmd_svsnick(const char *source, const char *guest, time_t when); -void inspircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void inspircd_cmd_connect(int servernum); -void inspircd_cmd_svshold(const char *nick); -void inspircd_cmd_release_svshold(const char *nick); -void inspircd_cmd_unsgline(const char *mask); -void inspircd_cmd_unszline(const char *mask); -void inspircd_cmd_szline(const char *mask, const char *reason, const char *whom); -void inspircd_cmd_sgline(const char *mask, const char *reason); -void inspircd_cmd_unban(const char *name, const char *nick); -void inspircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void inspircd_cmd_svid_umode(const char *nick, time_t ts); -void inspircd_cmd_nc_change(User * u); -void inspircd_cmd_svid_umode2(User * u, const char *ts); -void inspircd_cmd_svid_umode3(User * u, const char *ts); -void inspircd_cmd_eob(); -int inspircd_flood_mode_check(const char *value); -void inspircd_cmd_jupe(const char *jserver, const char *who, const char *reason); -int inspircd_valid_nick(const char *nick); -void inspircd_cmd_ctcp(const char *source, const char *dest, const char *buf); -int anope_event_fjoin(const char *source, int ac, const char **av); -int anope_event_fmode(const char *source, int ac, const char **av); -int anope_event_ftopic(const char *source, int ac, const char **av); -int anope_event_sanick(const char *source, int ac, const char **av); -int anope_event_samode(const char *source, int ac, const char **av); -int anope_event_sajoin(const char *source, int ac, const char **av); -int anope_event_sapart(const char *source, int ac, const char **av); -int anope_event_version(const char *source, int ac, const char **av); -int anope_event_opertype(const char *source, int ac, const char **av); -int anope_event_idle(const char *source, int ac, const char **av); - -class InspIRCdProto : public IRCDProtoNew { - public: - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/obsolete/hybrid.c b/src/protocol/obsolete/hybrid.c new file mode 100644 index 000000000..e04a6c54a --- /dev/null +++ b/src/protocol/obsolete/hybrid.c @@ -0,0 +1,1566 @@ +/* Hybrid IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#include "services.h" +#include "pseudo.h" +#include "hybrid.h" + +IRCDVar myIrcd[] = { + {"HybridIRCd 7.*", /* ircd name */ + "+o", /* nickserv mode */ + "+o", /* chanserv mode */ + "+o", /* memoserv mode */ + NULL, /* hostserv mode */ + "+aio", /* operserv mode */ + "+o", /* botserv mode */ + "+h", /* helpserv mode */ + "+i", /* Dev/Null mode */ + "+io", /* Global mode */ + "+o", /* nickserv alias mode */ + "+o", /* chanserv alias mode */ + "+o", /* memoserv alias mode */ + NULL, /* hostserv alias mode */ + "+aio", /* operserv alias mode */ + "+o", /* botserv alias mode */ + "+h", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+io", /* Global alias mode */ + "+", /* Used by BotServ Bots */ + 3, /* Chan Max Symbols */ + "-ailmnpst", /* Modes to Remove */ + "+o", /* Channel Umode used by Botserv bots */ + 0, /* SVSNICK */ + 0, /* Vhost */ + 0, /* Has Owner */ + NULL, /* Mode to set for an owner */ + NULL, /* Mode to unset for an owner */ + NULL, /* Mode to set for admin */ + NULL, /* Mode to unset for admin */ + NULL, /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + NULL, /* Mode on UnReg */ + NULL, /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 0, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 1, /* Join 2 Set */ + 1, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + 0, /* Protected Umode */ + 0, /* Has Admin */ + 0, /* Chan SQlines */ + 0, /* Quit on Kill */ + 0, /* SVSMODE unban */ + 0, /* Has Protect */ + 0, /* Reverse */ + 0, /* Chan Reg */ + 0, /* Channel Mode */ + 0, /* vidents */ + 0, /* svshold */ + 0, /* time stamp on mode */ + 0, /* NICKIP */ + 0, /* UMODE */ + 0, /* O:LINE */ + 0, /* VHOST ON NICK */ + 0, /* Change RealName */ + CMODE_p, /* No Knock */ + 0, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + 0, /* Vhost Mode */ + 0, /* +f */ + 0, /* +L */ + 0, /* +f Mode */ + 0, /* +L Mode */ + 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + NULL, /* vhost char */ + 0, /* ts6 */ + 0, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 0, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + CAPAB_NOQUIT, /* NOQUIT */ + 0, /* TSMODE */ + 0, /* UNCONNECT */ + 0, /* NICKIP */ + 0, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + 0, /* BURST */ + CAPAB_TS5, /* TS5 */ + 0, /* TS3 */ + 0, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + CAPAB_QS, /* QS */ + CAPAB_UID, /* UID */ + CAPAB_KNOCK, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + 0, /* DODKEY */ + 0, /* DOZIP */ + 0, 0, 0} +}; + + + +void hybrid_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'd': + if (ac == 0) { + alog("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + opcnt++; + + if (WallOper) + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + display_news(user, NEWS_OPER); + + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + send_cmd(ServerName, "SVSMODE %s -r", user->nick); + user->mode &= ~UMODE_r; + } + break; + + } + } +} + +unsigned long umodes[128] = { + 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 myCsmodes[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) ! */ + 0, 0, 0, + 'h', + 0, 0, 0, 0, + 0, + + 'v', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +CMMode myCmmodes[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}, /* 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}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + +CBMode myCbmodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, + {0}, /* A */ + {0}, /* B */ + {0}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {0}, /* K */ + {0}, /* L */ + {0}, /* M */ + {0}, /* N */ + {0}, /* O */ + {0}, /* P */ + {0}, /* Q */ + {0}, + {0}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {CMODE_a, 0, NULL, NULL}, + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {0}, /* q */ + {0}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'a', CMODE_a, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {0} +}; + + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {0}, /* a */ + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {0}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + + + +void hybrid_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + hybrid_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void hybrid_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void hybrid_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void hybrid_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void hybrid_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $$%s :%s", dest, msg); +} + +void hybrid_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $$%s :%s", dest, msg); +} + + +void hybrid_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "OPERWALL :%s", buf); +} + +/* GLOBOPS - to handle old WALLOPS */ +void hybrid_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt); +} + +int anope_event_sjoin(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + +int anope_event_nick(const char *source, int ac, const char **av) +{ + if (ac != 2) { + User *user = do_nick(source, av[0], av[4], av[5], av[6], av[7], + strtoul(av[2], NULL, 10), 0, 0, NULL, NULL); + if (user) + anope_set_umode(user, 1, &av[3]); + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +int anope_event_topic(const char *source, int ac, const char **av) +{ + if (ac == 4) { + do_topic(source, ac, av); + } else { + Channel *c = findchan(av[0]); + time_t topic_time = time(NULL); + + if (!c) { + if (debug) { + alog("debug: TOPIC %s for nonexistent channel %s", + merge_args(ac - 1, av + 1), av[0]); + } + return MOD_CONT; + } + + if (check_topiclock(c, topic_time)) + return MOD_CONT; + + if (c->topic) { + free(c->topic); + c->topic = NULL; + } + if (ac > 1 && *av[1]) + c->topic = sstrdup(av[1]); + + strscpy(c->topic_setter, source, sizeof(c->topic_setter)); + c->topic_time = topic_time; + + record_topic(av[0]); + + if (ac > 1 && *av[1]) + send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); + else + send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); + } + return MOD_CONT; +} + +int anope_event_tburst(const char *source, int ac, const char **av) +{ + if (ac != 5) + return MOD_CONT; + + av[0] = av[1]; + av[1] = av[3]; + av[3] = av[4]; + do_topic(source, 4, av); + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + + +/* *INDENT-OFF* */ +void moduleAddIRCDMsgs(void) { + Message *m; + + updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-"); + + m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("402", anope_event_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", 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", 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); + 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + m = createMessage("TBURST", anope_event_tburst); addCoreMessage(IRCD,m); + m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSQLINE", anope_event_null); addCoreMessage(IRCD,m); + 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* */ + + +void hybrid_cmd_sqline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(ServerName, "RESV * %s :%s", mask, reason); +} +void hybrid_cmd_unsgline(const char *mask) +{ + if (!mask) { + return; + } + + send_cmd(ServerName, "UNXLINE * %s", mask); +} + +void hybrid_cmd_unszline(const char *mask) +{ + /* Does not support */ +} +void hybrid_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + /* Does not support */ +} + +void hybrid_cmd_svsadmin(const char *server, int set) +{ +} + +void hybrid_cmd_sgline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(ServerName, "XLINE * %s 0 :%s", mask, reason); +} + +void HybridIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + /* hybrid seems to support UNKLINE -Certus */ + send_cmd(s_OperServ, "UNKLINE * %s %s", user, host); +} + +void hybrid_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s :%s", chan, topic); +} + +void hybrid_cmd_vhost_off(User * u) +{ + /* does not support vhosting */ +} + +void hybrid_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + /* does not support vhosting */ +} + +void hybrid_cmd_unsqline(const char *user) +{ + if (!user) { + return; + } + + send_cmd(ServerName, "UNRESV * %s", user); +} + +void hybrid_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime, channel, + user); +} + +/* +oper: the nick of the oper performing the kline +target.server: the server(s) this kline is destined for +duration: the duration if a tkline, 0 if permanent. +user: the 'user' portion of the kline +host: the 'host' portion of the kline +reason: the reason for the kline. +*/ + +void hybrid_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(s_OperServ, "KLINE * %ld %s %s :%s", + (long int) (expires - (long) time(NULL)), user, host, reason); +} + +void hybrid_cmd_svskill(const char *source, const char *user, const char *buf) +{ + if (!buf) { + return; + } + + if (!source || !user) { + return; + } + + send_cmd(source, "KILL %s :%s", user, buf); +} + + +void hybrid_cmd_svsmode(User * u, int ac, const char **av) +{ + /* Hybrid does not support SVSMODE */ +} + +/* + * 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 hybrid_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 5 0 :%ld", (long int) time(NULL)); +} + +/* 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 hybrid_cmd_capab() +{ + send_cmd(NULL, + "CAPAB :QS EX CHW IE KLN GLN HOPS HUB AOPS KNOCK TBURST PARA"); +} + +/* PASS */ +void hybrid_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +/* SERVER name hop descript */ +void hybrid_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); +} +void hybrid_cmd_connect(int servernum) +{ + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) + hybrid_cmd_pass(RemotePassword); + else if (servernum == 2) + hybrid_cmd_pass(RemotePassword2); + else if (servernum == 3) + hybrid_cmd_pass(RemotePassword3); + + hybrid_cmd_capab(); + hybrid_cmd_server(ServerName, 1, ServerDesc); + hybrid_cmd_svinfo(); +} + +void hybrid_cmd_svsinfo() +{ + /* not used */ +} + + + +void hybrid_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); + +} + +void hybrid_cmd_part(const char *nick, const char *chan, const char *buf) +{ + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + hybrid_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + +int anope_event_eob(const char *source, int ac, const char **av) +{ + Server *s; + s = findserver(servlist, source); + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); + + return MOD_CONT; +} + +void hybrid_cmd_eob() +{ +/* send_cmd(ServerName, "EOB"); */ +} + + +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + return MOD_CONT; +} + +/* EVENT: SERVER */ +int anope_event_server(const char *source, int ac, const char **av) +{ + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + do_server(source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, av); + return MOD_CONT; +} + +void hybrid_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void hybrid_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void hybrid_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void hybrid_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + +/* 391 */ +void hybrid_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void hybrid_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void hybrid_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void hybrid_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void hybrid_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void hybrid_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void hybrid_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void hybrid_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void hybrid_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void hybrid_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void hybrid_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void hybrid_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +void hybrid_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "MODE %s %s", dest, buf); +} + +void hybrid_cmd_nick(const char *nick, const char *name, const char *mode) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, + (long int) time(NULL), mode, ServiceUser, ServiceHost, + ServerName, (name)); +} + +void hybrid_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +void hybrid_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); +} + +void hybrid_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); +} + +/* QUIT */ +void hybrid_cmd_quit(const char *source, const char *buf) +{ + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +/* PONG */ +void hybrid_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +/* INVITE */ +void hybrid_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +/* SQUIT */ +void hybrid_cmd_squit(const char *servname, const char *message) +{ + if (!servname || !message) { + return; + } + + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +int anope_event_mode(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + +void hybrid_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); +} + +/* Event: PROTOCTL */ +int anope_event_capab(const char *source, int ac, const char **av) +{ + int argvsize = 8; + int argc; + const char **argv; + char *str; + + if (ac < 1) + return MOD_CONT; + + /* We get the params as one arg, we should split it for capab_parse */ + argv = (const char **)scalloc(argvsize, sizeof(const char *)); + argc = 0; + while ((str = myStrGetToken(av[0], ' ', argc))) { + if (argc == argvsize) { + argvsize += 8; + argv = (const char **)srealloc(argv, argvsize * sizeof(const char *)); + } + argv[argc] = str; + argc++; + } + + capab_parse(argc, argv); + + /* Free our built ac/av */ + for (argvsize = 0; argvsize < argc; argvsize++) { + free((char *)argv[argvsize]); + } + free((char **)argv); + + return MOD_CONT; +} + +/* SVSHOLD - set */ +void hybrid_cmd_svshold(const char *nick) +{ + /* Not supported by this IRCD */ +} + +/* SVSHOLD - release */ +void hybrid_cmd_release_svshold(const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSNICK */ +void hybrid_cmd_svsnick(const char *nick, const char *newnick, time_t when) +{ + /* Not Supported by this IRCD */ +} + +void hybrid_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); +} + +void hybrid_cmd_svso(const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + +void hybrid_cmd_unban(const char *name, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE channel modes */ + +void hybrid_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void hybrid_cmd_svid_umode(const char *nick, time_t ts) +{ + send_cmd(ServerName, "SVSMODE %s +d 1", nick); +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void hybrid_cmd_nc_change(User * u) +{ + /* not used */ +} + +/* SVSMODE +d */ +void hybrid_cmd_svid_umode2(User * u, const char *ts) +{ + /* not used */ +} + + +void hybrid_cmd_svid_umode3(User * u, const char *ts) +{ + /* not used */ +} + +/* NICK */ +void hybrid_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s", newnick); +} + +/* + * 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 + */ +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +void hybrid_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + /* Not Supported by this IRCD */ +} + +void hybrid_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + /* Not Supported by this IRCD */ +} + +void hybrid_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int hybrid_flood_mode_check(const char *value) +{ + return 0; +} + +int anope_event_error(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + +void hybrid_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + hybrid_cmd_squit(jserver, rbuf); + hybrid_cmd_server(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int hybrid_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int hybrid_valid_chan(const char *chan) +{ + /* no hard coded invalid chans */ + return 1; +} + + +void hybrid_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "NOTICE %s :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(hybrid_cmd_topic); + pmodule_cmd_vhost_off(hybrid_cmd_vhost_off); + pmodule_cmd_akill(hybrid_cmd_akill); + pmodule_cmd_svskill(hybrid_cmd_svskill); + pmodule_cmd_svsmode(hybrid_cmd_svsmode); + pmodule_cmd_372(hybrid_cmd_372); + pmodule_cmd_372_error(hybrid_cmd_372_error); + pmodule_cmd_375(hybrid_cmd_375); + pmodule_cmd_376(hybrid_cmd_376); + pmodule_cmd_nick(hybrid_cmd_nick); + pmodule_cmd_guest_nick(hybrid_cmd_guest_nick); + pmodule_cmd_mode(hybrid_cmd_mode); + pmodule_cmd_bot_nick(hybrid_cmd_bot_nick); + pmodule_cmd_kick(hybrid_cmd_kick); + pmodule_cmd_notice_ops(hybrid_cmd_notice_ops); + pmodule_cmd_notice(hybrid_cmd_notice); + pmodule_cmd_notice2(hybrid_cmd_notice2); + pmodule_cmd_privmsg(hybrid_cmd_privmsg); + pmodule_cmd_privmsg2(hybrid_cmd_privmsg2); + pmodule_cmd_serv_notice(hybrid_cmd_serv_notice); + pmodule_cmd_serv_privmsg(hybrid_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(hybrid_cmd_bot_chan_mode); + pmodule_cmd_351(hybrid_cmd_351); + pmodule_cmd_quit(hybrid_cmd_quit); + pmodule_cmd_pong(hybrid_cmd_pong); + pmodule_cmd_join(hybrid_cmd_join); + pmodule_cmd_unsqline(hybrid_cmd_unsqline); + pmodule_cmd_invite(hybrid_cmd_invite); + pmodule_cmd_part(hybrid_cmd_part); + pmodule_cmd_391(hybrid_cmd_391); + pmodule_cmd_250(hybrid_cmd_250); + pmodule_cmd_307(hybrid_cmd_307); + pmodule_cmd_311(hybrid_cmd_311); + pmodule_cmd_312(hybrid_cmd_312); + pmodule_cmd_317(hybrid_cmd_317); + pmodule_cmd_219(hybrid_cmd_219); + pmodule_cmd_401(hybrid_cmd_401); + pmodule_cmd_318(hybrid_cmd_318); + pmodule_cmd_242(hybrid_cmd_242); + pmodule_cmd_243(hybrid_cmd_243); + pmodule_cmd_211(hybrid_cmd_211); + pmodule_cmd_global(hybrid_cmd_global); + pmodule_cmd_global_legacy(hybrid_cmd_global_legacy); + pmodule_cmd_sqline(hybrid_cmd_sqline); + pmodule_cmd_squit(hybrid_cmd_squit); + pmodule_cmd_svso(hybrid_cmd_svso); + pmodule_cmd_chg_nick(hybrid_cmd_chg_nick); + pmodule_cmd_svsnick(hybrid_cmd_svsnick); + pmodule_cmd_vhost_on(hybrid_cmd_vhost_on); + pmodule_cmd_connect(hybrid_cmd_connect); + pmodule_cmd_svshold(hybrid_cmd_svshold); + pmodule_cmd_release_svshold(hybrid_cmd_release_svshold); + pmodule_cmd_unsgline(hybrid_cmd_unsgline); + pmodule_cmd_unszline(hybrid_cmd_unszline); + pmodule_cmd_szline(hybrid_cmd_szline); + pmodule_cmd_sgline(hybrid_cmd_sgline); + pmodule_cmd_unban(hybrid_cmd_unban); + pmodule_cmd_svsmode_chan(hybrid_cmd_svsmode_chan); + pmodule_cmd_svid_umode(hybrid_cmd_svid_umode); + pmodule_cmd_nc_change(hybrid_cmd_nc_change); + pmodule_cmd_svid_umode2(hybrid_cmd_svid_umode2); + pmodule_cmd_svid_umode3(hybrid_cmd_svid_umode3); + pmodule_cmd_svsjoin(hybrid_cmd_svsjoin); + pmodule_cmd_svspart(hybrid_cmd_svspart); + pmodule_cmd_swhois(hybrid_cmd_swhois); + pmodule_cmd_eob(hybrid_cmd_eob); + pmodule_flood_mode_check(hybrid_flood_mode_check); + pmodule_cmd_jupe(hybrid_cmd_jupe); + pmodule_valid_nick(hybrid_valid_nick); + pmodule_valid_chan(hybrid_valid_chan); + pmodule_cmd_ctcp(hybrid_cmd_ctcp); + pmodule_set_umode(hybrid_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(PROTOCOL); + + pmodule_ircd_version("Hybrid IRCd 7.0"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set(""); + pmodule_ircd_flood_mode_char_remove(""); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} diff --git a/src/protocol/obsolete/hybrid.h b/src/protocol/obsolete/hybrid.h new file mode 100644 index 000000000..42a4fabaf --- /dev/null +++ b/src/protocol/obsolete/hybrid.h @@ -0,0 +1,118 @@ +/* Hybrid IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#define UMODE_a 0x00000001 /* Admin status */ +#define UMODE_b 0x00000080 /* See bot and drone flooding notices */ +#define UMODE_c 0x00000100 /* Client connection/quit notices */ +#define UMODE_d 0x00000200 /* See debugging notices */ +#define UMODE_f 0x00000400 /* See I: line full notices */ +#define UMODE_g 0x00000800 /* Server Side Ignore */ +#define UMODE_i 0x00000004 /* Not shown in NAMES or WHO unless you share a channel */ +#define UMODE_k 0x00001000 /* See server generated KILL messages */ +#define UMODE_l 0x00002000 /* See LOCOPS messages */ +#define UMODE_n 0x00004000 /* See client nick changes */ +#define UMODE_o 0x00000008 /* Operator status */ +#define UMODE_r 0x00000010 /* See rejected client notices */ +#define UMODE_s 0x00008000 /* See general server notices */ +#define UMODE_u 0x00010000 /* See unauthorized client notices */ +#define UMODE_w 0x00000020 /* See server generated WALLOPS */ +#define UMODE_x 0x00020000 /* See remote server connection and split notices */ +#define UMODE_y 0x00040000 /* See LINKS, STATS (if configured), TRACE notices */ +#define UMODE_z 0x00080000 /* See oper generated WALLOPS */ + +#define CMODE_i 0x00000001 /* Invite only */ +#define CMODE_m 0x00000002 /* Users without +v/h/o cannot send text to the channel */ +#define CMODE_n 0x00000004 /* Users must be in the channel to send text to it */ +#define CMODE_p 0x00000008 /* Private is obsolete, this now restricts KNOCK */ +#define CMODE_s 0x00000010 /* The channel does not show up on NAMES or LIST */ +#define CMODE_t 0x00000020 /* Only chanops can change the topic */ +#define CMODE_k 0x00000040 /* Key/password for the channel. */ +#define CMODE_l 0x00000080 /* Limit the number of users in a channel */ +#define CMODE_a 0x00000400 /* Anonymous ops, chanops are hidden */ + + +#define DEFAULT_MLOCK CMODE_n | CMODE_t + +void hybrid_set_umode(User * user, int ac, const char **av); +void hybrid_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void hybrid_cmd_vhost_off(User * u); +void hybrid_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void hybrid_cmd_svskill(const char *source, const char *user, const char *buf); +void hybrid_cmd_svsmode(User * u, int ac, const char **av); +void hybrid_cmd_372(const char *source, const char *msg); +void hybrid_cmd_372_error(const char *source); +void hybrid_cmd_375(const char *source); +void hybrid_cmd_376(const char *source); +void hybrid_cmd_nick(const char *nick, const char *name, const char *modes); +void hybrid_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void hybrid_cmd_mode(const char *source, const char *dest, const char *buf); +void hybrid_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void hybrid_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void hybrid_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void hybrid_cmd_notice(const char *source, const char *dest, const char *buf); +void hybrid_cmd_notice2(const char *source, const char *dest, const char *msg); +void hybrid_cmd_privmsg(const char *source, const char *dest, const char *buf); +void hybrid_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void hybrid_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void hybrid_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void hybrid_cmd_bot_chan_mode(const char *nick, const char *chan); +void hybrid_cmd_351(const char *source); +void hybrid_cmd_quit(const char *source, const char *buf); +void hybrid_cmd_pong(const char *servname, const char *who); +void hybrid_cmd_join(const char *user, const char *channel, time_t chantime); +void hybrid_cmd_unsqline(const char *user); +void hybrid_cmd_invite(const char *source, const char *chan, const char *nick); +void hybrid_cmd_part(const char *nick, const char *chan, const char *buf); +void hybrid_cmd_391(const char *source, const char *timestr); +void hybrid_cmd_250(const char *buf); +void hybrid_cmd_307(const char *buf); +void hybrid_cmd_311(const char *buf); +void hybrid_cmd_312(const char *buf); +void hybrid_cmd_317(const char *buf); +void hybrid_cmd_219(const char *source, const char *letter); +void hybrid_cmd_401(const char *source, const char *who); +void hybrid_cmd_318(const char *source, const char *who); +void hybrid_cmd_242(const char *buf); +void hybrid_cmd_243(const char *buf); +void hybrid_cmd_211(const char *buf); +void hybrid_cmd_global(const char *source, const char *buf); +void hybrid_cmd_global_legacy(const char *source, const char *fmt); +void hybrid_cmd_sqline(const char *mask, const char *reason); +void hybrid_cmd_squit(const char *servname, const char *message); +void hybrid_cmd_svso(const char *source, const char *nick, const char *flag); +void hybrid_cmd_chg_nick(const char *oldnick, const char *newnick); +void hybrid_cmd_svsnick(const char *source, const char *guest, time_t when); +void hybrid_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void hybrid_cmd_connect(int servernum); +void hybrid_cmd_svshold(const char *nick); +void hybrid_cmd_release_svshold(const char *nick); +void hybrid_cmd_unsgline(const char *mask); +void hybrid_cmd_unszline(const char *mask); +void hybrid_cmd_szline(const char *mask, const char *reason, const char *whom); +void hybrid_cmd_sgline(const char *mask, const char *reason); +void hybrid_cmd_unban(const char *name, const char *nick); +void hybrid_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void hybrid_cmd_svid_umode(const char *nick, time_t ts); +void hybrid_cmd_nc_change(User * u); +void hybrid_cmd_svid_umode2(User * u, const char *ts); +void hybrid_cmd_svid_umode3(User * u, const char *ts); +void hybrid_cmd_eob(); +int hybrid_flood_mode_check(const char *value); +void hybrid_cmd_jupe(const char *jserver, const char *who, const char *reason); +int hybrid_valid_nick(const char *nick); +void hybrid_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class HybridIRCdProto : public IRCDProtoNew { + public: + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/plexus3.c b/src/protocol/obsolete/plexus3.c new file mode 100644 index 000000000..a376e11c7 --- /dev/null +++ b/src/protocol/obsolete/plexus3.c @@ -0,0 +1,1853 @@ +/* PlexusIRCD IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + +#include "services.h" +#include "pseudo.h" +#include "plexus3.h" + +IRCDVar myIrcd[] = { + {"hybrid-7.2.1+plexus-3.0.0+",/* ircd name */ + "+i", /* nickserv mode */ + "+i", /* chanserv mode */ + "+i", /* memoserv mode */ + "+i", /* hostserv mode */ + "+oai", /* operserv mode */ + "+i", /* botserv mode */ + "+i", /* helpserv mode */ + "+i", /* Dev/Null mode */ + "+i", /* Global mode */ + "+i", /* nickserv alias mode */ + "+i", /* chanserv alias mode */ + "+i", /* memoserv alias mode */ + "+i", /* hostserv alias mode */ + "+oai", /* operserv alias mode */ + "+i", /* botserv alias mode */ + "+i", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+i", /* Global alias mode */ + "+i", /* Used by BotServ Bots */ + 5, /* Chan Max Symbols */ + "-cilmnpstBMNORS", /* Modes to Remove */ + "+ao", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 1, /* Has Owner */ + "+q", /* Mode to set for an owner */ + "-q", /* Mode to unset for an owner */ + "+a", /* Mode to set for chan admin */ + "-a", /* Mode to unset for chan admin */ + "+rd", /* Mode On Reg */ + "N", /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-r+d", /* Mode on UnReg */ + "+d", /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 0, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + UMODE_N, /* Protected Umode */ + 0, /* Has Admin */ + 1, /* Chan SQlines */ + 0, /* Quit on Kill */ + 0, /* SVSMODE unban */ + 1, /* Has Protect */ + 0, /* Reverse */ + 0, /* Chan Reg */ + 0, /* Channel Mode */ + 0, /* vidents */ + 1, /* svshold */ + 1, /* time stamp on mode */ + 0, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 1, /* VHOST ON NICK */ + 0, /* Change RealName */ + CMODE_p, /* No Knock */ + 0, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_x, /* Vhost Mode */ + 0, /* +f */ + 0, /* +L */ + 0, /* +f Mode */ + 0, /* +L Mode */ + 1, /* 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 */ + 1, /* +I support */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + "x", /* vhost char */ + 0, /* ts6 */ + 0, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 1, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + 0, /* NOQUIT */ + 0, /* TSMODE */ + 0, /* UNCONNECT */ + 0, /* NICKIP */ + 0, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + 0, /* BURST */ + CAPAB_TS5, /* TS5 */ + 0, /* TS3 */ + 0, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + CAPAB_QS, /* QS */ + CAPAB_UID, /* UID */ + CAPAB_KNOCK, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + 0, /* DODKEY */ + 0, /* DOZIP */ + 0, 0, 0} +}; + + + +void +plexus_set_umode (User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog ("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) + { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) + { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'd': + if (ac == 0) + { + alog ("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul (*av, NULL, 0); + break; + case 'x': + update_host (user); + break; + case 'o': + if (add) + { + opcnt++; + + if (WallOper) + anope_cmd_global (s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + display_news (user, NEWS_OPER); + + } + else + { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified (user)) + { + common_svsmode (user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + } + } +} + +unsigned long umodes[128] = { + 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, UMODE_N, 0, /* 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, 0, /* ^ _ ` */ + UMODE_a, 0, 0, /* a b c */ + 0, 0, 0, /* d e f */ + 0, 0, UMODE_i, /* g h i */ + 0, 0, 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, UMODE_w, UMODE_x, /* v w x */ + 0, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ � */ +}; + + +char myCsmodes[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, + 'h', /* (37) % Channel halfops */ + 'a', + 0, 0, 0, 0, + + 'v', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'q', 0 +}; + +CMMode myCmmodes[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}, /* 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}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + +CBMode myCbmodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, + {0}, /* A */ + {CMODE_B, CBM_NO_USER_MLOCK, NULL, NULL}, /* B */ + {0}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {0}, /* K */ + {0}, /* L */ + {CMODE_M, 0, NULL, NULL}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, /* O */ + {0}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {0}, /* q */ + {0}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'B', CMODE_B, 0, NULL, NULL}, + {'M', CMODE_M, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {'S', CMODE_S, 0, NULL, NULL}, + {0} +}; + + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {CUS_OWNER, 0, check_valid_op}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + + + +void +plexus_cmd_notice (const char *source, const char *dest, const char *buf) +{ + if (!buf) + { + return; + } + + if (NSDefFlags & NI_MSG) + { + plexus_cmd_privmsg2 (source, dest, buf); + } + else + { + send_cmd (source, "NOTICE %s :%s", dest, buf); + } +} + +void +plexus_cmd_notice2 (const char *source, const char *dest, const char *msg) +{ + send_cmd (source, "NOTICE %s :%s", dest, msg); +} + +void +plexus_cmd_privmsg (const char *source, const char *dest, const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (source, "PRIVMSG %s :%s", dest, buf); +} + +void +plexus_cmd_privmsg2 (const char *source, const char *dest, const char *msg) +{ + send_cmd (source, "PRIVMSG %s :%s", dest, msg); +} + +void +plexus_cmd_serv_notice (const char *source, const char *dest, const char *msg) +{ + send_cmd (source, "NOTICE $$%s :%s", dest, msg); +} + +void +plexus_cmd_serv_privmsg (const char *source, const char *dest, const char *msg) +{ + send_cmd (source, "PRIVMSG $$%s :%s", dest, msg); +} + + +void +plexus_cmd_global (const char *source, const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (source ? source : ServerName, "OPERWALL :%s", buf); +} + +/* GLOBOPS - to handle old WALLOPS */ +void +plexus_cmd_global_legacy (const char *source, const char *fmt) +{ + send_cmd (source ? source : ServerName, "OPERWALL :%s", fmt); +} + +int +anope_event_sjoin (const char *source, int ac, const char **av) +{ + do_sjoin (source, ac, av); + return MOD_CONT; +} + +int +anope_event_nick (const char *source, int ac, const char **av) +{ + if (ac != 2) + { + User *user = do_nick (source, av[0], av[4], av[8], av[6], av[9], + strtoul (av[2], NULL, 10), + strtoul (av[7], NULL, 0), 0, av[5], NULL); + if (user) + anope_set_umode (user, 1, &av[3]); + } + else + { + do_nick (source, av[0], NULL, NULL, NULL, NULL, + strtoul (av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +int +anope_event_topic (const char *source, int ac, const char **av) +{ + if (ac == 4) + { + do_topic (source, ac, av); + } + else + { + Channel *c = findchan (av[0]); + time_t topic_time = time (NULL); + + if (!c) + { + if (debug) + { + alog ("debug: TOPIC %s for nonexistent channel %s", + merge_args (ac - 1, av + 1), av[0]); + } + return MOD_CONT; + } + + if (check_topiclock (c, topic_time)) + return MOD_CONT; + + if (c->topic) + { + free (c->topic); + c->topic = NULL; + } + if (ac > 1 && *av[1]) + c->topic = sstrdup (av[1]); + + strscpy (c->topic_setter, source, sizeof (c->topic_setter)); + c->topic_time = topic_time; + + record_topic (av[0]); + + if (ac > 1 && *av[1]) + send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); + else + send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); + + } + return MOD_CONT; +} + +int +anope_event_tburst (const char *source, int ac, const char **av) +{ + if (ac != 5) + return MOD_CONT; + + av[0] = av[1]; + av[1] = av[3]; + av[3] = av[4]; + do_topic (source, 4, av); + return MOD_CONT; +} + +/* + * ENCAP handler + * av[0] = servermask (not used) + * av[1] = command + * av[2] and beyond are dynamic. + */ +int +anope_event_encap (const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (!stricmp (av[1], "CHGHOST")) + { + User *u; + + if (ac != 4) + return MOD_CONT; + + u = finduser (av[2]); + if (!u) + { + if (debug) + { + alog ("debug: CHGHOST for nonexistent user %s", av[2]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[3]); + return MOD_CONT; + } + return MOD_CONT; +} + +int +anope_event_436 (const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll (av[0]); + return MOD_CONT; +} + + +void +moduleAddIRCDMsgs (void) +{ + Message *m; + + updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); + + m = createMessage ("401", anope_event_null); + addCoreMessage (IRCD, m); + m = createMessage ("402", anope_event_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", 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", 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); + 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 ("TOPIC", anope_event_topic); + addCoreMessage (IRCD, m); + m = createMessage ("TBURST", anope_event_tburst); + addCoreMessage (IRCD, m); + m = createMessage ("USER", anope_event_null); + addCoreMessage (IRCD, m); + m = createMessage ("WALLOPS", anope_event_null); + addCoreMessage (IRCD, m); + m = createMessage ("WHOIS", anope_event_whois); + addCoreMessage (IRCD, m); + 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); + m = createMessage ("ENCAP", anope_event_encap); + addCoreMessage (IRCD, m); + m = createMessage ("SVSMODE", anope_event_mode); + addCoreMessage (IRCD, m); +} + +void +plexus_cmd_sqline (const char *mask, const char *reason) +{ + send_cmd (s_OperServ, "RESV * %s :%s", mask, reason); +} + +void +plexus_cmd_unsgline (const char *mask) +{ + send_cmd (s_OperServ, "UNXLINE * %s", mask); +} + +void +plexus_cmd_unszline (const char *mask) +{ + /* Does not support */ +} + +void +plexus_cmd_szline (const char *mask, const char *reason, const char *whom) +{ + /* Does not support */ +} + +void PleXusIRCdProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(ServerName, "ENCAP %s SVSNOOP %s", server, set ? "+" : "-"); +} + +void +plexus_cmd_svsadmin (const char *server, int set) +{ + ircd_proto.cmd_svsnoop(server, set); +} + +void +plexus_cmd_sgline (const char *mask, const char *reason) +{ + send_cmd (s_OperServ, "XLINE * %s 0 :%s", mask, reason); +} + +void PleXusIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(s_OperServ, "UNKLINE * %s %s", user, host); +} + +void +plexus_cmd_topic (const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd (whosets, "ENCAP * TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +void +plexus_cmd_vhost_off (User * u) +{ + common_svsmode (u, "-x", NULL); +} + +void +plexus_cmd_vhost_on (const char *nick, const char *vIdent, const char *vhost) +{ + User *u; + + if (!nick) + { + return; + } + + u = finduser (nick); + + if (u) + { + send_cmd (ServerName, "ENCAP * CHGHOST %s %s", u->nick, vhost); + common_svsmode (u, "+x", NULL); + u->mode |= UMODE_x; + } +} + +void +plexus_cmd_unsqline (const char *user) +{ + send_cmd (s_OperServ, "UNRESV * %s", user); +} + +void +plexus_cmd_join (const char *user, const char *channel, time_t chantime) +{ + send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel, + user); +} + +/* +oper: the nick of the oper performing the kline +target.server: the server(s) this kline is destined for +duration: the duration if a tkline, 0 if permanent. +user: the 'user' portion of the kline +host: the 'host' portion of the kline +reason: the reason for the kline. +*/ + +void +plexus_cmd_akill (const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd (s_OperServ, "KLINE * %ld %s %s :%s", + (long int) (expires - (long) time (NULL)), user, host, reason); +} + +void +plexus_cmd_svskill (const char *source, const char *user, const char *buf) +{ + if (!buf) + { + return; + } + + if (!source || !user) + { + return; + } + + send_cmd (source, "KILL %s :%s", user, buf); +} + +void +plexus_cmd_svsmode (User * u, int ac, const char **av) +{ + send_cmd (ServerName, "ENCAP * SVSMODE %s %ld %s%s%s", u->nick, + (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), + (ac == 2 ? av[1] : "")); +} + +/* + * 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 +plexus_cmd_svinfo () +{ + send_cmd (NULL, "SVINFO 5 5 0 :%ld", (long int) time (NULL)); +} + +/* 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 - supports encapsulization of protocol messages + SVS - supports services protocol extensions +*/ +void +plexus_cmd_capab () +{ + send_cmd (NULL, + "CAPAB :QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS"); +} + +/* PASS */ +void +plexus_cmd_pass (const char *pass) +{ + send_cmd (NULL, "PASS %s :TS", pass); +} + +/* SERVER name hop descript */ +void +plexus_cmd_server (const char *servname, int hop, const char *descript) +{ + send_cmd (NULL, "SERVER %s %d :%s", servname, hop, descript); +} + +void +plexus_cmd_connect (int servernum) +{ + me_server = new_server (NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) + plexus_cmd_pass (RemotePassword); + else if (servernum == 2) + plexus_cmd_pass (RemotePassword2); + else if (servernum == 3) + plexus_cmd_pass (RemotePassword3); + + plexus_cmd_capab (); + plexus_cmd_server (ServerName, 1, ServerDesc); + plexus_cmd_svinfo (); +} + +void +plexus_cmd_svsinfo () +{ + /* not used */ +} + + + +void +plexus_cmd_bot_nick (const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick (nick, NULL); + send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, + (long int) time (NULL), modes, user, host, ServerName, host, + real); + plexus_cmd_sqline (nick, "Reserved for services"); + +} + +void +plexus_cmd_part (const char *nick, const char *chan, const char *buf) +{ + if (buf) + { + send_cmd (nick, "PART %s :%s", chan, buf); + } + else + { + send_cmd (nick, "PART %s", chan); + } +} + +int +anope_event_ping (const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + plexus_cmd_pong (ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +int +anope_event_away (const char *source, int ac, const char **av) +{ + if (!source) + { + return MOD_CONT; + } + m_away (source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int +anope_event_kill (const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill (av[0], av[1]); + return MOD_CONT; +} + +int +anope_event_kick (const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick (source, ac, av); + return MOD_CONT; +} + +int +anope_event_eob (const char *source, int ac, const char **av) +{ + Server *s; + s = findserver (servlist, source); + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync (s, 1); + + return MOD_CONT; +} + +void +plexus_cmd_eob () +{ + send_cmd (ServerName, "EOB"); +} + + +int +anope_event_join (const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join (source, ac, av); + return MOD_CONT; +} + +int +anope_event_motd (const char *source, int ac, const char **av) +{ + if (!source) + { + return MOD_CONT; + } + + m_motd (source); + return MOD_CONT; +} + +int +anope_event_privmsg (const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg (source, av[0], av[1]); + return MOD_CONT; +} + +int +anope_event_part (const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part (source, ac, av); + return MOD_CONT; +} + +int +anope_event_whois (const char *source, int ac, const char **av) +{ + if (source && ac >= 1) + { + m_whois (source, av[0]); + } + return MOD_CONT; +} + +/* EVENT: SERVER */ +int +anope_event_server (const char *source, int ac, const char **av) +{ + if (!stricmp (av[1], "1")) + { + uplink = sstrdup (av[0]); + } + do_server (source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + +int +anope_event_squit (const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit (source, ac, av); + return MOD_CONT; +} + +int +anope_event_quit (const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit (source, ac, av); + return MOD_CONT; +} + +void +plexus_cmd_372 (const char *source, const char *msg) +{ + send_cmd (ServerName, "372 %s :- %s", source, msg); +} + +void +plexus_cmd_372_error (const char *source) +{ + send_cmd (ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void +plexus_cmd_375 (const char *source) +{ + send_cmd (ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void +plexus_cmd_376 (const char *source) +{ + send_cmd (ServerName, "376 %s :End of /MOTD command.", source); +} + +/* 391 */ +void +plexus_cmd_391 (const char *source, const char *timestr) +{ + if (!timestr) + { + return; + } + send_cmd (ServerName, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void +plexus_cmd_250 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "250 %s", buf); +} + +/* 307 */ +void +plexus_cmd_307 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "307 %s", buf); +} + +/* 311 */ +void +plexus_cmd_311 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "311 %s", buf); +} + +/* 312 */ +void +plexus_cmd_312 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "312 %s", buf); +} + +/* 317 */ +void +plexus_cmd_317 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "317 %s", buf); +} + +/* 219 */ +void +plexus_cmd_219 (const char *source, const char *letter) +{ + if (!source) + { + return; + } + + if (letter) + { + send_cmd (ServerName, "219 %s %c :End of /STATS report.", source, + *letter); + } + else + { + send_cmd (ServerName, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void +plexus_cmd_401 (const char *source, const char *who) +{ + if (!source || !who) + { + return; + } + send_cmd (ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void +plexus_cmd_318 (const char *source, const char *who) +{ + if (!source || !who) + { + return; + } + + send_cmd (ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void +plexus_cmd_242 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "242 %s", buf); +} + +/* 243 */ +void +plexus_cmd_243 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "243 %s", buf); +} + +/* 211 */ +void +plexus_cmd_211 (const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "211 %s", buf); +} + +void +plexus_cmd_mode (const char *source, const char *dest, const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (source, "MODE %s %s", dest, buf); +} + +void +plexus_cmd_nick (const char *nick, const char *name, const char *mode) +{ + EnforceQlinedNick (nick, NULL); + send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, + (long int) time (NULL), mode, ServiceUser, ServiceHost, + ServerName, ServiceHost, (name)); + send_cmd (nick, "RESV * %s :%s", nick, "Reserved for services"); +} + +void +plexus_cmd_kick (const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) + { + send_cmd (source, "KICK %s %s :%s", chan, user, buf); + } + else + { + send_cmd (source, "KICK %s %s", chan, user); + } +} + +void +plexus_cmd_notice_ops (const char *source, const char *dest, const char *buf) +{ + if (!buf) + { + return; + } + + send_cmd (ServerName, "NOTICE @%s :%s", dest, buf); +} + +void +plexus_cmd_bot_chan_mode (const char *nick, const char *chan) +{ + anope_cmd_mode (nick, chan, "%s %s %s", myIrcd->botchanumode, nick, nick); +} + +/* QUIT */ +void +plexus_cmd_quit (const char *source, const char *buf) +{ + if (buf) + { + send_cmd (source, "QUIT :%s", buf); + } + else + { + send_cmd (source, "QUIT"); + } +} + +/* PONG */ +void +plexus_cmd_pong (const char *servname, const char *who) +{ + send_cmd (servname, "PONG %s", who); +} + +/* INVITE */ +void +plexus_cmd_invite (const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) + { + return; + } + + send_cmd (source, "INVITE %s %s", nick, chan); +} + +/* SQUIT */ +void +plexus_cmd_squit (const char *servname, const char *message) +{ + if (!servname || !message) + { + return; + } + + send_cmd (ServerName, "SQUIT %s :%s", servname, message); +} + +int +anope_event_mode (const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') + { + do_cmode (source, ac, av); + } + else + { + Server *s; + s = findserver (servlist, source); + + if (s && *av[0]) + { + do_umode (av[0], ac, av); + } + else + { + do_umode (source, ac, av); + } + } + return MOD_CONT; +} + +void +plexus_cmd_351 (const char *source) +{ + send_cmd (ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); +} + +/* Event: PROTOCTL */ +int +anope_event_capab (const char *source, int ac, const char **av) +{ + int argvsize = 8; + int argc; + const char **argv; + char *str; + + if (ac < 1) + return MOD_CONT; + + /* We get the params as one arg, we should split it for capab_parse */ + argv = (const char **)scalloc (argvsize, sizeof (const char *)); + argc = 0; + while ((str = myStrGetToken (av[0], ' ', argc))) + { + if (argc == argvsize) + { + argvsize += 8; + argv = (const char **)srealloc (argv, argvsize * sizeof (const char *)); + } + argv[argc] = str; + argc++; + } + + capab_parse (argc, argv); + + /* Free our built ac/av */ + for (argvsize = 0; argvsize < argc; argvsize++) + { + free ((char *)argv[argvsize]); + } + free ((char **)argv); + + return MOD_CONT; +} + +/* SVSHOLD - set */ +void +plexus_cmd_svshold (const char *nick) +{ + send_cmd (s_OperServ, "ENCAP * RESV %d %s 0 :%s", NSReleaseTimeout, nick, + "This nick is being held for a registered user. " + "For help with regaining nicknames please see /nickserv help release"); +} + +/* SVSHOLD - release */ +void +plexus_cmd_release_svshold (const char *nick) +{ + send_cmd (s_OperServ, "UNRESV * %s", nick); +} + +/* SVSNICK */ +void +plexus_cmd_svsnick (const char *nick, const char *newnick, time_t when) +{ + User *u; + + if (!nick || !newnick) + return; + + if( (u = finduser (nick))) { + send_cmd (ServerName, "ENCAP * SVSNICK %s %ld %s %ld", + u->nick, (long int) u->timestamp, newnick, (long int) when); + } +} + +void +plexus_cmd_guest_nick (const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, + (long int) time (NULL), modes, user, host, ServerName, host, + real); +} + +void +plexus_cmd_svso (const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + +void +plexus_cmd_unban (const char *name, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE channel modes */ + +void +plexus_cmd_svsmode_chan (const char *name, const char *mode, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void +plexus_cmd_svid_umode (const char *nick, time_t ts) +{ + send_cmd (ServerName, "ENCAP * SVSMODE %s %lu +d 1", nick, + (unsigned long int) ts); +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void +plexus_cmd_nc_change (User * u) +{ + common_svsmode (u, "+d", "1"); +} + +/* SVSMODE +d */ +void +plexus_cmd_svid_umode2 (User * u, const char *ts) +{ + /* not used */ +} + +void +plexus_cmd_svid_umode3 (User * u, const char *ts) +{ + char modes[512]; + + strlcpy(modes, "+r", sizeof(modes)); + + if(ircd->rootmodeonid && is_services_root(u)) { + strlcat(modes, ircd->rootmodeonid, sizeof(modes)); + } else if(ircd->adminmodeonid && is_services_admin(u)) { + strlcat(modes, ircd->adminmodeonid, sizeof(modes)); + } else if(ircd->opermodeonid && is_services_oper(u)) { + strlcat(modes, ircd->opermodeonid, sizeof(modes)); + } + if (u->svid != u->timestamp) { + strlcat(modes, "d", sizeof(modes)); + common_svsmode (u, modes, ts); + } else { + common_svsmode (u, modes, NULL); + } +} + +/* NICK */ +void +plexus_cmd_chg_nick (const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) + { + return; + } + + send_cmd (oldnick, "NICK %s", newnick); +} + +/* + * 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 + */ +int +anope_event_svinfo (const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int +anope_event_pass (const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +void +plexus_cmd_svsjoin (const char *source, const char *nick, const char *chan, const char *param) +{ + send_cmd(ServerName, "ENCAP * SVSJOIN %s %s", nick, chan); +} + +void +plexus_cmd_svspart (const char *source, const char *nick, const char *chan) +{ + send_cmd(ServerName, "ENCAP * SVSPART %s %s", nick, chan); +} + +void +plexus_cmd_swhois (const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +int +anope_event_notice (const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int +anope_event_admin (const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int +anope_event_invite (const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int +plexus_flood_mode_check (const char *value) +{ + return 0; +} + +int +anope_event_error (const char *source, int ac, const char **av) +{ + if (ac >= 1) + { + if (debug) + { + alog ("debug: %s", av[0]); + } + } + return MOD_CONT; +} + +void +plexus_cmd_jupe (const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf (rbuf, sizeof (rbuf), "(H) Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + plexus_cmd_squit (jserver, rbuf); + plexus_cmd_server (jserver, 2, rbuf); + new_server (me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int +plexus_valid_nick (const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int +plexus_valid_chan (const char *chan) +{ + /* no hard coded invalid chan */ + return 1; +} + + +void +plexus_cmd_ctcp (const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) + { + return; + } + else + { + s = normalizeBuffer (buf); + } + + send_cmd (source, "NOTICE %s :\1%s \1", dest, s); + free (s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void +moduleAddAnopeCmds () +{ + pmodule_cmd_topic (plexus_cmd_topic); + pmodule_cmd_vhost_off (plexus_cmd_vhost_off); + pmodule_cmd_akill (plexus_cmd_akill); + pmodule_cmd_svskill (plexus_cmd_svskill); + pmodule_cmd_svsmode (plexus_cmd_svsmode); + pmodule_cmd_372 (plexus_cmd_372); + pmodule_cmd_372_error (plexus_cmd_372_error); + pmodule_cmd_375 (plexus_cmd_375); + pmodule_cmd_376 (plexus_cmd_376); + pmodule_cmd_nick (plexus_cmd_nick); + pmodule_cmd_guest_nick (plexus_cmd_guest_nick); + pmodule_cmd_mode (plexus_cmd_mode); + pmodule_cmd_bot_nick (plexus_cmd_bot_nick); + pmodule_cmd_kick (plexus_cmd_kick); + pmodule_cmd_notice_ops (plexus_cmd_notice_ops); + pmodule_cmd_notice (plexus_cmd_notice); + pmodule_cmd_notice2 (plexus_cmd_notice2); + pmodule_cmd_privmsg (plexus_cmd_privmsg); + pmodule_cmd_privmsg2 (plexus_cmd_privmsg2); + pmodule_cmd_serv_notice (plexus_cmd_serv_notice); + pmodule_cmd_serv_privmsg (plexus_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode (plexus_cmd_bot_chan_mode); + pmodule_cmd_351 (plexus_cmd_351); + pmodule_cmd_quit (plexus_cmd_quit); + pmodule_cmd_pong (plexus_cmd_pong); + pmodule_cmd_join (plexus_cmd_join); + pmodule_cmd_unsqline (plexus_cmd_unsqline); + pmodule_cmd_invite (plexus_cmd_invite); + pmodule_cmd_part (plexus_cmd_part); + pmodule_cmd_391 (plexus_cmd_391); + pmodule_cmd_250 (plexus_cmd_250); + pmodule_cmd_307 (plexus_cmd_307); + pmodule_cmd_311 (plexus_cmd_311); + pmodule_cmd_312 (plexus_cmd_312); + pmodule_cmd_317 (plexus_cmd_317); + pmodule_cmd_219 (plexus_cmd_219); + pmodule_cmd_401 (plexus_cmd_401); + pmodule_cmd_318 (plexus_cmd_318); + pmodule_cmd_242 (plexus_cmd_242); + pmodule_cmd_243 (plexus_cmd_243); + pmodule_cmd_211 (plexus_cmd_211); + pmodule_cmd_global (plexus_cmd_global); + pmodule_cmd_global_legacy (plexus_cmd_global_legacy); + pmodule_cmd_sqline (plexus_cmd_sqline); + pmodule_cmd_squit (plexus_cmd_squit); + pmodule_cmd_svso (plexus_cmd_svso); + pmodule_cmd_chg_nick (plexus_cmd_chg_nick); + pmodule_cmd_svsnick (plexus_cmd_svsnick); + pmodule_cmd_vhost_on (plexus_cmd_vhost_on); + pmodule_cmd_connect (plexus_cmd_connect); + pmodule_cmd_svshold (plexus_cmd_svshold); + pmodule_cmd_release_svshold (plexus_cmd_release_svshold); + pmodule_cmd_unsgline (plexus_cmd_unsgline); + pmodule_cmd_unszline (plexus_cmd_unszline); + pmodule_cmd_szline (plexus_cmd_szline); + pmodule_cmd_sgline (plexus_cmd_sgline); + pmodule_cmd_unban (plexus_cmd_unban); + pmodule_cmd_svsmode_chan (plexus_cmd_svsmode_chan); + pmodule_cmd_svid_umode (plexus_cmd_svid_umode); + pmodule_cmd_nc_change (plexus_cmd_nc_change); + pmodule_cmd_svid_umode2 (plexus_cmd_svid_umode2); + pmodule_cmd_svid_umode3 (plexus_cmd_svid_umode3); + pmodule_cmd_svsjoin (plexus_cmd_svsjoin); + pmodule_cmd_svspart (plexus_cmd_svspart); + pmodule_cmd_swhois (plexus_cmd_swhois); + pmodule_cmd_eob (plexus_cmd_eob); + pmodule_flood_mode_check (plexus_flood_mode_check); + pmodule_cmd_jupe (plexus_cmd_jupe); + pmodule_valid_nick (plexus_valid_nick); + pmodule_valid_chan (plexus_valid_chan); + pmodule_cmd_ctcp (plexus_cmd_ctcp); + pmodule_set_umode (plexus_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int +AnopeInit (int argc, char **argv) +{ + + moduleAddAuthor ("Anope"); + moduleAddVersion ("$Id: plexus.c 995 2006-03-01 20:19:11Z rob $"); + moduleSetType (PROTOCOL); + + pmodule_ircd_version ("hybrid-7.2.1+plexus-3.0.0+"); + pmodule_ircd_cap (myIrcdcap); + pmodule_ircd_var (myIrcd); + pmodule_ircd_cbmodeinfos (myCbmodeinfos); + pmodule_ircd_cumodes (myCumodes); + pmodule_ircd_flood_mode_char_set (""); + pmodule_ircd_flood_mode_char_remove (""); + pmodule_ircd_cbmodes (myCbmodes); + pmodule_ircd_cmmodes (myCmmodes); + pmodule_ircd_csmodes (myCsmodes); + pmodule_ircd_useTSMode (0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode (UMODE_i); + pmodule_oper_umode (UMODE_o); + pmodule_invite_cmode (CMODE_i); + pmodule_secret_cmode (CMODE_s); + pmodule_private_cmode (CMODE_p); + pmodule_key_mode (CMODE_k); + pmodule_limit_mode (CMODE_l); + + moduleAddAnopeCmds (); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs (); + + return MOD_CONT; +} + +/* EOF */ diff --git a/src/protocol/obsolete/plexus3.h b/src/protocol/obsolete/plexus3.h new file mode 100644 index 000000000..9c8cba453 --- /dev/null +++ b/src/protocol/obsolete/plexus3.h @@ -0,0 +1,115 @@ +/* PlexusIRCD IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#define UMODE_i 0x00000001 +#define UMODE_o 0x00000002 +#define UMODE_w 0x00000004 +#define UMODE_a 0x00000008 +#define UMODE_x 0x00000010 +#define UMODE_S 0x00000020 +#define UMODE_r 0x00000040 +#define UMODE_R 0x00000080 +#define UMODE_N 0x00000100 + +#define CMODE_i 0x00000001 +#define CMODE_m 0x00000002 +#define CMODE_n 0x00000004 +#define CMODE_p 0x00000008 +#define CMODE_s 0x00000010 +#define CMODE_t 0x00000020 +#define CMODE_k 0x00000040 /* These two used only by ChanServ */ +#define CMODE_l 0x00000080 +#define CMODE_M 0x00001000 +#define CMODE_c 0x00002000 +#define CMODE_O 0x00004000 +#define CMODE_R 0x00008000 +#define CMODE_N 0x00010000 +#define CMODE_B 0x00020000 +#define CMODE_S 0x00040000 + +#define DEFAULT_MLOCK CMODE_n | CMODE_t + +void plexus_set_umode(User * user, int ac, const char **av); +void plexus_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void plexus_cmd_vhost_off(User * u); +void plexus_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void plexus_cmd_svskill(const char *source, const char *user, const char *buf); +void plexus_cmd_svsmode(User * u, int ac, const char **av); +void plexus_cmd_372(const char *source, const char *msg); +void plexus_cmd_372_error(const char *source); +void plexus_cmd_375(const char *source); +void plexus_cmd_376(const char *source); +void plexus_cmd_nick(const char *nick, const char *name, const char *modes); +void plexus_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void plexus_cmd_mode(const char *source, const char *dest, const char *buf); +void plexus_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void plexus_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void plexus_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void plexus_cmd_notice(const char *source, const char *dest, const char *buf); +void plexus_cmd_notice2(const char *source, const char *dest, const char *msg); +void plexus_cmd_privmsg(const char *source, const char *dest, const char *buf); +void plexus_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void plexus_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void plexus_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void plexus_cmd_bot_chan_mode(const char *nick, const char *chan); +void plexus_cmd_351(const char *source); +void plexus_cmd_quit(const char *source, const char *buf); +void plexus_cmd_pong(const char *servname, const char *who); +void plexus_cmd_join(const char *user, const char *channel, time_t chantime); +void plexus_cmd_unsqline(const char *user); +void plexus_cmd_invite(const char *source, const char *chan, const char *nick); +void plexus_cmd_part(const char *nick, const char *chan, const char *buf); +void plexus_cmd_391(const char *source, const char *timestr); +void plexus_cmd_250(const char *buf); +void plexus_cmd_307(const char *buf); +void plexus_cmd_311(const char *buf); +void plexus_cmd_312(const char *buf); +void plexus_cmd_317(const char *buf); +void plexus_cmd_219(const char *source, const char *letter); +void plexus_cmd_401(const char *source, const char *who); +void plexus_cmd_318(const char *source, const char *who); +void plexus_cmd_242(const char *buf); +void plexus_cmd_243(const char *buf); +void plexus_cmd_211(const char *buf); +void plexus_cmd_global(const char *source, const char *buf); +void plexus_cmd_global_legacy(const char *source, const char *fmt); +void plexus_cmd_sqline(const char *mask, const char *reason); +void plexus_cmd_squit(const char *servname, const char *message); +void plexus_cmd_svso(const char *source, const char *nick, const char *flag); +void plexus_cmd_chg_nick(const char *oldnick, const char *newnick); +void plexus_cmd_svsnick(const char *source, const char *guest, time_t when); +void plexus_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void plexus_cmd_connect(int servernum); +void plexus_cmd_svshold(const char *nick); +void plexus_cmd_release_svshold(const char *nick); +void plexus_cmd_unsgline(const char *mask); +void plexus_cmd_unszline(const char *mask); +void plexus_cmd_szline(const char *mask, const char *reason, const char *whom); +void plexus_cmd_sgline(const char *mask, const char *reason); +void plexus_cmd_unban(const char *name, const char *nick); +void plexus_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void plexus_cmd_svid_umode(const char *nick, time_t ts); +void plexus_cmd_nc_change(User * u); +void plexus_cmd_svid_umode2(User * u, const char *ts); +void plexus_cmd_svid_umode3(User * u, const char *ts); +void plexus_cmd_eob(); +int plexus_flood_mode_check(const char *value); +void plexus_cmd_jupe(const char *jserver, const char *who, const char *reason); +int plexus_valid_nick(const char *nick); +void plexus_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class PleXusIRCdProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/ptlink.c b/src/protocol/obsolete/ptlink.c new file mode 100644 index 000000000..78c200c2d --- /dev/null +++ b/src/protocol/obsolete/ptlink.c @@ -0,0 +1,1799 @@ +/* PTLink IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#include "services.h" +#include "pseudo.h" +#include "ptlink.h" + +IRCDVar myIrcd[] = { + {"PTlink 6.15.*+", /* ircd name */ + "+o", /* nickserv mode */ + "+o", /* chanserv mode */ + "+o", /* memoserv mode */ + "+o", /* hostserv mode */ + "+io", /* operserv mode */ + "+o", /* botserv mode */ + "+h", /* helpserv mode */ + "+i", /* Dev/Null mode */ + "+io", /* Global mode */ + "+o", /* nickserv alias mode */ + "+o", /* chanserv alias mode */ + "+o", /* memoserv alias mode */ + "+io", /* hostserv alias mode */ + "+io", /* operserv alias mode */ + "+o", /* botserv alias mode */ + "+h", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+io", /* Global alias mode */ + "+", /* Used by BotServ Bots */ + 2, /* Chan Max Symbols */ + "-inpsmtCRKOASdcqBNl", /* Modes to Remove */ + "+ao", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 0, /* Has Owner */ + NULL, /* Mode to set for an owner */ + NULL, /* Mode to unset for an owner */ + "+a", /* Mode to set for chan admin */ + "-a", /* Mode to unset for chan admin */ + "+r", /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-r", /* Mode on UnReg */ + NULL, /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 1, /* Supports SZlines */ + 0, /* Supports Halfop +h */ + 4, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + 0, /* Protected Umode */ + 0, /* Has Admin */ + 0, /* Chan SQlines */ + 0, /* Quit on Kill */ + 0, /* SVSMODE unban */ + 1, /* Has Protect */ + 0, /* Reverse */ + 1, /* Chan Reg */ + CMODE_r, /* Channel Mode */ + 1, /* vidents */ + 0, /* svshold */ + 0, /* time stamp on mode */ + 0, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 1, /* VHOST ON NICK */ + 0, /* Change RealName */ + CMODE_K, /* No Knock */ + CMODE_A, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_VH, /* Vhost Mode */ + 1, /* +f */ + 0, /* +L */ + CMODE_f, + 0, + 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + NULL, /* vhost char */ + 0, /* ts6 */ + 1, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 0, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + 0, /* NOQUIT */ + 0, /* TSMODE */ + 0, /* UNCONNECT */ + 0, /* NICKIP */ + 0, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + 0, /* BURST */ + 0, /* TS5 */ + 0, /* TS3 */ + 0, /* DKEY */ + CAPAB_PT4, /* PT4 */ + CAPAB_SCS, /* SCS */ + CAPAB_QS, /* QS */ + 0, /* UID */ + 0, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + 0, /* DODKEY */ + 0, /* DOZIP */ + 0, 0, 0} +}; + + +unsigned long umodes[128] = { + 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 myCsmodes[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, + + 'v', 0, 0, 'a', 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +CMMode myCmmodes[128] = { + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, + {NULL}, + {add_ban, del_ban}, + {NULL}, + {NULL}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + +CBMode myCbmodes[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}, + {CMODE_A, 0, NULL, NULL}, /* A */ + {CMODE_B, 0, NULL, NULL}, /* B */ + {CMODE_C, 0, NULL, NULL}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {CMODE_K, 0, NULL, NULL}, /* K */ + {0}, /* L */ + {0}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, 0, NULL, NULL}, /* O */ + {0}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, + {CMODE_d, 0, NULL, NULL}, + {0}, /* e */ + {CMODE_f, 0, set_flood, cs_set_flood}, + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {CMODE_q, 0, NULL, NULL}, + {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'d', CMODE_d, 0, NULL, NULL}, + {'f', CMODE_f, 0, get_flood, cs_get_flood}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'q', CMODE_q, 0, NULL, NULL}, + {'r', CMODE_r, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'A', CMODE_A, 0, NULL, NULL}, + {'B', CMODE_B, 0, NULL, NULL}, + {'C', CMODE_C, 0, NULL, NULL}, + {'K', CMODE_K, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {'S', CMODE_S, 0, NULL, NULL}, + {0} +}; + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {0}, /* a */ + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {0}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + + + +void ptlink_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(s_ChanServ, chan, "%s %s %s", ircd->botchanumode, nick, + 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(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + +/* + * Note: This function has no validation whatsoever. Also, as of PTlink6.15.1 + * when you /deoper you get to keep your vindent, but you lose your vhost. In + * 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(const char *source, int ac, const char **av) +{ + User *u; + const char *newhost = NULL, *newuser = NULL; + int tofree = 0; + + if (ac != 1) + return MOD_CONT; + u = finduser(source); + + if (!u) { + if (debug) { + alog("debug: NEWMASK for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + if ((u->mode & (UMODE_NM | UMODE_VH)) == (UMODE_NM | UMODE_VH)) { + /* This NEWMASK should be discarded because it's sent due to a +r by + * someone with a ptlink-masked host. PTlink has our correct host, so + * we can just ignore this :) Or we'll get ptlink's old host which is + * not what we want. -GD + */ + u->mode &= ~UMODE_NM; + if (debug) + alog("debug: Ignoring NEWMASK because it's send because of SVSMODE +r"); + return MOD_CONT; + } + + newuser = myStrGetOnlyToken(av[0], '@', 0); + if (newuser) { + newhost = myStrGetTokenRemainder(av[0], '@', 1); + tofree = 1; + u->SetIdent(newuser); + free((char *)newuser); + } else { + newhost = av[0]; + } + + if (newhost && *newhost == '@') + newhost++; + + u->mode |= UMODE_VH; + + if (newhost) + u->SetDisplayedHost(newhost); + + if (tofree) + free((char *)newhost); + + return MOD_CONT; +} + +/* + NICK %s %d %lu %s %s %s %s %s :%s + parv[0] = nickname + parv[1] = hopcount + parv[2] = nick TS (nick introduction time) + parv[3] = umodes + parv[4] = username + parv[5] = hostname + parv[6] = spoofed hostname + parv[7] = server + parv[8] = 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) +*/ +/* + NICK xpto 2 561264 +rw irc num.myisp.pt mask.myisp.pt uc.ptlink.net :Just me + 0 1 2 3 4 5 6 7 8 + +*/ +int anope_event_nick(const char *source, int ac, const char **av) +{ + User *user; + + if (ac != 2) { + user = do_nick(source, av[0], av[4], av[5], av[7], av[8], + strtoul(av[2], NULL, 10), 0, 0, av[6], NULL); + if (user) + anope_set_umode(user, 1, &av[3]); + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + 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(const char *source, int ac, const char **av) +{ + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + do_server(source, av[0], av[1], av[3], NULL); + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + + +void moduleAddIRCDMsgs(void) +{ + Message *m; + + updateProtectDetails("PROTECT", "PROTECTME", "protect", "deprotect", + "AUTOPROTECT", "+a", "-a"); + + m = createMessage("401", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("402", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("436", anope_event_436); + addCoreMessage(IRCD, m); + m = createMessage("461", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("AWAY", anope_event_away); + 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", 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); + 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("TOPIC", anope_event_topic); + addCoreMessage(IRCD, m); + m = createMessage("USER", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("WALLOPS", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("WHOIS", anope_event_whois); + addCoreMessage(IRCD, m); + m = createMessage("AKILL", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("GLOBOPS", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("GNOTICE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("GOPER", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("RAKILL", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SILENCE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SVSKILL", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SVSMODE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SVSNICK", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SVSNOOP", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("SQLINE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("UNSQLINE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("NEWMASK", anope_event_newmask); + addCoreMessage(IRCD, m); + m = createMessage("CAPAB", anope_event_capab); + addCoreMessage(IRCD, m); + 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); + m = createMessage("ERROR", anope_event_error); + addCoreMessage(IRCD, m); + m = createMessage("NJOIN", anope_event_sjoin); + addCoreMessage(IRCD, m); + m = createMessage("NNICK", anope_event_nick); + addCoreMessage(IRCD, m); + m = createMessage("ZLINE", anope_event_null); + addCoreMessage(IRCD, m); + m = createMessage("UNZLINE", anope_event_null); + addCoreMessage(IRCD, m); +} + +int anope_event_svsinfo(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +/* Event: PROTOCTL */ +int anope_event_capab(const char *source, int ac, const char **av) +{ + capab_parse(ac, av); + return MOD_CONT; +} + +/* + :%s SQLINE %s :%s + parv[0] = sender + parv[1] = sqlined nick/mask + parv[2] = reason +*/ +void ptlink_cmd_sqline(const char *mask, const char *reason) +{ + send_cmd(ServerName, "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 PTlinkProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(NULL, "SVSADMIN %s :%s", server, set ? "noopers" : "rehash"); +} + +void ptlink_cmd_svsadmin(const char *server, int set) +{ + ircd_proto.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 PTlinkProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(NULL, "UNGLINE %s@%s", user, host); +} + + +void anope_part(char *nick, char *chan) +{ + send_cmd(nick, "PART %s", chan); +} +void anope_topic(char *whosets, char *chan, char *whosetit, char *topic, + time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +/* + :%s UNSQLINE %s + parv[0] = sender + parv[1] = sqlined nick/mask +*/ +void ptlink_cmd_unsqline(const char *user) +{ + send_cmd(NULL, "UNSQLINE %s", user); +} + +void ptlink_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(ServerName, "SJOIN %ld %s + :%s", (long int) chantime, + channel, user); +} + +/* + :%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 ptlink_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(ServerName, "GLINE %s@%s %i %s :%s", user, host, 86400 * 2, + who, reason); +} + + +void ptlink_cmd_svskill(const char *source, const char *user, const char *buf) +{ + if (!buf) { + return; + } + + if (!source || !user) { + return; + } + + 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 ptlink_cmd_svsmode(User * u, int ac, const char **av) +{ + send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], + (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); + + /* If we set +r on someone +NRah (1 or more of those modes), PTlink will + * send us a NEWMASK with their ptlink-masked-host. If we want HostServ + * to work for them, we will need to send our NEWMASK after we receive + * theirs. Thus we make a hack and store in moduleData that we need to + * look out for that. + */ + if ((strchr(av[0], 'r') + && ((u->mode & UMODE_N) || (u->mode & UMODE_R) + || (u->mode & UMODE_a) || (u->mode & UMODE_h)))) + u->mode |= UMODE_NM; +} + +int anope_event_error(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + +void ptlink_cmd_squit(const char *servname, const char *message) +{ + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +/* PONG */ +void ptlink_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +/* + SVINFO %d %d + parv[0] = server name + parv[1] = current supported protocol version + parv[2] = minimum supported protocol version + + See the ptlink.h for information on PTLINK_TS_CURRENT, and + PTLINK_TS_MIN +*/ +void ptlink_cmd_svinfo() +{ +#if defined(PTLINK_TS_CURRENT) && defined(PTLINK_TS_MIN) + send_cmd(NULL, "SVINFO %d %d %lu", PTLINK_TS_CURRENT, PTLINK_TS_MIN, + (unsigned long int) time(NULL)); +#else + /* hardwired if the defs some how go missing */ + send_cmd(NULL, "SVINFO 6 3 %lu", (unsigned long int) time(NULL)); +#endif +} + +/* + SVSINFO %lu %d + parv[0] = sender (server name) + parv[1] = local services data TS + parv[1] = max global users +*/ +void ptlink_cmd_svsinfo() +{ + send_cmd(NULL, "SVSINFO %lu %d", (unsigned long int) time(NULL), + maxusercnt); +} + +/* + 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 ptlink_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +/* + CAPAB :%s + parv[1] = capability list +*/ +void ptlink_cmd_capab() +{ + send_cmd(NULL, "CAPAB :QS PTS4"); +} + + +void ptlink_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d Anope.Services%s :%s", servname, hop, + version_number_dotted, descript); +} +void ptlink_cmd_connect(int servernum) +{ + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) + ptlink_cmd_pass(RemotePassword); + else if (servernum == 2) + ptlink_cmd_pass(RemotePassword2); + else if (servernum == 3) + ptlink_cmd_pass(RemotePassword3); + + ptlink_cmd_capab(); + ptlink_cmd_server(ServerName, 1, ServerDesc); + ptlink_cmd_svinfo(); + ptlink_cmd_svsinfo(); +} + + + +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + 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(const char *source, int ac, const char **av) +{ + if (ac != 4) + return MOD_CONT; + do_topic(source, ac, av); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, 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(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + + +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + + +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +void ptlink_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); +} + + +void ptlink_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + ptlink_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void ptlink_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void ptlink_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void ptlink_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void ptlink_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $%s :%s", dest, msg); +} + +void ptlink_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $%s :%s", dest, msg); +} + +/* GLOBOPS */ +void ptlink_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); +} + +/* 391 */ +void ptlink_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void ptlink_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void ptlink_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void ptlink_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void ptlink_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void ptlink_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void ptlink_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void ptlink_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void ptlink_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void ptlink_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void ptlink_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void ptlink_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +void ptlink_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + 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 ptlink_cmd_nick(const char *nick, const char *name, const char *mode) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, + (unsigned long int) time(NULL), mode, ServiceUser, + ServiceHost, ServiceHost, ServerName, name); + ptlink_cmd_sqline(nick, "Reserved for services"); +} + +void ptlink_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (!buf) { + return; + } + + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +/* QUIT */ +void ptlink_cmd_quit(const char *source, const char *buf) +{ + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +void ptlink_cmd_part(const char *nick, const char *chan, const char *buf) +{ + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +/* + :%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 ptlink_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (long int) time(NULL), topic); +} + +void ptlink_cmd_vhost_off(User * u) +{ + /* does not support vhosting */ +} + +void ptlink_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + User *u; + + if (vIdent) { + send_cmd(s_HostServ, "NEWMASK %s@%s %s", vIdent, vhost, nick); + } else { + send_cmd(s_HostServ, "NEWMASK %s %s", vhost, nick); + } + + if ((u = finduser(nick))) + u->mode |= UMODE_VH; +} + +/* INVITE */ +void ptlink_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +void ptlink_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void ptlink_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void ptlink_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void ptlink_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + + +void ptlink_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'o': + if (add) { + opcnt++; + + if (WallOper) + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + display_news(user, NEWS_OPER); + if (is_services_admin(user)) { + common_svsmode(user, "+a", NULL); + user->mode |= UMODE_a; + } + + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + } + } +} + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + ptlink_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +void ptlink_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, + (unsigned long int) time(NULL), modes, user, host, host, + ServerName, real); + ptlink_cmd_sqline(nick, "Reserved for services"); + +} + +void ptlink_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); + + +} + +/* SVSHOLD - set */ +void ptlink_cmd_svshold(const char *nick) +{ + /* Not supported by this IRCD */ +} + +/* SVSHOLD - release */ +void ptlink_cmd_release_svshold(const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* +:%s UNZLINE %s + parv[0] = sender + parv[1] = zlined host +*/ +void ptlink_cmd_unszline(const char *mask) +{ + send_cmd(s_OperServ, "UNZLINE %s", mask); +} + +/* +:%s ZLINE %s :%s + parv[0] = sender + parv[1] = zlined host + parv[2] = time + parv[3] = reason +*/ +void ptlink_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + send_cmd(s_OperServ, "ZLINE %s %ld :%s", mask, + (long int) time(NULL) + 86400 * 2, reason); +} + +/* +:%s UNSXLINE %s + parv[0] = sender + parv[1] = info ban mask +*/ +void ptlink_cmd_unsgline(const char *mask) +{ + send_cmd(ServerName, "UNSXLINE :%s", mask); +} + + +/* + * sxline - add info ban line + * + * parv[0] = sender prefix + * parv[1] = mask length + * parv[2] = real name banned mask:reason + */ +void ptlink_cmd_sgline(const char *mask, const char *reason) +{ + send_cmd(ServerName, "SXLINE %d :%s:%s", (int) strlen(mask), mask, + reason); +} + +/* 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 ptlink_cmd_svsnick(const char *source, const char *guest, time_t when) +{ + if (!source || !guest) { + return; + } + send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); +} + +void ptlink_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, + (unsigned long int) time(NULL), modes, user, host, host, + ServerName, real); +} + + +void ptlink_cmd_unban(const char *name, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE channel modes */ + +void ptlink_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + /* Not Supported by this IRCD */ +} + +void ptlink_cmd_svso(const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void ptlink_cmd_svid_umode(const char *nick, time_t ts) +{ + /* Not Supported by this ircd */ +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void ptlink_cmd_nc_change(User * u) +{ + /* Not Supported by this ircd */ +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void ptlink_cmd_svid_umode2(User * u, const char *ts) +{ + common_svsmode(u, "+r", NULL); +} + +void ptlink_cmd_svid_umode3(User * u, const char *ts) +{ + /* Bahamuts have this extra one, since they can check on even nick changes */ +} + +/* NICK */ +/* + :%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 ptlink_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s %ld", newnick, (long int) time(NULL)); +} + +/* + :%s SVSJOIN %s :%s + parv[0] = sender (services client) + parv[1] = target client nick + parv[2] = channels list + :OperServ SVSJOIN Trystan #Admin +*/ +void ptlink_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + 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 ptlink_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + send_cmd(source, "SVSPART %s :%s", nick, chan); +} + +void ptlink_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_rehash(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int ptlink_flood_mode_check(const 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 ptlink_cmd_eob() +{ + /* not supported */ +} + +void ptlink_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + ptlink_cmd_squit(jserver, rbuf); + ptlink_cmd_server(jserver, 1, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* GLOBOPS - to handle old WALLOPS */ +void ptlink_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int ptlink_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int ptlink_valid_chan(const char *cahn) +{ + /* no hard coded invalid chan */ + return 1; +} + + +void ptlink_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "NOTICE %s :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(ptlink_cmd_topic); + pmodule_cmd_vhost_off(ptlink_cmd_vhost_off); + pmodule_cmd_akill(ptlink_cmd_akill); + pmodule_cmd_svskill(ptlink_cmd_svskill); + pmodule_cmd_svsmode(ptlink_cmd_svsmode); + pmodule_cmd_372(ptlink_cmd_372); + pmodule_cmd_372_error(ptlink_cmd_372_error); + pmodule_cmd_375(ptlink_cmd_375); + pmodule_cmd_376(ptlink_cmd_376); + pmodule_cmd_nick(ptlink_cmd_nick); + pmodule_cmd_guest_nick(ptlink_cmd_guest_nick); + pmodule_cmd_mode(ptlink_cmd_mode); + pmodule_cmd_bot_nick(ptlink_cmd_bot_nick); + pmodule_cmd_kick(ptlink_cmd_kick); + pmodule_cmd_notice_ops(ptlink_cmd_notice_ops); + pmodule_cmd_notice(ptlink_cmd_notice); + pmodule_cmd_notice2(ptlink_cmd_notice2); + pmodule_cmd_privmsg(ptlink_cmd_privmsg); + pmodule_cmd_privmsg2(ptlink_cmd_privmsg2); + pmodule_cmd_serv_notice(ptlink_cmd_serv_notice); + pmodule_cmd_serv_privmsg(ptlink_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(ptlink_cmd_bot_chan_mode); + pmodule_cmd_351(ptlink_cmd_351); + pmodule_cmd_quit(ptlink_cmd_quit); + pmodule_cmd_pong(ptlink_cmd_pong); + pmodule_cmd_join(ptlink_cmd_join); + pmodule_cmd_unsqline(ptlink_cmd_unsqline); + pmodule_cmd_invite(ptlink_cmd_invite); + pmodule_cmd_part(ptlink_cmd_part); + pmodule_cmd_391(ptlink_cmd_391); + pmodule_cmd_250(ptlink_cmd_250); + pmodule_cmd_307(ptlink_cmd_307); + pmodule_cmd_311(ptlink_cmd_311); + pmodule_cmd_312(ptlink_cmd_312); + pmodule_cmd_317(ptlink_cmd_317); + pmodule_cmd_219(ptlink_cmd_219); + pmodule_cmd_401(ptlink_cmd_401); + pmodule_cmd_318(ptlink_cmd_318); + pmodule_cmd_242(ptlink_cmd_242); + pmodule_cmd_243(ptlink_cmd_243); + pmodule_cmd_211(ptlink_cmd_211); + pmodule_cmd_global(ptlink_cmd_global); + pmodule_cmd_global_legacy(ptlink_cmd_global_legacy); + pmodule_cmd_sqline(ptlink_cmd_sqline); + pmodule_cmd_squit(ptlink_cmd_squit); + pmodule_cmd_svso(ptlink_cmd_svso); + pmodule_cmd_chg_nick(ptlink_cmd_chg_nick); + pmodule_cmd_svsnick(ptlink_cmd_svsnick); + pmodule_cmd_vhost_on(ptlink_cmd_vhost_on); + pmodule_cmd_connect(ptlink_cmd_connect); + pmodule_cmd_svshold(ptlink_cmd_svshold); + pmodule_cmd_release_svshold(ptlink_cmd_release_svshold); + pmodule_cmd_unsgline(ptlink_cmd_unsgline); + pmodule_cmd_unszline(ptlink_cmd_unszline); + pmodule_cmd_szline(ptlink_cmd_szline); + pmodule_cmd_sgline(ptlink_cmd_sgline); + pmodule_cmd_unban(ptlink_cmd_unban); + pmodule_cmd_svsmode_chan(ptlink_cmd_svsmode_chan); + pmodule_cmd_svid_umode(ptlink_cmd_svid_umode); + pmodule_cmd_nc_change(ptlink_cmd_nc_change); + pmodule_cmd_svid_umode2(ptlink_cmd_svid_umode2); + pmodule_cmd_svid_umode3(ptlink_cmd_svid_umode3); + pmodule_cmd_svsjoin(ptlink_cmd_svsjoin); + pmodule_cmd_svspart(ptlink_cmd_svspart); + pmodule_cmd_swhois(ptlink_cmd_swhois); + pmodule_cmd_eob(ptlink_cmd_eob); + pmodule_flood_mode_check(ptlink_flood_mode_check); + pmodule_cmd_jupe(ptlink_cmd_jupe); + pmodule_valid_nick(ptlink_valid_nick); + pmodule_valid_chan(ptlink_valid_chan); + pmodule_cmd_ctcp(ptlink_cmd_ctcp); + pmodule_set_umode(ptlink_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(PROTOCOL); + + + pmodule_ircd_version("PTlink 6.15.*+"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set("+f"); + pmodule_ircd_flood_mode_char_remove("-f"); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} + +/* EOF */ diff --git a/src/protocol/obsolete/ptlink.h b/src/protocol/obsolete/ptlink.h new file mode 100644 index 000000000..65b3aeb4c --- /dev/null +++ b/src/protocol/obsolete/ptlink.h @@ -0,0 +1,154 @@ +/* PTLink IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#define UMODE_a 0x00000001 +#define UMODE_h 0x00000002 +#define UMODE_i 0x00000004 +#define UMODE_o 0x00000008 +#define UMODE_r 0x00000010 +#define UMODE_w 0x00000020 +#define UMODE_A 0x00000040 +#define UMODE_B 0x00000080 +#define UMODE_H 0x00000100 +#define UMODE_N 0x00000200 +#define UMODE_O 0x00000400 +#define UMODE_p 0x00000800 +#define UMODE_R 0x00001000 +#define UMODE_s 0x00002000 +#define UMODE_S 0x00004000 +#define UMODE_T 0x00008000 +#define UMODE_v 0x00001000 +#define UMODE_y 0x00002000 +#define UMODE_z 0x00004000 + +#define UMODE_VH 0x00008000 /* Fake umode used for internal vhost things */ +#define UMODE_NM 0x00010000 /* Fake umode used for internal NEWMASK things */ +/* Let's hope for a better vhost-system with PTlink7 ;) */ + + +#define CMODE_i 0x00000001 +#define CMODE_m 0x00000002 +#define CMODE_n 0x00000004 +#define CMODE_p 0x00000008 +#define CMODE_s 0x00000010 +#define CMODE_t 0x00000020 +#define CMODE_k 0x00000040 /* These two used only by ChanServ */ +#define CMODE_l 0x00000080 +#define CMODE_A 0x00000400 +#define CMODE_B 0x00000800 +#define CMODE_c 0x00001000 +#define CMODE_d 0x00002000 +#define CMODE_f 0x00004000 +#define CMODE_K 0x00008000 +#define CMODE_O 0x00010000 +#define CMODE_q 0x00020000 +#define CMODE_S 0x00040000 +#define CMODE_N 0x00080000 +#define CMODE_R 0x00000100 /* Only identified users can join */ +#define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_C 0x00100000 + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r + +/* + The following variables are set to define the TS protocol version + that we support. + + PTLink 6.14 to 6.17 TS CURRENT is 6 and MIN is 3 + PTlink 6.18 TS CURRENT is 9 and MIN is 3 + PTLink 6.19 TS CURRENT is 10 and MIN is 9 + + If you are running 6.18 or 6.19 do not touch these values as they will + allow you to connect + + If you are running an older version of PTLink, first think about updating + your ircd, or changing the TS_CURRENT to 6 to allow services to connect +*/ + +#define PTLINK_TS_CURRENT 9 +#define PTLINK_TS_MIN 3 + +void ptlink_set_umode(User * user, int ac, const char **av); +void ptlink_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void ptlink_cmd_vhost_off(User * u); +void ptlink_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void ptlink_cmd_svskill(const char *source, const char *user, const char *buf); +void ptlink_cmd_svsmode(User * u, int ac, const char **av); +void ptlink_cmd_372(const char *source, const char *msg); +void ptlink_cmd_372_error(const char *source); +void ptlink_cmd_375(const char *source); +void ptlink_cmd_376(const char *source); +void ptlink_cmd_nick(const char *nick, const char *name, const char *modes); +void ptlink_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void ptlink_cmd_mode(const char *source, const char *dest, const char *buf); +void ptlink_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void ptlink_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void ptlink_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void ptlink_cmd_notice(const char *source, const char *dest, const char *buf); +void ptlink_cmd_notice2(const char *source, const char *dest, const char *msg); +void ptlink_cmd_privmsg(const char *source, const char *dest, const char *buf); +void ptlink_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void ptlink_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void ptlink_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void ptlink_cmd_bot_chan_mode(const char *nick, const char *chan); +void ptlink_cmd_351(const char *source); +void ptlink_cmd_quit(const char *source, const char *buf); +void ptlink_cmd_pong(const char *servname, const char *who); +void ptlink_cmd_join(const char *user, const char *channel, time_t chantime); +void ptlink_cmd_unsqline(const char *user); +void ptlink_cmd_invite(const char *source, const char *chan, const char *nick); +void ptlink_cmd_part(const char *nick, const char *chan, const char *buf); +void ptlink_cmd_391(const char *source, const char *timestr); +void ptlink_cmd_250(const char *buf); +void ptlink_cmd_307(const char *buf); +void ptlink_cmd_311(const char *buf); +void ptlink_cmd_312(const char *buf); +void ptlink_cmd_317(const char *buf); +void ptlink_cmd_219(const char *source, const char *letter); +void ptlink_cmd_401(const char *source, const char *who); +void ptlink_cmd_318(const char *source, const char *who); +void ptlink_cmd_242(const char *buf); +void ptlink_cmd_243(const char *buf); +void ptlink_cmd_211(const char *buf); +void ptlink_cmd_global(const char *source, const char *buf); +void ptlink_cmd_global_legacy(const char *source, const char *fmt); +void ptlink_cmd_sqline(const char *mask, const char *reason); +void ptlink_cmd_squit(const char *servname, const char *message); +void ptlink_cmd_svso(const char *source, const char *nick, const char *flag); +void ptlink_cmd_chg_nick(const char *oldnick, const char *newnick); +void ptlink_cmd_svsnick(const char *source, const char *guest, time_t when); +void ptlink_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void ptlink_cmd_connect(int servernum); +void ptlink_cmd_svshold(const char *nick); +void ptlink_cmd_release_svshold(const char *nick); +void ptlink_cmd_unsgline(const char *mask); +void ptlink_cmd_unszline(const char *mask); +void ptlink_cmd_szline(const char *mask, const char *reason, const char *whom); +void ptlink_cmd_sgline(const char *mask, const char *reason); +void ptlink_cmd_unban(const char *name, const char *nick); +void ptlink_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void ptlink_cmd_svid_umode(const char *nick, time_t ts); +void ptlink_cmd_nc_change(User * u); +void ptlink_cmd_svid_umode2(User * u, const char *ts); +void ptlink_cmd_svid_umode3(User * u, const char *ts); +void ptlink_cmd_eob(); +int ptlink_flood_mode_check(const char *value); +void ptlink_cmd_jupe(const char *jserver, const char *who, const char *reason); +int ptlink_valid_nick(const char *nick); +void ptlink_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class PTlinkProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/rageircd.c b/src/protocol/obsolete/rageircd.c new file mode 100644 index 000000000..cb5ef0af4 --- /dev/null +++ b/src/protocol/obsolete/rageircd.c @@ -0,0 +1,1678 @@ +/* Rage IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#include "services.h" +#include "pseudo.h" +#include "rageircd.h" + +IRCDVar myIrcd[] = { + {"RageIRCd 2.0.*", /* ircd name */ + "+d", /* nickserv mode */ + "+d", /* chanserv mode */ + "+d", /* memoserv mode */ + "+d", /* hostserv mode */ + "+di", /* operserv mode */ + "+d", /* botserv mode */ + "+dh", /* helpserv mode */ + "+di", /* Dev/Null mode */ + "+di", /* Global mode */ + "+o", /* nickserv alias mode */ + "+o", /* chanserv alias mode */ + "+o", /* memoserv alias mode */ + "+io", /* hostserv alias mode */ + "+io", /* operserv alias mode */ + "+o", /* botserv alias mode */ + "+o", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+io", /* Global alias mode */ + "+", /* Used by BotServ Bots */ + 3, /* Chan Max Symbols */ + "-ilmnpRstcOACNM", /* Modes to Remove */ + "+o", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 0, /* Has Owner */ + NULL, /* Mode to set for an owner */ + NULL, /* Mode to unset for an owner */ + "+a", /* Mode to set for channel admin */ + "-a", /* Mode to unset for channel admin */ + "+rd", /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-rd", /* Mode on UnReg */ + "-r+d", /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 0, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topic Backward */ + 0, /* Protected Umode */ + 1, /* Has Admin */ + 1, /* Chan SQlines */ + 1, /* Quit on Kill */ + 0, /* SVSMODE unban */ + 0, /* Has Protect */ + 0, /* Reverse */ + 1, /* Chan Reg */ + CMODE_r, /* Channel Mode */ + 0, /* vidents */ + 1, /* svshold */ + 1, /* time stamp on mode */ + 1, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 1, /* VHOST ON NICK */ + 0, /* Change RealName */ + CMODE_p, /* No Knock */ + CMODE_A, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_x, /* Vhost Mode */ + 0, /* +f */ + 0, /* +L */ + 0, + 0, + 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + "x", /* vhost char */ + 0, /* ts6 */ + 1, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 1, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + CAPAB_NOQUIT, /* NOQUIT */ + CAPAB_TSMODE, /* TSMODE */ + CAPAB_UNCONNECT, /* UNCONNECT */ + 0, /* NICKIP */ + 0, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + CAPAB_BURST, /* BURST */ + 0, /* TS5 */ + 0, /* TS3 */ + CAPAB_DKEY, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + 0, /* QS */ + CAPAB_UID, /* UID */ + 0, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + CAPAB_SN2, /* SN2 */ + CAPAB_TOKEN, /* TOKEN */ + CAPAB_VHOST, /* VHOST */ + CAPAB_SSJ3, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + 0, /* DODKEY */ + 0, /* DOZIP */ + 0, 0, 0} +}; + + +unsigned long umodes[128] = { + 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, 0, /* M N O */ + 0, 0, UMODE_R, /* 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, 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 */ + 0, 0, UMODE_r, /* p q r */ + 0, 0, 0, /* s t u */ + 0, UMODE_w, 0, /* v w x */ + 0, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ � */ +}; + +char myCsmodes[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, + 'h', /* (37) % Channel halfops */ + 0, 0, 0, 0, + 'a', /* * Channel Admins */ + + 'v', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +CMMode myCmmodes[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}, /* 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}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + +CBMode myCbmodes[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}, + {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, /* B */ + {CMODE_C, 0, NULL, NULL}, + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {0}, /* K */ + {0}, /* L */ + {CMODE_M, 0, NULL, NULL}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {0}, /* q */ + {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'r', CMODE_r, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'A', CMODE_A, 0, NULL, NULL}, + {'C', CMODE_C, 0, NULL, NULL}, + {'M', CMODE_M, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {0} +}; + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin}, + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {0}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + + + +void rageircd_cmd_bot_unban(ChannelInfo * ci, const char *nick) +{ + send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick); +} + +int anope_event_sjoin(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + +int anope_event_nick(const char *source, int ac, const char **av) +{ + User *user; + + if (ac != 2) { + user = do_nick(source, av[0], av[4], av[5], av[6], av[9], + strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), + strtoul(av[8], NULL, 0), "*", NULL); + if (user) + anope_set_umode(user, 1, &av[3]); + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +/* Event: PROTOCTL */ +int anope_event_capab(const char *source, int ac, const char **av) +{ + capab_parse(ac, av); + return MOD_CONT; +} + +int anope_event_vhost(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: VHOST for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[1]); + return MOD_CONT; +} + +/* +** SNICK +** source = NULL +** parv[0] = nickname Trystan +** parv[1] = timestamp 1090113640 +** parv[2] = hops 1 +** parv[3] = username Trystan +** parv[4] = host c-24-2-101-227.client.comcast.net +** parv[5] = IP 402810339 +** parv[6] = vhost mynet-27CCA80D.client.comcast.net +** parv[7] = server rage2.nomadirc.net +** parv[8] = servicestamp 0 +** parv[9] = modes +ix +** parv[10] = info Dreams are answers to questions not yet asked +*/ + +int anope_event_snick(const char *source, int ac, const char **av) +{ + User *user; + + if (ac != 2) { + user = do_nick(source, av[0], av[3], av[4], av[7], av[10], + strtoul(av[1], NULL, 10), strtoul(av[8], NULL, 0), + strtoul(av[5], NULL, 0), av[6], NULL); + if (user) { + anope_set_umode(user, 1, &av[9]); + } + } + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + + +/* *INDENT-OFF* */ +void moduleAddIRCDMsgs(void) { + Message *m; + + updateProtectDetails("ADMIN","ADMINME","admin","deadmin","AUTOADMIN","+a","-a"); + + m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); + m = createMessage("482", anope_event_482); addCoreMessage(IRCD,m); + m = createMessage("461", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_null); 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", 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); + 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_globops); addCoreMessage(IRCD,m); + m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); + m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); + m = createMessage("UNSQLINE", anope_event_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); + m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); + m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); + m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); + m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); + m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SNICK", anope_event_snick); addCoreMessage(IRCD,m); + 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(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + + +int anope_event_burst(const char *source, int ac, const char **av) +{ + Server *s; + s = findserver(servlist, source); + if (ac > 1) { + /* for future use - start burst */ +} else { + + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); +} + +return MOD_CONT; +} + +void rageircd_cmd_sqline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(NULL, "SQLINE %s :%s", mask, reason); +} + +void rageircd_cmd_unsgline(const char *mask) +{ + send_cmd(NULL, "UNSGLINE 0 :%s", mask); +} + +void rageircd_cmd_unszline(const char *mask) +{ + send_cmd(NULL, "UNSZLINE 0 %s", mask); +} + +void rageircd_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + send_cmd(NULL, "SZLINE %s :%s", mask, reason); +} + +void RageIRCdProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); +} + +void rageircd_cmd_svsadmin(const char *server, int set) +{ + ircd_proto.cmd_svsnoop(server, set); +} + +void rageircd_cmd_sgline(const char *mask, const char *reason) +{ + send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); + +} + +void RageIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(NULL, "RAKILL %s %s", host, user); +} + + +/* PART */ +void rageircd_cmd_part(const char *nick, const char *chan, const char *buf) +{ + if (!nick || !chan) { + return; + } + + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +void rageircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +void rageircd_cmd_vhost_off(User * u) +{ + send_cmd(s_HostServ, "SVSMODE %s -x", u->nick); + notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); +} + +void rageircd_cmd_chghost(const char *nick, const char *vhost) +{ + if (!nick || !vhost) { + return; + } + send_cmd(ServerName, "VHOST %s %s", nick, vhost); +} + +void rageircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + send_cmd(s_HostServ, "SVSMODE %s +x", nick); + rageircd_cmd_chghost(nick, vhost); +} + +void rageircd_cmd_unsqline(const char *user) +{ + send_cmd(NULL, "UNSQLINE %s", user); +} + +void rageircd_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); +} + +void rageircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, + (long int) time(NULL), reason); +} + +void rageircd_cmd_svskill(const char *source, const char *user, const char *buf) +{ + if (!buf) { + return; + } + + if (!source || !user) { + return; + } + + send_cmd(source, "SVSKILL %s :%s", user, buf); +} + +void rageircd_cmd_svsmode(User * u, int ac, const char **av) +{ + send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, + (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), + (ac == 2 ? av[1] : "")); +} + +void rageircd_cmd_squit(const char *servname, const char *message) +{ + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +/* PONG */ +void rageircd_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +void rageircd_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 3 0 %ld bluemoon 0", (long int) time(NULL)); +} + +void rageircd_cmd_capab() +{ + /* CAPAB BURST UNCONNECT ZIP SSJ3 SN2 VHOST SUID TOK1 TSMODE */ + send_cmd(NULL, "CAPAB BURST UNCONNECT SSJ3 SN2 VHOST TSMODE"); +} + +void rageircd_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); +} + +/* PASS */ +void rageircd_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +void rageircd_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void rageircd_cmd_connect(int servernum) +{ + if (Numeric) { + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, Numeric); + } else { + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + } + + if (servernum == 1) + rageircd_cmd_pass(RemotePassword); + else if (servernum == 2) + rageircd_cmd_pass(RemotePassword2); + else if (servernum == 3) + rageircd_cmd_pass(RemotePassword3); + rageircd_cmd_capab(); + if (Numeric) { + send_cmd(NULL, "MYID !%s", Numeric); + } + rageircd_cmd_server(ServerName, 1, ServerDesc); + rageircd_cmd_svinfo(); + rageircd_cmd_burst(); +} + +void rageircd_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'd': + if (ac == 0) { + alog("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + opcnt++; + + if (WallOper) + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + display_news(user, NEWS_OPER); + if (is_services_oper(user)) { + common_svsmode(user, "+a", NULL); + user->mode |= UMODE_a; + } + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + case 'x': + update_host(user); + break; + } + } +} + +/* GLOBOPS */ +void rageircd_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); +} + +void rageircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); +} + + +void rageircd_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + rageircd_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void rageircd_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void rageircd_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void rageircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void rageircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $%s :%s", dest, msg); +} + +void rageircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $%s :%s", dest, msg); +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + rageircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +void rageircd_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); +} + +void rageircd_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (ircdcap->tsmode) { + if (uplink_capab & ircdcap->tsmode || UseTSMODE) { + send_cmd(source, "MODE %s 0 %s", dest, buf); + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } +} + + +void rageircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +void rageircd_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void rageircd_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void rageircd_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void rageircd_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + +/* INVITE */ +void rageircd_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +/* 391 */ +void rageircd_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void rageircd_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void rageircd_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void rageircd_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void rageircd_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void rageircd_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void rageircd_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void rageircd_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void rageircd_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void rageircd_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void rageircd_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void rageircd_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +void rageircd_cmd_nick(const char *nick, const char *name, const char *modes) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, + (long int) time(NULL), ServiceUser, ServiceHost, ServerName, + modes, name); + rageircd_cmd_sqline(nick, "Reserved for services"); +} + +/* EVENT : OS */ +int anope_event_os(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_OperServ, av[0]); + return MOD_CONT; +} + +/* EVENT : NS */ +int anope_event_ns(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_NickServ, av[0]); + return MOD_CONT; +} + +/* EVENT : MS */ +int anope_event_ms(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_MemoServ, av[0]); + return MOD_CONT; +} + +/* EVENT : HS */ +int anope_event_hs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_HostServ, av[0]); + return MOD_CONT; +} + +/* EVENT : CS */ +int anope_event_cs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_ChanServ, av[0]); + return MOD_CONT; +} + +/* QUIT */ +void rageircd_cmd_quit(const char *source, const char *buf) +{ + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +void rageircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, + (long int) time(NULL), user, host, ServerName, modes, real); + rageircd_cmd_sqline(nick, "Reserved for services"); +} + +/* SVSMODE -b */ +void rageircd_cmd_unban(const char *name, const char *nick) +{ + rageircd_cmd_svsmode_chan(name, "-b", nick); +} + + +/* SVSMODE channel modes */ + +void rageircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + if (nick) { + send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); + } else { + send_cmd(ServerName, "SVSMODE %s %s", name, mode); + } +} + +void rageircd_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); +} + +int anope_event_server(const char *source, int ac, const char **av) +{ + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + do_server(source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + + +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + return MOD_CONT; +} + + +int anope_event_482(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_topic(const char *source, int ac, const char **av) +{ + if (ac != 4) + return MOD_CONT; + do_topic(source, ac, av); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, av); + return MOD_CONT; +} + + +int anope_event_mode(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + + +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + + +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +/* SVSHOLD - set */ +void rageircd_cmd_svshold(const char *nick) +{ + send_cmd(ServerName, "SVSHOLD %s %d :%s", nick, NSReleaseTimeout, + "Being held for registered user"); +} + +/* SVSHOLD - release */ +void rageircd_cmd_release_svshold(const char *nick) +{ + send_cmd(ServerName, "SVSHOLD %s 0", nick); +} + +void rageircd_cmd_svsnick(const char *source, const char *guest, time_t when) +{ + if (!source || !guest) { + return; + } + send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); +} + +void rageircd_cmd_guest_nick(const char *nick, const char *user, const char *host, + const char *real, const char *modes) +{ + send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, + (long int) time(NULL), user, host, ServerName, modes, real); +} + + +void rageircd_cmd_svso(const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void rageircd_cmd_svid_umode(const char *nick, time_t ts) +{ + send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, + (unsigned long int) ts); +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void rageircd_cmd_nc_change(User * u) +{ + common_svsmode(u, "+d", "1"); +} + +/* SVSMODE +d */ +void rageircd_cmd_svid_umode2(User * u, const char *ts) +{ + /* not used by bahamut ircds */ +} + +void rageircd_cmd_svid_umode3(User * u, const char *ts) +{ + if (u->svid != u->timestamp) { + common_svsmode(u, "+rd", ts); + } else { + common_svsmode(u, "+r", NULL); + } +} + +/* NICK */ +void rageircd_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s", newnick); +} + +int anope_event_myid(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +/* + * SVINFO + * parv[0] = sender prefix + * + * if (parc == 2) + * parv[1] = ZIP (compression initialisation) + * + * if (parc > 2) + * parv[1] = TS_CURRENT + * parv[2] = TS_MIN + * parv[3] = standalone or connected to non-TS (unused) + * parv[4] = UTC time + * parv[5] = ircd codename + * parv[6] = masking keys + */ +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_gnotice(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_sqline(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +void rageircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + /* Find no reference to it in the code and docs */ +} + +void rageircd_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + /* Find no reference to it in the code and docs */ +} + +void rageircd_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +int anope_event_rehash(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_globops(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int rageircd_flood_mode_check(const char *value) +{ + return 0; +} + +void rageircd_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +void rageircd_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + rageircd_cmd_squit(jserver, rbuf); + rageircd_cmd_server(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* GLOBOPS - to handle old WALLOPS */ +void rageircd_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int rageircd_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int rageircd_valid_chan(const char *chan) +{ + /* no hard coded invalid nicks */ + return 1; +} + + +void rageircd_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "NOTICE %s :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(rageircd_cmd_topic); + pmodule_cmd_vhost_off(rageircd_cmd_vhost_off); + pmodule_cmd_akill(rageircd_cmd_akill); + pmodule_cmd_svskill(rageircd_cmd_svskill); + pmodule_cmd_svsmode(rageircd_cmd_svsmode); + pmodule_cmd_372(rageircd_cmd_372); + pmodule_cmd_372_error(rageircd_cmd_372_error); + pmodule_cmd_375(rageircd_cmd_375); + pmodule_cmd_376(rageircd_cmd_376); + pmodule_cmd_nick(rageircd_cmd_nick); + pmodule_cmd_guest_nick(rageircd_cmd_guest_nick); + pmodule_cmd_mode(rageircd_cmd_mode); + pmodule_cmd_bot_nick(rageircd_cmd_bot_nick); + pmodule_cmd_kick(rageircd_cmd_kick); + pmodule_cmd_notice_ops(rageircd_cmd_notice_ops); + pmodule_cmd_notice(rageircd_cmd_notice); + pmodule_cmd_notice2(rageircd_cmd_notice2); + pmodule_cmd_privmsg(rageircd_cmd_privmsg); + pmodule_cmd_privmsg2(rageircd_cmd_privmsg2); + pmodule_cmd_serv_notice(rageircd_cmd_serv_notice); + pmodule_cmd_serv_privmsg(rageircd_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(rageircd_cmd_bot_chan_mode); + pmodule_cmd_351(rageircd_cmd_351); + pmodule_cmd_quit(rageircd_cmd_quit); + pmodule_cmd_pong(rageircd_cmd_pong); + pmodule_cmd_join(rageircd_cmd_join); + pmodule_cmd_unsqline(rageircd_cmd_unsqline); + pmodule_cmd_invite(rageircd_cmd_invite); + pmodule_cmd_part(rageircd_cmd_part); + pmodule_cmd_391(rageircd_cmd_391); + pmodule_cmd_250(rageircd_cmd_250); + pmodule_cmd_307(rageircd_cmd_307); + pmodule_cmd_311(rageircd_cmd_311); + pmodule_cmd_312(rageircd_cmd_312); + pmodule_cmd_317(rageircd_cmd_317); + pmodule_cmd_219(rageircd_cmd_219); + pmodule_cmd_401(rageircd_cmd_401); + pmodule_cmd_318(rageircd_cmd_318); + pmodule_cmd_242(rageircd_cmd_242); + pmodule_cmd_243(rageircd_cmd_243); + pmodule_cmd_211(rageircd_cmd_211); + pmodule_cmd_global(rageircd_cmd_global); + pmodule_cmd_global_legacy(rageircd_cmd_global_legacy); + pmodule_cmd_sqline(rageircd_cmd_sqline); + pmodule_cmd_squit(rageircd_cmd_squit); + pmodule_cmd_svso(rageircd_cmd_svso); + pmodule_cmd_chg_nick(rageircd_cmd_chg_nick); + pmodule_cmd_svsnick(rageircd_cmd_svsnick); + pmodule_cmd_vhost_on(rageircd_cmd_vhost_on); + pmodule_cmd_connect(rageircd_cmd_connect); + pmodule_cmd_svshold(rageircd_cmd_svshold); + pmodule_cmd_release_svshold(rageircd_cmd_release_svshold); + pmodule_cmd_unsgline(rageircd_cmd_unsgline); + pmodule_cmd_unszline(rageircd_cmd_unszline); + pmodule_cmd_szline(rageircd_cmd_szline); + pmodule_cmd_sgline(rageircd_cmd_sgline); + pmodule_cmd_unban(rageircd_cmd_unban); + pmodule_cmd_svsmode_chan(rageircd_cmd_svsmode_chan); + pmodule_cmd_svid_umode(rageircd_cmd_svid_umode); + pmodule_cmd_nc_change(rageircd_cmd_nc_change); + pmodule_cmd_svid_umode2(rageircd_cmd_svid_umode2); + pmodule_cmd_svid_umode3(rageircd_cmd_svid_umode3); + pmodule_cmd_svsjoin(rageircd_cmd_svsjoin); + pmodule_cmd_svspart(rageircd_cmd_svspart); + pmodule_cmd_swhois(rageircd_cmd_swhois); + pmodule_cmd_eob(rageircd_cmd_eob); + pmodule_flood_mode_check(rageircd_flood_mode_check); + pmodule_cmd_jupe(rageircd_cmd_jupe); + pmodule_valid_nick(rageircd_valid_nick); + pmodule_valid_chan(rageircd_valid_chan); + pmodule_cmd_ctcp(rageircd_cmd_ctcp); + pmodule_set_umode(rageircd_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(PROTOCOL); + + pmodule_ircd_version("RageIRCd 2.0.x"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set(""); + pmodule_ircd_flood_mode_char_remove(""); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(1); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} + +/* EOF */ diff --git a/src/protocol/obsolete/rageircd.h b/src/protocol/obsolete/rageircd.h new file mode 100644 index 000000000..620ab53ec --- /dev/null +++ b/src/protocol/obsolete/rageircd.h @@ -0,0 +1,117 @@ +/* Rage IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#define UMODE_a 0x00000001 +#define UMODE_h 0x00000002 +#define UMODE_i 0x00000004 +#define UMODE_o 0x00000008 +#define UMODE_r 0x00000010 +#define UMODE_w 0x00000020 +#define UMODE_A 0x00000040 +#define UMODE_R 0x80000000 +#define UMODE_x 0x40000000 + +#define CMODE_i 0x00000001 +#define CMODE_m 0x00000002 +#define CMODE_n 0x00000004 +#define CMODE_p 0x00000008 +#define CMODE_s 0x00000010 +#define CMODE_t 0x00000020 +#define CMODE_k 0x00000040 /* These two used only by ChanServ */ +#define CMODE_l 0x00000080 +#define CMODE_R 0x00000100 /* Only identified users can join */ +#define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_c 0x00000400 /* Colors can't be used */ +#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */ +#define CMODE_N 0x00001000 +#define CMODE_S 0x00002000 +#define CMODE_C 0x00004000 +#define CMODE_A 0x00008000 +#define CMODE_O 0x00010000 /* Only opers can join */ + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r + +void rageircd_set_umode(User * user, int ac, const char **av); +void rageircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void rageircd_cmd_vhost_off(User * u); +void rageircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void rageircd_cmd_svskill(const char *source, const char *user, const char *buf); +void rageircd_cmd_svsmode(User * u, int ac, const char **av); +void rageircd_cmd_372(const char *source, const char *msg); +void rageircd_cmd_372_error(const char *source); +void rageircd_cmd_375(const char *source); +void rageircd_cmd_376(const char *source); +void rageircd_cmd_nick(const char *nick, const char *name, const char *modes); +void rageircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void rageircd_cmd_mode(const char *source, const char *dest, const char *buf); +void rageircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void rageircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void rageircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void rageircd_cmd_notice(const char *source, const char *dest, const char *buf); +void rageircd_cmd_notice2(const char *source, const char *dest, const char *msg); +void rageircd_cmd_privmsg(const char *source, const char *dest, const char *buf); +void rageircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void rageircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void rageircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void rageircd_cmd_bot_chan_mode(const char *nick, const char *chan); +void rageircd_cmd_351(const char *source); +void rageircd_cmd_quit(const char *source, const char *buf); +void rageircd_cmd_pong(const char *servname, const char *who); +void rageircd_cmd_join(const char *user, const char *channel, time_t chantime); +void rageircd_cmd_unsqline(const char *user); +void rageircd_cmd_invite(const char *source, const char *chan, const char *nick); +void rageircd_cmd_part(const char *nick, const char *chan, const char *buf); +void rageircd_cmd_391(const char *source, const char *timestr); +void rageircd_cmd_250(const char *buf); +void rageircd_cmd_307(const char *buf); +void rageircd_cmd_311(const char *buf); +void rageircd_cmd_312(const char *buf); +void rageircd_cmd_317(const char *buf); +void rageircd_cmd_219(const char *source, const char *letter); +void rageircd_cmd_401(const char *source, const char *who); +void rageircd_cmd_318(const char *source, const char *who); +void rageircd_cmd_242(const char *buf); +void rageircd_cmd_243(const char *buf); +void rageircd_cmd_211(const char *buf); +void rageircd_cmd_global(const char *source, const char *buf); +void rageircd_cmd_global_legacy(const char *source, const char *fmt); +void rageircd_cmd_sqline(const char *mask, const char *reason); +void rageircd_cmd_squit(const char *servname, const char *message); +void rageircd_cmd_svso(const char *source, const char *nick, const char *flag); +void rageircd_cmd_chg_nick(const char *oldnick, const char *newnick); +void rageircd_cmd_svsnick(const char *source, const char *guest, time_t when); +void rageircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void rageircd_cmd_connect(int servernum); +void rageircd_cmd_svshold(const char *nick); +void rageircd_cmd_release_svshold(const char *nick); +void rageircd_cmd_unsgline(const char *mask); +void rageircd_cmd_unszline(const char *mask); +void rageircd_cmd_szline(const char *mask, const char *reason, const char *whom); +void rageircd_cmd_sgline(const char *mask, const char *reason); +void rageircd_cmd_unban(const char *name, const char *nick); +void rageircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void rageircd_cmd_svid_umode(const char *nick, time_t ts); +void rageircd_cmd_nc_change(User * u); +void rageircd_cmd_svid_umode2(User * u, const char *ts); +void rageircd_cmd_svid_umode3(User * u, const char *ts); +void rageircd_cmd_eob(); +int rageircd_flood_mode_check(const char *value); +void rageircd_cmd_jupe(const char *jserver, const char *who, const char *reason); +int rageircd_valid_nick(const char *nick); +void rageircd_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class RageIRCdProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/solidircd.c b/src/protocol/obsolete/solidircd.c new file mode 100644 index 000000000..f9909072d --- /dev/null +++ b/src/protocol/obsolete/solidircd.c @@ -0,0 +1,1709 @@ +/* Solid-IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +/*************************************************************************/ + +#include "services.h" +#include "pseudo.h" +#include "solidircd.h" + +IRCDVar myIrcd[] = { + {"Solid-IRCd 3.4.*", /* ircd name */ + "+o", /* nickserv mode */ + "+o", /* chanserv mode */ + "+o", /* memoserv mode */ + "+o", /* hostserv mode */ + "+io", /* operserv mode */ + "+o", /* botserv mode */ + "+h", /* helpserv mode */ + "+i", /* Dev/Null mode */ + "+io", /* Global mode */ + "+o", /* nickserv alias mode */ + "+o", /* chanserv alias mode */ + "+o", /* memoserv alias mode */ + "+io", /* hostserv alias mode */ + "+io", /* operserv alias mode */ + "+o", /* botserv alias mode */ + "+h", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+io", /* Global alias mode */ + "+", /* Used by BotServ Bots */ + 2, /* Chan Max Symbols */ + "-cilmnpstOR", /* Modes to Remove */ + "+o", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 0, /* Has Owner */ + NULL, /* Mode to set for an owner */ + NULL, /* Mode to unset for an owner */ + NULL, /* Mode to set for chan admin */ + NULL, /* Mode to unset for chan admin */ + "+rd", /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-r+d", /* Mode on UnReg */ + "+d", /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 1, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + 0, /* Protected Umode */ + 0, /* Has Admin */ + 1, /* Chan SQlines */ + 1, /* Quit on Kill */ + 1, /* SVSMODE unban */ + 0, /* Has Protect */ + 0, /* Reverse */ + 1, /* Chan Reg */ + CMODE_r, /* Channel Mode */ + 0, /* vidents */ + 1, /* svshold */ + 1, /* time stamp on mode */ + 1, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 0, /* VHOST ON NICK */ + 0, /* Change RealName */ + 0, /* No Knock */ + 0, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_v, /* Vhost Mode */ + 1, /* +f */ + 0, /* +L */ + CMODE_j, /* Mode */ + 0, /* Mode */ + 1, + 1, /* 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + "v", /* vhost char */ + 0, /* ts6 */ + 1, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 1, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + CAPAB_NOQUIT, /* NOQUIT */ + CAPAB_TSMODE, /* TSMODE */ + CAPAB_UNCONNECT, /* UNCONNECT */ + 0, /* NICKIP */ + 0, /* SJOIN */ + 0, /* ZIP */ + CAPAB_BURST, /* BURST */ + 0, /* TS5 */ + 0, /* TS3 */ + CAPAB_DKEY, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + 0, /* QS */ + 0, /* UID */ + 0, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + 0, /* DODKEY */ + CAPAB_DOZIP, /* DOZIP */ + 0, 0, 0} +}; + + +void solidircd_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'a': + if (UnRestrictSAdmin) { + break; + } + if (add && !is_services_admin(user)) { + common_svsmode(user, "-a", NULL); + user->mode &= ~UMODE_a; + } + break; + case 'd': + if (ac == 0) { + alog("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + opcnt++; + + if (WallOper) + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + display_news(user, NEWS_OPER); + + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + case 'v': + update_host(user); + break; + } + } +} + + +unsigned long umodes[128] = { + 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, UMODE_C, /* A B C */ + UMODE_D, 0, UMODE_F, /* D E F */ + 0, 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 */ + 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 */ + UMODE_v, UMODE_w, UMODE_x, /* v w x */ + UMODE_y, /* y */ + UMODE_z, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ � */ +}; + +char myCsmodes[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, + 'h', + 0, 0, 0, 0, + 0, + + 'v', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +CMMode myCmmodes[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}, /* 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}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + + +CBMode myCbmodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, + {0}, /* A */ + {0}, /* B */ + {0}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {0}, /* K */ + {0}, /* L */ + {CMODE_M, 0, NULL, NULL}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {CMODE_j, 0, set_flood, cs_set_flood}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {0}, /* q */ + {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'j', CMODE_j, 0, get_flood, cs_get_flood}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'r', CMODE_r, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'M', CMODE_M, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'S', CMODE_S, 0, NULL, NULL}, + {0} +}; + + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {0}, /* a */ + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {0}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + +void solidircd_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (ircdcap->tsmode) { + if (uplink_capab & ircdcap->tsmode) { + send_cmd(source, "MODE %s 0 %s", dest, buf); + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } +} + +/* SVSHOLD - set */ +void solidircd_cmd_svshold(const char *nick) +{ + send_cmd(ServerName, "SVSHOLD %s %d :%s", nick, NSReleaseTimeout, + "Being held for registered user"); +} + +/* SVSHOLD - release */ +void solidircd_cmd_release_svshold(const char *nick) +{ + send_cmd(ServerName, "SVSHOLD %s 0", nick); +} + +/* SVSMODE -b */ +void solidircd_cmd_unban(const char *name, const char *nick) +{ + solidircd_cmd_svsmode_chan(name, "-b", nick); +} + + +/* SVSMODE channel modes */ + +void solidircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + if (nick) { + send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); + } else { + send_cmd(ServerName, "SVSMODE %s %s", name, mode); + } +} + +void solidircd_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); +} + +/* EVENT: SJOIN */ +int anope_event_sjoin(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + +/* +** NICK - new +** source = NULL +** parv[0] = nickname +** parv[1] = hopcount +** parv[2] = timestamp +** parv[3] = modes +** parv[4] = username +** parv[5] = hostname +** parv[6] = server +** parv[7] = servicestamp +** parv[8] = IP +** parv[9] = info +** NICK - change +** source = oldnick +** parv[0] = new nickname +** parv[1] = hopcount +*/ +int anope_event_nick(const char *source, int ac, const char **av) +{ + User *user; + + if (ac != 2) { + user = do_nick(source, av[0], av[4], av[5], av[6], av[9], + strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), + strtoul(av[8], NULL, 0), NULL, NULL); + if (user) { + anope_set_umode(user, 1, &av[3]); + } + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +/* EVENT : CAPAB */ +int anope_event_capab(const char *source, int ac, const char **av) +{ + capab_parse(ac, av); + return MOD_CONT; +} + +/* EVENT : OS */ +int anope_event_os(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_OperServ, av[0]); + return MOD_CONT; +} + +/* EVENT : NS */ +int anope_event_ns(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_NickServ, av[0]); + return MOD_CONT; +} + +/* EVENT : MS */ +int anope_event_ms(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_MemoServ, av[0]); + return MOD_CONT; +} + +/* EVENT : HS */ +int anope_event_hs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_HostServ, av[0]); + return MOD_CONT; +} + +/* EVENT : CS */ +int anope_event_cs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_ChanServ, av[0]); + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + +/* *INDENT-OFF* */ +void moduleAddIRCDMsgs(void) { + Message *m; + + updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-"); + + m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("402", anope_event_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", anope_event_null); 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", 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); + 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); + m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); + m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); + m = createMessage("UNSQLINE", anope_event_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); + m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); + m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); + m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); + m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); + m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSZLINE", anope_event_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); + m = createMessage("SVHOST", anope_event_vs); addCoreMessage(IRCD,m); + m = createMessage("ELMER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILLY", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SHUN", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("NORMAL", anope_event_null); addCoreMessage(IRCD,m); +} + +/* *INDENT-ON* */ + + +int anope_event_vs(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: SVHOST for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[1]); + return MOD_CONT; + +} + +/* SQLINE */ +void solidircd_cmd_sqline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(NULL, "SQLINE %s :%s", mask, reason); +} + +/* UNSGLINE */ +void solidircd_cmd_unsgline(const char *mask) +{ + send_cmd(NULL, "UNSGLINE 0 :%s", mask); +} + +/* UNSZLINE */ +void solidircd_cmd_unszline(const char *mask) +{ + send_cmd(NULL, "UNSZLINE 0 %s", mask); +} + +/* SZLINE */ +void solidircd_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + send_cmd(NULL, "SZLINE %s :%s", mask, reason); +} + +/* SVSNOOP */ +void SolidIRCdProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); +} + +void solidircd_cmd_svsadmin(const char *server, int set) +{ + ircd_proto.cmd_svsnoop(server, set); +} + +/* SGLINE */ +void solidircd_cmd_sgline(const char *mask, const char *reason) +{ + send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); +} + +/* RAKILL */ +void SolidIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(NULL, "RAKILL %s %s", host, user); +} + +/* PART */ +void solidircd_cmd_part(const char *nick, const char *chan, const char *buf) +{ + if (!nick || !chan) { + return; + } + + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +/* TOPIC */ +void solidircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +/* UNSQLINE */ +void solidircd_cmd_unsqline(const char *user) +{ + send_cmd(NULL, "UNSQLINE %s", user); +} + +/* JOIN - SJOIN */ +void solidircd_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); +} + +/* AKILL */ +/* parv[1]=host + * parv[2]=user + * parv[3]=length + * parv[4]=akiller + * parv[5]=time set + * parv[6]=reason + */ +void solidircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, + (long int) time(NULL), reason); +} + +/* SVSKILL */ +/* parv[0] = servername + * parv[1] = client + * parv[2] = nick stamp + * parv[3] = kill message + */ +/* + Note: if the stamp is null 0, the below usage is correct of Bahamut +*/ +void solidircd_cmd_svskill(const char *source, const char *user, const char *buf) +{ + + if (!source || !user || !buf) { + return; + } + + send_cmd(source, "SVSKILL %s :%s", user, buf); +} + +/* SVSMODE */ +/* parv[0] - sender + * parv[1] - nick + * parv[2] - TS (or mode, depending on svs version) + * parv[3] - mode (or services id if old svs version) + * parv[4] - optional arguement (services id) + */ +void solidircd_cmd_svsmode(User * u, int ac, const char **av) +{ + send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, + (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), + (ac == 2 ? av[1] : "")); +} + +/* SQUIT */ +/* + * parv[0] = sender prefix + * parv[1] = server name + * parv[2] = comment +*/ +void solidircd_cmd_squit(const char *servname, const char *message) +{ + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +/* PONG */ +void solidircd_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +void solidircd_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + + +/* + * 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 solidircd_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); +} + +/* PASS */ +void solidircd_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +/* SERVER */ +void solidircd_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d :%s", servname, hop, ServerDesc); +} + +/* CAPAB */ +void solidircd_cmd_capab() +{ + /* CAPAB SSJOIN NOQUIT BURST UNCONNECT ZIP NICKIP TSMODE */ + send_cmd(NULL, "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE"); +} + +void solidircd_cmd_connect(int servernum) +{ + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) { + solidircd_cmd_pass(RemotePassword); + } else if (servernum == 2) { + solidircd_cmd_pass(RemotePassword2); + } else if (servernum == 3) { + solidircd_cmd_pass(RemotePassword3); + } + solidircd_cmd_capab(); + solidircd_cmd_server(ServerName, 1, ServerDesc); + solidircd_cmd_svinfo(); + solidircd_cmd_burst(); +} + +/* EVENT : SERVER */ +int anope_event_server(const char *source, int ac, const char **av) +{ + char *uplink; + + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + + do_server(source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + +/* EVENT : PRIVMSG */ +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +/* EVENT : 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 + */ +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + return MOD_CONT; +} + +int anope_event_topic(const char *source, int ac, const char **av) +{ + if (ac != 4) + return MOD_CONT; + do_topic(source, ac, av); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, av); + return MOD_CONT; +} + +/* EVENT: MODE */ +int anope_event_mode(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + +/* EVENT: KILL */ +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +/* EVENT: KICK */ +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + +/* EVENT: JOIN */ +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +/* EVENT: MOTD */ +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +void solidircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + + if (!buf) { + return; + } + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); +} + +/* NOTICE */ +void solidircd_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + solidircd_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void solidircd_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void solidircd_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void solidircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void solidircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $%s :%s", dest, msg); +} + +void solidircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $%s :%s", dest, msg); +} + +/* GLOBOPS */ +void solidircd_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); +} + +/* 391 */ +void solidircd_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void solidircd_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void solidircd_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void solidircd_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void solidircd_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void solidircd_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void solidircd_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void solidircd_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void solidircd_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void solidircd_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void solidircd_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void solidircd_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +void solidircd_cmd_nick(const char *nick, const char *name, const char *modes) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, ServiceUser, ServiceHost, + ServerName, name); + solidircd_cmd_sqline(nick, "Reserved for services"); +} + +void solidircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +void solidircd_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void solidircd_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void solidircd_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void solidircd_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + +/* INVITE */ +void solidircd_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +/* QUIT */ +void solidircd_cmd_quit(const char *source, const char *buf) +{ + + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + solidircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +void solidircd_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s)-- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); + + +} + +void solidircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); + solidircd_cmd_sqline(nick, "Reserved for services"); +} + +/* SVSNICK */ +/* parv[0] = sender + * parv[1] = old nickname + * parv[2] = new nickname + * parv[3] = timestamp + */ +void solidircd_cmd_svsnick(const char *source, const char *guest, time_t when) +{ + if (!source || !guest) { + return; + } + send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); +} + +void solidircd_cmd_guest_nick(const char *nick, const char *user, const char *host, + const char *real, const char *modes) +{ + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); +} + +void solidircd_cmd_svso(const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + +void solidircd_cmd_chghost(const char *nick, const char *vhost) +{ + if (!nick || !vhost) { + return; + } + send_cmd(ServerName, "SVHOST %s %s", nick, vhost); +} + + +void solidircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + send_cmd(s_HostServ, "SVSMODE %s +v", nick); + solidircd_cmd_chghost(nick, vhost); +} + +void solidircd_cmd_vhost_off(User * u) +{ + send_cmd(s_HostServ, "SVSMODE %s -v", u->nick); + notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void solidircd_cmd_svid_umode(const char *nick, time_t ts) +{ + send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, + (unsigned long int) ts); +} + + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void solidircd_cmd_nc_change(User * u) +{ + common_svsmode(u, "+d", "1"); +} + +/* SVSMODE +d */ +void solidircd_cmd_svid_umode2(User * u, const char *ts) +{ + /* not used by bahamut ircds */ +} + + +void solidircd_cmd_svid_umode3(User * u, const char *ts) +{ + if (u->svid != u->timestamp) { + common_svsmode(u, "+rd", ts); + } else { + common_svsmode(u, "+r", NULL); + } +} + +/* NICK */ +void solidircd_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s :%ld", newnick, (long int) time(NULL)); +} + +int anope_event_error(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_sqline(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + + +int anope_event_gnotice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +void solidircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + /* Can not find any reference to these in Bahamut */ +} + +void solidircd_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + /* Can not find any reference to these in Bahamut */ +} + +void solidircd_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +void solidircd_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +int anope_event_burst(const char *source, int ac, const char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); + } + return MOD_CONT; +} + +int anope_event_luserslock(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_rehash(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int solidircd_flood_mode_check(const 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 solidircd_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + solidircd_cmd_squit(jserver, rbuf); + solidircd_cmd_server(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* GLOBOPS - to handle old WALLOPS */ +void solidircd_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int solidircd_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int solidircd_valid_chan(const char *chan) +{ + /* no hard coded invalid chan*/ + return 1; +} + + +void solidircd_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "%s NOTICE :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(solidircd_cmd_topic); + pmodule_cmd_vhost_off(solidircd_cmd_vhost_off); + pmodule_cmd_akill(solidircd_cmd_akill); + pmodule_cmd_svskill(solidircd_cmd_svskill); + pmodule_cmd_svsmode(solidircd_cmd_svsmode); + pmodule_cmd_372(solidircd_cmd_372); + pmodule_cmd_372_error(solidircd_cmd_372_error); + pmodule_cmd_375(solidircd_cmd_375); + pmodule_cmd_376(solidircd_cmd_376); + pmodule_cmd_nick(solidircd_cmd_nick); + pmodule_cmd_guest_nick(solidircd_cmd_guest_nick); + pmodule_cmd_mode(solidircd_cmd_mode); + pmodule_cmd_bot_nick(solidircd_cmd_bot_nick); + pmodule_cmd_kick(solidircd_cmd_kick); + pmodule_cmd_notice_ops(solidircd_cmd_notice_ops); + pmodule_cmd_notice(solidircd_cmd_notice); + pmodule_cmd_notice2(solidircd_cmd_notice2); + pmodule_cmd_privmsg(solidircd_cmd_privmsg); + pmodule_cmd_privmsg2(solidircd_cmd_privmsg2); + pmodule_cmd_serv_notice(solidircd_cmd_serv_notice); + pmodule_cmd_serv_privmsg(solidircd_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(solidircd_cmd_bot_chan_mode); + pmodule_cmd_351(solidircd_cmd_351); + pmodule_cmd_quit(solidircd_cmd_quit); + pmodule_cmd_pong(solidircd_cmd_pong); + pmodule_cmd_join(solidircd_cmd_join); + pmodule_cmd_unsqline(solidircd_cmd_unsqline); + pmodule_cmd_invite(solidircd_cmd_invite); + pmodule_cmd_part(solidircd_cmd_part); + pmodule_cmd_391(solidircd_cmd_391); + pmodule_cmd_250(solidircd_cmd_250); + pmodule_cmd_307(solidircd_cmd_307); + pmodule_cmd_311(solidircd_cmd_311); + pmodule_cmd_312(solidircd_cmd_312); + pmodule_cmd_317(solidircd_cmd_317); + pmodule_cmd_219(solidircd_cmd_219); + pmodule_cmd_401(solidircd_cmd_401); + pmodule_cmd_318(solidircd_cmd_318); + pmodule_cmd_242(solidircd_cmd_242); + pmodule_cmd_243(solidircd_cmd_243); + pmodule_cmd_211(solidircd_cmd_211); + pmodule_cmd_global(solidircd_cmd_global); + pmodule_cmd_global_legacy(solidircd_cmd_global_legacy); + pmodule_cmd_sqline(solidircd_cmd_sqline); + pmodule_cmd_squit(solidircd_cmd_squit); + pmodule_cmd_svso(solidircd_cmd_svso); + pmodule_cmd_chg_nick(solidircd_cmd_chg_nick); + pmodule_cmd_svsnick(solidircd_cmd_svsnick); + pmodule_cmd_vhost_on(solidircd_cmd_vhost_on); + pmodule_cmd_connect(solidircd_cmd_connect); + pmodule_cmd_svshold(solidircd_cmd_svshold); + pmodule_cmd_release_svshold(solidircd_cmd_release_svshold); + pmodule_cmd_unsgline(solidircd_cmd_unsgline); + pmodule_cmd_unszline(solidircd_cmd_unszline); + pmodule_cmd_szline(solidircd_cmd_szline); + pmodule_cmd_sgline(solidircd_cmd_sgline); + pmodule_cmd_unban(solidircd_cmd_unban); + pmodule_cmd_svsmode_chan(solidircd_cmd_svsmode_chan); + pmodule_cmd_svid_umode(solidircd_cmd_svid_umode); + pmodule_cmd_nc_change(solidircd_cmd_nc_change); + pmodule_cmd_svid_umode2(solidircd_cmd_svid_umode2); + pmodule_cmd_svid_umode3(solidircd_cmd_svid_umode3); + pmodule_cmd_svsjoin(solidircd_cmd_svsjoin); + pmodule_cmd_svspart(solidircd_cmd_svspart); + pmodule_cmd_swhois(solidircd_cmd_swhois); + pmodule_cmd_eob(solidircd_cmd_eob); + pmodule_flood_mode_check(solidircd_flood_mode_check); + pmodule_cmd_jupe(solidircd_cmd_jupe); + pmodule_valid_nick(solidircd_valid_nick); + pmodule_valid_chan(solidircd_valid_chan); + pmodule_cmd_ctcp(solidircd_cmd_ctcp); + pmodule_set_umode(solidircd_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(PROTOCOL); + + pmodule_ircd_version("Solid-IRCd 3.4.*"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set("+j"); + pmodule_ircd_flood_mode_char_remove("-j"); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} diff --git a/src/protocol/obsolete/solidircd.h b/src/protocol/obsolete/solidircd.h new file mode 100644 index 000000000..03686afd4 --- /dev/null +++ b/src/protocol/obsolete/solidircd.h @@ -0,0 +1,141 @@ +/* SolidIRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +/*************************************************************************/ + +#define UMODE_a 0x00000001 /* umode +a - Services Admin */ +#define UMODE_h 0x00000002 /* umode +h - Helper */ +#define UMODE_i 0x00000004 /* umode +i - Invisible */ +#define UMODE_o 0x00000008 /* umode +o - Oper */ +#define UMODE_r 0x00000010 /* umode +r - registered nick */ +#define UMODE_w 0x00000020 /* umode +w - Get wallops */ +#define UMODE_A 0x00000040 /* umode +A - Server Admin */ +#define UMODE_x 0x00000080 /* umode +x - Squelch with notice */ +#define UMODE_X 0x00000100 /* umode +X - Squelch without notice */ +#define UMODE_F 0x00000200 /* umode +F - no cptr->since message rate throttle */ +#define UMODE_j 0x00000400 /* umode +j - client rejection notices */ +#define UMODE_K 0x00000800 /* umode +K - U: lined server kill messages */ +#define UMODE_O 0x00001000 /* umode +O - Local Oper */ +#define UMODE_s 0x00002000 /* umode +s - Server notices */ +#define UMODE_c 0x00004000 /* umode +c - Client connections/exits */ +#define UMODE_k 0x00008000 /* umode +k - Server kill messages */ +#define UMODE_f 0x00010000 /* umode +f - Server flood messages */ +#define UMODE_y 0x00020000 /* umode +y - Stats/links */ +#define UMODE_d 0x00040000 /* umode +d - Debug info */ +#define UMODE_g 0x00080000 /* umode +g - Globops */ +#define UMODE_b 0x00100000 /* umode +b - Chatops */ +#define UMODE_n 0x00200000 /* umode +n - Routing Notices */ +#define UMODE_m 0x00400000 /* umode +m - spambot notices */ +#define UMODE_e 0x00800000 /* umode +e - oper notices for the above +D */ +#define UMODE_D 0x01000000 /* umode +D - Hidden dccallow umode */ +#define UMODE_I 0x02000000 /* umode +I - invisible oper (masked) */ +#define UMODE_C 0x04000000 /* umode +C - conops */ +#define UMODE_v 0x10000000 /* umode +v - hostmasking */ +#define UMODE_H 0x20000000 /* umode +H - Oper Hiding */ +#define UMODE_z 0x40000000 /* umode +z - SSL */ +#define UMODE_R 0x80000000 /* umode +R - No non registered msgs */ + +#define CMODE_i 0x00000001 +#define CMODE_m 0x00000002 +#define CMODE_n 0x00000004 +#define CMODE_p 0x00000008 +#define CMODE_s 0x00000010 +#define CMODE_t 0x00000020 +#define CMODE_k 0x00000040 /* These two used only by ChanServ */ +#define CMODE_l 0x00000080 +#define CMODE_R 0x00000100 /* Only identified users can join */ +#define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_c 0x00000400 /* Colors can't be used */ +#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */ +#define CMODE_j 0x00001000 /* join throttle */ +#define CMODE_S 0x00002000 /* SSL only */ +#define CMODE_N 0x00004000 /* No Nickname change */ +#define CMODE_O 0x00008000 /* Only opers can join */ + + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r + +void solidircd_set_umode(User * user, int ac, const char **av); +void solidircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void solidircd_cmd_vhost_off(User * u); +void solidircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void solidircd_cmd_svskill(const char *source, const char *user, const char *buf); +void solidircd_cmd_svsmode(User * u, int ac, const char **av); +void solidircd_cmd_372(const char *source, const char *msg); +void solidircd_cmd_372_error(const char *source); +void solidircd_cmd_375(const char *source); +void solidircd_cmd_376(const char *source); +void solidircd_cmd_nick(const char *nick, const char *name, const char *modes); +void solidircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void solidircd_cmd_mode(const char *source, const char *dest, const char *buf); +void solidircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void solidircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void solidircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void solidircd_cmd_notice(const char *source, const char *dest, const char *buf); +void solidircd_cmd_notice2(const char *source, const char *dest, const char *msg); +void solidircd_cmd_privmsg(const char *source, const char *dest, const char *buf); +void solidircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void solidircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void solidircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void solidircd_cmd_bot_chan_mode(const char *nick, const char *chan); +void solidircd_cmd_351(const char *source); +void solidircd_cmd_quit(const char *source, const char *buf); +void solidircd_cmd_pong(const char *servname, const char *who); +void solidircd_cmd_join(const char *user, const char *channel, time_t chantime); +void solidircd_cmd_unsqline(const char *user); +void solidircd_cmd_invite(const char *source, const char *chan, const char *nick); +void solidircd_cmd_part(const char *nick, const char *chan, const char *buf); +void solidircd_cmd_391(const char *source, const char *timestr); +void solidircd_cmd_250(const char *buf); +void solidircd_cmd_307(const char *buf); +void solidircd_cmd_311(const char *buf); +void solidircd_cmd_312(const char *buf); +void solidircd_cmd_317(const char *buf); +void solidircd_cmd_219(const char *source, const char *letter); +void solidircd_cmd_401(const char *source, const char *who); +void solidircd_cmd_318(const char *source, const char *who); +void solidircd_cmd_242(const char *buf); +void solidircd_cmd_243(const char *buf); +void solidircd_cmd_211(const char *buf); +void solidircd_cmd_global(const char *source, const char *buf); +void solidircd_cmd_global_legacy(const char *source, const char *fmt); +void solidircd_cmd_sqline(const char *mask, const char *reason); +void solidircd_cmd_squit(const char *servname, const char *message); +void solidircd_cmd_svso(const char *source, const char *nick, const char *flag); +void solidircd_cmd_chg_nick(const char *oldnick, const char *newnick); +void solidircd_cmd_svsnick(const char *source, const char *guest, time_t when); +void solidircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void solidircd_cmd_connect(int servernum); +void solidircd_cmd_svshold(const char *nick); +void solidircd_cmd_release_svshold(const char *nick); +void solidircd_cmd_unsgline(const char *mask); +void solidircd_cmd_unszline(const char *mask); +void solidircd_cmd_szline(const char *mask, const char *reason, const char *whom); +void solidircd_cmd_sgline(const char *mask, const char *reason); +void solidircd_cmd_unban(const char *name, const char *nick); +void solidircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void solidircd_cmd_svid_umode(const char *nick, time_t ts); +void solidircd_cmd_nc_change(User * u); +void solidircd_cmd_svid_umode2(User * u, const char *ts); +void solidircd_cmd_svid_umode3(User * u, const char *ts); +void solidircd_cmd_eob(); +int solidircd_flood_mode_check(const char *value); +void solidircd_cmd_jupe(const char *jserver, const char *who, const char *reason); +int solidircd_valid_nick(const char *nick); +void solidircd_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class SolidIRCdProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/ultimate3.c b/src/protocol/obsolete/ultimate3.c new file mode 100644 index 000000000..e3a516ed3 --- /dev/null +++ b/src/protocol/obsolete/ultimate3.c @@ -0,0 +1,1817 @@ +/* Ultimate IRCD 3 functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#include "services.h" +#include "pseudo.h" +#include "ultimate3.h" + +IRCDVar myIrcd[] = { + {"UltimateIRCd 3.0.*", /* ircd name */ + "+S", /* nickserv mode */ + "+S", /* chanserv mode */ + "+S", /* memoserv mode */ + "+o", /* hostserv mode */ + "+iS", /* operserv mode */ + "+S", /* botserv mode */ + "+Sh", /* helpserv mode */ + "+iS", /* Dev/Null mode */ + "+iS", /* Global mode */ + "+o", /* nickserv alias mode */ + "+o", /* chanserv alias mode */ + "+o", /* memoserv alias mode */ + "+io", /* hostserv alias mode */ + "+io", /* operserv alias mode */ + "+o", /* botserv alias mode */ + "+h", /* helpserv alias mode */ + "+i", /* Dev/Null alias mode */ + "+io", /* Global alias mode */ + "+S", /* Used by BotServ Bots */ + 5, /* Chan Max Symbols */ + "-ilmnpqstRKAO", /* Modes to Remove */ + "+o", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 0, /* Has Owner */ + NULL, /* Mode to set for an owner */ + NULL, /* Mode to unset for an owner */ + "+a", /* Mode to set for channel admin */ + "-a", /* Mode to unset for channel admin */ + "+rd", /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-r+d", /* Mode on UnReg */ + "+d", /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 1, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + UMODE_p, /* Protected Umode */ + 1, /* Has Admin */ + 1, /* Chan SQlines */ + 0, /* Quit on Kill */ + 1, /* SVSMODE unban */ + 0, /* Has Protect */ + 0, /* Reverse */ + 1, /* Chan Reg */ + CMODE_r, /* Channel Mode */ + 0, /* vidents */ + 0, /* svshold */ + 1, /* time stamp on mode */ + 1, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 1, /* VHOST ON NICK */ + 0, /* Change RealName */ + CMODE_K, /* No Knock */ + CMODE_A, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_x, /* Vhost Mode */ + 0, /* +f */ + 0, /* +L */ + 0, /* +f Mode */ + 0, /* +L Mode */ + 1, /* On nick change check if they could be identified */ + 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 1, /* Sglines are enforced */ + "x", /* vhost char */ + 0, /* ts6 */ + 1, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 1, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + +IRCDCAPAB myIrcdcap[] = { + { + CAPAB_NOQUIT, /* NOQUIT */ + CAPAB_TSMODE, /* TSMODE */ + CAPAB_UNCONNECT, /* UNCONNECT */ + 0, /* NICKIP */ + CAPAB_NSJOIN, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + CAPAB_BURST, /* BURST */ + CAPAB_TS5, /* TS5 */ + 0, /* TS3 */ + CAPAB_DKEY, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + 0, /* QS */ + 0, /* UID */ + 0, /* KNOCK */ + CAPAB_CLIENT, /* CLIENT */ + CAPAB_IPV6, /* IPV6 */ + CAPAB_SSJ5, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + CAPAB_DODKEY, /* DODKEY */ + CAPAB_DOZIP, /* DOZIP */ + 0, 0, 0} +}; + +void ultimate3_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'a': + if (add && !is_services_oper(user)) { + common_svsmode(user, "-a", NULL); + user->mode &= ~UMODE_a; + } + break; + case 'P': + if (add && !is_services_admin(user)) { + common_svsmode(user, "-P", NULL); + user->mode &= ~UMODE_P; + } + break; + case 'Z': + if (add && !is_services_root(user)) { + common_svsmode(user, "-Z", NULL); + user->mode &= ~UMODE_Z; + } + break; + case 'd': + if (ac == 0) { + alog("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + opcnt++; + if (WallOper) { + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + } + display_news(user, NEWS_OPER); + if (is_services_oper(user)) { + common_svsmode(user, "+a", NULL); + user->mode |= UMODE_a; + } + if (is_services_admin(user)) { + common_svsmode(user, "+P", NULL); + user->mode |= UMODE_P; + } + if (is_services_root(user)) { + common_svsmode(user, "+Z", NULL); + user->mode |= UMODE_Z; + } + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + case 'x': + update_host(user); + break; + } + } +} + +unsigned long umodes[128] = { + 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, UMODE_R, /* 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 /* ~ � */ +}; + + +char myCsmodes[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 */ + 0, 0, 0, + 'h', /* (37) % Channel halfops */ + 0, 0, 0, 0, + 0, + + 'v', 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +CMMode myCmmodes[128] = { + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, + {NULL}, + {add_ban, del_ban}, + {NULL}, + {NULL}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + +CBMode myCbmodes[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}, + {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, /* B */ + {0}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {0}, /* H */ + {0}, /* I */ + {0}, /* J */ + {CMODE_K, 0, NULL, NULL}, /* K */ + {0}, /* L */ + {CMODE_M, 0, NULL, NULL}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, + {0}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, /* i */ + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, /* m */ + {CMODE_n, 0, NULL, NULL}, /* n */ + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, /* p */ + {CMODE_q, 0, NULL, NULL}, /* q */ + {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, + {CMODE_s, 0, NULL, NULL}, /* s */ + {CMODE_t, 0, NULL, NULL}, /* t */ + {0}, /* u */ + {0}, /* v */ + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'q', CMODE_q, 0, NULL, NULL}, + {'r', CMODE_r, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'A', CMODE_A, 0, NULL, NULL}, + {'K', CMODE_K, 0, NULL, NULL}, + {'M', CMODE_M, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {'S', CMODE_S, 0, NULL, NULL}, + {0} +}; + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin}, + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {0}, /* q */ + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + +/* SVSMODE -b */ +void ultimate3_cmd_unban(const char *name, const char *nick) +{ + ultimate3_cmd_svsmode_chan(name, "-b", nick); +} + + +/* SVSMODE channel modes */ + +void ultimate3_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + if (nick) { + send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); + } else { + send_cmd(ServerName, "SVSMODE %s %s", name, mode); + } +} + +int anope_event_sjoin(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + + +/* +** NICK - new +** source = NULL +** parv[0] = nickname +** parv[1] = hopcount +** parv[2] = timestamp +** parv[3] = modes +** parv[4] = username +** parv[5] = hostname +** parv[6] = server +** parv[7] = servicestamp +** parv[8] = IP +** parv[9] = info +** NICK - change +** source = oldnick +** parv[0] = new nickname +** parv[1] = hopcount +*/ +int anope_event_nick(const char *source, int ac, const char **av) +{ + if (ac != 2) { + User *user = do_nick(source, av[0], av[4], av[5], av[6], av[9], + strtoul(av[2], NULL, 10), strtoul(av[7], NULL, + 0), + strtoul(av[8], NULL, 0), "*", NULL); + if (user) + anope_set_umode(user, 1, &av[3]); + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +int anope_event_sethost(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: SETHOST for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[1]); + return MOD_CONT; +} + +int anope_event_capab(const char *source, int ac, const char **av) +{ + capab_parse(ac, av); + return MOD_CONT; +} + +/* +** CLIENT +** source = NULL +** parv[0] = nickname Trystan +** parv[1] = hopcount 1 +** parv[2] = timestamp 1090083810 +** parv[3] = modes +ix +** parv[4] = modes ? + +** parv[5] = username Trystan +** parv[6] = hostname c-24-2-101-227.client.comcast.net +** parv[7] = vhost 3223f75b.2b32ee69.client.comcast.net +** parv[8] = server WhiteRose.No.Eu.Shadow-Realm.org +** parv[9] = svid 0 +** parv[10] = ip 402810339 +** parv[11] = info Dreams are answers to questions not yet asked +*/ +int anope_event_client(const char *source, int ac, const char **av) +{ + if (ac != 2) { + User *user = do_nick(source, av[0], av[5], av[6], av[8], av[11], + strtoul(av[2], NULL, 10), strtoul(av[9], NULL, + 0), + strtoul(av[10], NULL, 0), av[7], NULL); + if (user) { + anope_set_umode(user, 1, &av[3]); + } + } + return MOD_CONT; +} + +/* *INDENT-OFF* */ +void moduleAddIRCDMsgs(void) { + Message *m; + + updateProtectDetails("ADMIN","ADMINME","admin","deadmin","AUTOADMIN","+a","-a"); + + m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("402", anope_event_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", 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", 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); + 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); + m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); + m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); + m = createMessage("UNSQLINE", anope_event_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); + m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); + m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); + m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); + m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); + m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); + m = createMessage("NETINFO", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GCONNECT", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("NETGLOBAL", anope_event_netglobal); addCoreMessage(IRCD,m); + m = createMessage("CHATOPS", anope_event_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", anope_event_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); + m = createMessage("EOBURST", anope_event_eob); addCoreMessage(IRCD,m); +} + +/* *INDENT-ON* */ + + +void ultimate3_cmd_sqline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(NULL, "SQLINE %s :%s", mask, reason); +} + +void ultimate3_cmd_unsgline(const char *mask) +{ + send_cmd(NULL, "UNSGLINE 0 :%s", mask); +} + +void ultimate3_cmd_unszline(const char *mask) +{ + send_cmd(NULL, "UNSZLINE 0 %s", mask); +} + +/* As of alpha27 (one after our offical support szline was removed */ +/* quote the changelog --- + Complete rewrite of the kline/akill/zline system. (s)zlines no longer exist. + K: lines set on IP addresses without username portions (or *) are treated as Z: lines used to be. +*/ +void ultimate3_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + send_cmd(NULL, "AKILL %s * %d %s %ld :%s", mask, 86400 * 2, whom, + (long int) time(NULL), reason); + /* leaving this in here in case some legacy user asks for it */ + /* send_cmd(NULL, "SZLINE %s :%s", mask, reason); */ +} + +void UltimateIRCdProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); +} + +void ultimate3_cmd_svsadmin(const char *server, int set) +{ + ircd_proto.cmd_svsnoop(server, set); +} + +void ultimate3_cmd_sgline(const char *mask, const char *reason) +{ + send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); +} + +void UltimateIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(NULL, "RAKILL %s %s", host, user); +} + +void ultimate3_cmd_vhost_off(User * u) +{ + send_cmd(s_HostServ, "SVSMODE %s -x", u->nick); + notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); +} + +void ultimate3_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + send_cmd(s_HostServ, "SVSMODE %s +x", nick); + send_cmd(ServerName, "SETHOST %s %s", nick, vhost); +} + +void ultimate3_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); +} + +void ultimate3_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, + (long int) time(NULL), reason); +} + +void ultimate3_cmd_svskill(const char *source, const char *user, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "SVSKILL %s :%s", user, buf); +} + + +void ultimate3_cmd_svsmode(User * u, int ac, const char **av) +{ + send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, + (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), + (ac == 2 ? av[1] : "")); +} + +void anope_squit(char *servname, char *message) +{ + send_cmd(servname, "SQUIT %s :%s", servname, message); +} + +void anope_pong(char *servname) +{ + send_cmd(servname, "PONG %s", servname); +} + +/* Events */ + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + ultimate3_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int anope_event_topic(const char *source, int ac, const char **av) +{ + if (ac != 4) + return MOD_CONT; + do_topic(source, ac, av); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, av); + return MOD_CONT; +} + + +int anope_event_mode(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + +/* EVENT : OS */ +int anope_event_os(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_OperServ, av[0]); + return MOD_CONT; +} + +/* EVENT : NS */ +int anope_event_ns(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_NickServ, av[0]); + return MOD_CONT; +} + +/* EVENT : MS */ +int anope_event_ms(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_MemoServ, av[0]); + return MOD_CONT; +} + +/* EVENT : HS */ +int anope_event_hs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_HostServ, av[0]); + return MOD_CONT; +} + +/* EVENT : CS */ +int anope_event_cs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_ChanServ, av[0]); + return MOD_CONT; +} + + +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + + +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +int anope_event_setname(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 1) + return MOD_CONT; + + u = finduser(source); + if (!u) { + if (debug) { + alog("debug: SETNAME for nonexistent user %s", source); + } + return MOD_CONT; + } + + u->SetRealname(av[0]); + return MOD_CONT; +} + +int anope_event_chgname(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: CHGNAME for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetRealname(av[1]); + return MOD_CONT; +} + +int anope_event_setident(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 1) + return MOD_CONT; + + u = finduser(source); + if (!u) { + if (debug) { + alog("debug: SETIDENT for nonexistent user %s", source); + } + return MOD_CONT; + } + + u->SetIdent(av[0]); + return MOD_CONT; +} +int anope_event_chgident(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: CHGIDENT for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetIdent(av[1]); + return MOD_CONT; +} + +/* EVENT: SERVER */ +int anope_event_server(const char *source, int ac, const char **av) +{ + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + do_server(source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + + +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + return MOD_CONT; +} + +void ultimate3_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +void ultimate3_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void ultimate3_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void ultimate3_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void ultimate3_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + +void ultimate3_cmd_nick(const char *nick, const char *name, const char *modes) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, + (long int) time(NULL), modes, ServiceUser, ServiceHost, + ServerName, name); + ultimate3_cmd_sqline(nick, "Reserved for services"); +} + +void ultimate3_cmd_guest_nick(const char *nick, const char *user, const char *host, + const char *real, const char *modes) +{ + send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); +} + +void ultimate3_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "MODE %s %s", dest, buf); +} + +void ultimate3_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); + ultimate3_cmd_sqline(nick, "Reserved for services"); +} + +void ultimate3_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +void ultimate3_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); +} + + +void ultimate3_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + ultimate3_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void ultimate3_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void ultimate3_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void ultimate3_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void ultimate3_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $%s :%s", dest, msg); +} + +void ultimate3_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $%s :%s", dest, msg); +} + +void ultimate3_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); +} + +void ultimate3_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule,version_build); + +} + +/* QUIT */ +void ultimate3_cmd_quit(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +/* PROTOCTL */ +void ultimate3_cmd_capab() +{ + send_cmd(NULL, + "CAPAB TS5 NOQUIT SSJ5 BURST UNCONNECT TSMODE NICKIP CLIENT"); +} + +/* PASS */ +void ultimate3_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +/* SERVER name hop descript */ +/* Unreal 3.2 actually sends some info about itself in the descript area */ +void ultimate3_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); +} + +/* PONG */ +void ultimate3_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +/* UNSQLINE */ +void ultimate3_cmd_unsqline(const char *user) +{ + if (!user) { + return; + } + send_cmd(NULL, "UNSQLINE %s", user); +} + +/* CHGHOST */ +void ultimate3_cmd_chghost(const char *nick, const char *vhost) +{ + if (!nick || !vhost) { + return; + } + send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); +} + +/* CHGIDENT */ +void ultimate3_cmd_chgident(const char *nick, const char *vIdent) +{ + if (!nick || !vIdent) { + return; + } + send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); +} + +/* INVITE */ +void ultimate3_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +/* PART */ +void ultimate3_cmd_part(const char *nick, const char *chan, const char *buf) +{ + + if (!nick || !chan) { + return; + } + + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +/* 391 */ +void ultimate3_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void ultimate3_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void ultimate3_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void ultimate3_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void ultimate3_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void ultimate3_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void ultimate3_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void ultimate3_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void ultimate3_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void ultimate3_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void ultimate3_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void ultimate3_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +/* GLOBOPS */ +void ultimate3_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); +} + +/* SQUIT */ +void ultimate3_cmd_squit(const char *servname, const char *message) +{ + if (!servname || !message) { + return; + } + + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +/* SVSO */ +void ultimate3_cmd_svso(const char *source, const char *nick, const char *flag) +{ + if (!source || !nick || !flag) { + return; + } + + send_cmd(source, "SVSO %s %s", nick, flag); +} + +/* NICK */ +void ultimate3_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s", newnick); +} + +/* SVSNICK */ +void ultimate3_cmd_svsnick(const char *source, const char *guest, time_t when) +{ + if (!source || !guest) { + return; + } + send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); +} + +/* Functions that use serval cmd functions */ +/* + * 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 ultimate3_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); +} + +void ultimate3_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + + +void ultimate3_cmd_connect(int servernum) +{ + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) { + ultimate3_cmd_pass(RemotePassword); + } + if (servernum == 2) { + ultimate3_cmd_pass(RemotePassword2); + } + if (servernum == 3) { + ultimate3_cmd_pass(RemotePassword3); + } + ultimate3_cmd_capab(); + ultimate3_cmd_server(ServerName, 1, ServerDesc); + ultimate3_cmd_svinfo(); + ultimate3_cmd_burst(); +} + +/* SVSHOLD - set */ +void ultimate3_cmd_svshold(const char *nick) +{ + /* Not supported by this IRCD */ +} + +/* SVSHOLD - release */ +void ultimate3_cmd_release_svshold(const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void ultimate3_cmd_svid_umode(const char *nick, time_t ts) +{ + send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, + (unsigned long int) ts); +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void ultimate3_cmd_nc_change(User * u) +{ + common_svsmode(u, "+d", "1"); +} + +/* SVSMODE +d */ +void ultimate3_cmd_svid_umode2(User * u, const char *ts) +{ + /* not used by bahamut ircds */ +} + +void ultimate3_cmd_svid_umode3(User * u, const char *ts) +{ + if (u->svid != u->timestamp) { + common_svsmode(u, "+rd", ts); + } else { + common_svsmode(u, "+r", NULL); + } + +} + +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_gnotice(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_netctrl(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +int anope_event_sqline(const char *source, int ac, const char **av) +{ + /* currently not used but removes the message : unknown message from server */ + return MOD_CONT; +} + +void ultimate3_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + /* Not Supported by this IRCD */ +} + +void ultimate3_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + /* Not Supported by this IRCD */ +} + +void ultimate3_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + + +void ultimate3_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +int anope_event_error(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + + +int anope_event_eob(const char *source, int ac, const char **av) +{ + Server *s; + + if (ac == 1) { + s = findserver(servlist, av[0]); + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); + } + return MOD_CONT; +} + + +int anope_event_burst(const char *source, int ac, const char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); + } + return MOD_CONT; +} + +int anope_event_rehash(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_netglobal(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int ultiamte3_flood_mode_check(const char *value) +{ + return 0; +} + +void ultimate3_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + ultimate3_cmd_squit(jserver, rbuf); + ultimate3_cmd_server(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* GLOBOPS - to handle old WALLOPS */ +void ultimate3_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int ultiamte3_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int ultiamte3_valid_chan(const char *chan) +{ + /* no hard coded invalid chans */ + return 1; +} + + +void ultimate3_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "NOTICE %s :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(ultimate3_cmd_topic); + pmodule_cmd_vhost_off(ultimate3_cmd_vhost_off); + pmodule_cmd_akill(ultimate3_cmd_akill); + pmodule_cmd_svskill(ultimate3_cmd_svskill); + pmodule_cmd_svsmode(ultimate3_cmd_svsmode); + pmodule_cmd_372(ultimate3_cmd_372); + pmodule_cmd_372_error(ultimate3_cmd_372_error); + pmodule_cmd_375(ultimate3_cmd_375); + pmodule_cmd_376(ultimate3_cmd_376); + pmodule_cmd_nick(ultimate3_cmd_nick); + pmodule_cmd_guest_nick(ultimate3_cmd_guest_nick); + pmodule_cmd_mode(ultimate3_cmd_mode); + pmodule_cmd_bot_nick(ultimate3_cmd_bot_nick); + pmodule_cmd_kick(ultimate3_cmd_kick); + pmodule_cmd_notice_ops(ultimate3_cmd_notice_ops); + pmodule_cmd_notice(ultimate3_cmd_notice); + pmodule_cmd_notice2(ultimate3_cmd_notice2); + pmodule_cmd_privmsg(ultimate3_cmd_privmsg); + pmodule_cmd_privmsg2(ultimate3_cmd_privmsg2); + pmodule_cmd_serv_notice(ultimate3_cmd_serv_notice); + pmodule_cmd_serv_privmsg(ultimate3_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(ultimate3_cmd_bot_chan_mode); + pmodule_cmd_351(ultimate3_cmd_351); + pmodule_cmd_quit(ultimate3_cmd_quit); + pmodule_cmd_pong(ultimate3_cmd_pong); + pmodule_cmd_join(ultimate3_cmd_join); + pmodule_cmd_unsqline(ultimate3_cmd_unsqline); + pmodule_cmd_invite(ultimate3_cmd_invite); + pmodule_cmd_part(ultimate3_cmd_part); + pmodule_cmd_391(ultimate3_cmd_391); + pmodule_cmd_250(ultimate3_cmd_250); + pmodule_cmd_307(ultimate3_cmd_307); + pmodule_cmd_311(ultimate3_cmd_311); + pmodule_cmd_312(ultimate3_cmd_312); + pmodule_cmd_317(ultimate3_cmd_317); + pmodule_cmd_219(ultimate3_cmd_219); + pmodule_cmd_401(ultimate3_cmd_401); + pmodule_cmd_318(ultimate3_cmd_318); + pmodule_cmd_242(ultimate3_cmd_242); + pmodule_cmd_243(ultimate3_cmd_243); + pmodule_cmd_211(ultimate3_cmd_211); + pmodule_cmd_global(ultimate3_cmd_global); + pmodule_cmd_global_legacy(ultimate3_cmd_global_legacy); + pmodule_cmd_sqline(ultimate3_cmd_sqline); + pmodule_cmd_squit(ultimate3_cmd_squit); + pmodule_cmd_svso(ultimate3_cmd_svso); + pmodule_cmd_chg_nick(ultimate3_cmd_chg_nick); + pmodule_cmd_svsnick(ultimate3_cmd_svsnick); + pmodule_cmd_vhost_on(ultimate3_cmd_vhost_on); + pmodule_cmd_connect(ultimate3_cmd_connect); + pmodule_cmd_svshold(ultimate3_cmd_svshold); + pmodule_cmd_release_svshold(ultimate3_cmd_release_svshold); + pmodule_cmd_unsgline(ultimate3_cmd_unsgline); + pmodule_cmd_unszline(ultimate3_cmd_unszline); + pmodule_cmd_szline(ultimate3_cmd_szline); + pmodule_cmd_sgline(ultimate3_cmd_sgline); + pmodule_cmd_unban(ultimate3_cmd_unban); + pmodule_cmd_svsmode_chan(ultimate3_cmd_svsmode_chan); + pmodule_cmd_svid_umode(ultimate3_cmd_svid_umode); + pmodule_cmd_nc_change(ultimate3_cmd_nc_change); + pmodule_cmd_svid_umode2(ultimate3_cmd_svid_umode2); + pmodule_cmd_svid_umode3(ultimate3_cmd_svid_umode3); + pmodule_cmd_svsjoin(ultimate3_cmd_svsjoin); + pmodule_cmd_svspart(ultimate3_cmd_svspart); + pmodule_cmd_swhois(ultimate3_cmd_swhois); + pmodule_cmd_eob(ultimate3_cmd_eob); + pmodule_flood_mode_check(ultiamte3_flood_mode_check); + pmodule_cmd_jupe(ultimate3_cmd_jupe); + pmodule_valid_nick(ultiamte3_valid_nick); + pmodule_valid_chan(ultiamte3_valid_chan); + pmodule_cmd_ctcp(ultimate3_cmd_ctcp); + pmodule_set_umode(ultimate3_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion + ("$Id$"); + moduleSetType(PROTOCOL); + + pmodule_ircd_version("UltimateIRCd 3.0.0.a26+"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set(""); + pmodule_ircd_flood_mode_char_remove(""); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} diff --git a/src/protocol/obsolete/ultimate3.h b/src/protocol/obsolete/ultimate3.h new file mode 100644 index 000000000..b14133765 --- /dev/null +++ b/src/protocol/obsolete/ultimate3.h @@ -0,0 +1,127 @@ +/* Ultimate IRCD 3.0 functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#define UMODE_a 0x00000001 +#define UMODE_h 0x00000002 +#define UMODE_i 0x00000004 +#define UMODE_o 0x00000008 +#define UMODE_r 0x00000010 +#define UMODE_w 0x00000020 +#define UMODE_A 0x00000040 +#define UMODE_0 0x00000080 +#define UMODE_Z 0x00000100 /* umode +Z - Services Root Admin */ +#define UMODE_S 0x00000200 /* umode +S - Services Client */ +#define UMODE_D 0x00000400 /* umode +D - has seen dcc warning message */ +#define UMODE_d 0x00000800 /* umode +d - user is deaf to channel messages */ +#define UMODE_W 0x00001000 /* umode +d - user is deaf to channel messages */ +#define UMODE_p 0x04000000 +#define UMODE_P 0x20000000 /* umode +P - Services Admin */ +#define UMODE_x 0x40000000 +#define UMODE_R 0x80000000 + + +#define CMODE_i 0x00000001 +#define CMODE_m 0x00000002 +#define CMODE_n 0x00000004 +#define CMODE_p 0x00000008 +#define CMODE_s 0x00000010 +#define CMODE_t 0x00000020 +#define CMODE_k 0x00000040 /* These two used only by ChanServ */ +#define CMODE_l 0x00000080 +#define CMODE_R 0x00000100 /* Only identified users can join */ +#define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_c 0x00000400 /* Colors can't be used */ +#define CMODE_A 0x00000800 +#define CMODE_N 0x00001000 +#define CMODE_S 0x00002000 +#define CMODE_K 0x00004000 +#define CMODE_O 0x00008000 /* Only opers can join */ +#define CMODE_q 0x00010000 /* No Quit Reason */ +#define CMODE_M 0x00020000 /* Non-regged nicks can't send messages */ + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r + +void ultimate3_set_umode(User * user, int ac, const char **av); +void ultimate3_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void ultimate3_cmd_vhost_off(User * u); +void ultimate3_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void ultimate3_cmd_svskill(const char *source, const char *user, const char *buf); +void ultimate3_cmd_svsmode(User * u, int ac, const char **av); +void ultimate3_cmd_372(const char *source, const char *msg); +void ultimate3_cmd_372_error(const char *source); +void ultimate3_cmd_375(const char *source); +void ultimate3_cmd_376(const char *source); +void ultimate3_cmd_nick(const char *nick, const char *name, const char *modes); +void ultimate3_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void ultimate3_cmd_mode(const char *source, const char *dest, const char *buf); +void ultimate3_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void ultimate3_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void ultimate3_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void ultimate3_cmd_notice(const char *source, const char *dest, const char *buf); +void ultimate3_cmd_notice2(const char *source, const char *dest, const char *msg); +void ultimate3_cmd_privmsg(const char *source, const char *dest, const char *buf); +void ultimate3_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void ultimate3_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void ultimate3_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void ultimate3_cmd_bot_chan_mode(const char *nick, const char *chan); +void ultimate3_cmd_351(const char *source); +void ultimate3_cmd_quit(const char *source, const char *buf); +void ultimate3_cmd_pong(const char *servname, const char *who); +void ultimate3_cmd_join(const char *user, const char *channel, time_t chantime); +void ultimate3_cmd_unsqline(const char *user); +void ultimate3_cmd_invite(const char *source, const char *chan, const char *nick); +void ultimate3_cmd_part(const char *nick, const char *chan, const char *buf); +void ultimate3_cmd_391(const char *source, const char *timestr); +void ultimate3_cmd_250(const char *buf); +void ultimate3_cmd_307(const char *buf); +void ultimate3_cmd_311(const char *buf); +void ultimate3_cmd_312(const char *buf); +void ultimate3_cmd_317(const char *buf); +void ultimate3_cmd_219(const char *source, const char *letter); +void ultimate3_cmd_401(const char *source, const char *who); +void ultimate3_cmd_318(const char *source, const char *who); +void ultimate3_cmd_242(const char *buf); +void ultimate3_cmd_243(const char *buf); +void ultimate3_cmd_211(const char *buf); +void ultimate3_cmd_global(const char *source, const char *buf); +void ultimate3_cmd_global_legacy(const char *source, const char *fmt); +void ultimate3_cmd_sqline(const char *mask, const char *reason); +void ultimate3_cmd_squit(const char *servname, const char *message); +void ultimate3_cmd_svso(const char *source, const char *nick, const char *flag); +void ultimate3_cmd_chg_nick(const char *oldnick, const char *newnick); +void ultimate3_cmd_svsnick(const char *source, const char *guest, time_t when); +void ultimate3_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void ultimate3_cmd_connect(int servernum); +void ultimate3_cmd_svshold(const char *nick); +void ultimate3_cmd_release_svshold(const char *nick); +void ultimate3_cmd_unsgline(const char *mask); +void ultimate3_cmd_unszline(const char *mask); +void ultimate3_cmd_szline(const char *mask, const char *reason, const char *whom); +void ultimate3_cmd_sgline(const char *mask, const char *reason); +void ultimate3_cmd_unban(const char *name, const char *nick); +void ultimate3_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void ultimate3_cmd_svid_umode(const char *nick, time_t ts); +void ultimate3_cmd_nc_change(User * u); +void ultimate3_cmd_svid_umode2(User * u, const char *ts); +void ultimate3_cmd_svid_umode3(User * u, const char *ts); +void ultimate3_cmd_eob(); +int ultimate3_flood_mode_check(const char *value); +void ultimate3_cmd_jupe(const char *jserver, const char *who, const char *reason); +int ultimate3_valid_nick(const char *nick); +void ultimate3_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class UltimateIRCdProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/obsolete/viagra.c b/src/protocol/obsolete/viagra.c new file mode 100644 index 000000000..69baf00c4 --- /dev/null +++ b/src/protocol/obsolete/viagra.c @@ -0,0 +1,1715 @@ +/* Viagra IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ + +#include "services.h" +#include "pseudo.h" +#include "viagra.h" + +IRCDVar myIrcd[] = { + {"ViagraIRCd 1.3.*", /* ircd name */ + "+oS", /* nickserv mode */ + "+oS", /* chanserv mode */ + "+oS", /* memoserv mode */ + "+oS", /* hostserv mode */ + "+ioS", /* operserv mode */ + "+oS", /* botserv mode */ + "+oS", /* helpserv mode */ + "+i", /* Dev/Null mode */ + "+ioS", /* Global mode */ + "+oS", /* nickserv alias mode */ + "+oS", /* chanserv alias mode */ + "+oS", /* memoserv alias mode */ + "+ioS", /* hostserv alias mode */ + "+ioS", /* operserv alias mode */ + "+oS", /* botserv alias mode */ + "+oS", /* helpserv alias mode */ + "+iS", /* Dev/Null alias mode */ + "+ioS", /* Global alias mode */ + "+qS", /* Used by BotServ Bots */ + 5, /* Chan Max Symbols */ + "-ciklmnpstOR", /* Modes to Remove */ + "+ao", /* Channel Umode used by Botserv bots */ + 1, /* SVSNICK */ + 1, /* Vhost */ + 1, /* Has Owner */ + "+q", /* Mode to set for an owner */ + "-q", /* Mode to unset for an owner */ + "+a", /* Mode to set for channel admin */ + "-a", /* Mode to unset for channel admin */ + "+rd", /* Mode On Reg */ + NULL, /* Mode on ID for Roots */ + NULL, /* Mode on ID for Admins */ + NULL, /* Mode on ID for Opers */ + "-r+d", /* Mode on UnReg */ + "-r+d", /* Mode on Nick Change */ + 1, /* Supports SGlines */ + 1, /* Supports SQlines */ + 1, /* Supports SZlines */ + 1, /* Supports Halfop +h */ + 3, /* Number of server args */ + 0, /* Join 2 Set */ + 0, /* Join 2 Message */ + 1, /* Has exceptions +e */ + 0, /* TS Topic Forward */ + 0, /* TS Topci Backward */ + 0, /* Protected Umode */ + 1, /* Has Admin */ + 0, /* Chan SQlines */ + 1, /* Quit on Kill */ + 1, /* SVSMODE unban */ + 1, /* Has Protect */ + 0, /* Reverse */ + 1, /* Chan Reg */ + CMODE_r, /* Channel Mode */ + 1, /* vidents */ + 0, /* svshold */ + 1, /* time stamp on mode */ + 1, /* NICKIP */ + 0, /* O:LINE */ + 1, /* UMODE */ + 1, /* VHOST ON NICK */ + 1, /* Change RealName */ + 0, /* No Knock */ + 0, /* Admin Only */ + DEFAULT_MLOCK, /* Default MLOCK */ + UMODE_x, /* Vhost Mode */ + 0, /* +f */ + 0, /* +L */ + 0, + 0, + 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 */ + 0, /* SJOIN ban char */ + 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ + 0, /* Can remove User Channel Modes with SVSMODE */ + 0, /* Sglines are not enforced until user reconnects */ + "x", /* vhost char */ + 0, /* ts6 */ + 1, /* support helper umode */ + 0, /* p10 */ + NULL, /* character set */ + 1, /* reports sync state */ + 0, /* CIDR channelbans */ + } + , + {NULL} +}; + + +IRCDCAPAB myIrcdcap[] = { + { + CAPAB_NOQUIT, /* NOQUIT */ + CAPAB_TSMODE, /* TSMODE */ + CAPAB_UNCONNECT, /* UNCONNECT */ + CAPAB_NICKIP, /* NICKIP */ + CAPAB_NSJOIN, /* SJOIN */ + CAPAB_ZIP, /* ZIP */ + CAPAB_BURST, /* BURST */ + CAPAB_TS5, /* TS5 */ + CAPAB_TS3, /* TS3 */ + CAPAB_DKEY, /* DKEY */ + 0, /* PT4 */ + 0, /* SCS */ + 0, /* QS */ + 0, /* UID */ + 0, /* KNOCK */ + 0, /* CLIENT */ + 0, /* IPV6 */ + 0, /* SSJ5 */ + 0, /* SN2 */ + 0, /* TOKEN */ + 0, /* VHOST */ + 0, /* SSJ3 */ + 0, /* NICK2 */ + 0, /* UMODE2 */ + 0, /* VL */ + 0, /* TLKEXT */ + CAPAB_DODKEY, /* DODKEY */ + CAPAB_DOZIP, /* DOZIP */ + 0, 0, 0} +}; + + + + +void viagra_set_umode(User * user, int ac, const char **av) +{ + int add = 1; /* 1 if adding modes, 0 if deleting */ + const char *modes = av[0]; + + ac--; + + if (debug) + alog("debug: Changing mode for %s to %s", user->nick, modes); + + while (*modes) { + + /* This looks better, much better than "add ? (do_add) : (do_remove)". + * At least this is readable without paying much attention :) -GD + */ + if (add) + user->mode |= umodes[(int) *modes]; + else + user->mode &= ~umodes[(int) *modes]; + + switch (*modes++) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'd': + if (ac == 0) { + alog("user: umode +d with no parameter (?) for user %s", + user->nick); + break; + } + + ac--; + av++; + user->svid = strtoul(*av, NULL, 0); + break; + case 'o': + if (add) { + opcnt++; + if (WallOper) { + anope_cmd_global(s_OperServ, + "\2%s\2 is now an IRC operator.", + user->nick); + } + display_news(user, NEWS_OPER); + } else { + opcnt--; + } + break; + case 'r': + if (add && !nick_identified(user)) { + common_svsmode(user, "-r", NULL); + user->mode &= ~UMODE_r; + } + break; + case 'x': + update_host(user); + break; + } + } +} + +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, UMODE_C, 0, 0, 0, 0, 0, UMODE_I, 0, 0, 0, 0, UMODE_N, + UMODE_O, + 0, + UMODE_Q, + UMODE_R, + UMODE_S, UMODE_T, 0, 0, 0, 0, 0, + 0, + 0, 0, 0, 0, 0, + 0, UMODE_a, UMODE_b, UMODE_c, UMODE_d, UMODE_e, UMODE_f, + UMODE_g, + UMODE_h, UMODE_i, 0, 0, 0, 0, UMODE_n, UMODE_o, + 0, + 0, UMODE_r, UMODE_s, 0, 0, 0, UMODE_w, + UMODE_x, + 0, + 0, + 0, 0, 0, 0, 0 +}; + + +char myCsmodes[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, + 'h', /* (37) % Channel halfops */ + 0, /* (38) & bans */ + 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, + + 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a', 0 +}; + +CMMode myCmmodes[128] = { + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, + {NULL}, + {add_ban, del_ban}, + {NULL}, + {NULL}, + {add_exception, del_exception}, + {NULL}, + {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} +}; + + + +CBMode myCbmodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, + {0}, /* A */ + {0}, /* B */ + {0}, /* C */ + {0}, /* D */ + {0}, /* E */ + {0}, /* F */ + {0}, /* G */ + {CMODE_H, 0, NULL, NULL}, /* H */ + {0}, /* I */ + {0}, /* J */ + {0}, /* K */ + {0}, /* L */ + {CMODE_M, 0, NULL, NULL}, /* M */ + {CMODE_N, 0, NULL, NULL}, /* N */ + {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, + {CMODE_P, 0, NULL, NULL}, /* P */ + {0}, /* Q */ + {CMODE_R, 0, NULL, NULL}, /* R */ + {CMODE_S, 0, NULL, NULL}, /* S */ + {0}, /* T */ + {0}, /* U */ + {0}, /* V */ + {0}, /* W */ + {0}, /* X */ + {0}, /* Y */ + {0}, /* Z */ + {0}, {0}, {0}, {0}, {0}, {0}, + {0}, /* a */ + {0}, /* b */ + {CMODE_c, 0, NULL, NULL}, + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {0}, /* h */ + {CMODE_i, 0, NULL, NULL}, + {0}, /* j */ + {CMODE_k, 0, chan_set_key, cs_set_key}, + {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, + {CMODE_m, 0, NULL, NULL}, + {CMODE_n, 0, NULL, NULL}, + {0}, /* o */ + {CMODE_p, 0, NULL, NULL}, + {0}, /* q */ + {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, + {CMODE_s, 0, NULL, NULL}, + {CMODE_t, 0, NULL, NULL}, + {0}, + {0}, /* v */ + {0}, /* w */ + {CMODE_x, 0, NULL, NULL}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0} +}; + +CBModeInfo myCbmodeinfos[] = { + {'c', CMODE_c, 0, NULL, NULL}, + {'i', CMODE_i, 0, NULL, NULL}, + {'k', CMODE_k, 0, get_key, cs_get_key}, + {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, + {'m', CMODE_m, 0, NULL, NULL}, + {'n', CMODE_n, 0, NULL, NULL}, + {'p', CMODE_p, 0, NULL, NULL}, + {'r', CMODE_r, 0, NULL, NULL}, + {'s', CMODE_s, 0, NULL, NULL}, + {'t', CMODE_t, 0, NULL, NULL}, + {'x', CMODE_x, 0, NULL, NULL}, + {'H', CMODE_H, 0, NULL, NULL}, + {'M', CMODE_M, 0, NULL, NULL}, + {'N', CMODE_N, 0, NULL, NULL}, + {'O', CMODE_O, 0, NULL, NULL}, + {'P', CMODE_P, 0, NULL, NULL}, + {'R', CMODE_R, 0, NULL, NULL}, + {'S', CMODE_S, 0, NULL, NULL}, + {0} +}; + +CUMode myCumodes[128] = { + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, + + {0}, + + {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* b */ + {0}, /* c */ + {0}, /* d */ + {0}, /* e */ + {0}, /* f */ + {0}, /* g */ + {CUS_HALFOP, 0, check_valid_op}, + {0}, /* i */ + {0}, /* j */ + {0}, /* k */ + {0}, /* l */ + {0}, /* m */ + {0}, /* n */ + {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, + {0}, /* p */ + {CUS_OWNER, 0, check_valid_op}, + {0}, /* r */ + {0}, /* s */ + {0}, /* t */ + {0}, /* u */ + {CUS_VOICE, 0, NULL}, + {0}, /* w */ + {0}, /* x */ + {0}, /* y */ + {0}, /* z */ + {0}, {0}, {0}, {0}, {0} +}; + + +void viagra_cmd_bot_unban(ChannelInfo * ci, const char *nick) +{ + send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick); +} + +int anope_event_setname(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 1) + return MOD_CONT; + + u = finduser(source); + if (!u) { + if (debug) { + alog("debug: SETNAME for nonexistent user %s", source); + } + return MOD_CONT; + } + + u->SetRealname(av[0]); + return MOD_CONT; +} + +int anope_event_sjoin(const char *source, int ac, const char **av) +{ + do_sjoin(source, ac, av); + return MOD_CONT; +} + +int anope_event_chgname(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: CHGNAME for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetRealname(av[1]); + return MOD_CONT; +} + +int anope_event_setident(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 1) + return MOD_CONT; + + u = finduser(source); + if (!u) { + if (debug) { + alog("debug: SETIDENT for nonexistent user %s", source); + } + return MOD_CONT; + } + + u->SetIdent(av[0]); + return MOD_CONT; +} + +int anope_event_chgident(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: CHGIDENT for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetIdent(av[1]); + return MOD_CONT; +} + +/* + * sethost + * parv[0] = sender + * parv[1] = newhost + */ +int anope_event_sethost(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 1) + return MOD_CONT; + + u = finduser(source); + if (!u) { + if (debug) { + alog("debug: SETHOST for nonexistent user %s", source); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[0]); + return MOD_CONT; +} + +int anope_event_nick(const char *source, int ac, const char **av) +{ + User *user; + + if (ac != 2) { + user = do_nick(source, av[0], av[4], av[5], av[6], av[9], + strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), + strtoul(av[8], NULL, 0), "*", NULL); + if (user) { + anope_set_umode(user, 1, &av[3]); + } + } else { + do_nick(source, av[0], NULL, NULL, NULL, NULL, + strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); + } + return MOD_CONT; +} + +int anope_event_vs(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: VS for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[1]); + return MOD_CONT; + +} + +int anope_event_chghost(const char *source, int ac, const char **av) +{ + User *u; + + if (ac != 2) + return MOD_CONT; + + u = finduser(av[0]); + if (!u) { + if (debug) { + alog("debug: CHGHOST for nonexistent user %s", av[0]); + } + return MOD_CONT; + } + + u->SetDisplayedHost(av[1]); + return MOD_CONT; +} + +int anope_event_436(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + + m_nickcoll(av[0]); + return MOD_CONT; +} + +int anope_event_notice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_svinfo(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +/* + * gnotice + * parv[0] = sender prefix + * parv[1] = message text + */ +int anope_event_gnotice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_sqline(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_burst(const char *source, int ac, const char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + /* If we found a server with the given source, that one just + * finished bursting. If there was no source, then our uplink + * server finished bursting. -GD + */ + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); + } + return MOD_CONT; +} + +int anope_event_tctrl(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +/* + * error + * parv[0] = sender prefix + * parv[*] = parameters + */ +int anope_event_error(const char *source, int ac, const char **av) +{ + if (ac >= 1) { + if (debug) { + alog("debug: %s", av[0]); + } + } + return MOD_CONT; +} + +/* *INDENT-OFF* */ +void moduleAddIRCDMsgs(void) { + Message *m; + + updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); + + m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("402", anope_event_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", 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", 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); + 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); + m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); + m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); + m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); + m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); + m = createMessage("UNSQLINE", anope_event_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); + m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); + m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); + m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); + m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); + m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); + m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); + m = createMessage("CHGHOST", anope_event_chghost); addCoreMessage(IRCD,m); + m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); + m = createMessage("CHGNAME", anope_event_chgname); addCoreMessage(IRCD,m); + 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("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* */ + + +/* SQLINE */ +void viagra_cmd_sqline(const char *mask, const char *reason) +{ + if (!mask || !reason) { + return; + } + + send_cmd(NULL, "SQLINE %s :%s", mask, reason); +} + +void viagra_cmd_unsgline(const char *mask) +{ + send_cmd(NULL, "UNSGLINE 0 :%s", mask); +} + +void viagra_cmd_unszline(const char *mask) +{ + send_cmd(NULL, "UNSZLINE 0 %s", mask); +} + +void viagra_cmd_szline(const char *mask, const char *reason, const char *whom) +{ + send_cmd(NULL, "SZLINE %s :%s", mask, reason); +} + +void ViagraIRCdProto::cmd_svsnoop(const char *server, int set) +{ + send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); +} + +void viagra_cmd_svsadmin(const char *server, int set) +{ + ircd_proto.cmd_svsnoop(server, set); +} + +void viagra_cmd_sgline(const char *mask, const char *reason) +{ + send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); +} + +void ViagraIRCdProto::cmd_remove_akill(const char *user, const char *host) +{ + send_cmd(NULL, "RAKILL %s %s", host, user); +} + +/* PART */ +void viagra_cmd_part(const char *nick, const char *chan, const char *buf) +{ + if (!nick || !chan) { + return; + } + + if (buf) { + send_cmd(nick, "PART %s :%s", chan, buf); + } else { + send_cmd(nick, "PART %s", chan); + } +} + +void viagra_cmd_topic(const char *whosets, const char *chan, const char *whosetit, + const char *topic, time_t when) +{ + send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, + (unsigned long int) when, topic); +} + +void viagra_cmd_vhost_off(User * u) +{ + send_cmd(NULL, "SVSMODE %s -x", u->nick); + notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); +} + +void viagra_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) +{ + if (vIdent) { + send_cmd(NULL, "CHGIDENT %s %s", nick, vIdent); + } + send_cmd(NULL, "SVSMODE %s +x", nick); + send_cmd(NULL, "SVSCHGHOST %s %s", nick, vhost); +} + +void viagra_cmd_unsqline(const char *user) +{ + send_cmd(NULL, "UNSQLINE %s", user); +} + +void viagra_cmd_join(const char *user, const char *channel, time_t chantime) +{ + send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); +} + + +/* + * m_akill() + * parv[1]=host + * parv[2]=user + * parv[3]=length + * parv[4]=akiller + * parv[5]=time set + * parv[6]=reason + */ +void viagra_cmd_akill(const char *user, const char *host, const char *who, time_t when, + time_t expires, const char *reason) +{ + send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, + (long int) time(NULL), reason); +} + + +/* + * svskill + * parv[0] = servername + * parv[1] = client + * parv[2] = nick stamp + * parv[3] = kill message + */ +void viagra_cmd_svskill(const char *source, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "SVSKILL %s :%s", user, buf); + } + return; +} + +void viagra_cmd_mode(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (ircdcap->tsmode) { + if (uplink_capab & ircdcap->tsmode) { + send_cmd(source, "MODE %s 0 %s", dest, buf); + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } + } else { + send_cmd(source, "MODE %s %s", dest, buf); + } +} + +/* QUIT */ +void viagra_cmd_quit(const char *source, const char *buf) +{ + if (buf) { + send_cmd(source, "QUIT :%s", buf); + } else { + send_cmd(source, "QUIT"); + } +} + +int anope_event_away(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + m_away(source, (ac ? av[0] : NULL)); + return MOD_CONT; +} + +int anope_event_ping(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + viagra_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); + return MOD_CONT; +} + +void viagra_cmd_svsmode(User * u, int ac, const char **av) +{ + send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, + (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), + (ac == 2 ? av[1] : "")); +} + +void viagra_cmd_squit(const char *servname, const char *message) +{ + send_cmd(NULL, "SQUIT %s :%s", servname, message); +} + +/* PONG */ +void viagra_cmd_pong(const char *servname, const char *who) +{ + send_cmd(servname, "PONG %s", who); +} + +/* + * 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 viagra_cmd_svinfo() +{ + send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); +} + +/* CAPAB */ +void viagra_cmd_capab() +{ + send_cmd(NULL, "CAPAB TS5 NOQUIT SSJOIN BURST UNCONNECT NICKIP"); +} + +/* PASS */ +void viagra_cmd_pass(const char *pass) +{ + send_cmd(NULL, "PASS %s :TS", pass); +} + +/* SERVER */ +void viagra_cmd_server(const char *servname, int hop, const char *descript) +{ + send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); +} + +void viagra_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void viagra_cmd_connect(int servernum) +{ + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + + if (servernum == 1) { + viagra_cmd_pass(RemotePassword); + } else if (servernum == 2) { + viagra_cmd_pass(RemotePassword2); + } else if (servernum == 3) { + viagra_cmd_pass(RemotePassword3); + } + viagra_cmd_capab(); + viagra_cmd_server(ServerName, 1, ServerDesc); + viagra_cmd_svinfo(); + viagra_cmd_burst(); +} + +/* EVENT : OS */ +int anope_event_os(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_OperServ, av[0]); + return MOD_CONT; +} + +/* EVENT : NS */ +int anope_event_ns(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_NickServ, av[0]); + return MOD_CONT; +} + +/* EVENT : MS */ +int anope_event_ms(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_MemoServ, av[0]); + return MOD_CONT; +} + +/* EVENT : HS */ +int anope_event_hs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_HostServ, av[0]); + return MOD_CONT; +} + +/* EVENT : CS */ +int anope_event_cs(const char *source, int ac, const char **av) +{ + if (ac < 1) + return MOD_CONT; + m_privmsg(source, s_ChanServ, av[0]); + return MOD_CONT; +} + +int anope_event_server(const char *source, int ac, const char **av) +{ + if (!stricmp(av[1], "1")) { + uplink = sstrdup(av[0]); + } + do_server(source, av[0], av[1], av[2], NULL); + return MOD_CONT; +} + + +int anope_event_privmsg(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + m_privmsg(source, av[0], av[1]); + return MOD_CONT; +} + +int anope_event_part(const char *source, int ac, const char **av) +{ + if (ac < 1 || ac > 2) + return MOD_CONT; + do_part(source, ac, av); + return MOD_CONT; +} + +int anope_event_whois(const char *source, int ac, const char **av) +{ + if (source && ac >= 1) { + m_whois(source, av[0]); + } + return MOD_CONT; +} + +int anope_event_topic(const char *source, int ac, const char **av) +{ + if (ac != 4) + return MOD_CONT; + do_topic(source, ac, av); + return MOD_CONT; +} + +int anope_event_squit(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + do_squit(source, ac, av); + return MOD_CONT; +} + +int anope_event_quit(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_quit(source, ac, av); + return MOD_CONT; +} + + +int anope_event_mode(const char *source, int ac, const char **av) +{ + if (ac < 2) + return MOD_CONT; + + if (*av[0] == '#' || *av[0] == '&') { + do_cmode(source, ac, av); + } else { + do_umode(source, ac, av); + } + return MOD_CONT; +} + +int anope_event_kill(const char *source, int ac, const char **av) +{ + if (ac != 2) + return MOD_CONT; + + m_kill(av[0], av[1]); + return MOD_CONT; +} + +int anope_event_kick(const char *source, int ac, const char **av) +{ + if (ac != 3) + return MOD_CONT; + do_kick(source, ac, av); + return MOD_CONT; +} + +int anope_event_join(const char *source, int ac, const char **av) +{ + if (ac != 1) + return MOD_CONT; + do_join(source, ac, av); + return MOD_CONT; +} + +int anope_event_motd(const char *source, int ac, const char **av) +{ + if (!source) { + return MOD_CONT; + } + + m_motd(source); + return MOD_CONT; +} + +void viagra_cmd_notice_ops(const char *source, const char *dest, const char *buf) +{ + if (buf) { + send_cmd(NULL, "NOTICE @%s :%s", dest, buf); + } + return; +} + +void viagra_cmd_notice(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + if (NSDefFlags & NI_MSG) { + viagra_cmd_privmsg2(source, dest, buf); + } else { + send_cmd(source, "NOTICE %s :%s", dest, buf); + } +} + +void viagra_cmd_notice2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE %s :%s", dest, msg); +} + +void viagra_cmd_privmsg(const char *source, const char *dest, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source, "PRIVMSG %s :%s", dest, buf); +} + +void viagra_cmd_privmsg2(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG %s :%s", dest, msg); +} + +void viagra_cmd_serv_notice(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "NOTICE $%s :%s", dest, msg); +} + +void viagra_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) +{ + send_cmd(source, "PRIVMSG $%s :%s", dest, msg); +} + +/* GLOBOPS */ +void viagra_cmd_global(const char *source, const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); +} + +/* 391 */ +void viagra_cmd_391(const char *source, const char *timestr) +{ + if (!timestr) { + return; + } + send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); +} + +/* 250 */ +void viagra_cmd_250(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "250 %s", buf); +} + +/* 307 */ +void viagra_cmd_307(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "307 %s", buf); +} + +/* 311 */ +void viagra_cmd_311(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "311 %s", buf); +} + +/* 312 */ +void viagra_cmd_312(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "312 %s", buf); +} + +/* 317 */ +void viagra_cmd_317(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(ServerName, "317 %s", buf); +} + +/* 219 */ +void viagra_cmd_219(const char *source, const char *letter) +{ + if (!source) { + return; + } + + if (letter) { + send_cmd(NULL, "219 %s %c :End of /STATS report.", source, + *letter); + } else { + send_cmd(NULL, "219 %s l :End of /STATS report.", source); + } +} + +/* 401 */ +void viagra_cmd_401(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + send_cmd(ServerName, "401 %s %s :No such service.", source, who); +} + +/* 318 */ +void viagra_cmd_318(const char *source, const char *who) +{ + if (!source || !who) { + return; + } + + send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); +} + +/* 242 */ +void viagra_cmd_242(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "242 %s", buf); +} + +/* 243 */ +void viagra_cmd_243(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "243 %s", buf); +} + +/* 211 */ +void viagra_cmd_211(const char *buf) +{ + if (!buf) { + return; + } + + send_cmd(NULL, "211 %s", buf); +} + +void viagra_cmd_351(const char *source) +{ + send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", + source, version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); +} + +void viagra_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + EnforceQlinedNick(nick, s_BotServ); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); + viagra_cmd_sqline(nick, "Reserved for services"); +} + +void viagra_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) +{ + if (buf) { + send_cmd(source, "KICK %s %s :%s", chan, user, buf); + } else { + send_cmd(source, "KICK %s %s", chan, user); + } +} + +void viagra_cmd_nick(const char *nick, const char *name, const char *modes) +{ + EnforceQlinedNick(nick, NULL); + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, ServiceUser, ServiceHost, + ServerName, name); + viagra_cmd_sqline(nick, "Reserved for services"); +} + +void viagra_cmd_372(const char *source, const char *msg) +{ + send_cmd(ServerName, "372 %s :- %s", source, msg); +} + +void viagra_cmd_372_error(const char *source) +{ + send_cmd(ServerName, "422 %s :- MOTD file not found! Please " + "contact your IRC administrator.", source); +} + +void viagra_cmd_375(const char *source) +{ + send_cmd(ServerName, "375 %s :- %s Message of the Day", + source, ServerName); +} + +void viagra_cmd_376(const char *source) +{ + send_cmd(ServerName, "376 %s :End of /MOTD command.", source); +} + +/* INVITE */ +void viagra_cmd_invite(const char *source, const char *chan, const char *nick) +{ + if (!source || !chan || !nick) { + return; + } + + send_cmd(source, "INVITE %s %s", nick, chan); +} + +void viagra_cmd_bot_chan_mode(const char *nick, const char *chan) +{ + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); +} + +int anope_event_capab(const char *source, int ac, const char **av) +{ + capab_parse(ac, av); + return MOD_CONT; +} + +/* SVSHOLD - set */ +void viagra_cmd_svshold(const char *nick) +{ + /* Not supported by this IRCD */ +} + +/* SVSHOLD - release */ +void viagra_cmd_release_svshold(const char *nick) +{ + /* Not Supported by this IRCD */ +} + +/* SVSNICK */ +void viagra_cmd_svsnick(const char *source, const char *guest, time_t when) +{ + if (!source || !guest) { + return; + } + send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); +} + +void viagra_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, + const char *modes) +{ + send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, + (long int) time(NULL), modes, user, host, ServerName, real); +} + +void viagra_cmd_svso(const char *source, const char *nick, const char *flag) +{ + /* Not Supported by this IRCD */ +} + + +/* SVSMODE -b */ +void viagra_cmd_unban(const char *name, const char *nick) +{ + viagra_cmd_svsmode_chan(name, "-b", nick); +} + +/* SVSMODE channel modes */ + +void viagra_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) +{ + if (nick) { + send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); + } else { + send_cmd(ServerName, "SVSMODE %s %s", name, mode); + } +} + +/* SVSMODE +d */ +/* sent if svid is something weird */ +void viagra_cmd_svid_umode(const char *nick, time_t ts) +{ + send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, + (unsigned long int) ts); +} + +/* SVSMODE +d */ +/* nc_change was = 1, and there is no na->status */ +void viagra_cmd_nc_change(User * u) +{ + common_svsmode(u, "+d", "1"); +} + +/* SVSMODE +d */ +void viagra_cmd_svid_umode2(User * u, const char *ts) +{ + /* not used by bahamut ircds */ +} + +void viagra_cmd_svid_umode3(User * u, const char *ts) +{ + if (u->svid != u->timestamp) { + common_svsmode(u, "+rd", ts); + } else { + common_svsmode(u, "+r", NULL); + } +} + +/* NICK */ +void viagra_cmd_chg_nick(const char *oldnick, const char *newnick) +{ + if (!oldnick || !newnick) { + return; + } + + send_cmd(oldnick, "NICK %s", newnick); +} + +/* + * svsjoin + * parv[0] = sender + * parv[1] = nick to make join + * parv[2] = channel(s) to join + */ +void viagra_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) +{ + 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 viagra_cmd_svspart(const char *source, const char *nick, const char *chan) +{ + send_cmd(source, "SVSPART %s :%s", nick, chan); +} + +void viagra_cmd_swhois(const char *source, const char *who, const char *mask) +{ + /* not supported */ +} + +int viagra_flood_mode_check(const char *value) +{ + return 0; +} + +int anope_event_rehash(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_snotice(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(const char *source, int ac, const char **av) +{ + return MOD_CONT; +} + +void viagra_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +void viagra_cmd_jupe(const char *jserver, const char *who, const char *reason) +{ + char rbuf[256]; + + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, + reason ? ": " : "", reason ? reason : ""); + + if (findserver(servlist, jserver)) + viagra_cmd_squit(jserver, rbuf); + viagra_cmd_server(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); +} + +/* GLOBOPS - to handle old WALLOPS */ +void viagra_cmd_global_legacy(const char *source, const char *fmt) +{ + send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); +} + +/* + 1 = valid nick + 0 = nick is in valid +*/ +int viagra_valid_nick(const char *nick) +{ + /* no hard coded invalid nicks */ + return 1; +} + +/* + 1 = valid chan + 0 = chan is in valid +*/ +int viagra_valid_chan(const char *chan) +{ + /* no hard coded invalid chans */ + return 1; +} + + +void viagra_cmd_ctcp(const char *source, const char *dest, const char *buf) +{ + char *s; + + if (!buf) { + return; + } else { + s = normalizeBuffer(buf); + } + + send_cmd(source, "NOTICE %s :\1%s \1", dest, s); + free(s); +} + + +/** + * Tell anope which function we want to perform each task inside of anope. + * These prototypes must match what anope expects. + **/ +void moduleAddAnopeCmds() +{ + pmodule_cmd_topic(viagra_cmd_topic); + pmodule_cmd_vhost_off(viagra_cmd_vhost_off); + pmodule_cmd_akill(viagra_cmd_akill); + pmodule_cmd_svskill(viagra_cmd_svskill); + pmodule_cmd_svsmode(viagra_cmd_svsmode); + pmodule_cmd_372(viagra_cmd_372); + pmodule_cmd_372_error(viagra_cmd_372_error); + pmodule_cmd_375(viagra_cmd_375); + pmodule_cmd_376(viagra_cmd_376); + pmodule_cmd_nick(viagra_cmd_nick); + pmodule_cmd_guest_nick(viagra_cmd_guest_nick); + pmodule_cmd_mode(viagra_cmd_mode); + pmodule_cmd_bot_nick(viagra_cmd_bot_nick); + pmodule_cmd_kick(viagra_cmd_kick); + pmodule_cmd_notice_ops(viagra_cmd_notice_ops); + pmodule_cmd_notice(viagra_cmd_notice); + pmodule_cmd_notice2(viagra_cmd_notice2); + pmodule_cmd_privmsg(viagra_cmd_privmsg); + pmodule_cmd_privmsg2(viagra_cmd_privmsg2); + pmodule_cmd_serv_notice(viagra_cmd_serv_notice); + pmodule_cmd_serv_privmsg(viagra_cmd_serv_privmsg); + pmodule_cmd_bot_chan_mode(viagra_cmd_bot_chan_mode); + pmodule_cmd_351(viagra_cmd_351); + pmodule_cmd_quit(viagra_cmd_quit); + pmodule_cmd_pong(viagra_cmd_pong); + pmodule_cmd_join(viagra_cmd_join); + pmodule_cmd_unsqline(viagra_cmd_unsqline); + pmodule_cmd_invite(viagra_cmd_invite); + pmodule_cmd_part(viagra_cmd_part); + pmodule_cmd_391(viagra_cmd_391); + pmodule_cmd_250(viagra_cmd_250); + pmodule_cmd_307(viagra_cmd_307); + pmodule_cmd_311(viagra_cmd_311); + pmodule_cmd_312(viagra_cmd_312); + pmodule_cmd_317(viagra_cmd_317); + pmodule_cmd_219(viagra_cmd_219); + pmodule_cmd_401(viagra_cmd_401); + pmodule_cmd_318(viagra_cmd_318); + pmodule_cmd_242(viagra_cmd_242); + pmodule_cmd_243(viagra_cmd_243); + pmodule_cmd_211(viagra_cmd_211); + pmodule_cmd_global(viagra_cmd_global); + pmodule_cmd_global_legacy(viagra_cmd_global_legacy); + pmodule_cmd_sqline(viagra_cmd_sqline); + pmodule_cmd_squit(viagra_cmd_squit); + pmodule_cmd_svso(viagra_cmd_svso); + pmodule_cmd_chg_nick(viagra_cmd_chg_nick); + pmodule_cmd_svsnick(viagra_cmd_svsnick); + pmodule_cmd_vhost_on(viagra_cmd_vhost_on); + pmodule_cmd_connect(viagra_cmd_connect); + pmodule_cmd_svshold(viagra_cmd_svshold); + pmodule_cmd_release_svshold(viagra_cmd_release_svshold); + pmodule_cmd_unsgline(viagra_cmd_unsgline); + pmodule_cmd_unszline(viagra_cmd_unszline); + pmodule_cmd_szline(viagra_cmd_szline); + pmodule_cmd_sgline(viagra_cmd_sgline); + pmodule_cmd_unban(viagra_cmd_unban); + pmodule_cmd_svsmode_chan(viagra_cmd_svsmode_chan); + pmodule_cmd_svid_umode(viagra_cmd_svid_umode); + pmodule_cmd_nc_change(viagra_cmd_nc_change); + pmodule_cmd_svid_umode2(viagra_cmd_svid_umode2); + pmodule_cmd_svid_umode3(viagra_cmd_svid_umode3); + pmodule_cmd_svsjoin(viagra_cmd_svsjoin); + pmodule_cmd_svspart(viagra_cmd_svspart); + pmodule_cmd_swhois(viagra_cmd_swhois); + pmodule_cmd_eob(viagra_cmd_eob); + pmodule_flood_mode_check(viagra_flood_mode_check); + pmodule_cmd_jupe(viagra_cmd_jupe); + pmodule_valid_nick(viagra_valid_nick); + pmodule_valid_chan(viagra_valid_chan); + pmodule_cmd_ctcp(viagra_cmd_ctcp); + pmodule_set_umode(viagra_set_umode); +} + +/** + * Now tell anope how to use us. + **/ +int AnopeInit(int argc, char **argv) +{ + + moduleAddAuthor("Anope"); + moduleAddVersion("$Id$"); + moduleSetType(PROTOCOL); + + pmodule_ircd_version("ViagraIRCd 1.3.x"); + pmodule_ircd_cap(myIrcdcap); + pmodule_ircd_var(myIrcd); + pmodule_ircd_cbmodeinfos(myCbmodeinfos); + pmodule_ircd_cumodes(myCumodes); + pmodule_ircd_flood_mode_char_set(""); + pmodule_ircd_flood_mode_char_remove(""); + pmodule_ircd_cbmodes(myCbmodes); + pmodule_ircd_cmmodes(myCmmodes); + pmodule_ircd_csmodes(myCsmodes); + pmodule_ircd_useTSMode(0); + + /** Deal with modes anope _needs_ to know **/ + pmodule_invis_umode(UMODE_i); + pmodule_oper_umode(UMODE_o); + pmodule_invite_cmode(CMODE_i); + pmodule_secret_cmode(CMODE_s); + pmodule_private_cmode(CMODE_p); + pmodule_key_mode(CMODE_k); + pmodule_limit_mode(CMODE_l); + + moduleAddAnopeCmds(); + pmodule_ircd_proto(&ircd_proto); + moduleAddIRCDMsgs(); + + return MOD_CONT; +} diff --git a/src/protocol/obsolete/viagra.h b/src/protocol/obsolete/viagra.h new file mode 100644 index 000000000..3bdfec1e1 --- /dev/null +++ b/src/protocol/obsolete/viagra.h @@ -0,0 +1,136 @@ +/* Viagra IRCD functions + * + * (C) 2003-2008 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +/* User Modes */ +#define UMODE_A 0x00000040 /* Is a Server Administrator. */ +#define UMODE_C 0x00002000 /* Is a Server Co Administrator. */ +#define UMODE_I 0x00008000 /* Stealth mode, makes you beeing hidden at channel. invisible joins/parts. */ +#define UMODE_N 0x00000400 /* Is a Network Administrator. */ +#define UMODE_O 0x00004000 /* Local IRC Operator. */ +#define UMODE_Q 0x00001000 /* Is an Abuse Administrator. */ +#define UMODE_R 0x08000000 /* Cant receive messages from non registered user. */ +#define UMODE_S 0x00000080 /* Is a Network Service. For Services only. */ +#define UMODE_T 0x00000800 /* Is a Technical Administrator. */ +#define UMODE_a 0x00000001 /* Is a Services Administrator. */ +#define UMODE_b 0x00040000 /* Can listen to generic bot warnings. */ +#define UMODE_c 0x00010000 /* See's all connects/disconnects on local server. */ +#define UMODE_d 0x00000100 /* Can listen to debug and channel cration notices. */ +#define UMODE_e 0x00080000 /* Can see client connections/exits on remote servers. */ +#define UMODE_f 0x00100000 /* Listen to flood/spam alerts from server. */ +#define UMODE_g 0x00000200 /* Can read & send to globops, and locops. */ +#define UMODE_h 0x00000002 /* Is a Help Operator. */ +#define UMODE_i 0x00000004 /* Invisible (Not shown in /who and /names searches). */ +#define UMODE_n 0x00020000 /* Can see client nick change notices. */ +#define UMODE_o 0x00000008 /* Global IRC Operator. */ +#define UMODE_r 0x00000010 /* Identifies the nick as being registered. */ +#define UMODE_s 0x00200000 /* Can listen to generic server messages. */ +#define UMODE_w 0x00000020 /* Can listen to wallop messages. */ +#define UMODE_x 0x40000000 /* Gives the user hidden hostname. */ + + +/* Channel Modes */ +#define CMODE_i 0x00000001 /* Invite-only allowed. */ +#define CMODE_m 0x00000002 /* Moderated channel, noone can speak and changing nick except users with mode +vho */ +#define CMODE_n 0x00000004 /* No messages from outside channel */ +#define CMODE_p 0x00000008 /* Private channel. */ +#define CMODE_s 0x00000010 /* Secret channel. */ +#define CMODE_t 0x00000020 /* Only channel operators may set the topic */ +#define CMODE_k 0x00000040 /* Needs the channel key to join the channel */ +#define CMODE_l 0x00000080 /* Channel may hold at most of users */ +#define CMODE_R 0x00000100 /* Requires a registered nickname to join the channel. */ +#define CMODE_r 0x00000200 /* Channel is registered. */ +#define CMODE_c 0x00000400 /* No ANSI color can be sent to the channel */ +#define CMODE_M 0x00000800 /* Requires a registered nickname to speak at the channel. */ +#define CMODE_H 0x00001000 /* HelpOps only channel. */ +#define CMODE_O 0x00008000 /* IRCOps only channel. */ +#define CMODE_S 0x00020000 /* Strips all mesages out of colors. */ +#define CMODE_N 0x01000000 /* No nickchanges allowed. */ +#define CMODE_P 0x02000000 /* "Peace mode" No kicks allowed unless by u:lines */ +#define CMODE_x 0x04000000 /* No bold/underlined or reversed text can be sent to the channel */ + +#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r + +void viagra_set_umode(User * user, int ac, const char **av); +void viagra_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); +void viagra_cmd_vhost_off(User * u); +void viagra_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); +void viagra_cmd_svskill(const char *source, const char *user, const char *buf); +void viagra_cmd_svsmode(User * u, int ac, const char **av); +void viagra_cmd_372(const char *source, const char *msg); +void viagra_cmd_372_error(const char *source); +void viagra_cmd_375(const char *source); +void viagra_cmd_376(const char *source); +void viagra_cmd_nick(const char *nick, const char *name, const char *modes); +void viagra_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void viagra_cmd_mode(const char *source, const char *dest, const char *buf); +void viagra_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); +void viagra_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); +void viagra_cmd_notice_ops(const char *source, const char *dest, const char *buf); +void viagra_cmd_notice(const char *source, const char *dest, const char *buf); +void viagra_cmd_notice2(const char *source, const char *dest, const char *msg); +void viagra_cmd_privmsg(const char *source, const char *dest, const char *buf); +void viagra_cmd_privmsg2(const char *source, const char *dest, const char *msg); +void viagra_cmd_serv_notice(const char *source, const char *dest, const char *msg); +void viagra_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); +void viagra_cmd_bot_chan_mode(const char *nick, const char *chan); +void viagra_cmd_351(const char *source); +void viagra_cmd_quit(const char *source, const char *buf); +void viagra_cmd_pong(const char *servname, const char *who); +void viagra_cmd_join(const char *user, const char *channel, time_t chantime); +void viagra_cmd_unsqline(const char *user); +void viagra_cmd_invite(const char *source, const char *chan, const char *nick); +void viagra_cmd_part(const char *nick, const char *chan, const char *buf); +void viagra_cmd_391(const char *source, const char *timestr); +void viagra_cmd_250(const char *buf); +void viagra_cmd_307(const char *buf); +void viagra_cmd_311(const char *buf); +void viagra_cmd_312(const char *buf); +void viagra_cmd_317(const char *buf); +void viagra_cmd_219(const char *source, const char *letter); +void viagra_cmd_401(const char *source, const char *who); +void viagra_cmd_318(const char *source, const char *who); +void viagra_cmd_242(const char *buf); +void viagra_cmd_243(const char *buf); +void viagra_cmd_211(const char *buf); +void viagra_cmd_global(const char *source, const char *buf); +void viagra_cmd_global_legacy(const char *source, const char *fmt); +void viagra_cmd_sqline(const char *mask, const char *reason); +void viagra_cmd_squit(const char *servname, const char *message); +void viagra_cmd_svso(const char *source, const char *nick, const char *flag); +void viagra_cmd_chg_nick(const char *oldnick, const char *newnick); +void viagra_cmd_svsnick(const char *source, const char *guest, time_t when); +void viagra_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); +void viagra_cmd_connect(int servernum); +void viagra_cmd_svshold(const char *nick); +void viagra_cmd_release_svshold(const char *nick); +void viagra_cmd_unsgline(const char *mask); +void viagra_cmd_unszline(const char *mask); +void viagra_cmd_szline(const char *mask, const char *reason, const char *whom); +void viagra_cmd_sgline(const char *mask, const char *reason); +void viagra_cmd_unban(const char *name, const char *nick); +void viagra_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); +void viagra_cmd_svid_umode(const char *nick, time_t ts); +void viagra_cmd_nc_change(User * u); +void viagra_cmd_svid_umode2(User * u, const char *ts); +void viagra_cmd_svid_umode3(User * u, const char *ts); +void viagra_cmd_eob(); +int viagra_flood_mode_check(const char *value); +void viagra_cmd_jupe(const char *jserver, const char *who, const char *reason); +int viagra_valid_nick(const char *nick); +void viagra_cmd_ctcp(const char *source, const char *dest, const char *buf); + +class ViagraIRCdProto : public IRCDProtoNew { + public: + void cmd_svsnoop(const char *, int); + void cmd_remove_akill(const char *, const char *); +} ircd_proto; diff --git a/src/protocol/plexus2.c b/src/protocol/plexus2.c deleted file mode 100644 index 596288916..000000000 --- a/src/protocol/plexus2.c +++ /dev/null @@ -1,1871 +0,0 @@ -/* PlexusIRCD IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "services.h" -#include "pseudo.h" -#include "plexus2.h" - -IRCDVar myIrcd[] = { - {"PleXusIRCd 2.0+", /* ircd name */ - "+oiSR", /* nickserv mode */ - "+oiSR", /* chanserv mode */ - "+oiSR", /* memoserv mode */ - "+oiSR", /* hostserv mode */ - "+oaiSR", /* operserv mode */ - "+oiSR", /* botserv mode */ - "+oiSR", /* helpserv mode */ - "+oiSR", /* Dev/Null mode */ - "+oiSR", /* Global mode */ - "+oiSR", /* nickserv alias mode */ - "+oiSR", /* chanserv alias mode */ - "+oiSR", /* memoserv alias mode */ - "+oiSR", /* hostserv alias mode */ - "+oaiSR", /* operserv alias mode */ - "+oiSR", /* botserv alias mode */ - "+oiSR", /* helpserv alias mode */ - "+oiSR", /* Dev/Null alias mode */ - "+oiSR", /* Global alias mode */ - "+iSR", /* Used by BotServ Bots */ - 3, /* Chan Max Symbols */ - "-acilmnpstMNORZ", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - NULL, /* Mode to set for chan admin */ - NULL, /* Mode to unset for chan admin */ - "+R", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-R", /* Mode on UnReg */ - "-R", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 1, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 0, /* Chan Reg */ - 0, /* Channel Mode */ - 0, /* vidents */ - 0, /* svshold */ - 1, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_p, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_h, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* +f Mode */ - 0, /* +L Mode */ - 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 */ - 1, /* +I support */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "h", /* vhost char */ - 0, /* ts6 */ - 0, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - 0, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - 0, /* BURST */ - CAPAB_TS5, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - CAPAB_QS, /* QS */ - CAPAB_UID, /* UID */ - CAPAB_KNOCK, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - - - -void -plexus_set_umode (User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog ("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) - { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) - { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'h': - update_host (user); - break; - case 'o': - if (add) - { - opcnt++; - - if (WallOper) - anope_cmd_global (s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news (user, NEWS_OPER); - - } - else - { - opcnt--; - } - break; - case 'R': - if (add && !nick_identified (user)) - { - common_svsmode (user, "-R", NULL); - user->mode &= ~UMODE_R; - } - break; - - } - } -} - -/* - * Local valid_op, and valid_halfop overrides. - * These are nessecary due to the way hybrid-based ircds handle halfops. - * hybrid-based ircds treat a -o as a -h as well. So if a user is set -o, - * the ircd will also set them -h if they have that mode. This breaks - * is_valid_op, as it always sends a -o. Breaking up the routines corrects this problem. - ThaPrince - */ - -int -plexus_check_valid_halfop (User * user, Channel * chan, int servermode) -{ - if (!chan || !chan->ci) - return 1; - - /* They will be kicked; no need to deop, no need to update our internal struct too */ - if (chan->ci->flags & CI_VERBOTEN) - return 0; - - if (servermode && !check_access (user, chan->ci, CA_AUTOHALFOP)) - { - notice_lang (s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ); - anope_cmd_mode (whosends (chan->ci), chan->name, "-h %s", user->nick); - return 0; - } - - if (check_access (user, chan->ci, CA_AUTODEOP)) - { - anope_cmd_mode (whosends (chan->ci), chan->name, "-h %s", user->nick); - return 0; - } - - return 1; -} - -int -plexus_check_valid_op (User * user, Channel * chan, int servermode) -{ - if (!chan || !chan->ci) - return 1; - - /* They will be kicked; no need to deop, no need to update our internal struct too */ - if (chan->ci->flags & CI_VERBOTEN) - return 0; - - if (servermode && !check_access (user, chan->ci, CA_AUTOOP)) - { - notice_lang (s_ChanServ, user, CHAN_IS_REGISTERED, s_ChanServ); - if (check_access (user, chan->ci, CA_AUTOHALFOP)) - { - anope_cmd_mode (whosends (chan->ci), chan->name, - "-o+h %s %s", user->nick, user->nick); - } - else - { - anope_cmd_mode (whosends (chan->ci), chan->name, "-o %s", - user->nick); - } - return 0; - } - - if (check_access (user, chan->ci, CA_AUTODEOP)) - { - anope_cmd_mode (whosends (chan->ci), chan->name, "-o %s", user->nick); - return 0; - } - - return 1; -} - -unsigned long umodes[128] = { - 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, 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, 0, /* ^ _ ` */ - UMODE_a, UMODE_b, 0, /* a b c */ - UMODE_d, 0, 0, /* d e f */ - 0, UMODE_h, UMODE_i, /* g h i */ - 0, 0, UMODE_l, /* j k l */ - UMODE_g, UMODE_n, UMODE_o, /* m n o */ - 0, 0, 0, /* p q r */ - 0, 0, UMODE_u, /* s t u */ - 0, UMODE_w, UMODE_x, /* v w x */ - 0, /* y */ - 0, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - - -char myCsmodes[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, - 'h', - 0, 0, 0, 0, - 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, /* O */ - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {0}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {CMODE_Z, 0, NULL, NULL}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {CMODE_a, 0, NULL, NULL}, - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {0}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'a', CMODE_a, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'Z', CMODE_Z, 0, NULL, NULL}, - {0} -}; - - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, plexus_check_valid_halfop}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, plexus_check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void -plexus_cmd_notice (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - if (NSDefFlags & NI_MSG) - { - plexus_cmd_privmsg2 (source, dest, buf); - } - else - { - send_cmd (source, "NOTICE %s :%s", dest, buf); - } -} - -void -plexus_cmd_notice2 (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "NOTICE %s :%s", dest, msg); -} - -void -plexus_cmd_privmsg (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source, "PRIVMSG %s :%s", dest, buf); -} - -void -plexus_cmd_privmsg2 (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "PRIVMSG %s :%s", dest, msg); -} - -void -plexus_cmd_serv_notice (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "NOTICE $$%s :%s", dest, msg); -} - -void -plexus_cmd_serv_privmsg (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "PRIVMSG $$%s :%s", dest, msg); -} - - -void -plexus_cmd_global (const char *source, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source ? source : ServerName, "OPERWALL :%s", buf); -} - -/* GLOBOPS - to handle old WALLOPS */ -void -plexus_cmd_global_legacy (const char *source, const char *fmt) -{ - send_cmd (source ? source : ServerName, "OPERWALL :%s", fmt); -} - -int -anope_event_sjoin (const char *source, int ac, const char **av) -{ - do_sjoin (source, ac, av); - return MOD_CONT; -} - -int -anope_event_nick (const char *source, int ac, const char **av) -{ - if (ac != 2) - { - User *user = do_nick (source, av[0], av[4], av[5], av[7], av[9], - strtoul (av[2], NULL, 10), - strtoul (av[8], NULL, 0), 0, av[6], NULL); - if (user) - anope_set_umode (user, 1, &av[3]); - } - else - { - do_nick (source, av[0], NULL, NULL, NULL, NULL, - strtoul (av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int -anope_event_topic (const char *source, int ac, const char **av) -{ - if (ac == 4) - { - do_topic (source, ac, av); - } - else - { - Channel *c = findchan (av[0]); - time_t topic_time = time (NULL); - - if (!c) - { - if (debug) - { - alog ("debug: TOPIC %s for nonexistent channel %s", - merge_args (ac - 1, av + 1), av[0]); - } - return MOD_CONT; - } - - if (check_topiclock (c, topic_time)) - return MOD_CONT; - - if (c->topic) - { - free (c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[1]) - c->topic = sstrdup (av[1]); - - strscpy (c->topic_setter, source, sizeof (c->topic_setter)); - c->topic_time = topic_time; - - record_topic (av[0]); - - if (ac > 1 && *av[1]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - - } - return MOD_CONT; -} - -int -anope_event_tburst (const char *source, int ac, const char **av) -{ - if (ac != 5) - return MOD_CONT; - - av[0] = av[1]; - av[1] = av[3]; - av[3] = av[4]; - do_topic (source, 4, av); - return MOD_CONT; -} - -int -anope_event_436 (const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll (av[0]); - return MOD_CONT; -} - - -void -moduleAddIRCDMsgs (void) -{ - Message *m; - - updateProtectDetails ("PROTECT", "PROTECTME", "protect", "deprotect", - "AUTOPROTECT", "+", "-"); - - m = createMessage ("401", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("402", anope_event_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", 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", 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); - 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 ("TOPIC", anope_event_topic); - addCoreMessage (IRCD, m); - m = createMessage ("TBURST", anope_event_tburst); - addCoreMessage (IRCD, m); - m = createMessage ("USER", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("WALLOPS", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("WHOIS", anope_event_whois); - addCoreMessage (IRCD, m); - m = createMessage ("SVSMODE", anope_event_mode); - addCoreMessage (IRCD, m); - m = createMessage ("SVSNICK", anope_event_null); - addCoreMessage (IRCD, m); - 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); - m = createMessage ("SETHOST", anope_event_sethost); - addCoreMessage (IRCD, m); -} - -void -plexus_cmd_sqline (const char *mask, const char *reason) -{ - send_cmd (s_OperServ, "RESV * %s :%s", mask, reason); -} - -void -plexus_cmd_unsgline (const char *mask) -{ - send_cmd (s_OperServ, "UNXLINE * %s", mask); -} - -void -plexus_cmd_unszline (const char *mask) -{ - /* Does not support */ -} - -void -plexus_cmd_szline (const char *mask, const char *reason, const char *whom) -{ - /* Does not support */ -} - -void -plexus_cmd_svsadmin (const char *server, int set) -{ -} - -void -plexus_cmd_sgline (const char *mask, const char *reason) -{ - send_cmd (s_OperServ, "XLINE * %s :%s", mask, reason); -} - -void PleXusIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(s_OperServ, "UNKLINE * %s %s", user, host); -} - -void -plexus_cmd_topic (const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd (whosets, "SVSTOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void -plexus_cmd_vhost_off (User * u) -{ - send_cmd (ServerName, "SVSMODE %s -h", u->nick); -} - -void -plexus_cmd_vhost_on (const char *nick, const char *vIdent, const char *vhost) -{ - User *u; - - if (!nick) - { - return; - } - - u = finduser (nick); - - if (u) - { - send_cmd (ServerName, "SVSHOST %s %s", nick, vhost); - u->mode |= UMODE_h; - } -} - -void -plexus_cmd_unsqline (const char *user) -{ - send_cmd (s_OperServ, "UNRESV * %s", user); -} - -void -plexus_cmd_join (const char *user, const char *channel, time_t chantime) -{ - send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel, - user); -} - -/* -oper: the nick of the oper performing the kline -target.server: the server(s) this kline is destined for -duration: the duration if a tkline, 0 if permanent. -user: the 'user' portion of the kline -host: the 'host' portion of the kline -reason: the reason for the kline. -*/ - -void -plexus_cmd_akill (const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd (s_OperServ, "KLINE * %ld %s %s :%s", - (long int) (expires - (long) time (NULL)), user, host, reason); -} - -void -plexus_cmd_svskill (const char *source, const char *user, const char *buf) -{ - if (!buf) - { - return; - } - - if (!source || !user) - { - return; - } - - send_cmd (source, "KILL %s :%s", user, buf); -} - -void -plexus_cmd_svsmode (User * u, int ac, const char **av) -{ - send_cmd (ServerName, "SVSMODE %s %s", u->nick, av[0]); - - if ((ac == 2) && isdigit (*av[1])) - send_cmd (ServerName, "SVSID %s %s", u->nick, av[1]); -} - -/* - * 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 -plexus_cmd_svinfo () -{ - send_cmd (NULL, "SVINFO 5 5 0 :%ld", (long int) time (NULL)); -} - -/* 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 -plexus_cmd_capab () -{ - send_cmd (NULL, - "CAPAB :QS EX CHW IE EOB KLN GLN HOPS HUB KNOCK TBURST PARA"); -} - -/* PASS */ -void -plexus_cmd_pass (const char *pass) -{ - send_cmd (NULL, "PASS %s :TS", pass); -} - -/* SERVER name hop descript */ -void -plexus_cmd_server (const char *servname, int hop, const char *descript) -{ - send_cmd (NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -void -plexus_cmd_connect (int servernum) -{ - me_server = new_server (NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) - plexus_cmd_pass (RemotePassword); - else if (servernum == 2) - plexus_cmd_pass (RemotePassword2); - else if (servernum == 3) - plexus_cmd_pass (RemotePassword3); - - plexus_cmd_capab (); - plexus_cmd_server (ServerName, 1, ServerDesc); - plexus_cmd_svinfo (); -} - -void -plexus_cmd_svsinfo () -{ - /* not used */ -} - - - -void -plexus_cmd_bot_nick (const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick (nick, NULL); - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s %s 0 :%s", nick, - (long int) time (NULL), modes, user, host, "*", ServerName, real); - plexus_cmd_sqline (nick, "Reserved for services"); - -} - -void -plexus_cmd_part (const char *nick, const char *chan, const char *buf) -{ - if (buf) - { - send_cmd (nick, "PART %s :%s", chan, buf); - } - else - { - send_cmd (nick, "PART %s", chan); - } -} - -int -anope_event_sethost (const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser (av[0]); - if (!u) - { - if (debug) - { - alog ("debug: SETHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -int -anope_event_ping (const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - plexus_cmd_pong (ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int -anope_event_away (const char *source, int ac, const char **av) -{ - if (!source) - { - return MOD_CONT; - } - m_away (source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int -anope_event_kill (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill (av[0], av[1]); - return MOD_CONT; -} - -int -anope_event_kick (const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick (source, ac, av); - return MOD_CONT; -} - -int -anope_event_eob (const char *source, int ac, const char **av) -{ - Server *s; - s = findserver (servlist, source); - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync (s, 1); - - return MOD_CONT; -} - -void -plexus_cmd_eob () -{ - send_cmd (ServerName, "EOB"); -} - - -int -anope_event_join (const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join (source, ac, av); - return MOD_CONT; -} - -int -anope_event_motd (const char *source, int ac, const char **av) -{ - if (!source) - { - return MOD_CONT; - } - - m_motd (source); - return MOD_CONT; -} - -int -anope_event_privmsg (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg (source, av[0], av[1]); - return MOD_CONT; -} - -int -anope_event_part (const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part (source, ac, av); - return MOD_CONT; -} - -int -anope_event_whois (const char *source, int ac, const char **av) -{ - if (source && ac >= 1) - { - m_whois (source, av[0]); - } - return MOD_CONT; -} - -/* EVENT: SERVER */ -int -anope_event_server (const char *source, int ac, const char **av) -{ - if (!stricmp (av[1], "1")) - { - uplink = sstrdup (av[0]); - } - do_server (source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - -int -anope_event_squit (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit (source, ac, av); - return MOD_CONT; -} - -int -anope_event_quit (const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit (source, ac, av); - return MOD_CONT; -} - -void -plexus_cmd_372 (const char *source, const char *msg) -{ - send_cmd (ServerName, "372 %s :- %s", source, msg); -} - -void -plexus_cmd_372_error (const char *source) -{ - send_cmd (ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void -plexus_cmd_375 (const char *source) -{ - send_cmd (ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void -plexus_cmd_376 (const char *source) -{ - send_cmd (ServerName, "376 %s :End of /MOTD command.", source); -} - -/* 391 */ -void -plexus_cmd_391 (const char *source, const char *timestr) -{ - if (!timestr) - { - return; - } - send_cmd (ServerName, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void -plexus_cmd_250 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "250 %s", buf); -} - -/* 307 */ -void -plexus_cmd_307 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "307 %s", buf); -} - -/* 311 */ -void -plexus_cmd_311 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "311 %s", buf); -} - -/* 312 */ -void -plexus_cmd_312 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "312 %s", buf); -} - -/* 317 */ -void -plexus_cmd_317 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "317 %s", buf); -} - -/* 219 */ -void -plexus_cmd_219 (const char *source, const char *letter) -{ - if (!source) - { - return; - } - - if (letter) - { - send_cmd (ServerName, "219 %s %c :End of /STATS report.", source, *letter); - } - else - { - send_cmd (ServerName, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void -plexus_cmd_401 (const char *source, const char *who) -{ - if (!source || !who) - { - return; - } - send_cmd (ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void -plexus_cmd_318 (const char *source, const char *who) -{ - if (!source || !who) - { - return; - } - - send_cmd (ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void -plexus_cmd_242 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "242 %s", buf); -} - -/* 243 */ -void -plexus_cmd_243 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "243 %s", buf); -} - -/* 211 */ -void -plexus_cmd_211 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "211 %s", buf); -} - -void -plexus_cmd_mode (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source, "MODE %s %s", dest, buf); -} - -void -plexus_cmd_nick (const char *nick, const char *name, const char *mode) -{ - EnforceQlinedNick (nick, NULL); - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s %s 0 :%s", nick, - (long int) time (NULL), mode, ServiceUser, ServiceHost, - "*", ServerName, (name)); - send_cmd (nick, "RESV * %s :%s", nick, "Reserved for services"); -} - -void -plexus_cmd_kick (const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) - { - send_cmd (source, "KICK %s %s :%s", chan, user, buf); - } - else - { - send_cmd (source, "KICK %s %s", chan, user); - } -} - -void -plexus_cmd_notice_ops (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "NOTICE @%s :%s", dest, buf); -} - -void -plexus_cmd_bot_chan_mode (const char *nick, const char *chan) -{ - anope_cmd_mode (nick, chan, "%s %s", ircd->botchanumode, nick); -} - -/* QUIT */ -void -plexus_cmd_quit (const char *source, const char *buf) -{ - if (buf) - { - send_cmd (source, "QUIT :%s", buf); - } - else - { - send_cmd (source, "QUIT"); - } -} - -/* PONG */ -void -plexus_cmd_pong (const char *servname, const char *who) -{ - send_cmd (servname, "PONG %s", who); -} - -/* INVITE */ -void -plexus_cmd_invite (const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) - { - return; - } - - send_cmd (source, "INVITE %s %s", nick, chan); -} - -/* SQUIT */ -void -plexus_cmd_squit (const char *servname, const char *message) -{ - if (!servname || !message) - { - return; - } - - send_cmd (ServerName, "SQUIT %s :%s", servname, message); -} - -int -anope_event_mode (const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') - { - do_cmode (source, ac, av); - } - else - { - Server *s; - s = findserver (servlist, source); - - if (s && *av[0]) - { - do_umode (av[0], ac, av); - } - else - { - do_umode (source, ac, av); - } - } - return MOD_CONT; -} - -void -plexus_cmd_351 (const char *source) -{ - send_cmd (ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* Event: PROTOCTL */ -int -anope_event_capab (const char *source, int ac, const char **av) -{ - int argvsize = 8; - int argc; - const char **argv; - char *str; - - if (ac < 1) - return MOD_CONT; - - /* We get the params as one arg, we should split it for capab_parse */ - argv = (const char **)scalloc(argvsize, sizeof(const char *)); - argc = 0; - while ((str = myStrGetToken(av[0], ' ', argc))) { - if (argc == argvsize) { - argvsize += 8; - argv = (const char **)srealloc(argv, argvsize * sizeof(const char *)); - } - argv[argc] = str; - argc++; - } - - capab_parse(argc, argv); - - /* Free our built ac/av */ - for (argvsize = 0; argvsize < argc; argvsize++) { - free((char *)argv[argvsize]); - } - free((char **)argv); - - return MOD_CONT; -} - -/* SVSHOLD - set */ -void -plexus_cmd_svshold (const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void -plexus_cmd_release_svshold (const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSNICK */ -void -plexus_cmd_svsnick (const char *nick, const char *newnick, time_t when) -{ - if (!nick || !newnick) - { - return; - } - send_cmd (ServerName, "SVSNICK %s %s", nick, newnick); -} - -void -plexus_cmd_guest_nick (const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s %s 0 :%s", nick, - (long int) time (NULL), modes, user, host, "*", ServerName, real); -} - -void -plexus_cmd_svso (const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void -plexus_cmd_unban (const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void -plexus_cmd_svsmode_chan (const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void -plexus_cmd_svid_umode (const char *nick, time_t ts) -{ - send_cmd (ServerName, "SVSID %s 1", nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void -plexus_cmd_nc_change (User * u) -{ - common_svsmode (u, "-R", "1"); -} - -/* SVSMODE +d */ -void -plexus_cmd_svid_umode2 (User * u, const char *ts) -{ - if (u->svid != u->timestamp) - { - common_svsmode (u, "+R", ts); - } - else - { - common_svsmode (u, "+R", NULL); - } -} - -void -plexus_cmd_svid_umode3 (User * u, const char *ts) -{ - /* not used */ -} - -/* NICK */ -void -plexus_cmd_chg_nick (const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) - { - return; - } - - send_cmd (oldnick, "NICK %s", newnick); -} - -/* - * 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 - */ -int -anope_event_svinfo (const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int -anope_event_pass (const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -void -plexus_cmd_svsjoin (const char *source, const char *nick, const char *chan, const char *param) -{ - /* Not Supported by this IRCD */ -} - -void -plexus_cmd_svspart (const char *source, const char *nick, const char *chan) -{ - /* Not Supported by this IRCD */ -} - -void -plexus_cmd_swhois (const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int -anope_event_notice (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -anope_event_admin (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -anope_event_invite (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -plexus_flood_mode_check (const char *value) -{ - return 0; -} - -int -anope_event_error (const char *source, int ac, const char **av) -{ - if (ac >= 1) - { - if (debug) - { - alog ("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void -plexus_cmd_jupe (const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf (rbuf, sizeof (rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - plexus_cmd_squit (jserver, rbuf); - plexus_cmd_server (jserver, 2, rbuf); - new_server (me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int -plexus_valid_nick (const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int -plexus_valid_chan (const char *chan) -{ - /* no hard coded invalid chan */ - return 1; -} - - -void -plexus_cmd_ctcp (const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) - { - return; - } - else - { - s = normalizeBuffer (buf); - } - - send_cmd (source, "NOTICE %s :\1%s \1", dest, s); - free (s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void -moduleAddAnopeCmds () -{ - pmodule_cmd_topic (plexus_cmd_topic); - pmodule_cmd_vhost_off (plexus_cmd_vhost_off); - pmodule_cmd_akill (plexus_cmd_akill); - pmodule_cmd_svskill (plexus_cmd_svskill); - pmodule_cmd_svsmode (plexus_cmd_svsmode); - pmodule_cmd_372 (plexus_cmd_372); - pmodule_cmd_372_error (plexus_cmd_372_error); - pmodule_cmd_375 (plexus_cmd_375); - pmodule_cmd_376 (plexus_cmd_376); - pmodule_cmd_nick (plexus_cmd_nick); - pmodule_cmd_guest_nick (plexus_cmd_guest_nick); - pmodule_cmd_mode (plexus_cmd_mode); - pmodule_cmd_bot_nick (plexus_cmd_bot_nick); - pmodule_cmd_kick (plexus_cmd_kick); - pmodule_cmd_notice_ops (plexus_cmd_notice_ops); - pmodule_cmd_notice (plexus_cmd_notice); - pmodule_cmd_notice2 (plexus_cmd_notice2); - pmodule_cmd_privmsg (plexus_cmd_privmsg); - pmodule_cmd_privmsg2 (plexus_cmd_privmsg2); - pmodule_cmd_serv_notice (plexus_cmd_serv_notice); - pmodule_cmd_serv_privmsg (plexus_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode (plexus_cmd_bot_chan_mode); - pmodule_cmd_351 (plexus_cmd_351); - pmodule_cmd_quit (plexus_cmd_quit); - pmodule_cmd_pong (plexus_cmd_pong); - pmodule_cmd_join (plexus_cmd_join); - pmodule_cmd_unsqline (plexus_cmd_unsqline); - pmodule_cmd_invite (plexus_cmd_invite); - pmodule_cmd_part (plexus_cmd_part); - pmodule_cmd_391 (plexus_cmd_391); - pmodule_cmd_250 (plexus_cmd_250); - pmodule_cmd_307 (plexus_cmd_307); - pmodule_cmd_311 (plexus_cmd_311); - pmodule_cmd_312 (plexus_cmd_312); - pmodule_cmd_317 (plexus_cmd_317); - pmodule_cmd_219 (plexus_cmd_219); - pmodule_cmd_401 (plexus_cmd_401); - pmodule_cmd_318 (plexus_cmd_318); - pmodule_cmd_242 (plexus_cmd_242); - pmodule_cmd_243 (plexus_cmd_243); - pmodule_cmd_211 (plexus_cmd_211); - pmodule_cmd_global (plexus_cmd_global); - pmodule_cmd_global_legacy (plexus_cmd_global_legacy); - pmodule_cmd_sqline (plexus_cmd_sqline); - pmodule_cmd_squit (plexus_cmd_squit); - pmodule_cmd_svso (plexus_cmd_svso); - pmodule_cmd_chg_nick (plexus_cmd_chg_nick); - pmodule_cmd_svsnick (plexus_cmd_svsnick); - pmodule_cmd_vhost_on (plexus_cmd_vhost_on); - pmodule_cmd_connect (plexus_cmd_connect); - pmodule_cmd_svshold (plexus_cmd_svshold); - pmodule_cmd_release_svshold (plexus_cmd_release_svshold); - pmodule_cmd_unsgline (plexus_cmd_unsgline); - pmodule_cmd_unszline (plexus_cmd_unszline); - pmodule_cmd_szline (plexus_cmd_szline); - pmodule_cmd_sgline (plexus_cmd_sgline); - pmodule_cmd_unban (plexus_cmd_unban); - pmodule_cmd_svsmode_chan (plexus_cmd_svsmode_chan); - pmodule_cmd_svid_umode (plexus_cmd_svid_umode); - pmodule_cmd_nc_change (plexus_cmd_nc_change); - pmodule_cmd_svid_umode2 (plexus_cmd_svid_umode2); - pmodule_cmd_svid_umode3 (plexus_cmd_svid_umode3); - pmodule_cmd_svsjoin (plexus_cmd_svsjoin); - pmodule_cmd_svspart (plexus_cmd_svspart); - pmodule_cmd_swhois (plexus_cmd_swhois); - pmodule_cmd_eob (plexus_cmd_eob); - pmodule_flood_mode_check (plexus_flood_mode_check); - pmodule_cmd_jupe (plexus_cmd_jupe); - pmodule_valid_nick (plexus_valid_nick); - pmodule_valid_chan (plexus_valid_chan); - pmodule_cmd_ctcp (plexus_cmd_ctcp); - pmodule_set_umode (plexus_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int -AnopeInit (int argc, char **argv) -{ - - moduleAddAuthor ("Anope"); - moduleAddVersion ("$Id$"); - moduleSetType (PROTOCOL); - - pmodule_ircd_version ("PleXusIRCd 2.0+"); - pmodule_ircd_cap (myIrcdcap); - pmodule_ircd_var (myIrcd); - pmodule_ircd_cbmodeinfos (myCbmodeinfos); - pmodule_ircd_cumodes (myCumodes); - pmodule_ircd_flood_mode_char_set (""); - pmodule_ircd_flood_mode_char_remove (""); - pmodule_ircd_cbmodes (myCbmodes); - pmodule_ircd_cmmodes (myCmmodes); - pmodule_ircd_csmodes (myCsmodes); - pmodule_ircd_useTSMode (0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode (UMODE_i); - pmodule_oper_umode (UMODE_o); - pmodule_invite_cmode (CMODE_i); - pmodule_secret_cmode (CMODE_s); - pmodule_private_cmode (CMODE_p); - pmodule_key_mode (CMODE_k); - pmodule_limit_mode (CMODE_l); - - moduleAddAnopeCmds (); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs (); - - return MOD_CONT; -} - -/* EOF */ diff --git a/src/protocol/plexus2.h b/src/protocol/plexus2.h deleted file mode 100644 index 867fca9a7..000000000 --- a/src/protocol/plexus2.h +++ /dev/null @@ -1,127 +0,0 @@ -/* PlexusIRCD IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_R 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_s 0x00000040 -#define UMODE_c 0x00000080 -#define UMODE_r 0x00000100 -#define UMODE_k 0x00000200 -#define UMODE_f 0x00000400 -#define UMODE_y 0x00000800 -#define UMODE_d 0x00001000 -#define UMODE_n 0x00002000 -#define UMODE_x 0x00004000 -#define UMODE_u 0x00008000 -#define UMODE_b 0x00010000 -#define UMODE_l 0x00020000 -#define UMODE_g 0x00040000 -#define UMODE_S 0x00080000 - - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_a 0x00000400 -#define CMODE_Z 0x00000800 -#define CMODE_M 0x00001000 -#define CMODE_c 0x00002000 -#define CMODE_O 0x00004000 -#define CMODE_R 0x00008000 -#define CMODE_N 0x00010000 - - -#define DEFAULT_MLOCK CMODE_n | CMODE_t - -void plexus_set_umode(User * user, int ac, const char **av); -void plexus_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void plexus_cmd_vhost_off(User * u); -void plexus_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void plexus_cmd_svskill(const char *source, const char *user, const char *buf); -void plexus_cmd_svsmode(User * u, int ac, const char **av); -void plexus_cmd_372(const char *source, const char *msg); -void plexus_cmd_372_error(const char *source); -void plexus_cmd_375(const char *source); -void plexus_cmd_376(const char *source); -void plexus_cmd_nick(const char *nick, const char *name, const char *modes); -void plexus_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void plexus_cmd_mode(const char *source, const char *dest, const char *buf); -void plexus_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void plexus_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void plexus_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void plexus_cmd_notice(const char *source, const char *dest, const char *buf); -void plexus_cmd_notice2(const char *source, const char *dest, const char *msg); -void plexus_cmd_privmsg(const char *source, const char *dest, const char *buf); -void plexus_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void plexus_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void plexus_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void plexus_cmd_bot_chan_mode(const char *nick, const char *chan); -void plexus_cmd_351(const char *source); -void plexus_cmd_quit(const char *source, const char *buf); -void plexus_cmd_pong(const char *servname, const char *who); -void plexus_cmd_join(const char *user, const char *channel, time_t chantime); -void plexus_cmd_unsqline(const char *user); -void plexus_cmd_invite(const char *source, const char *chan, const char *nick); -void plexus_cmd_part(const char *nick, const char *chan, const char *buf); -void plexus_cmd_391(const char *source, const char *timestr); -void plexus_cmd_250(const char *buf); -void plexus_cmd_307(const char *buf); -void plexus_cmd_311(const char *buf); -void plexus_cmd_312(const char *buf); -void plexus_cmd_317(const char *buf); -void plexus_cmd_219(const char *source, const char *letter); -void plexus_cmd_401(const char *source, const char *who); -void plexus_cmd_318(const char *source, const char *who); -void plexus_cmd_242(const char *buf); -void plexus_cmd_243(const char *buf); -void plexus_cmd_211(const char *buf); -void plexus_cmd_global(const char *source, const char *buf); -void plexus_cmd_global_legacy(const char *source, const char *fmt); -void plexus_cmd_sqline(const char *mask, const char *reason); -void plexus_cmd_squit(const char *servname, const char *message); -void plexus_cmd_svso(const char *source, const char *nick, const char *flag); -void plexus_cmd_chg_nick(const char *oldnick, const char *newnick); -void plexus_cmd_svsnick(const char *source, const char *guest, time_t when); -void plexus_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void plexus_cmd_connect(int servernum); -void plexus_cmd_svshold(const char *nick); -void plexus_cmd_release_svshold(const char *nick); -void plexus_cmd_unsgline(const char *mask); -void plexus_cmd_unszline(const char *mask); -void plexus_cmd_szline(const char *mask, const char *reason, const char *whom); -void plexus_cmd_sgline(const char *mask, const char *reason); -void plexus_cmd_unban(const char *name, const char *nick); -void plexus_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void plexus_cmd_svid_umode(const char *nick, time_t ts); -void plexus_cmd_nc_change(User * u); -void plexus_cmd_svid_umode2(User * u, const char *ts); -void plexus_cmd_svid_umode3(User * u, const char *ts); -void plexus_cmd_eob(); -int plexus_flood_mode_check(const char *value); -void plexus_cmd_jupe(const char *jserver, const char *who, const char *reason); -int plexus_valid_nick(const char *nick); -void plexus_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class PleXusIRCdProto : public IRCDProtoNew { - public: - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/plexus3.c b/src/protocol/plexus3.c deleted file mode 100644 index a376e11c7..000000000 --- a/src/protocol/plexus3.c +++ /dev/null @@ -1,1853 +0,0 @@ -/* PlexusIRCD IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - */ - -#include "services.h" -#include "pseudo.h" -#include "plexus3.h" - -IRCDVar myIrcd[] = { - {"hybrid-7.2.1+plexus-3.0.0+",/* ircd name */ - "+i", /* nickserv mode */ - "+i", /* chanserv mode */ - "+i", /* memoserv mode */ - "+i", /* hostserv mode */ - "+oai", /* operserv mode */ - "+i", /* botserv mode */ - "+i", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+i", /* Global mode */ - "+i", /* nickserv alias mode */ - "+i", /* chanserv alias mode */ - "+i", /* memoserv alias mode */ - "+i", /* hostserv alias mode */ - "+oai", /* operserv alias mode */ - "+i", /* botserv alias mode */ - "+i", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+i", /* Global alias mode */ - "+i", /* Used by BotServ Bots */ - 5, /* Chan Max Symbols */ - "-cilmnpstBMNORS", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 1, /* Has Owner */ - "+q", /* Mode to set for an owner */ - "-q", /* Mode to unset for an owner */ - "+a", /* Mode to set for chan admin */ - "-a", /* Mode to unset for chan admin */ - "+rd", /* Mode On Reg */ - "N", /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "+d", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - UMODE_N, /* Protected Umode */ - 0, /* Has Admin */ - 1, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 1, /* Has Protect */ - 0, /* Reverse */ - 0, /* Chan Reg */ - 0, /* Channel Mode */ - 0, /* vidents */ - 1, /* svshold */ - 1, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_p, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* +f Mode */ - 0, /* +L Mode */ - 1, /* 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 */ - 1, /* +I support */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 0, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - 0, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - 0, /* BURST */ - CAPAB_TS5, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - CAPAB_QS, /* QS */ - CAPAB_UID, /* UID */ - CAPAB_KNOCK, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - - - -void -plexus_set_umode (User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog ("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) - { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) - { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) - { - alog ("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul (*av, NULL, 0); - break; - case 'x': - update_host (user); - break; - case 'o': - if (add) - { - opcnt++; - - if (WallOper) - anope_cmd_global (s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news (user, NEWS_OPER); - - } - else - { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified (user)) - { - common_svsmode (user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - } - } -} - -unsigned long umodes[128] = { - 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, UMODE_N, 0, /* 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, 0, /* ^ _ ` */ - UMODE_a, 0, 0, /* a b c */ - 0, 0, 0, /* d e f */ - 0, 0, UMODE_i, /* g h i */ - 0, 0, 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, UMODE_w, UMODE_x, /* v w x */ - 0, /* y */ - 0, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - - -char myCsmodes[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, - 'h', /* (37) % Channel halfops */ - 'a', - 0, 0, 0, 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'q', 0 -}; - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {CMODE_B, CBM_NO_USER_MLOCK, NULL, NULL}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, /* O */ - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {0}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'B', CMODE_B, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {CUS_OWNER, 0, check_valid_op}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void -plexus_cmd_notice (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - if (NSDefFlags & NI_MSG) - { - plexus_cmd_privmsg2 (source, dest, buf); - } - else - { - send_cmd (source, "NOTICE %s :%s", dest, buf); - } -} - -void -plexus_cmd_notice2 (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "NOTICE %s :%s", dest, msg); -} - -void -plexus_cmd_privmsg (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source, "PRIVMSG %s :%s", dest, buf); -} - -void -plexus_cmd_privmsg2 (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "PRIVMSG %s :%s", dest, msg); -} - -void -plexus_cmd_serv_notice (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "NOTICE $$%s :%s", dest, msg); -} - -void -plexus_cmd_serv_privmsg (const char *source, const char *dest, const char *msg) -{ - send_cmd (source, "PRIVMSG $$%s :%s", dest, msg); -} - - -void -plexus_cmd_global (const char *source, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source ? source : ServerName, "OPERWALL :%s", buf); -} - -/* GLOBOPS - to handle old WALLOPS */ -void -plexus_cmd_global_legacy (const char *source, const char *fmt) -{ - send_cmd (source ? source : ServerName, "OPERWALL :%s", fmt); -} - -int -anope_event_sjoin (const char *source, int ac, const char **av) -{ - do_sjoin (source, ac, av); - return MOD_CONT; -} - -int -anope_event_nick (const char *source, int ac, const char **av) -{ - if (ac != 2) - { - User *user = do_nick (source, av[0], av[4], av[8], av[6], av[9], - strtoul (av[2], NULL, 10), - strtoul (av[7], NULL, 0), 0, av[5], NULL); - if (user) - anope_set_umode (user, 1, &av[3]); - } - else - { - do_nick (source, av[0], NULL, NULL, NULL, NULL, - strtoul (av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int -anope_event_topic (const char *source, int ac, const char **av) -{ - if (ac == 4) - { - do_topic (source, ac, av); - } - else - { - Channel *c = findchan (av[0]); - time_t topic_time = time (NULL); - - if (!c) - { - if (debug) - { - alog ("debug: TOPIC %s for nonexistent channel %s", - merge_args (ac - 1, av + 1), av[0]); - } - return MOD_CONT; - } - - if (check_topiclock (c, topic_time)) - return MOD_CONT; - - if (c->topic) - { - free (c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[1]) - c->topic = sstrdup (av[1]); - - strscpy (c->topic_setter, source, sizeof (c->topic_setter)); - c->topic_time = topic_time; - - record_topic (av[0]); - - if (ac > 1 && *av[1]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - - } - return MOD_CONT; -} - -int -anope_event_tburst (const char *source, int ac, const char **av) -{ - if (ac != 5) - return MOD_CONT; - - av[0] = av[1]; - av[1] = av[3]; - av[3] = av[4]; - do_topic (source, 4, av); - return MOD_CONT; -} - -/* - * ENCAP handler - * av[0] = servermask (not used) - * av[1] = command - * av[2] and beyond are dynamic. - */ -int -anope_event_encap (const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (!stricmp (av[1], "CHGHOST")) - { - User *u; - - if (ac != 4) - return MOD_CONT; - - u = finduser (av[2]); - if (!u) - { - if (debug) - { - alog ("debug: CHGHOST for nonexistent user %s", av[2]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[3]); - return MOD_CONT; - } - return MOD_CONT; -} - -int -anope_event_436 (const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll (av[0]); - return MOD_CONT; -} - - -void -moduleAddIRCDMsgs (void) -{ - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); - - m = createMessage ("401", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("402", anope_event_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", 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", 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); - 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 ("TOPIC", anope_event_topic); - addCoreMessage (IRCD, m); - m = createMessage ("TBURST", anope_event_tburst); - addCoreMessage (IRCD, m); - m = createMessage ("USER", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("WALLOPS", anope_event_null); - addCoreMessage (IRCD, m); - m = createMessage ("WHOIS", anope_event_whois); - addCoreMessage (IRCD, m); - 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); - m = createMessage ("ENCAP", anope_event_encap); - addCoreMessage (IRCD, m); - m = createMessage ("SVSMODE", anope_event_mode); - addCoreMessage (IRCD, m); -} - -void -plexus_cmd_sqline (const char *mask, const char *reason) -{ - send_cmd (s_OperServ, "RESV * %s :%s", mask, reason); -} - -void -plexus_cmd_unsgline (const char *mask) -{ - send_cmd (s_OperServ, "UNXLINE * %s", mask); -} - -void -plexus_cmd_unszline (const char *mask) -{ - /* Does not support */ -} - -void -plexus_cmd_szline (const char *mask, const char *reason, const char *whom) -{ - /* Does not support */ -} - -void PleXusIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(ServerName, "ENCAP %s SVSNOOP %s", server, set ? "+" : "-"); -} - -void -plexus_cmd_svsadmin (const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void -plexus_cmd_sgline (const char *mask, const char *reason) -{ - send_cmd (s_OperServ, "XLINE * %s 0 :%s", mask, reason); -} - -void PleXusIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(s_OperServ, "UNKLINE * %s %s", user, host); -} - -void -plexus_cmd_topic (const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd (whosets, "ENCAP * TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void -plexus_cmd_vhost_off (User * u) -{ - common_svsmode (u, "-x", NULL); -} - -void -plexus_cmd_vhost_on (const char *nick, const char *vIdent, const char *vhost) -{ - User *u; - - if (!nick) - { - return; - } - - u = finduser (nick); - - if (u) - { - send_cmd (ServerName, "ENCAP * CHGHOST %s %s", u->nick, vhost); - common_svsmode (u, "+x", NULL); - u->mode |= UMODE_x; - } -} - -void -plexus_cmd_unsqline (const char *user) -{ - send_cmd (s_OperServ, "UNRESV * %s", user); -} - -void -plexus_cmd_join (const char *user, const char *channel, time_t chantime) -{ - send_cmd (ServerName, "SJOIN %ld %s + :%s", (long int) chantime, channel, - user); -} - -/* -oper: the nick of the oper performing the kline -target.server: the server(s) this kline is destined for -duration: the duration if a tkline, 0 if permanent. -user: the 'user' portion of the kline -host: the 'host' portion of the kline -reason: the reason for the kline. -*/ - -void -plexus_cmd_akill (const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd (s_OperServ, "KLINE * %ld %s %s :%s", - (long int) (expires - (long) time (NULL)), user, host, reason); -} - -void -plexus_cmd_svskill (const char *source, const char *user, const char *buf) -{ - if (!buf) - { - return; - } - - if (!source || !user) - { - return; - } - - send_cmd (source, "KILL %s :%s", user, buf); -} - -void -plexus_cmd_svsmode (User * u, int ac, const char **av) -{ - send_cmd (ServerName, "ENCAP * SVSMODE %s %ld %s%s%s", u->nick, - (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), - (ac == 2 ? av[1] : "")); -} - -/* - * 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 -plexus_cmd_svinfo () -{ - send_cmd (NULL, "SVINFO 5 5 0 :%ld", (long int) time (NULL)); -} - -/* 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 - supports encapsulization of protocol messages - SVS - supports services protocol extensions -*/ -void -plexus_cmd_capab () -{ - send_cmd (NULL, - "CAPAB :QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS"); -} - -/* PASS */ -void -plexus_cmd_pass (const char *pass) -{ - send_cmd (NULL, "PASS %s :TS", pass); -} - -/* SERVER name hop descript */ -void -plexus_cmd_server (const char *servname, int hop, const char *descript) -{ - send_cmd (NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -void -plexus_cmd_connect (int servernum) -{ - me_server = new_server (NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) - plexus_cmd_pass (RemotePassword); - else if (servernum == 2) - plexus_cmd_pass (RemotePassword2); - else if (servernum == 3) - plexus_cmd_pass (RemotePassword3); - - plexus_cmd_capab (); - plexus_cmd_server (ServerName, 1, ServerDesc); - plexus_cmd_svinfo (); -} - -void -plexus_cmd_svsinfo () -{ - /* not used */ -} - - - -void -plexus_cmd_bot_nick (const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick (nick, NULL); - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, - (long int) time (NULL), modes, user, host, ServerName, host, - real); - plexus_cmd_sqline (nick, "Reserved for services"); - -} - -void -plexus_cmd_part (const char *nick, const char *chan, const char *buf) -{ - if (buf) - { - send_cmd (nick, "PART %s :%s", chan, buf); - } - else - { - send_cmd (nick, "PART %s", chan); - } -} - -int -anope_event_ping (const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - plexus_cmd_pong (ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int -anope_event_away (const char *source, int ac, const char **av) -{ - if (!source) - { - return MOD_CONT; - } - m_away (source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int -anope_event_kill (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill (av[0], av[1]); - return MOD_CONT; -} - -int -anope_event_kick (const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick (source, ac, av); - return MOD_CONT; -} - -int -anope_event_eob (const char *source, int ac, const char **av) -{ - Server *s; - s = findserver (servlist, source); - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync (s, 1); - - return MOD_CONT; -} - -void -plexus_cmd_eob () -{ - send_cmd (ServerName, "EOB"); -} - - -int -anope_event_join (const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join (source, ac, av); - return MOD_CONT; -} - -int -anope_event_motd (const char *source, int ac, const char **av) -{ - if (!source) - { - return MOD_CONT; - } - - m_motd (source); - return MOD_CONT; -} - -int -anope_event_privmsg (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg (source, av[0], av[1]); - return MOD_CONT; -} - -int -anope_event_part (const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part (source, ac, av); - return MOD_CONT; -} - -int -anope_event_whois (const char *source, int ac, const char **av) -{ - if (source && ac >= 1) - { - m_whois (source, av[0]); - } - return MOD_CONT; -} - -/* EVENT: SERVER */ -int -anope_event_server (const char *source, int ac, const char **av) -{ - if (!stricmp (av[1], "1")) - { - uplink = sstrdup (av[0]); - } - do_server (source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - -int -anope_event_squit (const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit (source, ac, av); - return MOD_CONT; -} - -int -anope_event_quit (const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit (source, ac, av); - return MOD_CONT; -} - -void -plexus_cmd_372 (const char *source, const char *msg) -{ - send_cmd (ServerName, "372 %s :- %s", source, msg); -} - -void -plexus_cmd_372_error (const char *source) -{ - send_cmd (ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void -plexus_cmd_375 (const char *source) -{ - send_cmd (ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void -plexus_cmd_376 (const char *source) -{ - send_cmd (ServerName, "376 %s :End of /MOTD command.", source); -} - -/* 391 */ -void -plexus_cmd_391 (const char *source, const char *timestr) -{ - if (!timestr) - { - return; - } - send_cmd (ServerName, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void -plexus_cmd_250 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "250 %s", buf); -} - -/* 307 */ -void -plexus_cmd_307 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "307 %s", buf); -} - -/* 311 */ -void -plexus_cmd_311 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "311 %s", buf); -} - -/* 312 */ -void -plexus_cmd_312 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "312 %s", buf); -} - -/* 317 */ -void -plexus_cmd_317 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "317 %s", buf); -} - -/* 219 */ -void -plexus_cmd_219 (const char *source, const char *letter) -{ - if (!source) - { - return; - } - - if (letter) - { - send_cmd (ServerName, "219 %s %c :End of /STATS report.", source, - *letter); - } - else - { - send_cmd (ServerName, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void -plexus_cmd_401 (const char *source, const char *who) -{ - if (!source || !who) - { - return; - } - send_cmd (ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void -plexus_cmd_318 (const char *source, const char *who) -{ - if (!source || !who) - { - return; - } - - send_cmd (ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void -plexus_cmd_242 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "242 %s", buf); -} - -/* 243 */ -void -plexus_cmd_243 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "243 %s", buf); -} - -/* 211 */ -void -plexus_cmd_211 (const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "211 %s", buf); -} - -void -plexus_cmd_mode (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (source, "MODE %s %s", dest, buf); -} - -void -plexus_cmd_nick (const char *nick, const char *name, const char *mode) -{ - EnforceQlinedNick (nick, NULL); - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, - (long int) time (NULL), mode, ServiceUser, ServiceHost, - ServerName, ServiceHost, (name)); - send_cmd (nick, "RESV * %s :%s", nick, "Reserved for services"); -} - -void -plexus_cmd_kick (const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) - { - send_cmd (source, "KICK %s %s :%s", chan, user, buf); - } - else - { - send_cmd (source, "KICK %s %s", chan, user); - } -} - -void -plexus_cmd_notice_ops (const char *source, const char *dest, const char *buf) -{ - if (!buf) - { - return; - } - - send_cmd (ServerName, "NOTICE @%s :%s", dest, buf); -} - -void -plexus_cmd_bot_chan_mode (const char *nick, const char *chan) -{ - anope_cmd_mode (nick, chan, "%s %s %s", myIrcd->botchanumode, nick, nick); -} - -/* QUIT */ -void -plexus_cmd_quit (const char *source, const char *buf) -{ - if (buf) - { - send_cmd (source, "QUIT :%s", buf); - } - else - { - send_cmd (source, "QUIT"); - } -} - -/* PONG */ -void -plexus_cmd_pong (const char *servname, const char *who) -{ - send_cmd (servname, "PONG %s", who); -} - -/* INVITE */ -void -plexus_cmd_invite (const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) - { - return; - } - - send_cmd (source, "INVITE %s %s", nick, chan); -} - -/* SQUIT */ -void -plexus_cmd_squit (const char *servname, const char *message) -{ - if (!servname || !message) - { - return; - } - - send_cmd (ServerName, "SQUIT %s :%s", servname, message); -} - -int -anope_event_mode (const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') - { - do_cmode (source, ac, av); - } - else - { - Server *s; - s = findserver (servlist, source); - - if (s && *av[0]) - { - do_umode (av[0], ac, av); - } - else - { - do_umode (source, ac, av); - } - } - return MOD_CONT; -} - -void -plexus_cmd_351 (const char *source) -{ - send_cmd (ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* Event: PROTOCTL */ -int -anope_event_capab (const char *source, int ac, const char **av) -{ - int argvsize = 8; - int argc; - const char **argv; - char *str; - - if (ac < 1) - return MOD_CONT; - - /* We get the params as one arg, we should split it for capab_parse */ - argv = (const char **)scalloc (argvsize, sizeof (const char *)); - argc = 0; - while ((str = myStrGetToken (av[0], ' ', argc))) - { - if (argc == argvsize) - { - argvsize += 8; - argv = (const char **)srealloc (argv, argvsize * sizeof (const char *)); - } - argv[argc] = str; - argc++; - } - - capab_parse (argc, argv); - - /* Free our built ac/av */ - for (argvsize = 0; argvsize < argc; argvsize++) - { - free ((char *)argv[argvsize]); - } - free ((char **)argv); - - return MOD_CONT; -} - -/* SVSHOLD - set */ -void -plexus_cmd_svshold (const char *nick) -{ - send_cmd (s_OperServ, "ENCAP * RESV %d %s 0 :%s", NSReleaseTimeout, nick, - "This nick is being held for a registered user. " - "For help with regaining nicknames please see /nickserv help release"); -} - -/* SVSHOLD - release */ -void -plexus_cmd_release_svshold (const char *nick) -{ - send_cmd (s_OperServ, "UNRESV * %s", nick); -} - -/* SVSNICK */ -void -plexus_cmd_svsnick (const char *nick, const char *newnick, time_t when) -{ - User *u; - - if (!nick || !newnick) - return; - - if( (u = finduser (nick))) { - send_cmd (ServerName, "ENCAP * SVSNICK %s %ld %s %ld", - u->nick, (long int) u->timestamp, newnick, (long int) when); - } -} - -void -plexus_cmd_guest_nick (const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd (ServerName, "NICK %s 1 %ld %s %s %s %s 0 %s :%s", nick, - (long int) time (NULL), modes, user, host, ServerName, host, - real); -} - -void -plexus_cmd_svso (const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void -plexus_cmd_unban (const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void -plexus_cmd_svsmode_chan (const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void -plexus_cmd_svid_umode (const char *nick, time_t ts) -{ - send_cmd (ServerName, "ENCAP * SVSMODE %s %lu +d 1", nick, - (unsigned long int) ts); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void -plexus_cmd_nc_change (User * u) -{ - common_svsmode (u, "+d", "1"); -} - -/* SVSMODE +d */ -void -plexus_cmd_svid_umode2 (User * u, const char *ts) -{ - /* not used */ -} - -void -plexus_cmd_svid_umode3 (User * u, const char *ts) -{ - char modes[512]; - - strlcpy(modes, "+r", sizeof(modes)); - - if(ircd->rootmodeonid && is_services_root(u)) { - strlcat(modes, ircd->rootmodeonid, sizeof(modes)); - } else if(ircd->adminmodeonid && is_services_admin(u)) { - strlcat(modes, ircd->adminmodeonid, sizeof(modes)); - } else if(ircd->opermodeonid && is_services_oper(u)) { - strlcat(modes, ircd->opermodeonid, sizeof(modes)); - } - if (u->svid != u->timestamp) { - strlcat(modes, "d", sizeof(modes)); - common_svsmode (u, modes, ts); - } else { - common_svsmode (u, modes, NULL); - } -} - -/* NICK */ -void -plexus_cmd_chg_nick (const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) - { - return; - } - - send_cmd (oldnick, "NICK %s", newnick); -} - -/* - * 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 - */ -int -anope_event_svinfo (const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int -anope_event_pass (const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -void -plexus_cmd_svsjoin (const char *source, const char *nick, const char *chan, const char *param) -{ - send_cmd(ServerName, "ENCAP * SVSJOIN %s %s", nick, chan); -} - -void -plexus_cmd_svspart (const char *source, const char *nick, const char *chan) -{ - send_cmd(ServerName, "ENCAP * SVSPART %s %s", nick, chan); -} - -void -plexus_cmd_swhois (const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int -anope_event_notice (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -anope_event_admin (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -anope_event_invite (const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int -plexus_flood_mode_check (const char *value) -{ - return 0; -} - -int -anope_event_error (const char *source, int ac, const char **av) -{ - if (ac >= 1) - { - if (debug) - { - alog ("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void -plexus_cmd_jupe (const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf (rbuf, sizeof (rbuf), "(H) Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - plexus_cmd_squit (jserver, rbuf); - plexus_cmd_server (jserver, 2, rbuf); - new_server (me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int -plexus_valid_nick (const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int -plexus_valid_chan (const char *chan) -{ - /* no hard coded invalid chan */ - return 1; -} - - -void -plexus_cmd_ctcp (const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) - { - return; - } - else - { - s = normalizeBuffer (buf); - } - - send_cmd (source, "NOTICE %s :\1%s \1", dest, s); - free (s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void -moduleAddAnopeCmds () -{ - pmodule_cmd_topic (plexus_cmd_topic); - pmodule_cmd_vhost_off (plexus_cmd_vhost_off); - pmodule_cmd_akill (plexus_cmd_akill); - pmodule_cmd_svskill (plexus_cmd_svskill); - pmodule_cmd_svsmode (plexus_cmd_svsmode); - pmodule_cmd_372 (plexus_cmd_372); - pmodule_cmd_372_error (plexus_cmd_372_error); - pmodule_cmd_375 (plexus_cmd_375); - pmodule_cmd_376 (plexus_cmd_376); - pmodule_cmd_nick (plexus_cmd_nick); - pmodule_cmd_guest_nick (plexus_cmd_guest_nick); - pmodule_cmd_mode (plexus_cmd_mode); - pmodule_cmd_bot_nick (plexus_cmd_bot_nick); - pmodule_cmd_kick (plexus_cmd_kick); - pmodule_cmd_notice_ops (plexus_cmd_notice_ops); - pmodule_cmd_notice (plexus_cmd_notice); - pmodule_cmd_notice2 (plexus_cmd_notice2); - pmodule_cmd_privmsg (plexus_cmd_privmsg); - pmodule_cmd_privmsg2 (plexus_cmd_privmsg2); - pmodule_cmd_serv_notice (plexus_cmd_serv_notice); - pmodule_cmd_serv_privmsg (plexus_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode (plexus_cmd_bot_chan_mode); - pmodule_cmd_351 (plexus_cmd_351); - pmodule_cmd_quit (plexus_cmd_quit); - pmodule_cmd_pong (plexus_cmd_pong); - pmodule_cmd_join (plexus_cmd_join); - pmodule_cmd_unsqline (plexus_cmd_unsqline); - pmodule_cmd_invite (plexus_cmd_invite); - pmodule_cmd_part (plexus_cmd_part); - pmodule_cmd_391 (plexus_cmd_391); - pmodule_cmd_250 (plexus_cmd_250); - pmodule_cmd_307 (plexus_cmd_307); - pmodule_cmd_311 (plexus_cmd_311); - pmodule_cmd_312 (plexus_cmd_312); - pmodule_cmd_317 (plexus_cmd_317); - pmodule_cmd_219 (plexus_cmd_219); - pmodule_cmd_401 (plexus_cmd_401); - pmodule_cmd_318 (plexus_cmd_318); - pmodule_cmd_242 (plexus_cmd_242); - pmodule_cmd_243 (plexus_cmd_243); - pmodule_cmd_211 (plexus_cmd_211); - pmodule_cmd_global (plexus_cmd_global); - pmodule_cmd_global_legacy (plexus_cmd_global_legacy); - pmodule_cmd_sqline (plexus_cmd_sqline); - pmodule_cmd_squit (plexus_cmd_squit); - pmodule_cmd_svso (plexus_cmd_svso); - pmodule_cmd_chg_nick (plexus_cmd_chg_nick); - pmodule_cmd_svsnick (plexus_cmd_svsnick); - pmodule_cmd_vhost_on (plexus_cmd_vhost_on); - pmodule_cmd_connect (plexus_cmd_connect); - pmodule_cmd_svshold (plexus_cmd_svshold); - pmodule_cmd_release_svshold (plexus_cmd_release_svshold); - pmodule_cmd_unsgline (plexus_cmd_unsgline); - pmodule_cmd_unszline (plexus_cmd_unszline); - pmodule_cmd_szline (plexus_cmd_szline); - pmodule_cmd_sgline (plexus_cmd_sgline); - pmodule_cmd_unban (plexus_cmd_unban); - pmodule_cmd_svsmode_chan (plexus_cmd_svsmode_chan); - pmodule_cmd_svid_umode (plexus_cmd_svid_umode); - pmodule_cmd_nc_change (plexus_cmd_nc_change); - pmodule_cmd_svid_umode2 (plexus_cmd_svid_umode2); - pmodule_cmd_svid_umode3 (plexus_cmd_svid_umode3); - pmodule_cmd_svsjoin (plexus_cmd_svsjoin); - pmodule_cmd_svspart (plexus_cmd_svspart); - pmodule_cmd_swhois (plexus_cmd_swhois); - pmodule_cmd_eob (plexus_cmd_eob); - pmodule_flood_mode_check (plexus_flood_mode_check); - pmodule_cmd_jupe (plexus_cmd_jupe); - pmodule_valid_nick (plexus_valid_nick); - pmodule_valid_chan (plexus_valid_chan); - pmodule_cmd_ctcp (plexus_cmd_ctcp); - pmodule_set_umode (plexus_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int -AnopeInit (int argc, char **argv) -{ - - moduleAddAuthor ("Anope"); - moduleAddVersion ("$Id: plexus.c 995 2006-03-01 20:19:11Z rob $"); - moduleSetType (PROTOCOL); - - pmodule_ircd_version ("hybrid-7.2.1+plexus-3.0.0+"); - pmodule_ircd_cap (myIrcdcap); - pmodule_ircd_var (myIrcd); - pmodule_ircd_cbmodeinfos (myCbmodeinfos); - pmodule_ircd_cumodes (myCumodes); - pmodule_ircd_flood_mode_char_set (""); - pmodule_ircd_flood_mode_char_remove (""); - pmodule_ircd_cbmodes (myCbmodes); - pmodule_ircd_cmmodes (myCmmodes); - pmodule_ircd_csmodes (myCsmodes); - pmodule_ircd_useTSMode (0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode (UMODE_i); - pmodule_oper_umode (UMODE_o); - pmodule_invite_cmode (CMODE_i); - pmodule_secret_cmode (CMODE_s); - pmodule_private_cmode (CMODE_p); - pmodule_key_mode (CMODE_k); - pmodule_limit_mode (CMODE_l); - - moduleAddAnopeCmds (); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs (); - - return MOD_CONT; -} - -/* EOF */ diff --git a/src/protocol/plexus3.h b/src/protocol/plexus3.h deleted file mode 100644 index 9c8cba453..000000000 --- a/src/protocol/plexus3.h +++ /dev/null @@ -1,115 +0,0 @@ -/* PlexusIRCD IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_i 0x00000001 -#define UMODE_o 0x00000002 -#define UMODE_w 0x00000004 -#define UMODE_a 0x00000008 -#define UMODE_x 0x00000010 -#define UMODE_S 0x00000020 -#define UMODE_r 0x00000040 -#define UMODE_R 0x00000080 -#define UMODE_N 0x00000100 - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_M 0x00001000 -#define CMODE_c 0x00002000 -#define CMODE_O 0x00004000 -#define CMODE_R 0x00008000 -#define CMODE_N 0x00010000 -#define CMODE_B 0x00020000 -#define CMODE_S 0x00040000 - -#define DEFAULT_MLOCK CMODE_n | CMODE_t - -void plexus_set_umode(User * user, int ac, const char **av); -void plexus_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void plexus_cmd_vhost_off(User * u); -void plexus_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void plexus_cmd_svskill(const char *source, const char *user, const char *buf); -void plexus_cmd_svsmode(User * u, int ac, const char **av); -void plexus_cmd_372(const char *source, const char *msg); -void plexus_cmd_372_error(const char *source); -void plexus_cmd_375(const char *source); -void plexus_cmd_376(const char *source); -void plexus_cmd_nick(const char *nick, const char *name, const char *modes); -void plexus_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void plexus_cmd_mode(const char *source, const char *dest, const char *buf); -void plexus_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void plexus_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void plexus_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void plexus_cmd_notice(const char *source, const char *dest, const char *buf); -void plexus_cmd_notice2(const char *source, const char *dest, const char *msg); -void plexus_cmd_privmsg(const char *source, const char *dest, const char *buf); -void plexus_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void plexus_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void plexus_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void plexus_cmd_bot_chan_mode(const char *nick, const char *chan); -void plexus_cmd_351(const char *source); -void plexus_cmd_quit(const char *source, const char *buf); -void plexus_cmd_pong(const char *servname, const char *who); -void plexus_cmd_join(const char *user, const char *channel, time_t chantime); -void plexus_cmd_unsqline(const char *user); -void plexus_cmd_invite(const char *source, const char *chan, const char *nick); -void plexus_cmd_part(const char *nick, const char *chan, const char *buf); -void plexus_cmd_391(const char *source, const char *timestr); -void plexus_cmd_250(const char *buf); -void plexus_cmd_307(const char *buf); -void plexus_cmd_311(const char *buf); -void plexus_cmd_312(const char *buf); -void plexus_cmd_317(const char *buf); -void plexus_cmd_219(const char *source, const char *letter); -void plexus_cmd_401(const char *source, const char *who); -void plexus_cmd_318(const char *source, const char *who); -void plexus_cmd_242(const char *buf); -void plexus_cmd_243(const char *buf); -void plexus_cmd_211(const char *buf); -void plexus_cmd_global(const char *source, const char *buf); -void plexus_cmd_global_legacy(const char *source, const char *fmt); -void plexus_cmd_sqline(const char *mask, const char *reason); -void plexus_cmd_squit(const char *servname, const char *message); -void plexus_cmd_svso(const char *source, const char *nick, const char *flag); -void plexus_cmd_chg_nick(const char *oldnick, const char *newnick); -void plexus_cmd_svsnick(const char *source, const char *guest, time_t when); -void plexus_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void plexus_cmd_connect(int servernum); -void plexus_cmd_svshold(const char *nick); -void plexus_cmd_release_svshold(const char *nick); -void plexus_cmd_unsgline(const char *mask); -void plexus_cmd_unszline(const char *mask); -void plexus_cmd_szline(const char *mask, const char *reason, const char *whom); -void plexus_cmd_sgline(const char *mask, const char *reason); -void plexus_cmd_unban(const char *name, const char *nick); -void plexus_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void plexus_cmd_svid_umode(const char *nick, time_t ts); -void plexus_cmd_nc_change(User * u); -void plexus_cmd_svid_umode2(User * u, const char *ts); -void plexus_cmd_svid_umode3(User * u, const char *ts); -void plexus_cmd_eob(); -int plexus_flood_mode_check(const char *value); -void plexus_cmd_jupe(const char *jserver, const char *who, const char *reason); -int plexus_valid_nick(const char *nick); -void plexus_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class PleXusIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/ptlink.c b/src/protocol/ptlink.c deleted file mode 100644 index 78c200c2d..000000000 --- a/src/protocol/ptlink.c +++ /dev/null @@ -1,1799 +0,0 @@ -/* PTLink IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "ptlink.h" - -IRCDVar myIrcd[] = { - {"PTlink 6.15.*+", /* ircd name */ - "+o", /* nickserv mode */ - "+o", /* chanserv mode */ - "+o", /* memoserv mode */ - "+o", /* hostserv mode */ - "+io", /* operserv mode */ - "+o", /* botserv mode */ - "+h", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+io", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+io", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+h", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+", /* Used by BotServ Bots */ - 2, /* Chan Max Symbols */ - "-inpsmtCRKOASdcqBNl", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - "+a", /* Mode to set for chan admin */ - "-a", /* Mode to unset for chan admin */ - "+r", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r", /* Mode on UnReg */ - NULL, /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 0, /* Supports Halfop +h */ - 4, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 1, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 1, /* vidents */ - 0, /* svshold */ - 0, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_K, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_VH, /* Vhost Mode */ - 1, /* +f */ - 0, /* +L */ - CMODE_f, - 0, - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - NULL, /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - 0, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - CAPAB_PT4, /* PT4 */ - CAPAB_SCS, /* SCS */ - CAPAB_QS, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - - -unsigned long umodes[128] = { - 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 myCsmodes[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, - - 'v', 0, 0, 'a', 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[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}, - {CMODE_A, 0, NULL, NULL}, /* A */ - {CMODE_B, 0, NULL, NULL}, /* B */ - {CMODE_C, 0, NULL, NULL}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {0}, /* L */ - {0}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, 0, NULL, NULL}, /* O */ - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {CMODE_d, 0, NULL, NULL}, - {0}, /* e */ - {CMODE_f, 0, set_flood, cs_set_flood}, - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {CMODE_q, 0, NULL, NULL}, - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'d', CMODE_d, 0, NULL, NULL}, - {'f', CMODE_f, 0, get_flood, cs_get_flood}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'q', CMODE_q, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'A', CMODE_A, 0, NULL, NULL}, - {'B', CMODE_B, 0, NULL, NULL}, - {'C', CMODE_C, 0, NULL, NULL}, - {'K', CMODE_K, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void ptlink_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(s_ChanServ, chan, "%s %s %s", ircd->botchanumode, nick, - 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(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -/* - * Note: This function has no validation whatsoever. Also, as of PTlink6.15.1 - * when you /deoper you get to keep your vindent, but you lose your vhost. In - * 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(const char *source, int ac, const char **av) -{ - User *u; - const char *newhost = NULL, *newuser = NULL; - int tofree = 0; - - if (ac != 1) - return MOD_CONT; - u = finduser(source); - - if (!u) { - if (debug) { - alog("debug: NEWMASK for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - if ((u->mode & (UMODE_NM | UMODE_VH)) == (UMODE_NM | UMODE_VH)) { - /* This NEWMASK should be discarded because it's sent due to a +r by - * someone with a ptlink-masked host. PTlink has our correct host, so - * we can just ignore this :) Or we'll get ptlink's old host which is - * not what we want. -GD - */ - u->mode &= ~UMODE_NM; - if (debug) - alog("debug: Ignoring NEWMASK because it's send because of SVSMODE +r"); - return MOD_CONT; - } - - newuser = myStrGetOnlyToken(av[0], '@', 0); - if (newuser) { - newhost = myStrGetTokenRemainder(av[0], '@', 1); - tofree = 1; - u->SetIdent(newuser); - free((char *)newuser); - } else { - newhost = av[0]; - } - - if (newhost && *newhost == '@') - newhost++; - - u->mode |= UMODE_VH; - - if (newhost) - u->SetDisplayedHost(newhost); - - if (tofree) - free((char *)newhost); - - return MOD_CONT; -} - -/* - NICK %s %d %lu %s %s %s %s %s :%s - parv[0] = nickname - parv[1] = hopcount - parv[2] = nick TS (nick introduction time) - parv[3] = umodes - parv[4] = username - parv[5] = hostname - parv[6] = spoofed hostname - parv[7] = server - parv[8] = 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) -*/ -/* - NICK xpto 2 561264 +rw irc num.myisp.pt mask.myisp.pt uc.ptlink.net :Just me - 0 1 2 3 4 5 6 7 8 - -*/ -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[7], av[8], - strtoul(av[2], NULL, 10), 0, 0, av[6], NULL); - if (user) - anope_set_umode(user, 1, &av[3]); - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - 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(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[3], NULL); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -void moduleAddIRCDMsgs(void) -{ - Message *m; - - updateProtectDetails("PROTECT", "PROTECTME", "protect", "deprotect", - "AUTOPROTECT", "+a", "-a"); - - m = createMessage("401", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("402", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("436", anope_event_436); - addCoreMessage(IRCD, m); - m = createMessage("461", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("AWAY", anope_event_away); - 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", 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); - 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("TOPIC", anope_event_topic); - addCoreMessage(IRCD, m); - m = createMessage("USER", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("WALLOPS", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("WHOIS", anope_event_whois); - addCoreMessage(IRCD, m); - m = createMessage("AKILL", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("GLOBOPS", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("GNOTICE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("GOPER", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("RAKILL", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SILENCE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SVSKILL", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SVSMODE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SVSNICK", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SVSNOOP", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("SQLINE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("UNSQLINE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("NEWMASK", anope_event_newmask); - addCoreMessage(IRCD, m); - m = createMessage("CAPAB", anope_event_capab); - addCoreMessage(IRCD, m); - 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); - m = createMessage("ERROR", anope_event_error); - addCoreMessage(IRCD, m); - m = createMessage("NJOIN", anope_event_sjoin); - addCoreMessage(IRCD, m); - m = createMessage("NNICK", anope_event_nick); - addCoreMessage(IRCD, m); - m = createMessage("ZLINE", anope_event_null); - addCoreMessage(IRCD, m); - m = createMessage("UNZLINE", anope_event_null); - addCoreMessage(IRCD, m); -} - -int anope_event_svsinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -/* - :%s SQLINE %s :%s - parv[0] = sender - parv[1] = sqlined nick/mask - parv[2] = reason -*/ -void ptlink_cmd_sqline(const char *mask, const char *reason) -{ - send_cmd(ServerName, "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 PTlinkProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSADMIN %s :%s", server, set ? "noopers" : "rehash"); -} - -void ptlink_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.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 PTlinkProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "UNGLINE %s@%s", user, host); -} - - -void anope_part(char *nick, char *chan) -{ - send_cmd(nick, "PART %s", chan); -} -void anope_topic(char *whosets, char *chan, char *whosetit, char *topic, - time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -/* - :%s UNSQLINE %s - parv[0] = sender - parv[1] = sqlined nick/mask -*/ -void ptlink_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -void ptlink_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(ServerName, "SJOIN %ld %s + :%s", (long int) chantime, - channel, user); -} - -/* - :%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 ptlink_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(ServerName, "GLINE %s@%s %i %s :%s", user, host, 86400 * 2, - who, reason); -} - - -void ptlink_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - 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 ptlink_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], - (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); - - /* If we set +r on someone +NRah (1 or more of those modes), PTlink will - * send us a NEWMASK with their ptlink-masked-host. If we want HostServ - * to work for them, we will need to send our NEWMASK after we receive - * theirs. Thus we make a hack and store in moduleData that we need to - * look out for that. - */ - if ((strchr(av[0], 'r') - && ((u->mode & UMODE_N) || (u->mode & UMODE_R) - || (u->mode & UMODE_a) || (u->mode & UMODE_h)))) - u->mode |= UMODE_NM; -} - -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void ptlink_cmd_squit(const char *servname, const char *message) -{ - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* PONG */ -void ptlink_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* - SVINFO %d %d - parv[0] = server name - parv[1] = current supported protocol version - parv[2] = minimum supported protocol version - - See the ptlink.h for information on PTLINK_TS_CURRENT, and - PTLINK_TS_MIN -*/ -void ptlink_cmd_svinfo() -{ -#if defined(PTLINK_TS_CURRENT) && defined(PTLINK_TS_MIN) - send_cmd(NULL, "SVINFO %d %d %lu", PTLINK_TS_CURRENT, PTLINK_TS_MIN, - (unsigned long int) time(NULL)); -#else - /* hardwired if the defs some how go missing */ - send_cmd(NULL, "SVINFO 6 3 %lu", (unsigned long int) time(NULL)); -#endif -} - -/* - SVSINFO %lu %d - parv[0] = sender (server name) - parv[1] = local services data TS - parv[1] = max global users -*/ -void ptlink_cmd_svsinfo() -{ - send_cmd(NULL, "SVSINFO %lu %d", (unsigned long int) time(NULL), - maxusercnt); -} - -/* - 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 ptlink_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -/* - CAPAB :%s - parv[1] = capability list -*/ -void ptlink_cmd_capab() -{ - send_cmd(NULL, "CAPAB :QS PTS4"); -} - - -void ptlink_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d Anope.Services%s :%s", servname, hop, - version_number_dotted, descript); -} -void ptlink_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) - ptlink_cmd_pass(RemotePassword); - else if (servernum == 2) - ptlink_cmd_pass(RemotePassword2); - else if (servernum == 3) - ptlink_cmd_pass(RemotePassword3); - - ptlink_cmd_capab(); - ptlink_cmd_server(ServerName, 1, ServerDesc); - ptlink_cmd_svinfo(); - ptlink_cmd_svsinfo(); -} - - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - 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(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, 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(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -void ptlink_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void ptlink_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - ptlink_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void ptlink_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void ptlink_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void ptlink_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void ptlink_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void ptlink_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -/* GLOBOPS */ -void ptlink_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* 391 */ -void ptlink_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void ptlink_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void ptlink_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void ptlink_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void ptlink_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void ptlink_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void ptlink_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void ptlink_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void ptlink_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void ptlink_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void ptlink_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void ptlink_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void ptlink_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - 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 ptlink_cmd_nick(const char *nick, const char *name, const char *mode) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, - (unsigned long int) time(NULL), mode, ServiceUser, - ServiceHost, ServiceHost, ServerName, name); - ptlink_cmd_sqline(nick, "Reserved for services"); -} - -void ptlink_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -/* QUIT */ -void ptlink_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -void ptlink_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -/* - :%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 ptlink_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (long int) time(NULL), topic); -} - -void ptlink_cmd_vhost_off(User * u) -{ - /* does not support vhosting */ -} - -void ptlink_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - User *u; - - if (vIdent) { - send_cmd(s_HostServ, "NEWMASK %s@%s %s", vIdent, vhost, nick); - } else { - send_cmd(s_HostServ, "NEWMASK %s %s", vhost, nick); - } - - if ((u = finduser(nick))) - u->mode |= UMODE_VH; -} - -/* INVITE */ -void ptlink_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -void ptlink_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void ptlink_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void ptlink_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void ptlink_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - - -void ptlink_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - if (is_services_admin(user)) { - common_svsmode(user, "+a", NULL); - user->mode |= UMODE_a; - } - - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - } - } -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - ptlink_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -void ptlink_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, - (unsigned long int) time(NULL), modes, user, host, host, - ServerName, real); - ptlink_cmd_sqline(nick, "Reserved for services"); - -} - -void ptlink_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); - - -} - -/* SVSHOLD - set */ -void ptlink_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void ptlink_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* -:%s UNZLINE %s - parv[0] = sender - parv[1] = zlined host -*/ -void ptlink_cmd_unszline(const char *mask) -{ - send_cmd(s_OperServ, "UNZLINE %s", mask); -} - -/* -:%s ZLINE %s :%s - parv[0] = sender - parv[1] = zlined host - parv[2] = time - parv[3] = reason -*/ -void ptlink_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(s_OperServ, "ZLINE %s %ld :%s", mask, - (long int) time(NULL) + 86400 * 2, reason); -} - -/* -:%s UNSXLINE %s - parv[0] = sender - parv[1] = info ban mask -*/ -void ptlink_cmd_unsgline(const char *mask) -{ - send_cmd(ServerName, "UNSXLINE :%s", mask); -} - - -/* - * sxline - add info ban line - * - * parv[0] = sender prefix - * parv[1] = mask length - * parv[2] = real name banned mask:reason - */ -void ptlink_cmd_sgline(const char *mask, const char *reason) -{ - send_cmd(ServerName, "SXLINE %d :%s:%s", (int) strlen(mask), mask, - reason); -} - -/* 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 ptlink_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -void ptlink_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %lu %s %s %s %s %s :%s", nick, - (unsigned long int) time(NULL), modes, user, host, host, - ServerName, real); -} - - -void ptlink_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void ptlink_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -void ptlink_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void ptlink_cmd_svid_umode(const char *nick, time_t ts) -{ - /* Not Supported by this ircd */ -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void ptlink_cmd_nc_change(User * u) -{ - /* Not Supported by this ircd */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void ptlink_cmd_svid_umode2(User * u, const char *ts) -{ - common_svsmode(u, "+r", NULL); -} - -void ptlink_cmd_svid_umode3(User * u, const char *ts) -{ - /* Bahamuts have this extra one, since they can check on even nick changes */ -} - -/* NICK */ -/* - :%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 ptlink_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s %ld", newnick, (long int) time(NULL)); -} - -/* - :%s SVSJOIN %s :%s - parv[0] = sender (services client) - parv[1] = target client nick - parv[2] = channels list - :OperServ SVSJOIN Trystan #Admin -*/ -void ptlink_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - 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 ptlink_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "SVSPART %s :%s", nick, chan); -} - -void ptlink_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_invite(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int ptlink_flood_mode_check(const 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 ptlink_cmd_eob() -{ - /* not supported */ -} - -void ptlink_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - ptlink_cmd_squit(jserver, rbuf); - ptlink_cmd_server(jserver, 1, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void ptlink_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int ptlink_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int ptlink_valid_chan(const char *cahn) -{ - /* no hard coded invalid chan */ - return 1; -} - - -void ptlink_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(ptlink_cmd_topic); - pmodule_cmd_vhost_off(ptlink_cmd_vhost_off); - pmodule_cmd_akill(ptlink_cmd_akill); - pmodule_cmd_svskill(ptlink_cmd_svskill); - pmodule_cmd_svsmode(ptlink_cmd_svsmode); - pmodule_cmd_372(ptlink_cmd_372); - pmodule_cmd_372_error(ptlink_cmd_372_error); - pmodule_cmd_375(ptlink_cmd_375); - pmodule_cmd_376(ptlink_cmd_376); - pmodule_cmd_nick(ptlink_cmd_nick); - pmodule_cmd_guest_nick(ptlink_cmd_guest_nick); - pmodule_cmd_mode(ptlink_cmd_mode); - pmodule_cmd_bot_nick(ptlink_cmd_bot_nick); - pmodule_cmd_kick(ptlink_cmd_kick); - pmodule_cmd_notice_ops(ptlink_cmd_notice_ops); - pmodule_cmd_notice(ptlink_cmd_notice); - pmodule_cmd_notice2(ptlink_cmd_notice2); - pmodule_cmd_privmsg(ptlink_cmd_privmsg); - pmodule_cmd_privmsg2(ptlink_cmd_privmsg2); - pmodule_cmd_serv_notice(ptlink_cmd_serv_notice); - pmodule_cmd_serv_privmsg(ptlink_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(ptlink_cmd_bot_chan_mode); - pmodule_cmd_351(ptlink_cmd_351); - pmodule_cmd_quit(ptlink_cmd_quit); - pmodule_cmd_pong(ptlink_cmd_pong); - pmodule_cmd_join(ptlink_cmd_join); - pmodule_cmd_unsqline(ptlink_cmd_unsqline); - pmodule_cmd_invite(ptlink_cmd_invite); - pmodule_cmd_part(ptlink_cmd_part); - pmodule_cmd_391(ptlink_cmd_391); - pmodule_cmd_250(ptlink_cmd_250); - pmodule_cmd_307(ptlink_cmd_307); - pmodule_cmd_311(ptlink_cmd_311); - pmodule_cmd_312(ptlink_cmd_312); - pmodule_cmd_317(ptlink_cmd_317); - pmodule_cmd_219(ptlink_cmd_219); - pmodule_cmd_401(ptlink_cmd_401); - pmodule_cmd_318(ptlink_cmd_318); - pmodule_cmd_242(ptlink_cmd_242); - pmodule_cmd_243(ptlink_cmd_243); - pmodule_cmd_211(ptlink_cmd_211); - pmodule_cmd_global(ptlink_cmd_global); - pmodule_cmd_global_legacy(ptlink_cmd_global_legacy); - pmodule_cmd_sqline(ptlink_cmd_sqline); - pmodule_cmd_squit(ptlink_cmd_squit); - pmodule_cmd_svso(ptlink_cmd_svso); - pmodule_cmd_chg_nick(ptlink_cmd_chg_nick); - pmodule_cmd_svsnick(ptlink_cmd_svsnick); - pmodule_cmd_vhost_on(ptlink_cmd_vhost_on); - pmodule_cmd_connect(ptlink_cmd_connect); - pmodule_cmd_svshold(ptlink_cmd_svshold); - pmodule_cmd_release_svshold(ptlink_cmd_release_svshold); - pmodule_cmd_unsgline(ptlink_cmd_unsgline); - pmodule_cmd_unszline(ptlink_cmd_unszline); - pmodule_cmd_szline(ptlink_cmd_szline); - pmodule_cmd_sgline(ptlink_cmd_sgline); - pmodule_cmd_unban(ptlink_cmd_unban); - pmodule_cmd_svsmode_chan(ptlink_cmd_svsmode_chan); - pmodule_cmd_svid_umode(ptlink_cmd_svid_umode); - pmodule_cmd_nc_change(ptlink_cmd_nc_change); - pmodule_cmd_svid_umode2(ptlink_cmd_svid_umode2); - pmodule_cmd_svid_umode3(ptlink_cmd_svid_umode3); - pmodule_cmd_svsjoin(ptlink_cmd_svsjoin); - pmodule_cmd_svspart(ptlink_cmd_svspart); - pmodule_cmd_swhois(ptlink_cmd_swhois); - pmodule_cmd_eob(ptlink_cmd_eob); - pmodule_flood_mode_check(ptlink_flood_mode_check); - pmodule_cmd_jupe(ptlink_cmd_jupe); - pmodule_valid_nick(ptlink_valid_nick); - pmodule_valid_chan(ptlink_valid_chan); - pmodule_cmd_ctcp(ptlink_cmd_ctcp); - pmodule_set_umode(ptlink_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(PROTOCOL); - - - pmodule_ircd_version("PTlink 6.15.*+"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set("+f"); - pmodule_ircd_flood_mode_char_remove("-f"); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} - -/* EOF */ diff --git a/src/protocol/ptlink.h b/src/protocol/ptlink.h deleted file mode 100644 index 65b3aeb4c..000000000 --- a/src/protocol/ptlink.h +++ /dev/null @@ -1,154 +0,0 @@ -/* PTLink IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_B 0x00000080 -#define UMODE_H 0x00000100 -#define UMODE_N 0x00000200 -#define UMODE_O 0x00000400 -#define UMODE_p 0x00000800 -#define UMODE_R 0x00001000 -#define UMODE_s 0x00002000 -#define UMODE_S 0x00004000 -#define UMODE_T 0x00008000 -#define UMODE_v 0x00001000 -#define UMODE_y 0x00002000 -#define UMODE_z 0x00004000 - -#define UMODE_VH 0x00008000 /* Fake umode used for internal vhost things */ -#define UMODE_NM 0x00010000 /* Fake umode used for internal NEWMASK things */ -/* Let's hope for a better vhost-system with PTlink7 ;) */ - - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_A 0x00000400 -#define CMODE_B 0x00000800 -#define CMODE_c 0x00001000 -#define CMODE_d 0x00002000 -#define CMODE_f 0x00004000 -#define CMODE_K 0x00008000 -#define CMODE_O 0x00010000 -#define CMODE_q 0x00020000 -#define CMODE_S 0x00040000 -#define CMODE_N 0x00080000 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ -#define CMODE_C 0x00100000 - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -/* - The following variables are set to define the TS protocol version - that we support. - - PTLink 6.14 to 6.17 TS CURRENT is 6 and MIN is 3 - PTlink 6.18 TS CURRENT is 9 and MIN is 3 - PTLink 6.19 TS CURRENT is 10 and MIN is 9 - - If you are running 6.18 or 6.19 do not touch these values as they will - allow you to connect - - If you are running an older version of PTLink, first think about updating - your ircd, or changing the TS_CURRENT to 6 to allow services to connect -*/ - -#define PTLINK_TS_CURRENT 9 -#define PTLINK_TS_MIN 3 - -void ptlink_set_umode(User * user, int ac, const char **av); -void ptlink_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void ptlink_cmd_vhost_off(User * u); -void ptlink_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void ptlink_cmd_svskill(const char *source, const char *user, const char *buf); -void ptlink_cmd_svsmode(User * u, int ac, const char **av); -void ptlink_cmd_372(const char *source, const char *msg); -void ptlink_cmd_372_error(const char *source); -void ptlink_cmd_375(const char *source); -void ptlink_cmd_376(const char *source); -void ptlink_cmd_nick(const char *nick, const char *name, const char *modes); -void ptlink_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ptlink_cmd_mode(const char *source, const char *dest, const char *buf); -void ptlink_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ptlink_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void ptlink_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void ptlink_cmd_notice(const char *source, const char *dest, const char *buf); -void ptlink_cmd_notice2(const char *source, const char *dest, const char *msg); -void ptlink_cmd_privmsg(const char *source, const char *dest, const char *buf); -void ptlink_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void ptlink_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void ptlink_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void ptlink_cmd_bot_chan_mode(const char *nick, const char *chan); -void ptlink_cmd_351(const char *source); -void ptlink_cmd_quit(const char *source, const char *buf); -void ptlink_cmd_pong(const char *servname, const char *who); -void ptlink_cmd_join(const char *user, const char *channel, time_t chantime); -void ptlink_cmd_unsqline(const char *user); -void ptlink_cmd_invite(const char *source, const char *chan, const char *nick); -void ptlink_cmd_part(const char *nick, const char *chan, const char *buf); -void ptlink_cmd_391(const char *source, const char *timestr); -void ptlink_cmd_250(const char *buf); -void ptlink_cmd_307(const char *buf); -void ptlink_cmd_311(const char *buf); -void ptlink_cmd_312(const char *buf); -void ptlink_cmd_317(const char *buf); -void ptlink_cmd_219(const char *source, const char *letter); -void ptlink_cmd_401(const char *source, const char *who); -void ptlink_cmd_318(const char *source, const char *who); -void ptlink_cmd_242(const char *buf); -void ptlink_cmd_243(const char *buf); -void ptlink_cmd_211(const char *buf); -void ptlink_cmd_global(const char *source, const char *buf); -void ptlink_cmd_global_legacy(const char *source, const char *fmt); -void ptlink_cmd_sqline(const char *mask, const char *reason); -void ptlink_cmd_squit(const char *servname, const char *message); -void ptlink_cmd_svso(const char *source, const char *nick, const char *flag); -void ptlink_cmd_chg_nick(const char *oldnick, const char *newnick); -void ptlink_cmd_svsnick(const char *source, const char *guest, time_t when); -void ptlink_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void ptlink_cmd_connect(int servernum); -void ptlink_cmd_svshold(const char *nick); -void ptlink_cmd_release_svshold(const char *nick); -void ptlink_cmd_unsgline(const char *mask); -void ptlink_cmd_unszline(const char *mask); -void ptlink_cmd_szline(const char *mask, const char *reason, const char *whom); -void ptlink_cmd_sgline(const char *mask, const char *reason); -void ptlink_cmd_unban(const char *name, const char *nick); -void ptlink_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void ptlink_cmd_svid_umode(const char *nick, time_t ts); -void ptlink_cmd_nc_change(User * u); -void ptlink_cmd_svid_umode2(User * u, const char *ts); -void ptlink_cmd_svid_umode3(User * u, const char *ts); -void ptlink_cmd_eob(); -int ptlink_flood_mode_check(const char *value); -void ptlink_cmd_jupe(const char *jserver, const char *who, const char *reason); -int ptlink_valid_nick(const char *nick); -void ptlink_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class PTlinkProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/rageircd.c b/src/protocol/rageircd.c deleted file mode 100644 index cb5ef0af4..000000000 --- a/src/protocol/rageircd.c +++ /dev/null @@ -1,1678 +0,0 @@ -/* Rage IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "rageircd.h" - -IRCDVar myIrcd[] = { - {"RageIRCd 2.0.*", /* ircd name */ - "+d", /* nickserv mode */ - "+d", /* chanserv mode */ - "+d", /* memoserv mode */ - "+d", /* hostserv mode */ - "+di", /* operserv mode */ - "+d", /* botserv mode */ - "+dh", /* helpserv mode */ - "+di", /* Dev/Null mode */ - "+di", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+io", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+o", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+", /* Used by BotServ Bots */ - 3, /* Chan Max Symbols */ - "-ilmnpRstcOACNM", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-rd", /* Mode on UnReg */ - "-r+d", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topic Backward */ - 0, /* Protected Umode */ - 1, /* Has Admin */ - 1, /* Chan SQlines */ - 1, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 0, /* vidents */ - 1, /* svshold */ - 1, /* time stamp on mode */ - 1, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_p, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, - 0, - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - CAPAB_TSMODE, /* TSMODE */ - CAPAB_UNCONNECT, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - CAPAB_BURST, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - CAPAB_DKEY, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - CAPAB_UID, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - CAPAB_SN2, /* SN2 */ - CAPAB_TOKEN, /* TOKEN */ - CAPAB_VHOST, /* VHOST */ - CAPAB_SSJ3, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - - -unsigned long umodes[128] = { - 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, 0, /* M N O */ - 0, 0, UMODE_R, /* 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, 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 */ - 0, 0, UMODE_r, /* p q r */ - 0, 0, 0, /* s t u */ - 0, UMODE_w, 0, /* v w x */ - 0, /* y */ - 0, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - -char myCsmodes[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, - 'h', /* (37) % Channel halfops */ - 0, 0, 0, 0, - 'a', /* * Channel Admins */ - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[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}, - {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* B */ - {CMODE_C, 0, NULL, NULL}, - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'A', CMODE_A, 0, NULL, NULL}, - {'C', CMODE_C, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void rageircd_cmd_bot_unban(ChannelInfo * ci, const char *nick) -{ - send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick); -} - -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), - strtoul(av[8], NULL, 0), "*", NULL); - if (user) - anope_set_umode(user, 1, &av[3]); - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -int anope_event_vhost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: VHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -/* -** SNICK -** source = NULL -** parv[0] = nickname Trystan -** parv[1] = timestamp 1090113640 -** parv[2] = hops 1 -** parv[3] = username Trystan -** parv[4] = host c-24-2-101-227.client.comcast.net -** parv[5] = IP 402810339 -** parv[6] = vhost mynet-27CCA80D.client.comcast.net -** parv[7] = server rage2.nomadirc.net -** parv[8] = servicestamp 0 -** parv[9] = modes +ix -** parv[10] = info Dreams are answers to questions not yet asked -*/ - -int anope_event_snick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - user = do_nick(source, av[0], av[3], av[4], av[7], av[10], - strtoul(av[1], NULL, 10), strtoul(av[8], NULL, 0), - strtoul(av[5], NULL, 0), av[6], NULL); - if (user) { - anope_set_umode(user, 1, &av[9]); - } - } - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("ADMIN","ADMINME","admin","deadmin","AUTOADMIN","+a","-a"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); - m = createMessage("482", anope_event_482); addCoreMessage(IRCD,m); - m = createMessage("461", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", anope_event_null); 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", 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); - 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_globops); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_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); - m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); - m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); - m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); - m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); - m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SNICK", anope_event_snick); addCoreMessage(IRCD,m); - 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(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - - -int anope_event_burst(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver(servlist, source); - if (ac > 1) { - /* for future use - start burst */ -} else { - - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); -} - -return MOD_CONT; -} - -void rageircd_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -void rageircd_cmd_unsgline(const char *mask) -{ - send_cmd(NULL, "UNSGLINE 0 :%s", mask); -} - -void rageircd_cmd_unszline(const char *mask) -{ - send_cmd(NULL, "UNSZLINE 0 %s", mask); -} - -void rageircd_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "SZLINE %s :%s", mask, reason); -} - -void RageIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void rageircd_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void rageircd_cmd_sgline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); - -} - -void RageIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - - -/* PART */ -void rageircd_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -void rageircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void rageircd_cmd_vhost_off(User * u) -{ - send_cmd(s_HostServ, "SVSMODE %s -x", u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); -} - -void rageircd_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(ServerName, "VHOST %s %s", nick, vhost); -} - -void rageircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - send_cmd(s_HostServ, "SVSMODE %s +x", nick); - rageircd_cmd_chghost(nick, vhost); -} - -void rageircd_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -void rageircd_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); -} - -void rageircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, - (long int) time(NULL), reason); -} - -void rageircd_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - send_cmd(source, "SVSKILL %s :%s", user, buf); -} - -void rageircd_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, - (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), - (ac == 2 ? av[1] : "")); -} - -void rageircd_cmd_squit(const char *servname, const char *message) -{ - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* PONG */ -void rageircd_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -void rageircd_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 5 3 0 %ld bluemoon 0", (long int) time(NULL)); -} - -void rageircd_cmd_capab() -{ - /* CAPAB BURST UNCONNECT ZIP SSJ3 SN2 VHOST SUID TOK1 TSMODE */ - send_cmd(NULL, "CAPAB BURST UNCONNECT SSJ3 SN2 VHOST TSMODE"); -} - -void rageircd_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -/* PASS */ -void rageircd_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -void rageircd_cmd_burst() -{ - send_cmd(NULL, "BURST"); -} - -void rageircd_cmd_connect(int servernum) -{ - if (Numeric) { - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, Numeric); - } else { - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - } - - if (servernum == 1) - rageircd_cmd_pass(RemotePassword); - else if (servernum == 2) - rageircd_cmd_pass(RemotePassword2); - else if (servernum == 3) - rageircd_cmd_pass(RemotePassword3); - rageircd_cmd_capab(); - if (Numeric) { - send_cmd(NULL, "MYID !%s", Numeric); - } - rageircd_cmd_server(ServerName, 1, ServerDesc); - rageircd_cmd_svinfo(); - rageircd_cmd_burst(); -} - -void rageircd_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - if (is_services_oper(user)) { - common_svsmode(user, "+a", NULL); - user->mode |= UMODE_a; - } - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - -/* GLOBOPS */ -void rageircd_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -void rageircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void rageircd_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - rageircd_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void rageircd_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void rageircd_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void rageircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void rageircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void rageircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - rageircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -void rageircd_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -void rageircd_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (ircdcap->tsmode) { - if (uplink_capab & ircdcap->tsmode || UseTSMODE) { - send_cmd(source, "MODE %s 0 %s", dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } -} - - -void rageircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void rageircd_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void rageircd_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void rageircd_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void rageircd_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -/* INVITE */ -void rageircd_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* 391 */ -void rageircd_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void rageircd_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void rageircd_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void rageircd_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void rageircd_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void rageircd_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void rageircd_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void rageircd_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void rageircd_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void rageircd_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void rageircd_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void rageircd_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void rageircd_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, - (long int) time(NULL), ServiceUser, ServiceHost, ServerName, - modes, name); - rageircd_cmd_sqline(nick, "Reserved for services"); -} - -/* EVENT : OS */ -int anope_event_os(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_OperServ, av[0]); - return MOD_CONT; -} - -/* EVENT : NS */ -int anope_event_ns(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_NickServ, av[0]); - return MOD_CONT; -} - -/* EVENT : MS */ -int anope_event_ms(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_MemoServ, av[0]); - return MOD_CONT; -} - -/* EVENT : HS */ -int anope_event_hs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_HostServ, av[0]); - return MOD_CONT; -} - -/* EVENT : CS */ -int anope_event_cs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_ChanServ, av[0]); - return MOD_CONT; -} - -/* QUIT */ -void rageircd_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -void rageircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, - (long int) time(NULL), user, host, ServerName, modes, real); - rageircd_cmd_sqline(nick, "Reserved for services"); -} - -/* SVSMODE -b */ -void rageircd_cmd_unban(const char *name, const char *nick) -{ - rageircd_cmd_svsmode_chan(name, "-b", nick); -} - - -/* SVSMODE channel modes */ - -void rageircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - if (nick) { - send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); - } else { - send_cmd(ServerName, "SVSMODE %s %s", name, mode); - } -} - -void rageircd_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); -} - -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - - -int anope_event_482(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -/* SVSHOLD - set */ -void rageircd_cmd_svshold(const char *nick) -{ - send_cmd(ServerName, "SVSHOLD %s %d :%s", nick, NSReleaseTimeout, - "Being held for registered user"); -} - -/* SVSHOLD - release */ -void rageircd_cmd_release_svshold(const char *nick) -{ - send_cmd(ServerName, "SVSHOLD %s 0", nick); -} - -void rageircd_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -void rageircd_cmd_guest_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - send_cmd(NULL, "SNICK %s %ld 1 %s %s 0 * %s 0 %s :%s", nick, - (long int) time(NULL), user, host, ServerName, modes, real); -} - - -void rageircd_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void rageircd_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, - (unsigned long int) ts); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void rageircd_cmd_nc_change(User * u) -{ - common_svsmode(u, "+d", "1"); -} - -/* SVSMODE +d */ -void rageircd_cmd_svid_umode2(User * u, const char *ts) -{ - /* not used by bahamut ircds */ -} - -void rageircd_cmd_svid_umode3(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -/* NICK */ -void rageircd_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -int anope_event_myid(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -/* - * SVINFO - * parv[0] = sender prefix - * - * if (parc == 2) - * parv[1] = ZIP (compression initialisation) - * - * if (parc > 2) - * parv[1] = TS_CURRENT - * parv[2] = TS_MIN - * parv[3] = standalone or connected to non-TS (unused) - * parv[4] = UTC time - * parv[5] = ircd codename - * parv[6] = masking keys - */ -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_gnotice(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_sqline(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -void rageircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Find no reference to it in the code and docs */ -} - -void rageircd_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Find no reference to it in the code and docs */ -} - -void rageircd_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_globops(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int rageircd_flood_mode_check(const char *value) -{ - return 0; -} - -void rageircd_cmd_eob() -{ - send_cmd(NULL, "BURST 0"); -} - -void rageircd_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - rageircd_cmd_squit(jserver, rbuf); - rageircd_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void rageircd_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int rageircd_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int rageircd_valid_chan(const char *chan) -{ - /* no hard coded invalid nicks */ - return 1; -} - - -void rageircd_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(rageircd_cmd_topic); - pmodule_cmd_vhost_off(rageircd_cmd_vhost_off); - pmodule_cmd_akill(rageircd_cmd_akill); - pmodule_cmd_svskill(rageircd_cmd_svskill); - pmodule_cmd_svsmode(rageircd_cmd_svsmode); - pmodule_cmd_372(rageircd_cmd_372); - pmodule_cmd_372_error(rageircd_cmd_372_error); - pmodule_cmd_375(rageircd_cmd_375); - pmodule_cmd_376(rageircd_cmd_376); - pmodule_cmd_nick(rageircd_cmd_nick); - pmodule_cmd_guest_nick(rageircd_cmd_guest_nick); - pmodule_cmd_mode(rageircd_cmd_mode); - pmodule_cmd_bot_nick(rageircd_cmd_bot_nick); - pmodule_cmd_kick(rageircd_cmd_kick); - pmodule_cmd_notice_ops(rageircd_cmd_notice_ops); - pmodule_cmd_notice(rageircd_cmd_notice); - pmodule_cmd_notice2(rageircd_cmd_notice2); - pmodule_cmd_privmsg(rageircd_cmd_privmsg); - pmodule_cmd_privmsg2(rageircd_cmd_privmsg2); - pmodule_cmd_serv_notice(rageircd_cmd_serv_notice); - pmodule_cmd_serv_privmsg(rageircd_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(rageircd_cmd_bot_chan_mode); - pmodule_cmd_351(rageircd_cmd_351); - pmodule_cmd_quit(rageircd_cmd_quit); - pmodule_cmd_pong(rageircd_cmd_pong); - pmodule_cmd_join(rageircd_cmd_join); - pmodule_cmd_unsqline(rageircd_cmd_unsqline); - pmodule_cmd_invite(rageircd_cmd_invite); - pmodule_cmd_part(rageircd_cmd_part); - pmodule_cmd_391(rageircd_cmd_391); - pmodule_cmd_250(rageircd_cmd_250); - pmodule_cmd_307(rageircd_cmd_307); - pmodule_cmd_311(rageircd_cmd_311); - pmodule_cmd_312(rageircd_cmd_312); - pmodule_cmd_317(rageircd_cmd_317); - pmodule_cmd_219(rageircd_cmd_219); - pmodule_cmd_401(rageircd_cmd_401); - pmodule_cmd_318(rageircd_cmd_318); - pmodule_cmd_242(rageircd_cmd_242); - pmodule_cmd_243(rageircd_cmd_243); - pmodule_cmd_211(rageircd_cmd_211); - pmodule_cmd_global(rageircd_cmd_global); - pmodule_cmd_global_legacy(rageircd_cmd_global_legacy); - pmodule_cmd_sqline(rageircd_cmd_sqline); - pmodule_cmd_squit(rageircd_cmd_squit); - pmodule_cmd_svso(rageircd_cmd_svso); - pmodule_cmd_chg_nick(rageircd_cmd_chg_nick); - pmodule_cmd_svsnick(rageircd_cmd_svsnick); - pmodule_cmd_vhost_on(rageircd_cmd_vhost_on); - pmodule_cmd_connect(rageircd_cmd_connect); - pmodule_cmd_svshold(rageircd_cmd_svshold); - pmodule_cmd_release_svshold(rageircd_cmd_release_svshold); - pmodule_cmd_unsgline(rageircd_cmd_unsgline); - pmodule_cmd_unszline(rageircd_cmd_unszline); - pmodule_cmd_szline(rageircd_cmd_szline); - pmodule_cmd_sgline(rageircd_cmd_sgline); - pmodule_cmd_unban(rageircd_cmd_unban); - pmodule_cmd_svsmode_chan(rageircd_cmd_svsmode_chan); - pmodule_cmd_svid_umode(rageircd_cmd_svid_umode); - pmodule_cmd_nc_change(rageircd_cmd_nc_change); - pmodule_cmd_svid_umode2(rageircd_cmd_svid_umode2); - pmodule_cmd_svid_umode3(rageircd_cmd_svid_umode3); - pmodule_cmd_svsjoin(rageircd_cmd_svsjoin); - pmodule_cmd_svspart(rageircd_cmd_svspart); - pmodule_cmd_swhois(rageircd_cmd_swhois); - pmodule_cmd_eob(rageircd_cmd_eob); - pmodule_flood_mode_check(rageircd_flood_mode_check); - pmodule_cmd_jupe(rageircd_cmd_jupe); - pmodule_valid_nick(rageircd_valid_nick); - pmodule_valid_chan(rageircd_valid_chan); - pmodule_cmd_ctcp(rageircd_cmd_ctcp); - pmodule_set_umode(rageircd_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("RageIRCd 2.0.x"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(1); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} - -/* EOF */ diff --git a/src/protocol/rageircd.h b/src/protocol/rageircd.h deleted file mode 100644 index 620ab53ec..000000000 --- a/src/protocol/rageircd.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Rage IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_R 0x80000000 -#define UMODE_x 0x40000000 - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ -#define CMODE_c 0x00000400 /* Colors can't be used */ -#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */ -#define CMODE_N 0x00001000 -#define CMODE_S 0x00002000 -#define CMODE_C 0x00004000 -#define CMODE_A 0x00008000 -#define CMODE_O 0x00010000 /* Only opers can join */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void rageircd_set_umode(User * user, int ac, const char **av); -void rageircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void rageircd_cmd_vhost_off(User * u); -void rageircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void rageircd_cmd_svskill(const char *source, const char *user, const char *buf); -void rageircd_cmd_svsmode(User * u, int ac, const char **av); -void rageircd_cmd_372(const char *source, const char *msg); -void rageircd_cmd_372_error(const char *source); -void rageircd_cmd_375(const char *source); -void rageircd_cmd_376(const char *source); -void rageircd_cmd_nick(const char *nick, const char *name, const char *modes); -void rageircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void rageircd_cmd_mode(const char *source, const char *dest, const char *buf); -void rageircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void rageircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void rageircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void rageircd_cmd_notice(const char *source, const char *dest, const char *buf); -void rageircd_cmd_notice2(const char *source, const char *dest, const char *msg); -void rageircd_cmd_privmsg(const char *source, const char *dest, const char *buf); -void rageircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void rageircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void rageircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void rageircd_cmd_bot_chan_mode(const char *nick, const char *chan); -void rageircd_cmd_351(const char *source); -void rageircd_cmd_quit(const char *source, const char *buf); -void rageircd_cmd_pong(const char *servname, const char *who); -void rageircd_cmd_join(const char *user, const char *channel, time_t chantime); -void rageircd_cmd_unsqline(const char *user); -void rageircd_cmd_invite(const char *source, const char *chan, const char *nick); -void rageircd_cmd_part(const char *nick, const char *chan, const char *buf); -void rageircd_cmd_391(const char *source, const char *timestr); -void rageircd_cmd_250(const char *buf); -void rageircd_cmd_307(const char *buf); -void rageircd_cmd_311(const char *buf); -void rageircd_cmd_312(const char *buf); -void rageircd_cmd_317(const char *buf); -void rageircd_cmd_219(const char *source, const char *letter); -void rageircd_cmd_401(const char *source, const char *who); -void rageircd_cmd_318(const char *source, const char *who); -void rageircd_cmd_242(const char *buf); -void rageircd_cmd_243(const char *buf); -void rageircd_cmd_211(const char *buf); -void rageircd_cmd_global(const char *source, const char *buf); -void rageircd_cmd_global_legacy(const char *source, const char *fmt); -void rageircd_cmd_sqline(const char *mask, const char *reason); -void rageircd_cmd_squit(const char *servname, const char *message); -void rageircd_cmd_svso(const char *source, const char *nick, const char *flag); -void rageircd_cmd_chg_nick(const char *oldnick, const char *newnick); -void rageircd_cmd_svsnick(const char *source, const char *guest, time_t when); -void rageircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void rageircd_cmd_connect(int servernum); -void rageircd_cmd_svshold(const char *nick); -void rageircd_cmd_release_svshold(const char *nick); -void rageircd_cmd_unsgline(const char *mask); -void rageircd_cmd_unszline(const char *mask); -void rageircd_cmd_szline(const char *mask, const char *reason, const char *whom); -void rageircd_cmd_sgline(const char *mask, const char *reason); -void rageircd_cmd_unban(const char *name, const char *nick); -void rageircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void rageircd_cmd_svid_umode(const char *nick, time_t ts); -void rageircd_cmd_nc_change(User * u); -void rageircd_cmd_svid_umode2(User * u, const char *ts); -void rageircd_cmd_svid_umode3(User * u, const char *ts); -void rageircd_cmd_eob(); -int rageircd_flood_mode_check(const char *value); -void rageircd_cmd_jupe(const char *jserver, const char *who, const char *reason); -int rageircd_valid_nick(const char *nick); -void rageircd_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class RageIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/shadowircd.c b/src/protocol/shadowircd.c deleted file mode 100644 index d315cd618..000000000 --- a/src/protocol/shadowircd.c +++ /dev/null @@ -1,1823 +0,0 @@ -/* ShadowIRCd functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * Provided by the ShadowIRCd development group. See - * http://www.shadowircd.net for details. - */ - -#include "services.h" -#include "pseudo.h" -#include "shadowircd.h" - -IRCDVar myIrcd[] = { - {"ShadowIRCd 4.0+", /* ircd name */ - "+oiqSK", /* nickserv mode */ - "+oiqSK", /* chanserv mode */ - "+oiqSK", /* memoserv mode */ - "+oiqSK", /* hostserv mode */ - "+oiqSK", /* operserv mode */ - "+oiqSK", /* botserv mode */ - "+oiqSK", /* helpserv mode */ - "+oiqSK", /* Dev/Null mode */ - "+oiqSK", /* Global mode */ - "+oiqSK", /* nickserv alias mode */ - "+oiqSK", /* chanserv alias mode */ - "+oiqSK", /* memoserv alias mode */ - "+oiqSK", /* hostserv alias mode */ - "+oiqSK", /* operserv alias mode */ - "+oiqSK", /* botserv alias mode */ - "+oiqSK", /* helpserv alias mode */ - "+oiqSK", /* Dev/Null alias mode */ - "+oiqSK", /* Global alias mode */ - "+oiqSK", /* Used by BotServ Bots */ - 4, /* Chan Max Symbols */ - "-cimnprstvzAEFGKLNOPRSTV", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+e", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-e", /* Mode on UnReg */ - "-e", /* Mode on Nick Change */ - 0, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 4, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 1, /* Has Admin */ - 1, /* Chan SQlines */ - 1, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - 1, /* Channel Mode */ - 1, /* vidents */ - 0, /* svshold */ - 0, /* time stamp on mode */ - 0, /* NICKIP */ - 1, /* UMODE */ - 0, /* O:LINE */ - 1, /* VHOST ON NICK */ - 1, /* Change RealName */ - CMODE_K, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_v, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* +f Mode */ - 0, /* +L Mode */ - 1, /* 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 */ - 1, /* +I support */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "v", /* vhost char */ - 1, /* ts6 */ - 0, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -/* ShadowIRCd does not use CAPAB */ -IRCDCAPAB myIrcdcap[] = { - { - 0, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - 0, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, 0, 0} -}; - -void shadowircd_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - - } else { - opcnt--; - } - break; - } - } -} - -unsigned long umodes[128] = { - 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, UMODE_E, 0, /* D E F */ - UMODE_G, 0, 0, /* G H I */ - 0, 0, 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, 0, /* V W X */ - 0, /* Y */ - 0, /* Z */ - 0, 0, 0, /* [ \ ] */ - 0, 0, 0, /* ^ _ ` */ - UMODE_a, UMODE_b, 0, /* a b c */ - UMODE_d, UMODE_e, 0, /* d e f */ - UMODE_g, 0, UMODE_i, /* g h i */ - 0, 0, UMODE_l, /* j k l */ - 0, UMODE_n, UMODE_o, /* m n o */ - 0, 0, 0, /* p q r */ - 0, 0, UMODE_u, /* s t u */ - UMODE_v, UMODE_w, UMODE_x, /* v w x */ - 0, /* y */ - 0, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - - -char myCsmodes[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', - 0, 0, 0, - 'h', - 0, 0, 0, 0, - 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[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}, - {CMODE_A, 0, NULL, NULL}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {CMODE_E, 0, NULL, NULL}, /* E */ - {CMODE_F, 0, NULL, NULL}, /* F */ - {CMODE_G, 0, NULL, NULL}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {CMODE_L, 0, NULL, NULL}, /* L */ - {0}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, 0, NULL, NULL}, /* O */ - {CMODE_P, 0, NULL, NULL}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {CMODE_T, 0, NULL, NULL}, /* T */ - {0}, /* U */ - {CMODE_V, 0, NULL, NULL}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, 0, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {CMODE_z, 0, NULL, NULL}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'z', CMODE_z, 0, NULL, NULL}, - {'A', CMODE_A, 0, NULL, NULL}, - {'E', CMODE_E, 0, NULL, NULL}, - {'F', CMODE_F, 0, NULL, NULL}, - {'G', CMODE_G, 0, NULL, NULL}, - {'K', CMODE_K, 0, NULL, NULL}, - {'L', CMODE_L, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'P', CMODE_P, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {'T', CMODE_T, 0, NULL, NULL}, - {'V', CMODE_V, 0, NULL, NULL}, - {0} -}; - - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - - -void shadowircd_cmd_notice(const char *source, const char *dest, const char *buf) -{ - Uid *ud; - User *u; - - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - shadowircd_cmd_privmsg2(source, dest, buf); - } else { - ud = find_uid(source); - u = finduser(dest); - send_cmd((ud ? ud->uid : source), "NOTICE %s :%s", - (u ? u->uid : dest), buf); - } -} - -void shadowircd_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - Uid *ud; - User *u; - - ud = find_uid(source); - u = finduser(dest); - send_cmd((ud ? ud->uid : source), "NOTICE %s :%s", (u ? u->uid : dest), - msg); -} - -void shadowircd_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - Uid *ud, *ud2; - - if (!buf) { - return; - } - ud = find_uid(source); - ud2 = find_uid(dest); - - send_cmd((ud ? ud->uid : source), "PRIVMSG %s :%s", - (ud2 ? ud2->uid : dest), buf); -} - -void shadowircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - Uid *ud, *ud2; - - ud = find_uid(source); - ud2 = find_uid(dest); - - send_cmd((ud ? ud->uid : source), "PRIVMSG %s :%s", - (ud2 ? ud2->uid : dest), msg); -} - -void shadowircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $$%s :%s", dest, msg); -} - -void shadowircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $$%s :%s", dest, msg); -} - - -void shadowircd_cmd_global(const char *source, const char *buf) -{ - Uid *u; - - if (!buf) { - return; - } - - if (source) { - u = find_uid(source); - if (u) { - send_cmd((u ? u->uid : source), "OPERWALL :%s", buf); - } else { - send_cmd(TS6SID, "OPERWALL :%s", buf); - } - } else { - send_cmd(TS6SID, "OPERWALL :%s", buf); - } -} - -/* GLOBOPS - to handle old WALLOPS */ -void shadowircd_cmd_global_legacy(const char *source, const char *fmt) -{ - Uid *u; - - if (source) { - u = find_uid(source); - if (u) { - send_cmd((u ? u->uid : source), "OPERWALL :%s", fmt); - } else { - send_cmd(TS6SID, "OPERWALL :%s", fmt); - } - } else { - send_cmd(TS6SID, "OPERWALL :%s", fmt); - } - - send_cmd(source ? source : ServerName, "OPERWALL :%s", fmt); -} - -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -/* - Non TS6 - - av[0] = nick - av[1] = hop - av[2] = ts - av[3] = modes - av[4] = user - av[5] = host - av[6] = server - av[7] = info - - TS6 - av[0] = nick - av[1] = hop - av[2] = ts - av[3] = modes - av[4] = user - av[5] = host - av[6] = IP - av[7] = UID - av[8] = vhost - av[9] = info - -*/ -int anope_event_nick(const char *source, int ac, const char **av) -{ - Server *s = NULL; - User *user, *u2; - - if (ac == 10) { - s = findserver_uid(servlist, source); - /* Source is always the server */ - user = do_nick("", av[0], av[4], av[5], s->name, av[9], - strtoul(av[2], NULL, 10), 0, 0, av[8], av[7]); - if (user) { - anope_set_umode(user, 1, &av[3]); - } - } else if (ac == 8) { - /* Changed use of s->name to av[6], as s will be NULL - * if i can believe the above comments, this should be fine - * if anyone from shadowircd see's this, and its wrong, let - * me know? :) - */ - user = do_nick(source, av[0], av[4], av[5], av[6], av[7], - strtoul(av[2], NULL, 10), 0, 0, NULL, NULL); - if (user) { - anope_set_umode(user, 1, &av[3]); - } - } else { - u2 = find_byuid(source); - do_nick((u2 ? u2->nick : source), av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - - -int anope_event_chghost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = find_byuid(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - User *u; - - if (ac == 4) { - do_topic(source, ac, av); - } else { - Channel *c = findchan(av[0]); - time_t topic_time = time(NULL); - - if (!c) { - if (debug) { - alog("debug: TOPIC %s for nonexistent channel %s", - merge_args(ac - 1, av + 1), av[0]); - } - return MOD_CONT; - } - - if (check_topiclock(c, topic_time)) - return MOD_CONT; - - if (c->topic) { - free(c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[1]) - c->topic = sstrdup(av[1]); - - u = find_byuid(source); - if (u) { - strscpy(c->topic_setter, u->nick, sizeof(c->topic_setter)); - } else { - strscpy(c->topic_setter, source, sizeof(c->topic_setter)); - } - c->topic_time = topic_time; - - record_topic(av[0]); - - if (ac > 1 && *av[1]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[1]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - } - return MOD_CONT; -} - -int anope_event_tburst(const char *source, int ac, const char **av) -{ - char *setter; - Channel *c; - time_t topic_time; - - if (ac != 4) { - return MOD_CONT; - } - - setter = myStrGetToken(av[2], '!', 0); - - c = findchan(av[0]); - topic_time = strtol(av[1], NULL, 10); - - if (!c) { - if (debug) { - alog("debug: TOPIC %s for nonexistent channel %s", - merge_args(ac - 1, av + 1), av[0]); - } - if (setter) - free(setter); - return MOD_CONT; - } - - if (check_topiclock(c, topic_time)) { - if (setter) - free(setter); - return MOD_CONT; - } - - if (c->topic) { - free(c->topic); - c->topic = NULL; - } - if (ac > 1 && *av[3]) - c->topic = sstrdup(av[3]); - - strscpy(c->topic_setter, setter, sizeof(c->topic_setter)); - c->topic_time = topic_time; - - record_topic(av[0]); - - if (ac > 1 && *av[3]) - send_event(EVENT_TOPIC_UPDATED, 2, av[0], av[3]); - else - send_event(EVENT_TOPIC_UPDATED, 2, av[0], ""); - - if (setter) - free(setter); - - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) -{ - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); - - TS6SID = sstrdup(Numeric); - UseTS6 = 1; - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", 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("SVSKILL", anope_event_kill); addCoreMessage(IRCD,m); - m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("TMODE", anope_event_tmode); addCoreMessage(IRCD,m); - m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); - m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("BMASK", anope_event_bmask); addCoreMessage(IRCD,m); - m = createMessage("UID", 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", 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("TBURST", anope_event_tburst); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - 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("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); - m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); - m = createMessage("421", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("ENCAP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SID", anope_event_sid); addCoreMessage(IRCD,m); - m = createMessage("EOB", anope_event_eos); addCoreMessage(IRCD,m); - m = createMessage("TSSYNC", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSCLOAK", anope_event_chghost); addCoreMessage(IRCD,m); - -} - -/* *INDENT-ON* */ - - -void shadowircd_cmd_sqline(const char *mask, const char *reason) -{ - send_cmd(NULL, "RESV * %s :%s", mask, reason); -} - -void shadowircd_cmd_unsgline(const char *mask) -{ - /* Does not support */ -} - -void shadowircd_cmd_unszline(const char *mask) -{ - /* Does not support */ -} - -void shadowircd_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - /* Does not support */ -} - -void shadowircd_cmd_svsadmin(const char *server, int set) -{ -} - -void shadowircd_cmd_sgline(const char *mask, const char *reason) -{ - /* does not support */ -} - -void ShadowIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - Uid *ud = find_uid(s_OperServ); - send_cmd(ud ? ud->uid : s_OperServ, "UNKLINE * %s %s", user, host); -} - -void shadowircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - Uid *ud; - - ud = find_uid(whosets); - send_cmd((ud ? ud->uid : whosets), "TOPIC %s %s %ld :%s", chan, - whosetit, (long int) when, topic); -} - -void shadowircd_cmd_vhost_off(User * u) -{ - send_cmd(NULL, "MODE %s -v", (u->uid ? u->uid : u->nick)); -} - -void shadowircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - send_cmd(NULL, "SVSCLOAK %s %s", nick, vhost); - - if (vIdent) - send_cmd(NULL, "SVSIDENT %s %s", nick, vIdent); -} - -void shadowircd_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNRESV * %s", user); -} - -void shadowircd_cmd_join(const char *user, const char *channel, time_t chantime) -{ - Uid *ud; - - ud = find_uid(user); - send_cmd(NULL, "SJOIN %ld %s + :%s", (long int) chantime, - channel, (ud ? ud->uid : user)); -} - -/* -oper: the nick of the oper performing the kline -target.server: the server(s) this kline is destined for -duration: the duration if a tkline, 0 if permanent. -user: the 'user' portion of the kline -host: the 'host' portion of the kline -reason: the reason for the kline. -*/ - -void shadowircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - Uid *ud; - - ud = find_uid(s_OperServ); - - send_cmd((ud ? ud->uid : s_OperServ), "KLINE * %ld %s %s :%s", - (long int) (expires - (long) time(NULL)), user, host, reason); -} - -void shadowircd_cmd_svskill(const char *source, const char *user, const char *buf) -{ - Uid *ud; - - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - ud = find_uid(user); - send_cmd(NULL, "SVSKILL %s :%s", (ud ? ud->uid : user), buf); -} - -void shadowircd_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(TS6SID, "MODE %s %s", u->uid, av[0]); -} - -void shadowircd_cmd_svsinfo() -{ - /* not used */ -} - -/* - * 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 shadowircd_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 6 3 0 :%ld", (long int) time(NULL)); -} - -void shadowircd_cmd_capab() -{ - /* ShadowIRCd does not use CAPAB */ -} - -/* PASS */ -void shadowircd_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s TS 6 %s", pass, TS6SID); -} - -/* SERVER name protocol hop descript */ -void shadowircd_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d %d :%s", servname, hop, PROTOCOL_REVISION, - descript); -} - - -void shadowircd_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, TS6SID); - if (servernum == 1) - shadowircd_cmd_pass(RemotePassword); - else if (servernum == 2) - shadowircd_cmd_pass(RemotePassword2); - else if (servernum == 3) - shadowircd_cmd_pass(RemotePassword3); - - shadowircd_cmd_capab(); - shadowircd_cmd_server(ServerName, 1, ServerDesc); - shadowircd_cmd_svinfo(); -} - -void shadowircd_cmd_bot_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - char *uidbuf = ts6_uid_retrieve(); - - EnforceQlinedNick(nick, NULL); - send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0.0.0.0 %s %s :%s", nick, - (long int) time(NULL), modes, user, host, uidbuf, host, - real); - new_uid(nick, uidbuf); - shadowircd_cmd_sqline(nick, "Reserved for services"); -} - -void shadowircd_cmd_part(const char *nick, const char *chan, const char *buf) -{ - Uid *ud; - - ud = find_uid(nick); - - if (buf) { - send_cmd((ud ? ud->uid : nick), "PART %s :%s", chan, buf); - } else { - send_cmd((ud ? ud->uid : nick), "PART %s", chan); - } -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - shadowircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - User *u = NULL; - - u = find_byuid(source); - - m_away(u->nick, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - -void shadowircd_cmd_eob() -{ - send_cmd(TS6SID, "EOB"); -} - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) { - do_sjoin(source, ac, av); - return MOD_CONT; - } else { - do_join(source, ac, av); - } - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - User *u; - Uid *ud; - - if (ac != 2) { - return MOD_CONT; - } - - u = find_byuid(source); - ud = find_nickuid(av[0]); - - m_privmsg((u ? u->nick : source), (ud ? ud->nick : av[0]), av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - User *u; - - if (ac < 1 || ac > 2) { - return MOD_CONT; - } - - u = find_byuid(source); - do_part(u->nick, ac, av); - - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - Uid *ud; - - if (source && ac >= 1) { - ud = find_nickuid(av[0]); - m_whois(source, (ud ? ud->nick : source)); - } - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - if (TS6UPLINK) { - do_server(source, av[0], av[1], av[2], TS6UPLINK); - } else { - do_server(source, av[0], av[1], av[2], NULL); - } - } else { - do_server(source, av[0], av[1], av[2], NULL); - } - return MOD_CONT; -} - -int anope_event_sid(const char *source, int ac, const char **av) -{ - Server *s; - - /* :42X SID trystan.nomadirc.net 2 43X :ircd-ratbox test server */ - - s = findserver_uid(servlist, source); - do_server(s->name, av[0], av[1], av[3], av[2]); - return MOD_CONT; -} - -int anope_event_eos(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver_uid(servlist, source); - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) { - return MOD_CONT; - } - - u = find_byuid(source); - - do_quit(u->nick, ac, av); - return MOD_CONT; -} - -void shadowircd_cmd_372(const char *source, const char *msg) -{ - send_cmd(TS6SID, "372 %s :- %s", source, msg); -} - -void shadowircd_cmd_372_error(const char *source) -{ - send_cmd(TS6SID, - "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void shadowircd_cmd_375(const char *source) -{ - send_cmd(TS6SID, - "375 %s :- %s Message of the Day", source, ServerName); -} - -void shadowircd_cmd_376(const char *source) -{ - send_cmd(TS6SID, "376 %s :End of /MOTD command.", source); -} - -/* 391 */ -void shadowircd_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void shadowircd_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void shadowircd_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(TS6SID, "307 %s", buf); -} - -/* 311 */ -void shadowircd_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(TS6SID, "311 %s", buf); -} - -/* 312 */ -void shadowircd_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(TS6SID, "312 %s", buf); -} - -/* 317 */ -void shadowircd_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(TS6SID, "317 %s", buf); -} - -/* 219 */ -void shadowircd_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void shadowircd_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(TS6SID, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void shadowircd_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(TS6SID, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void shadowircd_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void shadowircd_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void shadowircd_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void shadowircd_cmd_mode(const char *source, const char *dest, const char *buf) -{ - Uid *ud; - if (!buf) { - return; - } - - if (source) { - ud = find_uid(source); - send_cmd((ud ? ud->uid : source), "MODE %s %s", dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } -} - -void shadowircd_cmd_tmode(const char *source, const char *dest, const char *buf) -{ - - if (!buf) { - return; - } - - send_cmd(NULL, "MODE %s %s", dest, buf); -} - -void shadowircd_cmd_nick(const char *nick, const char *name, const char *mode) -{ - char *uidbuf = ts6_uid_retrieve(); - - EnforceQlinedNick(nick, NULL); - send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0.0.0.0 %s %s :%s", nick, - (long int) time(NULL), mode, ServiceUser, ServiceHost, - uidbuf, ServiceHost, name); - new_uid(nick, uidbuf); - shadowircd_cmd_sqline(nick, "Reserved for services"); -} - -void shadowircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - Uid *ud; - User *u; - - ud = find_uid(source); - u = finduser(user); - - if (buf) { - send_cmd((ud ? ud->uid : source), "KICK %s %s :%s", chan, - (u ? u->uid : user), buf); - } else { - send_cmd((ud ? ud->uid : source), "KICK %s %s", chan, - (u ? u->uid : user)); - } -} - -void shadowircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - -void shadowircd_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - Uid *u; - - u = find_uid(nick); - anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, - (u ? u->uid : nick)); -} - -/* QUIT */ -void shadowircd_cmd_quit(const char *source, const char *buf) -{ - Uid *ud; - - ud = find_uid(source); - - if (buf) { - send_cmd((ud ? ud->uid : source), "QUIT :%s", buf); - } else { - send_cmd((ud ? ud->uid : source), "QUIT"); - } -} - -/* PONG */ -void shadowircd_cmd_pong(const char *servname, const char *who) -{ - send_cmd(TS6SID, "PONG %s", who); -} - -/* INVITE */ -void shadowircd_cmd_invite(const char *source, const char *chan, const char *nick) -{ - Uid *ud; - User *u; - - if (!source || !chan || !nick) { - return; - } - - ud = find_uid(source); - u = finduser(nick); - - send_cmd((ud ? ud->uid : source), "INVITE %s %s", - (u ? u->uid : nick), chan); -} - -/* SQUIT */ -void shadowircd_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -int anope_event_mode(const char *source, int ac, const char **av) -{ - User *u, *u2; - - if (ac < 2 || *av[0] == '&') { - return MOD_CONT; - } - - if (*av[0] == '#') { - do_cmode(source, ac, av); - } else { - u = find_byuid(source); - u2 = find_byuid(av[0]); - av[0] = u2->nick; - do_umode2((u ? u->nick : source), ac, av); - } - return MOD_CONT; -} - -int anope_event_tmode(const char *source, int ac, const char **av) -{ - if (*av[1] == '#' || *av[1] == '&') { - do_cmode(source, ac, av); - } - return MOD_CONT; -} - -void shadowircd_cmd_351(const char *source) -{ - send_cmd(TS6SID, - "351 %s Anope-%s %s :%s (ShadowProtocol %d) - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, - PROTOCOL_REVISION, version_flags, EncModule, version_build); -} - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - /* Not supported by ShadowIRCd. */ - return MOD_CONT; -} - -/* SVSHOLD - set */ -void shadowircd_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void shadowircd_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSNICK */ -void shadowircd_cmd_svsnick(const char *nick, const char *newnick, time_t when) -{ - if (!nick || !newnick) { - return; - } - send_cmd(NULL, "SVSNICK %s %s %ld", nick, newnick, (long int) when); -} - -void shadowircd_cmd_guest_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - /* not supported */ -} - -void shadowircd_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void shadowircd_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void shadowircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void shadowircd_cmd_svid_umode(const char *nick, time_t ts) -{ - /* not supported */ -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void shadowircd_cmd_nc_change(User * u) -{ - /* not supported */ -} - -/* SVSMODE +d */ -void shadowircd_cmd_svid_umode2(User * u, const char *ts) -{ - /* not supported */ -} - -void shadowircd_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -/* NICK */ -void shadowircd_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* - * 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 - */ -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - TS6UPLINK = sstrdup(av[3]); - return MOD_CONT; -} - -void shadowircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Not Supported by this IRCD */ -} - -void shadowircd_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Not Supported by this IRCD */ -} - -void shadowircd_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_invite(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_bmask(const char *source, int ac, const char **av) -{ - Channel *c; - char *bans; - char *b; - int count, i; - - /* :42X BMASK 1106409026 #ircops b :*!*@*.aol.com */ - /* 0 1 2 3 */ - c = findchan(av[1]); - - if (c) { - bans = sstrdup(av[3]); - count = myNumToken(bans, ' '); - for (i = 0; i <= count - 1; i++) { - b = myStrGetToken(bans, ' ', i); - if (!stricmp(av[2], "b")) { - add_ban(c, b); - } - if (!stricmp(av[2], "e")) { - add_exception(c, b); - } - if (!stricmp(av[2], "I")) { - add_invite(c, b); - } - if (b) - free(b); - } - free(bans); - } - return MOD_CONT; -} - -int shadowircd_flood_mode_check(const char *value) -{ - return 0; -} - -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void shadowircd_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - shadowircd_cmd_squit(jserver, rbuf); - shadowircd_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int shadowircd_valid_nick(const char *nick) -{ - /* TS6 Save extension -Certus */ - if (isdigit(*nick)) - return 0; - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int shadowircd_valid_chan(const char *chan) -{ - /* no hard coded invalid chan */ - return 1; -} - - -void shadowircd_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(shadowircd_cmd_topic); - pmodule_cmd_vhost_off(shadowircd_cmd_vhost_off); - pmodule_cmd_akill(shadowircd_cmd_akill); - pmodule_cmd_svskill(shadowircd_cmd_svskill); - pmodule_cmd_svsmode(shadowircd_cmd_svsmode); - pmodule_cmd_372(shadowircd_cmd_372); - pmodule_cmd_372_error(shadowircd_cmd_372_error); - pmodule_cmd_375(shadowircd_cmd_375); - pmodule_cmd_376(shadowircd_cmd_376); - pmodule_cmd_nick(shadowircd_cmd_nick); - pmodule_cmd_guest_nick(shadowircd_cmd_guest_nick); - pmodule_cmd_mode(shadowircd_cmd_mode); - pmodule_cmd_bot_nick(shadowircd_cmd_bot_nick); - pmodule_cmd_kick(shadowircd_cmd_kick); - pmodule_cmd_notice_ops(shadowircd_cmd_notice_ops); - pmodule_cmd_notice(shadowircd_cmd_notice); - pmodule_cmd_notice2(shadowircd_cmd_notice2); - pmodule_cmd_privmsg(shadowircd_cmd_privmsg); - pmodule_cmd_privmsg2(shadowircd_cmd_privmsg2); - pmodule_cmd_serv_notice(shadowircd_cmd_serv_notice); - pmodule_cmd_serv_privmsg(shadowircd_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(shadowircd_cmd_bot_chan_mode); - pmodule_cmd_351(shadowircd_cmd_351); - pmodule_cmd_quit(shadowircd_cmd_quit); - pmodule_cmd_pong(shadowircd_cmd_pong); - pmodule_cmd_join(shadowircd_cmd_join); - pmodule_cmd_unsqline(shadowircd_cmd_unsqline); - pmodule_cmd_invite(shadowircd_cmd_invite); - pmodule_cmd_part(shadowircd_cmd_part); - pmodule_cmd_391(shadowircd_cmd_391); - pmodule_cmd_250(shadowircd_cmd_250); - pmodule_cmd_307(shadowircd_cmd_307); - pmodule_cmd_311(shadowircd_cmd_311); - pmodule_cmd_312(shadowircd_cmd_312); - pmodule_cmd_317(shadowircd_cmd_317); - pmodule_cmd_219(shadowircd_cmd_219); - pmodule_cmd_401(shadowircd_cmd_401); - pmodule_cmd_318(shadowircd_cmd_318); - pmodule_cmd_242(shadowircd_cmd_242); - pmodule_cmd_243(shadowircd_cmd_243); - pmodule_cmd_211(shadowircd_cmd_211); - pmodule_cmd_global(shadowircd_cmd_global); - pmodule_cmd_global_legacy(shadowircd_cmd_global_legacy); - pmodule_cmd_sqline(shadowircd_cmd_sqline); - pmodule_cmd_squit(shadowircd_cmd_squit); - pmodule_cmd_svso(shadowircd_cmd_svso); - pmodule_cmd_chg_nick(shadowircd_cmd_chg_nick); - pmodule_cmd_svsnick(shadowircd_cmd_svsnick); - pmodule_cmd_vhost_on(shadowircd_cmd_vhost_on); - pmodule_cmd_connect(shadowircd_cmd_connect); - pmodule_cmd_svshold(shadowircd_cmd_svshold); - pmodule_cmd_release_svshold(shadowircd_cmd_release_svshold); - pmodule_cmd_unsgline(shadowircd_cmd_unsgline); - pmodule_cmd_unszline(shadowircd_cmd_unszline); - pmodule_cmd_szline(shadowircd_cmd_szline); - pmodule_cmd_sgline(shadowircd_cmd_sgline); - pmodule_cmd_unban(shadowircd_cmd_unban); - pmodule_cmd_svsmode_chan(shadowircd_cmd_svsmode_chan); - pmodule_cmd_svid_umode(shadowircd_cmd_svid_umode); - pmodule_cmd_nc_change(shadowircd_cmd_nc_change); - pmodule_cmd_svid_umode2(shadowircd_cmd_svid_umode2); - pmodule_cmd_svid_umode3(shadowircd_cmd_svid_umode3); - pmodule_cmd_svsjoin(shadowircd_cmd_svsjoin); - pmodule_cmd_svspart(shadowircd_cmd_svspart); - pmodule_cmd_swhois(shadowircd_cmd_swhois); - pmodule_cmd_eob(shadowircd_cmd_eob); - pmodule_flood_mode_check(shadowircd_flood_mode_check); - pmodule_cmd_jupe(shadowircd_cmd_jupe); - pmodule_valid_nick(shadowircd_valid_nick); - pmodule_valid_chan(shadowircd_valid_chan); - pmodule_cmd_ctcp(shadowircd_cmd_ctcp); - pmodule_set_umode(shadowircd_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("ShadowIRCd 4.0+"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(1); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/shadowircd.h b/src/protocol/shadowircd.h deleted file mode 100644 index c3044026b..000000000 --- a/src/protocol/shadowircd.h +++ /dev/null @@ -1,145 +0,0 @@ -/* ShadowIRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/* The protocol revision. */ -#define PROTOCOL_REVISION 3402 - - -#define UMODE_a 0x00000001 -#define UMODE_C 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_z 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_s 0x00000040 -#define UMODE_c 0x00000080 -#define UMODE_r 0x00000100 -#define UMODE_k 0x00000200 -#define UMODE_f 0x00000400 -#define UMODE_y 0x00000800 -#define UMODE_d 0x00001000 -#define UMODE_n 0x00002000 -#define UMODE_x 0x00004000 -#define UMODE_u 0x00008000 -#define UMODE_b 0x00010000 -#define UMODE_l 0x00020000 -#define UMODE_g 0x00040000 -#define UMODE_v 0x00080000 -#define UMODE_A 0x00100000 -#define UMODE_E 0x00200000 -#define UMODE_G 0x00400000 -#define UMODE_R 0x00800000 -#define UMODE_e 0x01000000 -#define UMODE_O 0x02000000 -#define UMODE_H 0x04000000 - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 -#define CMODE_l 0x00000080 -#define CMODE_K 0x00000100 -#define CMODE_A 0x00000200 -#define CMODE_r 0x00000400 -#define CMODE_z 0x00000800 -#define CMODE_S 0x00001000 -#define CMODE_c 0x00002000 -#define CMODE_E 0x00004000 -#define CMODE_F 0x00008000 -#define CMODE_G 0x00010000 -#define CMODE_L 0x00020000 -#define CMODE_N 0x00040000 -#define CMODE_O 0x00080000 -#define CMODE_P 0x00100000 -#define CMODE_R 0x00200000 -#define CMODE_T 0x00400000 -#define CMODE_V 0x00800000 - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void shadowircd_set_umode(User * user, int ac, const char **av); -void shadowircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void shadowircd_cmd_vhost_off(User * u); -void shadowircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void shadowircd_cmd_svskill(const char *source, const char *user, const char *buf); -void shadowircd_cmd_svsmode(User * u, int ac, const char **av); -void shadowircd_cmd_372(const char *source, const char *msg); -void shadowircd_cmd_372_error(const char *source); -void shadowircd_cmd_375(const char *source); -void shadowircd_cmd_376(const char *source); -void shadowircd_cmd_nick(const char *nick, const char *name, const char *modes); -void shadowircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void shadowircd_cmd_mode(const char *source, const char *dest, const char *buf); -void shadowircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void shadowircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void shadowircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void shadowircd_cmd_notice(const char *source, const char *dest, const char *buf); -void shadowircd_cmd_notice2(const char *source, const char *dest, const char *msg); -void shadowircd_cmd_privmsg(const char *source, const char *dest, const char *buf); -void shadowircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void shadowircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void shadowircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void shadowircd_cmd_bot_chan_mode(const char *nick, const char *chan); -void shadowircd_cmd_351(const char *source); -void shadowircd_cmd_quit(const char *source, const char *buf); -void shadowircd_cmd_pong(const char *servname, const char *who); -void shadowircd_cmd_join(const char *user, const char *channel, time_t chantime); -void shadowircd_cmd_unsqline(const char *user); -void shadowircd_cmd_invite(const char *source, const char *chan, const char *nick); -void shadowircd_cmd_part(const char *nick, const char *chan, const char *buf); -void shadowircd_cmd_391(const char *source, const char *timestr); -void shadowircd_cmd_250(const char *buf); -void shadowircd_cmd_307(const char *buf); -void shadowircd_cmd_311(const char *buf); -void shadowircd_cmd_312(const char *buf); -void shadowircd_cmd_317(const char *buf); -void shadowircd_cmd_219(const char *source, const char *letter); -void shadowircd_cmd_401(const char *source, const char *who); -void shadowircd_cmd_318(const char *source, const char *who); -void shadowircd_cmd_242(const char *buf); -void shadowircd_cmd_243(const char *buf); -void shadowircd_cmd_211(const char *buf); -void shadowircd_cmd_global(const char *source, const char *buf); -void shadowircd_cmd_global_legacy(const char *source, const char *fmt); -void shadowircd_cmd_sqline(const char *mask, const char *reason); -void shadowircd_cmd_squit(const char *servname, const char *message); -void shadowircd_cmd_svso(const char *source, const char *nick, const char *flag); -void shadowircd_cmd_chg_nick(const char *oldnick, const char *newnick); -void shadowircd_cmd_svsnick(const char *source, const char *guest, time_t when); -void shadowircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void shadowircd_cmd_connect(int servernum); -void shadowircd_cmd_svshold(const char *nick); -void shadowircd_cmd_release_svshold(const char *nick); -void shadowircd_cmd_unsgline(const char *mask); -void shadowircd_cmd_unszline(const char *mask); -void shadowircd_cmd_szline(const char *mask, const char *reason, const char *whom); -void shadowircd_cmd_sgline(const char *mask, const char *reason); -void shadowircd_cmd_unban(const char *name, const char *nick); -void shadowircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void shadowircd_cmd_svid_umode(const char *nick, time_t ts); -void shadowircd_cmd_nc_change(User * u); -void shadowircd_cmd_svid_umode2(User * u, const char *ts); -void shadowircd_cmd_svid_umode3(User * u, const char *ts); -void shadowircd_cmd_eob(); -int shadowircd_flood_mode_check(const char *value); -void shadowircd_cmd_jupe(const char *jserver, const char *who, const char *reason); -int shadowircd_valid_nick(const char *nick); -void shadowircd_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class ShadowIRCdProto : public IRCDProtoNew { - public: - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/solidircd.c b/src/protocol/solidircd.c deleted file mode 100644 index f9909072d..000000000 --- a/src/protocol/solidircd.c +++ /dev/null @@ -1,1709 +0,0 @@ -/* Solid-IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#include "services.h" -#include "pseudo.h" -#include "solidircd.h" - -IRCDVar myIrcd[] = { - {"Solid-IRCd 3.4.*", /* ircd name */ - "+o", /* nickserv mode */ - "+o", /* chanserv mode */ - "+o", /* memoserv mode */ - "+o", /* hostserv mode */ - "+io", /* operserv mode */ - "+o", /* botserv mode */ - "+h", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+io", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+io", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+h", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+", /* Used by BotServ Bots */ - 2, /* Chan Max Symbols */ - "-cilmnpstOR", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - NULL, /* Mode to set for chan admin */ - NULL, /* Mode to unset for chan admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "+d", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 1, /* Chan SQlines */ - 1, /* Quit on Kill */ - 1, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 0, /* vidents */ - 1, /* svshold */ - 1, /* time stamp on mode */ - 1, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 0, /* VHOST ON NICK */ - 0, /* Change RealName */ - 0, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_v, /* Vhost Mode */ - 1, /* +f */ - 0, /* +L */ - CMODE_j, /* Mode */ - 0, /* Mode */ - 1, - 1, /* 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "v", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - CAPAB_TSMODE, /* TSMODE */ - CAPAB_UNCONNECT, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - 0, /* ZIP */ - CAPAB_BURST, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - CAPAB_DKEY, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - CAPAB_DOZIP, /* DOZIP */ - 0, 0, 0} -}; - - -void solidircd_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'a': - if (UnRestrictSAdmin) { - break; - } - if (add && !is_services_admin(user)) { - common_svsmode(user, "-a", NULL); - user->mode &= ~UMODE_a; - } - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - - if (WallOper) - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - display_news(user, NEWS_OPER); - - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'v': - update_host(user); - break; - } - } -} - - -unsigned long umodes[128] = { - 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, UMODE_C, /* A B C */ - UMODE_D, 0, UMODE_F, /* D E F */ - 0, 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 */ - 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 */ - UMODE_v, UMODE_w, UMODE_x, /* v w x */ - UMODE_y, /* y */ - UMODE_z, /* z */ - 0, 0, 0, /* { | } */ - 0, 0 /* ~ � */ -}; - -char myCsmodes[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, - 'h', - 0, 0, 0, 0, - 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -CMMode myCmmodes[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}, /* 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}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {CMODE_j, 0, set_flood, cs_set_flood}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'j', CMODE_j, 0, get_flood, cs_get_flood}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - -void solidircd_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (ircdcap->tsmode) { - if (uplink_capab & ircdcap->tsmode) { - send_cmd(source, "MODE %s 0 %s", dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } -} - -/* SVSHOLD - set */ -void solidircd_cmd_svshold(const char *nick) -{ - send_cmd(ServerName, "SVSHOLD %s %d :%s", nick, NSReleaseTimeout, - "Being held for registered user"); -} - -/* SVSHOLD - release */ -void solidircd_cmd_release_svshold(const char *nick) -{ - send_cmd(ServerName, "SVSHOLD %s 0", nick); -} - -/* SVSMODE -b */ -void solidircd_cmd_unban(const char *name, const char *nick) -{ - solidircd_cmd_svsmode_chan(name, "-b", nick); -} - - -/* SVSMODE channel modes */ - -void solidircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - if (nick) { - send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); - } else { - send_cmd(ServerName, "SVSMODE %s %s", name, mode); - } -} - -void solidircd_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); -} - -/* EVENT: SJOIN */ -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -/* -** NICK - new -** source = NULL -** parv[0] = nickname -** parv[1] = hopcount -** parv[2] = timestamp -** parv[3] = modes -** parv[4] = username -** parv[5] = hostname -** parv[6] = server -** parv[7] = servicestamp -** parv[8] = IP -** parv[9] = info -** NICK - change -** source = oldnick -** parv[0] = new nickname -** parv[1] = hopcount -*/ -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), - strtoul(av[8], NULL, 0), NULL, NULL); - if (user) { - anope_set_umode(user, 1, &av[3]); - } - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -/* EVENT : CAPAB */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -/* EVENT : OS */ -int anope_event_os(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_OperServ, av[0]); - return MOD_CONT; -} - -/* EVENT : NS */ -int anope_event_ns(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_NickServ, av[0]); - return MOD_CONT; -} - -/* EVENT : MS */ -int anope_event_ms(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_MemoServ, av[0]); - return MOD_CONT; -} - -/* EVENT : HS */ -int anope_event_hs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_HostServ, av[0]); - return MOD_CONT; -} - -/* EVENT : CS */ -int anope_event_cs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_ChanServ, av[0]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+","-"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", anope_event_null); 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", 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); - 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_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); - m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); - m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); - m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); - m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); - m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSZLINE", anope_event_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); - m = createMessage("SVHOST", anope_event_vs); addCoreMessage(IRCD,m); - m = createMessage("ELMER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILLY", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SHUN", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("NORMAL", anope_event_null); addCoreMessage(IRCD,m); -} - -/* *INDENT-ON* */ - - -int anope_event_vs(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: SVHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; - -} - -/* SQLINE */ -void solidircd_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -/* UNSGLINE */ -void solidircd_cmd_unsgline(const char *mask) -{ - send_cmd(NULL, "UNSGLINE 0 :%s", mask); -} - -/* UNSZLINE */ -void solidircd_cmd_unszline(const char *mask) -{ - send_cmd(NULL, "UNSZLINE 0 %s", mask); -} - -/* SZLINE */ -void solidircd_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "SZLINE %s :%s", mask, reason); -} - -/* SVSNOOP */ -void SolidIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void solidircd_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -/* SGLINE */ -void solidircd_cmd_sgline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); -} - -/* RAKILL */ -void SolidIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - -/* PART */ -void solidircd_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -/* TOPIC */ -void solidircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -/* UNSQLINE */ -void solidircd_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -/* JOIN - SJOIN */ -void solidircd_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); -} - -/* AKILL */ -/* parv[1]=host - * parv[2]=user - * parv[3]=length - * parv[4]=akiller - * parv[5]=time set - * parv[6]=reason - */ -void solidircd_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, - (long int) time(NULL), reason); -} - -/* SVSKILL */ -/* parv[0] = servername - * parv[1] = client - * parv[2] = nick stamp - * parv[3] = kill message - */ -/* - Note: if the stamp is null 0, the below usage is correct of Bahamut -*/ -void solidircd_cmd_svskill(const char *source, const char *user, const char *buf) -{ - - if (!source || !user || !buf) { - return; - } - - send_cmd(source, "SVSKILL %s :%s", user, buf); -} - -/* SVSMODE */ -/* parv[0] - sender - * parv[1] - nick - * parv[2] - TS (or mode, depending on svs version) - * parv[3] - mode (or services id if old svs version) - * parv[4] - optional arguement (services id) - */ -void solidircd_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, - (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), - (ac == 2 ? av[1] : "")); -} - -/* SQUIT */ -/* - * parv[0] = sender prefix - * parv[1] = server name - * parv[2] = comment -*/ -void solidircd_cmd_squit(const char *servname, const char *message) -{ - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* PONG */ -void solidircd_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -void solidircd_cmd_burst() -{ - send_cmd(NULL, "BURST"); -} - - -/* - * 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 solidircd_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); -} - -/* PASS */ -void solidircd_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -/* SERVER */ -void solidircd_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, ServerDesc); -} - -/* CAPAB */ -void solidircd_cmd_capab() -{ - /* CAPAB SSJOIN NOQUIT BURST UNCONNECT ZIP NICKIP TSMODE */ - send_cmd(NULL, "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE"); -} - -void solidircd_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) { - solidircd_cmd_pass(RemotePassword); - } else if (servernum == 2) { - solidircd_cmd_pass(RemotePassword2); - } else if (servernum == 3) { - solidircd_cmd_pass(RemotePassword3); - } - solidircd_cmd_capab(); - solidircd_cmd_server(ServerName, 1, ServerDesc); - solidircd_cmd_svinfo(); - solidircd_cmd_burst(); -} - -/* EVENT : SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - char *uplink; - - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - -/* EVENT : PRIVMSG */ -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -/* EVENT : 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 - */ -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - -/* EVENT: MODE */ -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - -/* EVENT: KILL */ -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -/* EVENT: KICK */ -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - -/* EVENT: JOIN */ -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -/* EVENT: MOTD */ -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -void solidircd_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - - if (!buf) { - return; - } - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - -/* NOTICE */ -void solidircd_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - solidircd_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void solidircd_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void solidircd_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void solidircd_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void solidircd_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void solidircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -/* GLOBOPS */ -void solidircd_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* 391 */ -void solidircd_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void solidircd_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void solidircd_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void solidircd_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void solidircd_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void solidircd_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void solidircd_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void solidircd_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void solidircd_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void solidircd_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void solidircd_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void solidircd_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void solidircd_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, ServiceUser, ServiceHost, - ServerName, name); - solidircd_cmd_sqline(nick, "Reserved for services"); -} - -void solidircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void solidircd_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void solidircd_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void solidircd_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void solidircd_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -/* INVITE */ -void solidircd_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* QUIT */ -void solidircd_cmd_quit(const char *source, const char *buf) -{ - - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - solidircd_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -void solidircd_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s)-- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); - - -} - -void solidircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); - solidircd_cmd_sqline(nick, "Reserved for services"); -} - -/* SVSNICK */ -/* parv[0] = sender - * parv[1] = old nickname - * parv[2] = new nickname - * parv[3] = timestamp - */ -void solidircd_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -void solidircd_cmd_guest_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); -} - -void solidircd_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - -void solidircd_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(ServerName, "SVHOST %s %s", nick, vhost); -} - - -void solidircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - send_cmd(s_HostServ, "SVSMODE %s +v", nick); - solidircd_cmd_chghost(nick, vhost); -} - -void solidircd_cmd_vhost_off(User * u) -{ - send_cmd(s_HostServ, "SVSMODE %s -v", u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void solidircd_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, - (unsigned long int) ts); -} - - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void solidircd_cmd_nc_change(User * u) -{ - common_svsmode(u, "+d", "1"); -} - -/* SVSMODE +d */ -void solidircd_cmd_svid_umode2(User * u, const char *ts) -{ - /* not used by bahamut ircds */ -} - - -void solidircd_cmd_svid_umode3(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -/* NICK */ -void solidircd_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s :%ld", newnick, (long int) time(NULL)); -} - -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_sqline(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - - -int anope_event_gnotice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -void solidircd_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Can not find any reference to these in Bahamut */ -} - -void solidircd_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Can not find any reference to these in Bahamut */ -} - -void solidircd_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -void solidircd_cmd_eob() -{ - send_cmd(NULL, "BURST 0"); -} - -int anope_event_burst(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver(servlist, source); - if (!ac) { - /* for future use - start burst */ - } else { - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - } - return MOD_CONT; -} - -int anope_event_luserslock(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int solidircd_flood_mode_check(const 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 solidircd_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - solidircd_cmd_squit(jserver, rbuf); - solidircd_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void solidircd_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int solidircd_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int solidircd_valid_chan(const char *chan) -{ - /* no hard coded invalid chan*/ - return 1; -} - - -void solidircd_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "%s NOTICE :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(solidircd_cmd_topic); - pmodule_cmd_vhost_off(solidircd_cmd_vhost_off); - pmodule_cmd_akill(solidircd_cmd_akill); - pmodule_cmd_svskill(solidircd_cmd_svskill); - pmodule_cmd_svsmode(solidircd_cmd_svsmode); - pmodule_cmd_372(solidircd_cmd_372); - pmodule_cmd_372_error(solidircd_cmd_372_error); - pmodule_cmd_375(solidircd_cmd_375); - pmodule_cmd_376(solidircd_cmd_376); - pmodule_cmd_nick(solidircd_cmd_nick); - pmodule_cmd_guest_nick(solidircd_cmd_guest_nick); - pmodule_cmd_mode(solidircd_cmd_mode); - pmodule_cmd_bot_nick(solidircd_cmd_bot_nick); - pmodule_cmd_kick(solidircd_cmd_kick); - pmodule_cmd_notice_ops(solidircd_cmd_notice_ops); - pmodule_cmd_notice(solidircd_cmd_notice); - pmodule_cmd_notice2(solidircd_cmd_notice2); - pmodule_cmd_privmsg(solidircd_cmd_privmsg); - pmodule_cmd_privmsg2(solidircd_cmd_privmsg2); - pmodule_cmd_serv_notice(solidircd_cmd_serv_notice); - pmodule_cmd_serv_privmsg(solidircd_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(solidircd_cmd_bot_chan_mode); - pmodule_cmd_351(solidircd_cmd_351); - pmodule_cmd_quit(solidircd_cmd_quit); - pmodule_cmd_pong(solidircd_cmd_pong); - pmodule_cmd_join(solidircd_cmd_join); - pmodule_cmd_unsqline(solidircd_cmd_unsqline); - pmodule_cmd_invite(solidircd_cmd_invite); - pmodule_cmd_part(solidircd_cmd_part); - pmodule_cmd_391(solidircd_cmd_391); - pmodule_cmd_250(solidircd_cmd_250); - pmodule_cmd_307(solidircd_cmd_307); - pmodule_cmd_311(solidircd_cmd_311); - pmodule_cmd_312(solidircd_cmd_312); - pmodule_cmd_317(solidircd_cmd_317); - pmodule_cmd_219(solidircd_cmd_219); - pmodule_cmd_401(solidircd_cmd_401); - pmodule_cmd_318(solidircd_cmd_318); - pmodule_cmd_242(solidircd_cmd_242); - pmodule_cmd_243(solidircd_cmd_243); - pmodule_cmd_211(solidircd_cmd_211); - pmodule_cmd_global(solidircd_cmd_global); - pmodule_cmd_global_legacy(solidircd_cmd_global_legacy); - pmodule_cmd_sqline(solidircd_cmd_sqline); - pmodule_cmd_squit(solidircd_cmd_squit); - pmodule_cmd_svso(solidircd_cmd_svso); - pmodule_cmd_chg_nick(solidircd_cmd_chg_nick); - pmodule_cmd_svsnick(solidircd_cmd_svsnick); - pmodule_cmd_vhost_on(solidircd_cmd_vhost_on); - pmodule_cmd_connect(solidircd_cmd_connect); - pmodule_cmd_svshold(solidircd_cmd_svshold); - pmodule_cmd_release_svshold(solidircd_cmd_release_svshold); - pmodule_cmd_unsgline(solidircd_cmd_unsgline); - pmodule_cmd_unszline(solidircd_cmd_unszline); - pmodule_cmd_szline(solidircd_cmd_szline); - pmodule_cmd_sgline(solidircd_cmd_sgline); - pmodule_cmd_unban(solidircd_cmd_unban); - pmodule_cmd_svsmode_chan(solidircd_cmd_svsmode_chan); - pmodule_cmd_svid_umode(solidircd_cmd_svid_umode); - pmodule_cmd_nc_change(solidircd_cmd_nc_change); - pmodule_cmd_svid_umode2(solidircd_cmd_svid_umode2); - pmodule_cmd_svid_umode3(solidircd_cmd_svid_umode3); - pmodule_cmd_svsjoin(solidircd_cmd_svsjoin); - pmodule_cmd_svspart(solidircd_cmd_svspart); - pmodule_cmd_swhois(solidircd_cmd_swhois); - pmodule_cmd_eob(solidircd_cmd_eob); - pmodule_flood_mode_check(solidircd_flood_mode_check); - pmodule_cmd_jupe(solidircd_cmd_jupe); - pmodule_valid_nick(solidircd_valid_nick); - pmodule_valid_chan(solidircd_valid_chan); - pmodule_cmd_ctcp(solidircd_cmd_ctcp); - pmodule_set_umode(solidircd_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("Solid-IRCd 3.4.*"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set("+j"); - pmodule_ircd_flood_mode_char_remove("-j"); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/solidircd.h b/src/protocol/solidircd.h deleted file mode 100644 index 03686afd4..000000000 --- a/src/protocol/solidircd.h +++ /dev/null @@ -1,141 +0,0 @@ -/* SolidIRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#define UMODE_a 0x00000001 /* umode +a - Services Admin */ -#define UMODE_h 0x00000002 /* umode +h - Helper */ -#define UMODE_i 0x00000004 /* umode +i - Invisible */ -#define UMODE_o 0x00000008 /* umode +o - Oper */ -#define UMODE_r 0x00000010 /* umode +r - registered nick */ -#define UMODE_w 0x00000020 /* umode +w - Get wallops */ -#define UMODE_A 0x00000040 /* umode +A - Server Admin */ -#define UMODE_x 0x00000080 /* umode +x - Squelch with notice */ -#define UMODE_X 0x00000100 /* umode +X - Squelch without notice */ -#define UMODE_F 0x00000200 /* umode +F - no cptr->since message rate throttle */ -#define UMODE_j 0x00000400 /* umode +j - client rejection notices */ -#define UMODE_K 0x00000800 /* umode +K - U: lined server kill messages */ -#define UMODE_O 0x00001000 /* umode +O - Local Oper */ -#define UMODE_s 0x00002000 /* umode +s - Server notices */ -#define UMODE_c 0x00004000 /* umode +c - Client connections/exits */ -#define UMODE_k 0x00008000 /* umode +k - Server kill messages */ -#define UMODE_f 0x00010000 /* umode +f - Server flood messages */ -#define UMODE_y 0x00020000 /* umode +y - Stats/links */ -#define UMODE_d 0x00040000 /* umode +d - Debug info */ -#define UMODE_g 0x00080000 /* umode +g - Globops */ -#define UMODE_b 0x00100000 /* umode +b - Chatops */ -#define UMODE_n 0x00200000 /* umode +n - Routing Notices */ -#define UMODE_m 0x00400000 /* umode +m - spambot notices */ -#define UMODE_e 0x00800000 /* umode +e - oper notices for the above +D */ -#define UMODE_D 0x01000000 /* umode +D - Hidden dccallow umode */ -#define UMODE_I 0x02000000 /* umode +I - invisible oper (masked) */ -#define UMODE_C 0x04000000 /* umode +C - conops */ -#define UMODE_v 0x10000000 /* umode +v - hostmasking */ -#define UMODE_H 0x20000000 /* umode +H - Oper Hiding */ -#define UMODE_z 0x40000000 /* umode +z - SSL */ -#define UMODE_R 0x80000000 /* umode +R - No non registered msgs */ - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ -#define CMODE_c 0x00000400 /* Colors can't be used */ -#define CMODE_M 0x00000800 /* Non-regged nicks can't send messages */ -#define CMODE_j 0x00001000 /* join throttle */ -#define CMODE_S 0x00002000 /* SSL only */ -#define CMODE_N 0x00004000 /* No Nickname change */ -#define CMODE_O 0x00008000 /* Only opers can join */ - - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void solidircd_set_umode(User * user, int ac, const char **av); -void solidircd_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void solidircd_cmd_vhost_off(User * u); -void solidircd_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void solidircd_cmd_svskill(const char *source, const char *user, const char *buf); -void solidircd_cmd_svsmode(User * u, int ac, const char **av); -void solidircd_cmd_372(const char *source, const char *msg); -void solidircd_cmd_372_error(const char *source); -void solidircd_cmd_375(const char *source); -void solidircd_cmd_376(const char *source); -void solidircd_cmd_nick(const char *nick, const char *name, const char *modes); -void solidircd_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void solidircd_cmd_mode(const char *source, const char *dest, const char *buf); -void solidircd_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void solidircd_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void solidircd_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void solidircd_cmd_notice(const char *source, const char *dest, const char *buf); -void solidircd_cmd_notice2(const char *source, const char *dest, const char *msg); -void solidircd_cmd_privmsg(const char *source, const char *dest, const char *buf); -void solidircd_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void solidircd_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void solidircd_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void solidircd_cmd_bot_chan_mode(const char *nick, const char *chan); -void solidircd_cmd_351(const char *source); -void solidircd_cmd_quit(const char *source, const char *buf); -void solidircd_cmd_pong(const char *servname, const char *who); -void solidircd_cmd_join(const char *user, const char *channel, time_t chantime); -void solidircd_cmd_unsqline(const char *user); -void solidircd_cmd_invite(const char *source, const char *chan, const char *nick); -void solidircd_cmd_part(const char *nick, const char *chan, const char *buf); -void solidircd_cmd_391(const char *source, const char *timestr); -void solidircd_cmd_250(const char *buf); -void solidircd_cmd_307(const char *buf); -void solidircd_cmd_311(const char *buf); -void solidircd_cmd_312(const char *buf); -void solidircd_cmd_317(const char *buf); -void solidircd_cmd_219(const char *source, const char *letter); -void solidircd_cmd_401(const char *source, const char *who); -void solidircd_cmd_318(const char *source, const char *who); -void solidircd_cmd_242(const char *buf); -void solidircd_cmd_243(const char *buf); -void solidircd_cmd_211(const char *buf); -void solidircd_cmd_global(const char *source, const char *buf); -void solidircd_cmd_global_legacy(const char *source, const char *fmt); -void solidircd_cmd_sqline(const char *mask, const char *reason); -void solidircd_cmd_squit(const char *servname, const char *message); -void solidircd_cmd_svso(const char *source, const char *nick, const char *flag); -void solidircd_cmd_chg_nick(const char *oldnick, const char *newnick); -void solidircd_cmd_svsnick(const char *source, const char *guest, time_t when); -void solidircd_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void solidircd_cmd_connect(int servernum); -void solidircd_cmd_svshold(const char *nick); -void solidircd_cmd_release_svshold(const char *nick); -void solidircd_cmd_unsgline(const char *mask); -void solidircd_cmd_unszline(const char *mask); -void solidircd_cmd_szline(const char *mask, const char *reason, const char *whom); -void solidircd_cmd_sgline(const char *mask, const char *reason); -void solidircd_cmd_unban(const char *name, const char *nick); -void solidircd_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void solidircd_cmd_svid_umode(const char *nick, time_t ts); -void solidircd_cmd_nc_change(User * u); -void solidircd_cmd_svid_umode2(User * u, const char *ts); -void solidircd_cmd_svid_umode3(User * u, const char *ts); -void solidircd_cmd_eob(); -int solidircd_flood_mode_check(const char *value); -void solidircd_cmd_jupe(const char *jserver, const char *who, const char *reason); -int solidircd_valid_nick(const char *nick); -void solidircd_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class SolidIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/ultimate2.c b/src/protocol/ultimate2.c deleted file mode 100644 index b235e545e..000000000 --- a/src/protocol/ultimate2.c +++ /dev/null @@ -1,1733 +0,0 @@ -/* Ultimate IRCD 2 functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "ultimate2.h" - -IRCDVar myIrcd[] = { - {"UltimateIRCd 2.8.*", /* ircd name */ - "+S", /* nickserv mode */ - "+S", /* chanserv mode */ - "+S", /* memoserv mode */ - "+oS", /* hostserv mode */ - "+iS", /* operserv mode */ - "+S", /* botserv mode */ - "+Sh", /* helpserv mode */ - "+iS", /* Dev/Null mode */ - "+iS", /* Global mode */ - "+oS", /* nickserv alias mode */ - "+oS", /* chanserv alias mode */ - "+oS", /* memoserv alias mode */ - "+ioS", /* hostserv alias mode */ - "+ioS", /* operserv alias mode */ - "+oS", /* botserv alias mode */ - "+oS", /* helpserv alias mode */ - "+iS", /* Dev/Null alias mode */ - "+ioS", /* Global alias mode */ - "+pS", /* Used by BotServ Bots */ - 3, /* Chan Max Symbols */ - "-ilmnpstxAIKORS", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - NULL, /* Mode to set for chan admin */ - NULL, /* Mode to remove for chan admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "-r+d", /* Mode on Nick Change */ - 0, /* Supports SGlines */ - 1, /* Supports SQlines */ - 0, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - UMODE_p, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 0, /* Has Protect */ - 1, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 1, /* vidents */ - 0, /* svshold */ - 1, /* time stamp on mode */ - 0, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 0, /* VHOST ON NICK */ - 1, /* Change RealName */ - CMODE_K, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 1, /* +f */ - 1, /* +L */ - CMODE_f, - CMODE_L, - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - 0, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - CAPAB_KNOCK, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - CAPAB_TOKEN, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - CAPAB_CHANMODE, /* CHANMODE */ - 0, 0} -}; - -void ultiamte2_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'a': - if (add && !is_services_oper(user)) { - common_svsmode(user, "-a", NULL); - user->mode &= ~UMODE_a; - } - break; - case 'P': - if (add && !is_services_admin(user)) { - common_svsmode(user, "-P", NULL); - user->mode &= ~UMODE_P; - } - break; - case 'R': - if (add && !is_services_root(user)) { - common_svsmode(user, "-R", NULL); - user->mode &= ~UMODE_R; - } - break; - case 'd': - if (ac == 0) { - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - if (WallOper) { - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - } - display_news(user, NEWS_OPER); - if (is_services_oper(user)) { - common_svsmode(user, "+a", NULL); - user->mode |= UMODE_a; - } - if (is_services_admin(user)) { - common_svsmode(user, "+P", NULL); - user->mode |= UMODE_P; - } - if (is_services_root(user)) { - common_svsmode(user, "+R", NULL); - user->mode |= UMODE_R; - } - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - -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, - UMODE_R, - 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, - UMODE_p, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - UMODE_x, - 0, - 0, - 0, 0, 0, 0, 0 -}; - -char myCsmodes[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, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[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}, - {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {CMODE_I, 0, NULL, NULL}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {CMODE_L, 0, set_redirect, cs_set_redirect}, - {0}, /* M */ - {0}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {CMODE_f, 0, set_flood, cs_set_flood}, - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, /* i */ - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, /* m */ - {CMODE_n, 0, NULL, NULL}, /* n */ - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, /* p */ - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, /* s */ - {CMODE_t, 0, NULL, NULL}, /* t */ - {0}, /* u */ - {0}, /* v */ - {0}, /* w */ - {CMODE_x, 0, NULL, NULL}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'f', CMODE_f, 0, get_flood, cs_get_flood}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'x', CMODE_x, 0, NULL, NULL}, - {'A', CMODE_A, 0, NULL, NULL}, - {'I', CMODE_I, 0, NULL, NULL}, - {'K', CMODE_K, 0, NULL, NULL}, - {'L', CMODE_L, 0, get_redirect, cs_get_redirect}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {0}, /* a */ - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - -int anope_event_setname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_chgname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGNAME for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetRealname(av[1]); - return MOD_CONT; -} - -int anope_event_setident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETIDENT for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetIdent(av[0]); - return MOD_CONT; -} - -int anope_event_chgident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGIDENT for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetIdent(av[1]); - return MOD_CONT; -} - -int anope_event_sethost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[0]); - return MOD_CONT; -} - -int anope_event_nick(const char *source, int ac, const char **av) -{ - if (ac != 2) { - if (ac == 7) { - do_nick(source, av[0], av[3], av[4], av[5], av[6], - strtoul(av[2], NULL, 10), 0, 0, NULL, NULL); - } else { - do_nick(source, av[0], av[3], av[4], av[5], av[7], - strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0), 0, - NULL, NULL); - } - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int anope_event_chghost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_null); 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", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("*", anope_event_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", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("%", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("=", anope_event_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", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("V", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("]", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("GNOTICE", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("Z", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("[", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("Y", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("U", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("h", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("n", anope_event_mode); addCoreMessage(IRCD,m); - } - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("e", anope_event_null); addCoreMessage(IRCD,m); - } - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("f", anope_event_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", anope_event_null); addCoreMessage(IRCD,m); - if (UseTokens) { - m = createMessage("d", anope_event_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); - 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* */ - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -void ultimate2_cmd_sqline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -void UltimateIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void ultimate2_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void UltimateIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - - -void ultimate2_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void ultimate2_cmd_vhost_off(User * u) -{ - /* does not support removing vhosting */ -} - -void ultimate2_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - if (vIdent) { - send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); - } - send_cmd(s_HostServ, "SVSMODE %s +x", nick); - send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); -} - -void ultimate2_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -void ultimate2_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "JOIN %s", channel); -} - -void ultimate2_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s :%s", host, user, reason); -} - -void ultimate2_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "KILL %s :%s", user, buf); -} - -void ultimate2_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], - (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); -} - -void ultimate2_cmd_capab() -{ - if (UseTokens) { - send_cmd(NULL, "PROTOCTL NOQUIT TOKEN SILENCE KNOCK"); - } else { - send_cmd(NULL, "PROTOCTL NOQUIT SILENCE KNOCK"); - } -} - - -/* PASS */ -void ultimate2_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS :%s", pass); -} - -/* SERVER name hop descript */ -void ultimate2_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -/* PONG */ -void ultimate2_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -void ultimate2_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - ultimate2_cmd_capab(); - if (servernum == 1) - ultimate2_cmd_pass(RemotePassword); - if (servernum == 2) - ultimate2_cmd_pass(RemotePassword2); - if (servernum == 3) - ultimate2_cmd_pass(RemotePassword3); - ultimate2_cmd_server(ServerName, 1, ServerDesc); -} - -/* CHGHOST */ -void ultimate2_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); -} - -/* CHGIDENT */ -void ultimate2_cmd_chgident(const char *nick, const char *vIdent) -{ - if (!nick || !vIdent) { - return; - } - send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); -} - -/* INVITE */ -void ultimate2_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* PART */ -void ultimate2_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -/* 391 */ -void ultimate2_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void ultimate2_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void ultimate2_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void ultimate2_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void ultimate2_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void ultimate2_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void ultimate2_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void ultimate2_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void ultimate2_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void ultimate2_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void ultimate2_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void ultimate2_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -/* GLOBOPS */ -void ultimate2_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* SQUIT */ -void ultimate2_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* SVSO */ -void ultimate2_cmd_svso(const char *source, const char *nick, const char *flag) -{ - if (!source || !nick || !flag) { - return; - } - - send_cmd(source, "SVSO %s %s", nick, flag); -} - -/* NICK */ -void ultimate2_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* SVSNICK */ -void ultimate2_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -/* Events */ - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - ultimate2_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -void ultimate2_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void ultimate2_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void ultimate2_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - ultimate2_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void ultimate2_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void ultimate2_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void ultimate2_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void ultimate2_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void ultimate2_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -void ultimate2_cmd_nick(const char *nick, const char *name, const char *mode) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), ServiceUser, ServiceHost, ServerName, - name); - anope_cmd_mode(nick, nick, "%s", mode); - ultimate2_cmd_sqline(nick, "Reserved for services"); -} - -void ultimate2_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* QUIT */ -void ultimate2_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -void ultimate2_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "MODE %s %s", dest, buf); -} - -void ultimate2_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), user, host, ServerName, real); - anope_cmd_mode(nick, nick, "%s", modes); - ultimate2_cmd_sqline(nick, "Reserved for services"); -} - -void ultimate2_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void ultimate2_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void ultimate2_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void ultimate2_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -void ultimate2_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); -} - -/* SVSHOLD - set */ -void ultimate2_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void ultimate2_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* UNSGLINE */ -void ultimate2_cmd_unsgline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* UNSZLINE */ -void ultimate2_cmd_unszline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* SZLINE */ -void ultimate2_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - /* Not Supported by this IRCD */ -} - -/* SGLINE */ -void ultimate2_cmd_sgline(const char *mask, const char *reason) -{ - /* Not Supported by this IRCD */ -} - -void ultimate2_cmd_guest_nick(const char *nick, const char *user, const char *host, - char *real, char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, - (long int) time(NULL), user, host, ServerName, real); - anope_cmd_mode(nick, nick, "MODE %s %s", modes); -} - - -void ultimate2_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void ultimate2_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void ultimate2_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s +d 1", nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void ultimate2_cmd_nc_change(User * u) -{ - common_svsmode(u, "-r+d", "1"); -} - -/* SVSMODE +r */ -void ultimate2_cmd_svid_umode2(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -void ultimate2_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_vctrl(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_netinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_snetinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_sqline(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -/* -** svsjoin -** -** parv[0] - sender -** parv[1] - nick to make join -** parv[2] - channel(s) to join -*/ -void ultimate2_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - 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 ultimate2_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "SVSPART %s %s", nick, chan); -} - -void ultimate2_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -void ultimate2_cmd_eob() -{ - /* not supported */ -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int ultiamte2_flood_mode_check(const 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(const char *source, int ac, const char **av) -{ - if (av[0]) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -void ultimate2_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - ultimate2_cmd_squit(jserver, rbuf); - ultimate2_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void ultimate2_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int ultiamte2_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int ultiamte2_valid_chan(const char *chan) -{ - /* no hard coded invalid chans */ - return 1; -} - - -void ultimate2_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(ultimate2_cmd_topic); - pmodule_cmd_vhost_off(ultimate2_cmd_vhost_off); - pmodule_cmd_akill(ultimate2_cmd_akill); - pmodule_cmd_svskill(ultimate2_cmd_svskill); - pmodule_cmd_svsmode(ultimate2_cmd_svsmode); - pmodule_cmd_372(ultimate2_cmd_372); - pmodule_cmd_372_error(ultimate2_cmd_372_error); - pmodule_cmd_375(ultimate2_cmd_375); - pmodule_cmd_376(ultimate2_cmd_376); - pmodule_cmd_nick(ultimate2_cmd_nick); - pmodule_cmd_guest_nick(ultimate2_cmd_guest_nick); - pmodule_cmd_mode(ultimate2_cmd_mode); - pmodule_cmd_bot_nick(ultimate2_cmd_bot_nick); - pmodule_cmd_kick(ultimate2_cmd_kick); - pmodule_cmd_notice_ops(ultimate2_cmd_notice_ops); - pmodule_cmd_notice(ultimate2_cmd_notice); - pmodule_cmd_notice2(ultimate2_cmd_notice2); - pmodule_cmd_privmsg(ultimate2_cmd_privmsg); - pmodule_cmd_privmsg2(ultimate2_cmd_privmsg2); - pmodule_cmd_serv_notice(ultimate2_cmd_serv_notice); - pmodule_cmd_serv_privmsg(ultimate2_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(ultimate2_cmd_bot_chan_mode); - pmodule_cmd_351(ultimate2_cmd_351); - pmodule_cmd_quit(ultimate2_cmd_quit); - pmodule_cmd_pong(ultimate2_cmd_pong); - pmodule_cmd_join(ultimate2_cmd_join); - pmodule_cmd_unsqline(ultimate2_cmd_unsqline); - pmodule_cmd_invite(ultimate2_cmd_invite); - pmodule_cmd_part(ultimate2_cmd_part); - pmodule_cmd_391(ultimate2_cmd_391); - pmodule_cmd_250(ultimate2_cmd_250); - pmodule_cmd_307(ultimate2_cmd_307); - pmodule_cmd_311(ultimate2_cmd_311); - pmodule_cmd_312(ultimate2_cmd_312); - pmodule_cmd_317(ultimate2_cmd_317); - pmodule_cmd_219(ultimate2_cmd_219); - pmodule_cmd_401(ultimate2_cmd_401); - pmodule_cmd_318(ultimate2_cmd_318); - pmodule_cmd_242(ultimate2_cmd_242); - pmodule_cmd_243(ultimate2_cmd_243); - pmodule_cmd_211(ultimate2_cmd_211); - pmodule_cmd_global(ultimate2_cmd_global); - pmodule_cmd_global_legacy(ultimate2_cmd_global_legacy); - pmodule_cmd_sqline(ultimate2_cmd_sqline); - pmodule_cmd_squit(ultimate2_cmd_squit); - pmodule_cmd_svso(ultimate2_cmd_svso); - pmodule_cmd_chg_nick(ultimate2_cmd_chg_nick); - pmodule_cmd_svsnick(ultimate2_cmd_svsnick); - pmodule_cmd_vhost_on(ultimate2_cmd_vhost_on); - pmodule_cmd_connect(ultimate2_cmd_connect); - pmodule_cmd_svshold(ultimate2_cmd_svshold); - pmodule_cmd_release_svshold(ultimate2_cmd_release_svshold); - pmodule_cmd_unsgline(ultimate2_cmd_unsgline); - pmodule_cmd_unszline(ultimate2_cmd_unszline); - pmodule_cmd_szline(ultimate2_cmd_szline); - pmodule_cmd_sgline(ultimate2_cmd_sgline); - pmodule_cmd_unban(ultimate2_cmd_unban); - pmodule_cmd_svsmode_chan(ultimate2_cmd_svsmode_chan); - pmodule_cmd_svid_umode(ultimate2_cmd_svid_umode); - pmodule_cmd_nc_change(ultimate2_cmd_nc_change); - pmodule_cmd_svid_umode2(ultimate2_cmd_svid_umode2); - pmodule_cmd_svid_umode3(ultimate2_cmd_svid_umode3); - pmodule_cmd_svsjoin(ultimate2_cmd_svsjoin); - pmodule_cmd_svspart(ultimate2_cmd_svspart); - pmodule_cmd_swhois(ultimate2_cmd_swhois); - pmodule_cmd_eob(ultimate2_cmd_eob); - pmodule_flood_mode_check(ultiamte2_flood_mode_check); - pmodule_cmd_jupe(ultimate2_cmd_jupe); - pmodule_valid_nick(ultiamte2_valid_nick); - pmodule_valid_chan(ultiamte2_valid_chan); - pmodule_cmd_ctcp(ultimate2_cmd_ctcp); - pmodule_set_umode(ultiamte2_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("UltimateIRCd 2.8.2+"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set("+f"); - pmodule_ircd_flood_mode_char_remove("-f"); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/ultimate2.h b/src/protocol/ultimate2.h deleted file mode 100644 index ea43a8576..000000000 --- a/src/protocol/ultimate2.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Ultimate IRCD 2 functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_p 0x04000000 -#define UMODE_R 0x08000000 -#define UMODE_P 0x20000000 -#define UMODE_g 0x80000000 -#define UMODE_x 0x40000000 - - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_f 0x00000400 -#define CMODE_x 0x00000800 -#define CMODE_A 0x00001000 -#define CMODE_I 0x00002000 -#define CMODE_K 0x00004000 -#define CMODE_L 0x00008000 -#define CMODE_O 0x00010000 -#define CMODE_S 0x00020000 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void ultimate2_set_umode(User * user, int ac, const char **av); -void ultimate2_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void ultimate2_cmd_vhost_off(User * u); -void ultimate2_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void ultimate2_cmd_svskill(const char *source, const char *user, const char *buf); -void ultimate2_cmd_svsmode(User * u, int ac, const char **av); -void ultimate2_cmd_372(const char *source, const char *msg); -void ultimate2_cmd_372_error(const char *source); -void ultimate2_cmd_375(const char *source); -void ultimate2_cmd_376(const char *source); -void ultimate2_cmd_nick(const char *nick, const char *name, const char *modes); -void ultimate2_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ultimate2_cmd_mode(const char *source, const char *dest, const char *buf); -void ultimate2_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ultimate2_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void ultimate2_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void ultimate2_cmd_notice(const char *source, const char *dest, const char *buf); -void ultimate2_cmd_notice2(const char *source, const char *dest, const char *msg); -void ultimate2_cmd_privmsg(const char *source, const char *dest, const char *buf); -void ultimate2_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void ultimate2_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void ultimate2_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void ultimate2_cmd_bot_chan_mode(const char *nick, const char *chan); -void ultimate2_cmd_351(const char *source); -void ultimate2_cmd_quit(const char *source, const char *buf); -void ultimate2_cmd_pong(const char *servname, const char *who); -void ultimate2_cmd_join(const char *user, const char *channel, time_t chantime); -void ultimate2_cmd_unsqline(const char *user); -void ultimate2_cmd_invite(const char *source, const char *chan, const char *nick); -void ultimate2_cmd_part(const char *nick, const char *chan, const char *buf); -void ultimate2_cmd_391(const char *source, const char *timestr); -void ultimate2_cmd_250(const char *buf); -void ultimate2_cmd_307(const char *buf); -void ultimate2_cmd_311(const char *buf); -void ultimate2_cmd_312(const char *buf); -void ultimate2_cmd_317(const char *buf); -void ultimate2_cmd_219(const char *source, const char *letter); -void ultimate2_cmd_401(const char *source, const char *who); -void ultimate2_cmd_318(const char *source, const char *who); -void ultimate2_cmd_242(const char *buf); -void ultimate2_cmd_243(const char *buf); -void ultimate2_cmd_211(const char *buf); -void ultimate2_cmd_global(const char *source, const char *buf); -void ultimate2_cmd_global_legacy(const char *source, const char *fmt); -void ultimate2_cmd_sqline(const char *mask, const char *reason); -void ultimate2_cmd_squit(const char *servname, const char *message); -void ultimate2_cmd_svso(const char *source, const char *nick, const char *flag); -void ultimate2_cmd_chg_nick(const char *oldnick, const char *newnick); -void ultimate2_cmd_svsnick(const char *source, const char *guest, time_t when); -void ultimate2_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void ultimate2_cmd_connect(int servernum); -void ultimate2_cmd_svshold(const char *nick); -void ultimate2_cmd_release_svshold(const char *nick); -void ultimate2_cmd_unsgline(const char *mask); -void ultimate2_cmd_unszline(const char *mask); -void ultimate2_cmd_szline(const char *mask, const char *reason, const char *whom); -void ultimate2_cmd_sgline(const char *mask, const char *reason); -void ultimate2_cmd_unban(const char *name, const char *nick); -void ultimate2_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void ultimate2_cmd_svid_umode(const char *nick, time_t ts); -void ultimate2_cmd_nc_change(User * u); -void ultimate2_cmd_svid_umode2(User * u, const char *ts); -void ultimate2_cmd_svid_umode3(User * u, const char *ts); -void ultimate2_cmd_eob(); -int ultimate2_flood_mode_check(const char *value); -void ultimate2_cmd_jupe(const char *jserver, const char *who, const char *reason); -int ultimate2_valid_nick(const char *nick); -void ultimate2_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class UltimateIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/ultimate3.c b/src/protocol/ultimate3.c deleted file mode 100644 index e3a516ed3..000000000 --- a/src/protocol/ultimate3.c +++ /dev/null @@ -1,1817 +0,0 @@ -/* Ultimate IRCD 3 functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#include "services.h" -#include "pseudo.h" -#include "ultimate3.h" - -IRCDVar myIrcd[] = { - {"UltimateIRCd 3.0.*", /* ircd name */ - "+S", /* nickserv mode */ - "+S", /* chanserv mode */ - "+S", /* memoserv mode */ - "+o", /* hostserv mode */ - "+iS", /* operserv mode */ - "+S", /* botserv mode */ - "+Sh", /* helpserv mode */ - "+iS", /* Dev/Null mode */ - "+iS", /* Global mode */ - "+o", /* nickserv alias mode */ - "+o", /* chanserv alias mode */ - "+o", /* memoserv alias mode */ - "+io", /* hostserv alias mode */ - "+io", /* operserv alias mode */ - "+o", /* botserv alias mode */ - "+h", /* helpserv alias mode */ - "+i", /* Dev/Null alias mode */ - "+io", /* Global alias mode */ - "+S", /* Used by BotServ Bots */ - 5, /* Chan Max Symbols */ - "-ilmnpqstRKAO", /* Modes to Remove */ - "+o", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 0, /* Has Owner */ - NULL, /* Mode to set for an owner */ - NULL, /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "+d", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - UMODE_p, /* Protected Umode */ - 1, /* Has Admin */ - 1, /* Chan SQlines */ - 0, /* Quit on Kill */ - 1, /* SVSMODE unban */ - 0, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 0, /* vidents */ - 0, /* svshold */ - 1, /* time stamp on mode */ - 1, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 0, /* Change RealName */ - CMODE_K, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, /* +f Mode */ - 0, /* +L Mode */ - 1, /* On nick change check if they could be identified */ - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 1, /* Sglines are enforced */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - CAPAB_TSMODE, /* TSMODE */ - CAPAB_UNCONNECT, /* UNCONNECT */ - 0, /* NICKIP */ - CAPAB_NSJOIN, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - CAPAB_BURST, /* BURST */ - CAPAB_TS5, /* TS5 */ - 0, /* TS3 */ - CAPAB_DKEY, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - CAPAB_CLIENT, /* CLIENT */ - CAPAB_IPV6, /* IPV6 */ - CAPAB_SSJ5, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - CAPAB_DODKEY, /* DODKEY */ - CAPAB_DOZIP, /* DOZIP */ - 0, 0, 0} -}; - -void ultimate3_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'a': - if (add && !is_services_oper(user)) { - common_svsmode(user, "-a", NULL); - user->mode &= ~UMODE_a; - } - break; - case 'P': - if (add && !is_services_admin(user)) { - common_svsmode(user, "-P", NULL); - user->mode &= ~UMODE_P; - } - break; - case 'Z': - if (add && !is_services_root(user)) { - common_svsmode(user, "-Z", NULL); - user->mode &= ~UMODE_Z; - } - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - if (WallOper) { - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - } - display_news(user, NEWS_OPER); - if (is_services_oper(user)) { - common_svsmode(user, "+a", NULL); - user->mode |= UMODE_a; - } - if (is_services_admin(user)) { - common_svsmode(user, "+P", NULL); - user->mode |= UMODE_P; - } - if (is_services_root(user)) { - common_svsmode(user, "+Z", NULL); - user->mode |= UMODE_Z; - } - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - -unsigned long umodes[128] = { - 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, UMODE_R, /* 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 /* ~ � */ -}; - - -char myCsmodes[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 */ - 0, 0, 0, - 'h', /* (37) % Channel halfops */ - 0, 0, 0, 0, - 0, - - 'v', 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - -CBMode myCbmodes[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}, - {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {0}, /* H */ - {0}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, /* i */ - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, /* m */ - {CMODE_n, 0, NULL, NULL}, /* n */ - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, /* p */ - {CMODE_q, 0, NULL, NULL}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, /* s */ - {CMODE_t, 0, NULL, NULL}, /* t */ - {0}, /* u */ - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'q', CMODE_q, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'A', CMODE_A, 0, NULL, NULL}, - {'K', CMODE_K, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_admin}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {0}, /* q */ - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - -/* SVSMODE -b */ -void ultimate3_cmd_unban(const char *name, const char *nick) -{ - ultimate3_cmd_svsmode_chan(name, "-b", nick); -} - - -/* SVSMODE channel modes */ - -void ultimate3_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - if (nick) { - send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); - } else { - send_cmd(ServerName, "SVSMODE %s %s", name, mode); - } -} - -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - - -/* -** NICK - new -** source = NULL -** parv[0] = nickname -** parv[1] = hopcount -** parv[2] = timestamp -** parv[3] = modes -** parv[4] = username -** parv[5] = hostname -** parv[6] = server -** parv[7] = servicestamp -** parv[8] = IP -** parv[9] = info -** NICK - change -** source = oldnick -** parv[0] = new nickname -** parv[1] = hopcount -*/ -int anope_event_nick(const char *source, int ac, const char **av) -{ - if (ac != 2) { - User *user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, - 0), - strtoul(av[8], NULL, 0), "*", NULL); - if (user) - anope_set_umode(user, 1, &av[3]); - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int anope_event_sethost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: SETHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -/* -** CLIENT -** source = NULL -** parv[0] = nickname Trystan -** parv[1] = hopcount 1 -** parv[2] = timestamp 1090083810 -** parv[3] = modes +ix -** parv[4] = modes ? + -** parv[5] = username Trystan -** parv[6] = hostname c-24-2-101-227.client.comcast.net -** parv[7] = vhost 3223f75b.2b32ee69.client.comcast.net -** parv[8] = server WhiteRose.No.Eu.Shadow-Realm.org -** parv[9] = svid 0 -** parv[10] = ip 402810339 -** parv[11] = info Dreams are answers to questions not yet asked -*/ -int anope_event_client(const char *source, int ac, const char **av) -{ - if (ac != 2) { - User *user = do_nick(source, av[0], av[5], av[6], av[8], av[11], - strtoul(av[2], NULL, 10), strtoul(av[9], NULL, - 0), - strtoul(av[10], NULL, 0), av[7], NULL); - if (user) { - anope_set_umode(user, 1, &av[3]); - } - } - return MOD_CONT; -} - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("ADMIN","ADMINME","admin","deadmin","AUTOADMIN","+a","-a"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", 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", 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); - 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_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); - m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); - m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); - m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); - m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); - m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); - m = createMessage("NETINFO", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GCONNECT", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("NETGLOBAL", anope_event_netglobal); addCoreMessage(IRCD,m); - m = createMessage("CHATOPS", anope_event_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", anope_event_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); - m = createMessage("EOBURST", anope_event_eob); addCoreMessage(IRCD,m); -} - -/* *INDENT-ON* */ - - -void ultimate3_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -void ultimate3_cmd_unsgline(const char *mask) -{ - send_cmd(NULL, "UNSGLINE 0 :%s", mask); -} - -void ultimate3_cmd_unszline(const char *mask) -{ - send_cmd(NULL, "UNSZLINE 0 %s", mask); -} - -/* As of alpha27 (one after our offical support szline was removed */ -/* quote the changelog --- - Complete rewrite of the kline/akill/zline system. (s)zlines no longer exist. - K: lines set on IP addresses without username portions (or *) are treated as Z: lines used to be. -*/ -void ultimate3_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "AKILL %s * %d %s %ld :%s", mask, 86400 * 2, whom, - (long int) time(NULL), reason); - /* leaving this in here in case some legacy user asks for it */ - /* send_cmd(NULL, "SZLINE %s :%s", mask, reason); */ -} - -void UltimateIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void ultimate3_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void ultimate3_cmd_sgline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); -} - -void UltimateIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - -void ultimate3_cmd_vhost_off(User * u) -{ - send_cmd(s_HostServ, "SVSMODE %s -x", u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); -} - -void ultimate3_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - send_cmd(s_HostServ, "SVSMODE %s +x", nick); - send_cmd(ServerName, "SETHOST %s %s", nick, vhost); -} - -void ultimate3_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); -} - -void ultimate3_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, - (long int) time(NULL), reason); -} - -void ultimate3_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "SVSKILL %s :%s", user, buf); -} - - -void ultimate3_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, - (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), - (ac == 2 ? av[1] : "")); -} - -void anope_squit(char *servname, char *message) -{ - send_cmd(servname, "SQUIT %s :%s", servname, message); -} - -void anope_pong(char *servname) -{ - send_cmd(servname, "PONG %s", servname); -} - -/* Events */ - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - ultimate3_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - -/* EVENT : OS */ -int anope_event_os(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_OperServ, av[0]); - return MOD_CONT; -} - -/* EVENT : NS */ -int anope_event_ns(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_NickServ, av[0]); - return MOD_CONT; -} - -/* EVENT : MS */ -int anope_event_ms(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_MemoServ, av[0]); - return MOD_CONT; -} - -/* EVENT : HS */ -int anope_event_hs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_HostServ, av[0]); - return MOD_CONT; -} - -/* EVENT : CS */ -int anope_event_cs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_ChanServ, av[0]); - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -int anope_event_setname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_chgname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGNAME for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetRealname(av[1]); - return MOD_CONT; -} - -int anope_event_setident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETIDENT for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetIdent(av[0]); - return MOD_CONT; -} -int anope_event_chgident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGIDENT for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetIdent(av[1]); - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -void ultimate3_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void ultimate3_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void ultimate3_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void ultimate3_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void ultimate3_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -void ultimate3_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, - (long int) time(NULL), modes, ServiceUser, ServiceHost, - ServerName, name); - ultimate3_cmd_sqline(nick, "Reserved for services"); -} - -void ultimate3_cmd_guest_nick(const char *nick, const char *user, const char *host, - const char *real, const char *modes) -{ - send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); -} - -void ultimate3_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "MODE %s %s", dest, buf); -} - -void ultimate3_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "CLIENT %s 1 %ld %s + %s %s * %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); - ultimate3_cmd_sqline(nick, "Reserved for services"); -} - -void ultimate3_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void ultimate3_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void ultimate3_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - ultimate3_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void ultimate3_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void ultimate3_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void ultimate3_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void ultimate3_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void ultimate3_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -void ultimate3_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); -} - -void ultimate3_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule,version_build); - -} - -/* QUIT */ -void ultimate3_cmd_quit(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -/* PROTOCTL */ -void ultimate3_cmd_capab() -{ - send_cmd(NULL, - "CAPAB TS5 NOQUIT SSJ5 BURST UNCONNECT TSMODE NICKIP CLIENT"); -} - -/* PASS */ -void ultimate3_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -/* SERVER name hop descript */ -/* Unreal 3.2 actually sends some info about itself in the descript area */ -void ultimate3_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -/* PONG */ -void ultimate3_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* UNSQLINE */ -void ultimate3_cmd_unsqline(const char *user) -{ - if (!user) { - return; - } - send_cmd(NULL, "UNSQLINE %s", user); -} - -/* CHGHOST */ -void ultimate3_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); -} - -/* CHGIDENT */ -void ultimate3_cmd_chgident(const char *nick, const char *vIdent) -{ - if (!nick || !vIdent) { - return; - } - send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); -} - -/* INVITE */ -void ultimate3_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* PART */ -void ultimate3_cmd_part(const char *nick, const char *chan, const char *buf) -{ - - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -/* 391 */ -void ultimate3_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void ultimate3_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void ultimate3_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void ultimate3_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void ultimate3_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void ultimate3_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void ultimate3_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void ultimate3_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void ultimate3_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void ultimate3_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void ultimate3_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void ultimate3_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -/* GLOBOPS */ -void ultimate3_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* SQUIT */ -void ultimate3_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* SVSO */ -void ultimate3_cmd_svso(const char *source, const char *nick, const char *flag) -{ - if (!source || !nick || !flag) { - return; - } - - send_cmd(source, "SVSO %s %s", nick, flag); -} - -/* NICK */ -void ultimate3_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* SVSNICK */ -void ultimate3_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -/* Functions that use serval cmd functions */ -/* - * 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 ultimate3_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); -} - -void ultimate3_cmd_burst() -{ - send_cmd(NULL, "BURST"); -} - - -void ultimate3_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) { - ultimate3_cmd_pass(RemotePassword); - } - if (servernum == 2) { - ultimate3_cmd_pass(RemotePassword2); - } - if (servernum == 3) { - ultimate3_cmd_pass(RemotePassword3); - } - ultimate3_cmd_capab(); - ultimate3_cmd_server(ServerName, 1, ServerDesc); - ultimate3_cmd_svinfo(); - ultimate3_cmd_burst(); -} - -/* SVSHOLD - set */ -void ultimate3_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void ultimate3_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void ultimate3_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, - (unsigned long int) ts); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void ultimate3_cmd_nc_change(User * u) -{ - common_svsmode(u, "+d", "1"); -} - -/* SVSMODE +d */ -void ultimate3_cmd_svid_umode2(User * u, const char *ts) -{ - /* not used by bahamut ircds */ -} - -void ultimate3_cmd_svid_umode3(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } - -} - -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_gnotice(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_netctrl(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -int anope_event_sqline(const char *source, int ac, const char **av) -{ - /* currently not used but removes the message : unknown message from server */ - return MOD_CONT; -} - -void ultimate3_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - /* Not Supported by this IRCD */ -} - -void ultimate3_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - /* Not Supported by this IRCD */ -} - -void ultimate3_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - - -void ultimate3_cmd_eob() -{ - send_cmd(NULL, "BURST 0"); -} - -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - - -int anope_event_eob(const char *source, int ac, const char **av) -{ - Server *s; - - if (ac == 1) { - s = findserver(servlist, av[0]); - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - } - return MOD_CONT; -} - - -int anope_event_burst(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver(servlist, source); - if (!ac) { - /* for future use - start burst */ - } else { - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - } - return MOD_CONT; -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(char *source, int ac, char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_netglobal(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_invite(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int ultiamte3_flood_mode_check(const char *value) -{ - return 0; -} - -void ultimate3_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - ultimate3_cmd_squit(jserver, rbuf); - ultimate3_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void ultimate3_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int ultiamte3_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int ultiamte3_valid_chan(const char *chan) -{ - /* no hard coded invalid chans */ - return 1; -} - - -void ultimate3_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(ultimate3_cmd_topic); - pmodule_cmd_vhost_off(ultimate3_cmd_vhost_off); - pmodule_cmd_akill(ultimate3_cmd_akill); - pmodule_cmd_svskill(ultimate3_cmd_svskill); - pmodule_cmd_svsmode(ultimate3_cmd_svsmode); - pmodule_cmd_372(ultimate3_cmd_372); - pmodule_cmd_372_error(ultimate3_cmd_372_error); - pmodule_cmd_375(ultimate3_cmd_375); - pmodule_cmd_376(ultimate3_cmd_376); - pmodule_cmd_nick(ultimate3_cmd_nick); - pmodule_cmd_guest_nick(ultimate3_cmd_guest_nick); - pmodule_cmd_mode(ultimate3_cmd_mode); - pmodule_cmd_bot_nick(ultimate3_cmd_bot_nick); - pmodule_cmd_kick(ultimate3_cmd_kick); - pmodule_cmd_notice_ops(ultimate3_cmd_notice_ops); - pmodule_cmd_notice(ultimate3_cmd_notice); - pmodule_cmd_notice2(ultimate3_cmd_notice2); - pmodule_cmd_privmsg(ultimate3_cmd_privmsg); - pmodule_cmd_privmsg2(ultimate3_cmd_privmsg2); - pmodule_cmd_serv_notice(ultimate3_cmd_serv_notice); - pmodule_cmd_serv_privmsg(ultimate3_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(ultimate3_cmd_bot_chan_mode); - pmodule_cmd_351(ultimate3_cmd_351); - pmodule_cmd_quit(ultimate3_cmd_quit); - pmodule_cmd_pong(ultimate3_cmd_pong); - pmodule_cmd_join(ultimate3_cmd_join); - pmodule_cmd_unsqline(ultimate3_cmd_unsqline); - pmodule_cmd_invite(ultimate3_cmd_invite); - pmodule_cmd_part(ultimate3_cmd_part); - pmodule_cmd_391(ultimate3_cmd_391); - pmodule_cmd_250(ultimate3_cmd_250); - pmodule_cmd_307(ultimate3_cmd_307); - pmodule_cmd_311(ultimate3_cmd_311); - pmodule_cmd_312(ultimate3_cmd_312); - pmodule_cmd_317(ultimate3_cmd_317); - pmodule_cmd_219(ultimate3_cmd_219); - pmodule_cmd_401(ultimate3_cmd_401); - pmodule_cmd_318(ultimate3_cmd_318); - pmodule_cmd_242(ultimate3_cmd_242); - pmodule_cmd_243(ultimate3_cmd_243); - pmodule_cmd_211(ultimate3_cmd_211); - pmodule_cmd_global(ultimate3_cmd_global); - pmodule_cmd_global_legacy(ultimate3_cmd_global_legacy); - pmodule_cmd_sqline(ultimate3_cmd_sqline); - pmodule_cmd_squit(ultimate3_cmd_squit); - pmodule_cmd_svso(ultimate3_cmd_svso); - pmodule_cmd_chg_nick(ultimate3_cmd_chg_nick); - pmodule_cmd_svsnick(ultimate3_cmd_svsnick); - pmodule_cmd_vhost_on(ultimate3_cmd_vhost_on); - pmodule_cmd_connect(ultimate3_cmd_connect); - pmodule_cmd_svshold(ultimate3_cmd_svshold); - pmodule_cmd_release_svshold(ultimate3_cmd_release_svshold); - pmodule_cmd_unsgline(ultimate3_cmd_unsgline); - pmodule_cmd_unszline(ultimate3_cmd_unszline); - pmodule_cmd_szline(ultimate3_cmd_szline); - pmodule_cmd_sgline(ultimate3_cmd_sgline); - pmodule_cmd_unban(ultimate3_cmd_unban); - pmodule_cmd_svsmode_chan(ultimate3_cmd_svsmode_chan); - pmodule_cmd_svid_umode(ultimate3_cmd_svid_umode); - pmodule_cmd_nc_change(ultimate3_cmd_nc_change); - pmodule_cmd_svid_umode2(ultimate3_cmd_svid_umode2); - pmodule_cmd_svid_umode3(ultimate3_cmd_svid_umode3); - pmodule_cmd_svsjoin(ultimate3_cmd_svsjoin); - pmodule_cmd_svspart(ultimate3_cmd_svspart); - pmodule_cmd_swhois(ultimate3_cmd_swhois); - pmodule_cmd_eob(ultimate3_cmd_eob); - pmodule_flood_mode_check(ultiamte3_flood_mode_check); - pmodule_cmd_jupe(ultimate3_cmd_jupe); - pmodule_valid_nick(ultiamte3_valid_nick); - pmodule_valid_chan(ultiamte3_valid_chan); - pmodule_cmd_ctcp(ultimate3_cmd_ctcp); - pmodule_set_umode(ultimate3_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion - ("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("UltimateIRCd 3.0.0.a26+"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/ultimate3.h b/src/protocol/ultimate3.h deleted file mode 100644 index b14133765..000000000 --- a/src/protocol/ultimate3.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Ultimate IRCD 3.0 functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_0 0x00000080 -#define UMODE_Z 0x00000100 /* umode +Z - Services Root Admin */ -#define UMODE_S 0x00000200 /* umode +S - Services Client */ -#define UMODE_D 0x00000400 /* umode +D - has seen dcc warning message */ -#define UMODE_d 0x00000800 /* umode +d - user is deaf to channel messages */ -#define UMODE_W 0x00001000 /* umode +d - user is deaf to channel messages */ -#define UMODE_p 0x04000000 -#define UMODE_P 0x20000000 /* umode +P - Services Admin */ -#define UMODE_x 0x40000000 -#define UMODE_R 0x80000000 - - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ -#define CMODE_c 0x00000400 /* Colors can't be used */ -#define CMODE_A 0x00000800 -#define CMODE_N 0x00001000 -#define CMODE_S 0x00002000 -#define CMODE_K 0x00004000 -#define CMODE_O 0x00008000 /* Only opers can join */ -#define CMODE_q 0x00010000 /* No Quit Reason */ -#define CMODE_M 0x00020000 /* Non-regged nicks can't send messages */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void ultimate3_set_umode(User * user, int ac, const char **av); -void ultimate3_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void ultimate3_cmd_vhost_off(User * u); -void ultimate3_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void ultimate3_cmd_svskill(const char *source, const char *user, const char *buf); -void ultimate3_cmd_svsmode(User * u, int ac, const char **av); -void ultimate3_cmd_372(const char *source, const char *msg); -void ultimate3_cmd_372_error(const char *source); -void ultimate3_cmd_375(const char *source); -void ultimate3_cmd_376(const char *source); -void ultimate3_cmd_nick(const char *nick, const char *name, const char *modes); -void ultimate3_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ultimate3_cmd_mode(const char *source, const char *dest, const char *buf); -void ultimate3_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void ultimate3_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void ultimate3_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void ultimate3_cmd_notice(const char *source, const char *dest, const char *buf); -void ultimate3_cmd_notice2(const char *source, const char *dest, const char *msg); -void ultimate3_cmd_privmsg(const char *source, const char *dest, const char *buf); -void ultimate3_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void ultimate3_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void ultimate3_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void ultimate3_cmd_bot_chan_mode(const char *nick, const char *chan); -void ultimate3_cmd_351(const char *source); -void ultimate3_cmd_quit(const char *source, const char *buf); -void ultimate3_cmd_pong(const char *servname, const char *who); -void ultimate3_cmd_join(const char *user, const char *channel, time_t chantime); -void ultimate3_cmd_unsqline(const char *user); -void ultimate3_cmd_invite(const char *source, const char *chan, const char *nick); -void ultimate3_cmd_part(const char *nick, const char *chan, const char *buf); -void ultimate3_cmd_391(const char *source, const char *timestr); -void ultimate3_cmd_250(const char *buf); -void ultimate3_cmd_307(const char *buf); -void ultimate3_cmd_311(const char *buf); -void ultimate3_cmd_312(const char *buf); -void ultimate3_cmd_317(const char *buf); -void ultimate3_cmd_219(const char *source, const char *letter); -void ultimate3_cmd_401(const char *source, const char *who); -void ultimate3_cmd_318(const char *source, const char *who); -void ultimate3_cmd_242(const char *buf); -void ultimate3_cmd_243(const char *buf); -void ultimate3_cmd_211(const char *buf); -void ultimate3_cmd_global(const char *source, const char *buf); -void ultimate3_cmd_global_legacy(const char *source, const char *fmt); -void ultimate3_cmd_sqline(const char *mask, const char *reason); -void ultimate3_cmd_squit(const char *servname, const char *message); -void ultimate3_cmd_svso(const char *source, const char *nick, const char *flag); -void ultimate3_cmd_chg_nick(const char *oldnick, const char *newnick); -void ultimate3_cmd_svsnick(const char *source, const char *guest, time_t when); -void ultimate3_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void ultimate3_cmd_connect(int servernum); -void ultimate3_cmd_svshold(const char *nick); -void ultimate3_cmd_release_svshold(const char *nick); -void ultimate3_cmd_unsgline(const char *mask); -void ultimate3_cmd_unszline(const char *mask); -void ultimate3_cmd_szline(const char *mask, const char *reason, const char *whom); -void ultimate3_cmd_sgline(const char *mask, const char *reason); -void ultimate3_cmd_unban(const char *name, const char *nick); -void ultimate3_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void ultimate3_cmd_svid_umode(const char *nick, time_t ts); -void ultimate3_cmd_nc_change(User * u); -void ultimate3_cmd_svid_umode2(User * u, const char *ts); -void ultimate3_cmd_svid_umode3(User * u, const char *ts); -void ultimate3_cmd_eob(); -int ultimate3_flood_mode_check(const char *value); -void ultimate3_cmd_jupe(const char *jserver, const char *who, const char *reason); -int ultimate3_valid_nick(const char *nick); -void ultimate3_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class UltimateIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/unreal31.c b/src/protocol/unreal31.c deleted file mode 100644 index 3b3feb39c..000000000 --- a/src/protocol/unreal31.c +++ /dev/null @@ -1,1591 +0,0 @@ -/* Unreal IRCD 3.1.x functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#include "services.h" -#include "pseudo.h" -#include "unreal31.h" - -IRCDVar myIrcd[] = { - {"UnrealIRCd 3.1.x", /* ircd name */ - "+oS", /* nickserv mode */ - "+oS", /* chanserv mode */ - "+oS", /* memoserv mode */ - "+oS", /* hostserv mode */ - "+ioS", /* operserv mode */ - "+oS", /* botserv mode */ - "+oS", /* helpserv mode */ - "+iS", /* Dev/Null mode */ - "+ioS", /* Global mode */ - "+oS", /* nickserv alias mode */ - "+oS", /* chanserv alias mode */ - "+oS", /* memoserv alias mode */ - "+ioS", /* hostserv alias mode */ - "+ioS", /* operserv alias mode */ - "+oS", /* botserv alias mode */ - "+oS", /* helpserv alias mode */ - "+iS", /* Dev/Null alias mode */ - "+ioS", /* Global alias mode */ - "+qS", /* Used by BotServ Bots */ - 5, /* Chan Max Symbols */ - "-cilmnpstuzACGHKNOQRSV", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 1, /* Has Owner */ - "+q", /* Mode to set for an owner */ - "-q", /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "-r+d", /* Mode on Nick Change */ - 0, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 1, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 0, /* Has Admin */ - 0, /* Chan SQlines */ - 0, /* Quit on Kill */ - 0, /* SVSMODE unban */ - 1, /* Has Protect */ - 1, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 1, /* vidents */ - 1, /* svshold */ - 1, /* time stamp on mode */ - 0, /* NICKIP */ - 1, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 1, /* Change RealName */ - CMODE_K, /* No Knock */ - CMODE_A, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 1, /* +f */ - 1, /* +L */ - CMODE_f, - CMODE_L, - 0, - 1, /* No Knock requires +i */ - NULL, /* CAPAB Chan Modes */ - 0, /* We support Unreal TOKENS */ - 1, /* TOKENS are CASE inSensitive */ - 0, /* TIME STAMPS are BASE64 */ - 0, /* +I support */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 0, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - 0, /* TSMODE */ - 0, /* UNCONNECT */ - 0, /* NICKIP */ - 0, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - 0, /* BURST */ - 0, /* TS5 */ - 0, /* TS3 */ - 0, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - CAPAB_TOKEN, /* TOKEN */ - 0, /* VHOST */ - CAPAB_SSJ3, /* SSJ3 */ - CAPAB_NICK2, /* NICK2 */ - CAPAB_UMODE2, /* UMODE2 */ - CAPAB_VL, /* VL */ - CAPAB_TLKEXT, /* TLKEXT */ - 0, /* DODKEY */ - 0, /* DOZIP */ - 0, - 0, 0} -}; - -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 -}; - - -char myCsmodes[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, - 'h', /* (37) % Channel halfops */ - 0, - 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, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a', 0 -}; - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - - -CBMode myCbmodes[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}, - {CMODE_A, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* B */ - {CMODE_C, 0, NULL, NULL}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {CMODE_G, 0, NULL, NULL}, /* G */ - {CMODE_H, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* I */ - {0}, /* J */ - {CMODE_K, 0, NULL, NULL}, /* K */ - {CMODE_L, 0, set_redirect, cs_set_redirect}, - {0}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {0}, /* P */ - {CMODE_Q, 0, NULL, NULL}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {CMODE_V, 0, NULL, NULL}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {CMODE_f, 0, set_flood, cs_set_flood}, - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {CMODE_u, 0, NULL, NULL}, - {0}, /* v */ - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {CMODE_z, 0, NULL, NULL}, - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'f', CMODE_f, 0, get_flood, cs_get_flood}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'u', CMODE_u, 0, NULL, NULL}, - {'z', CMODE_z, 0, NULL, NULL}, - {'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}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'Q', CMODE_Q, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {'V', CMODE_V, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {CUS_OWNER, 0, check_valid_op}, - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - -void unreal_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - if (WallOper) { - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - } - display_news(user, NEWS_OPER); - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", anope_event_null); 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", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", anope_event_null); 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("USER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("PROTOCTL", anope_event_capab); addCoreMessage(IRCD,m); - m = createMessage("CHGHOST", anope_event_chghost); addCoreMessage(IRCD,m); - m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); - m = createMessage("CHGNAME", anope_event_chgname); addCoreMessage(IRCD,m); - m = createMessage("NETINFO", anope_event_null); addCoreMessage(IRCD,m); - 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); - m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); - m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); -} - -/* *INDENT-ON* */ - -/* Event: PROTOCTL */ -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -void UnrealIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void unreal_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void UnrealIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "TKL - G %s %s %s", user, host, s_OperServ); -} - -void unreal_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void unreal_cmd_vhost_off(User * u) -{ - send_cmd(s_HostServ, "SVSMODE %s -xt", u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); -} - -void unreal_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "TKL + G %s %s %s %ld %ld :%s", user, host, who, - (long int) time(NULL) + 86400 * 2, (long int) when, reason); -} - -void unreal_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (!buf) { - return; - } - - if (!source || !user) { - return; - } - - send_cmd(source, "SVSKILL %s :%s", user, buf); -} - -void unreal_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %s%s%s", u->nick, av[0], - (ac == 2 ? " " : ""), (ac == 2 ? av[1] : "")); -} - - -void unreal_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void unreal_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void unreal_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void unreal_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -void unreal_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, - (long int) time(NULL), ServiceUser, ServiceHost, ServerName, - modes, name); - unreal_cmd_sqline(nick, "Reserved for services"); -} - -void unreal_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, - (long int) time(NULL), user, host, ServerName, modes, real); -} - -void unreal_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "MODE %s %s", dest, buf); -} - -void unreal_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 %s * :%s", nick, - (long int) time(NULL), user, host, ServerName, modes, real); - unreal_cmd_sqline(nick, "Reserved for services"); -} - -void unreal_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void unreal_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); -} - - -void unreal_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - unreal_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void unreal_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void unreal_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void unreal_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void unreal_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void unreal_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - - -void unreal_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); -} - -void unreal_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -/* QUIT */ -void unreal_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -/* PROTOCTL */ -void unreal_cmd_protoctl() -{ - /* - See Unreal's protoctl.txt for reference - VHP - Send hostnames in NICKv2 even if not sethosted - */ - send_cmd(NULL, "PROTOCTL NICKv2 VHP"); -} - -/* PASS */ -void unreal_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS :%s", pass); -} - -/* SERVER name hop descript */ -/* Unreal 3.2 actually sends some info about itself in the descript area */ -void unreal_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -/* PONG */ -void unreal_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* JOIN */ -/* Althought Unreal 3.2 does not need the timestamp others do so - we get it in the common function call */ -void unreal_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "JOIN %s", channel); -} - -/* UNSQLINE */ -void unreal_cmd_unsqline(const char *user) -{ - if (!user) { - return; - } - send_cmd(NULL, "UNSQLINE %s", user); -} - -/* CHGHOST */ -void unreal_cmd_chghost(const char *nick, const char *vhost) -{ - if (!nick || !vhost) { - return; - } - send_cmd(ServerName, "CHGHOST %s %s", nick, vhost); -} - -/* CHGIDENT */ -void unreal_cmd_chgident(const char *nick, const char *vIdent) -{ - if (!nick || !vIdent) { - return; - } - send_cmd(ServerName, "CHGIDENT %s %s", nick, vIdent); -} - -/* INVITE */ -void unreal_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -/* PART */ -void unreal_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -/* 391 */ -void unreal_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void unreal_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void unreal_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void unreal_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void unreal_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void unreal_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void unreal_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void unreal_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void unreal_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void unreal_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void unreal_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void unreal_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -/* GLOBOPS */ -void unreal_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* SQLINE */ -void unreal_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -/* SQUIT */ -void unreal_cmd_squit(const char *servname, const char *message) -{ - if (!servname || !message) { - return; - } - - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* SVSO */ -void unreal_cmd_svso(const char *source, const char *nick, const char *flag) -{ - if (!source || !nick || !flag) { - return; - } - - send_cmd(source, "SVSO %s %s", nick, flag); -} - -/* NICK */ -void unreal_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* SVSNICK */ -void unreal_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -/* Functions that use serval cmd functions */ - -void unreal_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - if (!nick) { - return; - } - if (vIdent) { - unreal_cmd_chgident(nick, vIdent); - } - unreal_cmd_chghost(nick, vhost); -} - -void unreal_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - unreal_cmd_protoctl(); - if (servernum == 1) { - unreal_cmd_pass(RemotePassword); - } - if (servernum == 2) { - unreal_cmd_pass(RemotePassword2); - } - if (servernum == 3) { - unreal_cmd_pass(RemotePassword3); - } - unreal_cmd_server(ServerName, 1, ServerDesc); -} - -/* Events */ - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - unreal_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -int anope_event_setname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_chgname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGNAME for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetRealname(av[1]); - return MOD_CONT; -} - -int anope_event_setident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETIDENT for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetIdent(av[0]); - return MOD_CONT; -} -int anope_event_chgident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGIDENT for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetIdent(av[1]); - return MOD_CONT; -} - -int anope_event_sethost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[0]); - return MOD_CONT; -} - - -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - if (ac == 7) { - /* - that was a bug that is now fixed in 3.2.1 - in some instances it would use the non-nickv2 format - it's sent when a nick collision occurs - - so we have to leave it around for now -TSL - */ - do_nick(source, av[0], av[3], av[4], av[5], av[6], - strtoul(av[2], NULL, 10), 0, 0, "*", NULL); - } else { - 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], - NULL); - if (user) - anope_set_umode(user, 1, &av[7]); - } - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - - -int anope_event_chghost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -/* EVENT: SERVER */ -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -/* SVSHOLD - set */ -void unreal_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void unreal_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* UNSGLINE */ -void unreal_cmd_unsgline(const char *mask) -{ - /* Not Supported by this IRCD */ -} - -/* UNSZLINE */ -void unreal_cmd_unszline(const char *mask) -{ - send_cmd(NULL, "%s - Z * %s %s", send_token("TKL", "BD"), mask, - s_OperServ); -} - -/* SZLINE */ -void unreal_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "%s + Z * %s %s %ld %ld :%s", send_token("TKL", "BD"), - mask, whom, (long int) time(NULL) + 86400 * 2, - (long int) time(NULL), reason); -} - -/* SGLINE */ -void unreal_cmd_sgline(const char *mask, const char *reason) -{ - /* Not Supported by this IRCD */ -} - -void unreal_cmd_unban(const char *name, const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSMODE channel modes */ - -void unreal_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - /* Not Supported by this IRCD */ -} - - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void unreal_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s +d 1", nick); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void unreal_cmd_nc_change(User * u) -{ - common_svsmode(u, "-r+d", "1"); -} - -/* SVSMODE +r */ -void unreal_cmd_svid_umode2(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -void unreal_cmd_svid_umode3(User * u, const char *ts) -{ - /* not used */ -} - -/* svsjoin - parv[0] - sender - parv[1] - nick to make join - parv[2] - channel(s) to join - parv[3] - (optional) channel key(s) -*/ -void unreal_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - if (param) { - send_cmd(source, "SVSJOIN %s %s :%s", nick, chan, param); - } else { - 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 unreal_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "SVSPART %s :%s", nick, chan); -} - -void unreal_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* Can anyone tell me if 3.1 has this? */ -} - -void unreal_cmd_eob() -{ - /* Can anyone tell me if 3.1 has this? */ -} - - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_credits(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int unreal_flood_mode_check(const 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 unreal_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - unreal_cmd_squit(jserver, rbuf); - unreal_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void unreal_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "%s :%s", - send_token("GLOBOPS", "]"), fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int unreal_valid_nick(const char *nick) -{ - if (!stricmp("ircd", nick)) { - return 0; - } - if (!stricmp("irc", nick)) { - return 0; - } - return 1; -} - -int unreal_valid_chan(const char *chan) { - if (strchr(chan, ':')) { - return 0; - } - return 1; -} - -void unreal_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(unreal_cmd_topic); - pmodule_cmd_vhost_off(unreal_cmd_vhost_off); - pmodule_cmd_akill(unreal_cmd_akill); - pmodule_cmd_svskill(unreal_cmd_svskill); - pmodule_cmd_svsmode(unreal_cmd_svsmode); - pmodule_cmd_372(unreal_cmd_372); - pmodule_cmd_372_error(unreal_cmd_372_error); - pmodule_cmd_375(unreal_cmd_375); - pmodule_cmd_376(unreal_cmd_376); - pmodule_cmd_nick(unreal_cmd_nick); - pmodule_cmd_guest_nick(unreal_cmd_guest_nick); - pmodule_cmd_mode(unreal_cmd_mode); - pmodule_cmd_bot_nick(unreal_cmd_bot_nick); - pmodule_cmd_kick(unreal_cmd_kick); - pmodule_cmd_notice_ops(unreal_cmd_notice_ops); - pmodule_cmd_notice(unreal_cmd_notice); - pmodule_cmd_notice2(unreal_cmd_notice2); - pmodule_cmd_privmsg(unreal_cmd_privmsg); - pmodule_cmd_privmsg2(unreal_cmd_privmsg2); - pmodule_cmd_serv_notice(unreal_cmd_serv_notice); - pmodule_cmd_serv_privmsg(unreal_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(unreal_cmd_bot_chan_mode); - pmodule_cmd_351(unreal_cmd_351); - pmodule_cmd_quit(unreal_cmd_quit); - pmodule_cmd_pong(unreal_cmd_pong); - pmodule_cmd_join(unreal_cmd_join); - pmodule_cmd_unsqline(unreal_cmd_unsqline); - pmodule_cmd_invite(unreal_cmd_invite); - pmodule_cmd_part(unreal_cmd_part); - pmodule_cmd_391(unreal_cmd_391); - pmodule_cmd_250(unreal_cmd_250); - pmodule_cmd_307(unreal_cmd_307); - pmodule_cmd_311(unreal_cmd_311); - pmodule_cmd_312(unreal_cmd_312); - pmodule_cmd_317(unreal_cmd_317); - pmodule_cmd_219(unreal_cmd_219); - pmodule_cmd_401(unreal_cmd_401); - pmodule_cmd_318(unreal_cmd_318); - pmodule_cmd_242(unreal_cmd_242); - pmodule_cmd_243(unreal_cmd_243); - pmodule_cmd_211(unreal_cmd_211); - pmodule_cmd_global(unreal_cmd_global); - pmodule_cmd_global_legacy(unreal_cmd_global_legacy); - pmodule_cmd_sqline(unreal_cmd_sqline); - pmodule_cmd_squit(unreal_cmd_squit); - pmodule_cmd_svso(unreal_cmd_svso); - pmodule_cmd_chg_nick(unreal_cmd_chg_nick); - pmodule_cmd_svsnick(unreal_cmd_svsnick); - pmodule_cmd_vhost_on(unreal_cmd_vhost_on); - pmodule_cmd_connect(unreal_cmd_connect); - pmodule_cmd_svshold(unreal_cmd_svshold); - pmodule_cmd_release_svshold(unreal_cmd_release_svshold); - pmodule_cmd_unsgline(unreal_cmd_unsgline); - pmodule_cmd_unszline(unreal_cmd_unszline); - pmodule_cmd_szline(unreal_cmd_szline); - pmodule_cmd_sgline(unreal_cmd_sgline); - pmodule_cmd_unban(unreal_cmd_unban); - pmodule_cmd_svsmode_chan(unreal_cmd_svsmode_chan); - pmodule_cmd_svid_umode(unreal_cmd_svid_umode); - pmodule_cmd_nc_change(unreal_cmd_nc_change); - pmodule_cmd_svid_umode2(unreal_cmd_svid_umode2); - pmodule_cmd_svid_umode3(unreal_cmd_svid_umode3); - pmodule_cmd_svsjoin(unreal_cmd_svsjoin); - pmodule_cmd_svspart(unreal_cmd_svspart); - pmodule_cmd_swhois(unreal_cmd_swhois); - pmodule_cmd_eob(unreal_cmd_eob); - pmodule_flood_mode_check(unreal_flood_mode_check); - pmodule_cmd_jupe(unreal_cmd_jupe); - pmodule_valid_nick(unreal_valid_nick); - pmodule_valid_chan(unreal_valid_chan); - pmodule_cmd_ctcp(unreal_cmd_ctcp); - pmodule_set_umode(unreal_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("UnrealIRCd 3.1.1+"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set("+f"); - pmodule_ircd_flood_mode_char_remove("-f"); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/unreal31.h b/src/protocol/unreal31.h deleted file mode 100644 index 46c5f4b73..000000000 --- a/src/protocol/unreal31.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Unreal IRCD 3.1.x functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/*************************************************************************/ - -#define UMODE_a 0x00000001 -#define UMODE_h 0x00000002 -#define UMODE_i 0x00000004 -#define UMODE_o 0x00000008 -#define UMODE_r 0x00000010 -#define UMODE_w 0x00000020 -#define UMODE_A 0x00000040 -#define UMODE_g 0x80000000 -#define UMODE_x 0x40000000 - -#define CMODE_i 0x00000001 -#define CMODE_m 0x00000002 -#define CMODE_n 0x00000004 -#define CMODE_p 0x00000008 -#define CMODE_s 0x00000010 -#define CMODE_t 0x00000020 -#define CMODE_k 0x00000040 /* These two used only by ChanServ */ -#define CMODE_l 0x00000080 -#define CMODE_c 0x00000400 -#define CMODE_A 0x00000800 -#define CMODE_H 0x00001000 -#define CMODE_K 0x00002000 -#define CMODE_L 0x00004000 -#define CMODE_O 0x00008000 -#define CMODE_Q 0x00010000 -#define CMODE_S 0x00020000 -#define CMODE_V 0x00040000 -#define CMODE_f 0x00080000 -#define CMODE_G 0x00100000 -#define CMODE_C 0x00200000 -#define CMODE_u 0x00400000 -#define CMODE_z 0x00800000 -#define CMODE_N 0x01000000 -#define CMODE_R 0x00000100 /* Only identified users can join */ -#define CMODE_r 0x00000200 /* Set for all registered channels */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void unreal_set_umode(User * user, int ac, const char **av); -void unreal_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void unreal_cmd_vhost_off(User * u); -void unreal_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void unreal_cmd_svskill(const char *source, const char *user, const char *buf); -void unreal_cmd_svsmode(User * u, int ac, const char **av); -void unreal_cmd_372(const char *source, const char *msg); -void unreal_cmd_372_error(const char *source); -void unreal_cmd_375(const char *source); -void unreal_cmd_376(const char *source); -void unreal_cmd_nick(const char *nick, const char *name, const char *modes); -void unreal_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void unreal_cmd_mode(const char *source, const char *dest, const char *buf); -void unreal_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void unreal_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void unreal_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void unreal_cmd_notice(const char *source, const char *dest, const char *buf); -void unreal_cmd_notice2(const char *source, const char *dest, const char *msg); -void unreal_cmd_privmsg(const char *source, const char *dest, const char *buf); -void unreal_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void unreal_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void unreal_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void unreal_cmd_bot_chan_mode(const char *nick, const char *chan); -void unreal_cmd_351(const char *source); -void unreal_cmd_quit(const char *source, const char *buf); -void unreal_cmd_pong(const char *servname, const char *who); -void unreal_cmd_join(const char *user, const char *channel, time_t chantime); -void unreal_cmd_unsqline(const char *user); -void unreal_cmd_invite(const char *source, const char *chan, const char *nick); -void unreal_cmd_part(const char *nick, const char *chan, const char *buf); -void unreal_cmd_391(const char *source, const char *timestr); -void unreal_cmd_250(const char *buf); -void unreal_cmd_307(const char *buf); -void unreal_cmd_311(const char *buf); -void unreal_cmd_312(const char *buf); -void unreal_cmd_317(const char *buf); -void unreal_cmd_219(const char *source, const char *letter); -void unreal_cmd_401(const char *source, const char *who); -void unreal_cmd_318(const char *source, const char *who); -void unreal_cmd_242(const char *buf); -void unreal_cmd_243(const char *buf); -void unreal_cmd_211(const char *buf); -void unreal_cmd_global(const char *source, const char *buf); -void unreal_cmd_global_legacy(const char *source, const char *fmt); -void unreal_cmd_sqline(const char *mask, const char *reason); -void unreal_cmd_squit(const char *servname, const char *message); -void unreal_cmd_svso(const char *source, const char *nick, const char *flag); -void unreal_cmd_chg_nick(const char *oldnick, const char *newnick); -void unreal_cmd_svsnick(const char *source, const char *guest, time_t when); -void unreal_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void unreal_cmd_connect(int servernum); -void unreal_cmd_svshold(const char *nick); -void unreal_cmd_release_svshold(const char *nick); -void unreal_cmd_unsgline(const char *mask); -void unreal_cmd_unszline(const char *mask); -void unreal_cmd_szline(const char *mask, const char *reason, const char *whom); -void unreal_cmd_sgline(const char *mask, const char *reason); -void unreal_cmd_unban(const char *name, const char *nick); -void unreal_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void unreal_cmd_svid_umode(const char *nick, time_t ts); -void unreal_cmd_nc_change(User * u); -void unreal_cmd_svid_umode2(User * u, const char *ts); -void unreal_cmd_svid_umode3(User * u, const char *ts); -void unreal_cmd_eob(); -int unreal_flood_mode_check(const char *value); -void unreal_cmd_jupe(const char *jserver, const char *who, const char *reason); -int unreal_valid_nick(const char *nick); -void unreal_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class UnrealIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/protocol/viagra.c b/src/protocol/viagra.c deleted file mode 100644 index 69baf00c4..000000000 --- a/src/protocol/viagra.c +++ /dev/null @@ -1,1715 +0,0 @@ -/* Viagra IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ - * - */ - -#include "services.h" -#include "pseudo.h" -#include "viagra.h" - -IRCDVar myIrcd[] = { - {"ViagraIRCd 1.3.*", /* ircd name */ - "+oS", /* nickserv mode */ - "+oS", /* chanserv mode */ - "+oS", /* memoserv mode */ - "+oS", /* hostserv mode */ - "+ioS", /* operserv mode */ - "+oS", /* botserv mode */ - "+oS", /* helpserv mode */ - "+i", /* Dev/Null mode */ - "+ioS", /* Global mode */ - "+oS", /* nickserv alias mode */ - "+oS", /* chanserv alias mode */ - "+oS", /* memoserv alias mode */ - "+ioS", /* hostserv alias mode */ - "+ioS", /* operserv alias mode */ - "+oS", /* botserv alias mode */ - "+oS", /* helpserv alias mode */ - "+iS", /* Dev/Null alias mode */ - "+ioS", /* Global alias mode */ - "+qS", /* Used by BotServ Bots */ - 5, /* Chan Max Symbols */ - "-ciklmnpstOR", /* Modes to Remove */ - "+ao", /* Channel Umode used by Botserv bots */ - 1, /* SVSNICK */ - 1, /* Vhost */ - 1, /* Has Owner */ - "+q", /* Mode to set for an owner */ - "-q", /* Mode to unset for an owner */ - "+a", /* Mode to set for channel admin */ - "-a", /* Mode to unset for channel admin */ - "+rd", /* Mode On Reg */ - NULL, /* Mode on ID for Roots */ - NULL, /* Mode on ID for Admins */ - NULL, /* Mode on ID for Opers */ - "-r+d", /* Mode on UnReg */ - "-r+d", /* Mode on Nick Change */ - 1, /* Supports SGlines */ - 1, /* Supports SQlines */ - 1, /* Supports SZlines */ - 1, /* Supports Halfop +h */ - 3, /* Number of server args */ - 0, /* Join 2 Set */ - 0, /* Join 2 Message */ - 1, /* Has exceptions +e */ - 0, /* TS Topic Forward */ - 0, /* TS Topci Backward */ - 0, /* Protected Umode */ - 1, /* Has Admin */ - 0, /* Chan SQlines */ - 1, /* Quit on Kill */ - 1, /* SVSMODE unban */ - 1, /* Has Protect */ - 0, /* Reverse */ - 1, /* Chan Reg */ - CMODE_r, /* Channel Mode */ - 1, /* vidents */ - 0, /* svshold */ - 1, /* time stamp on mode */ - 1, /* NICKIP */ - 0, /* O:LINE */ - 1, /* UMODE */ - 1, /* VHOST ON NICK */ - 1, /* Change RealName */ - 0, /* No Knock */ - 0, /* Admin Only */ - DEFAULT_MLOCK, /* Default MLOCK */ - UMODE_x, /* Vhost Mode */ - 0, /* +f */ - 0, /* +L */ - 0, - 0, - 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 */ - 0, /* SJOIN ban char */ - 0, /* SJOIN except char */ - 0, /* SJOIN invite char */ - 0, /* Can remove User Channel Modes with SVSMODE */ - 0, /* Sglines are not enforced until user reconnects */ - "x", /* vhost char */ - 0, /* ts6 */ - 1, /* support helper umode */ - 0, /* p10 */ - NULL, /* character set */ - 1, /* reports sync state */ - 0, /* CIDR channelbans */ - } - , - {NULL} -}; - - -IRCDCAPAB myIrcdcap[] = { - { - CAPAB_NOQUIT, /* NOQUIT */ - CAPAB_TSMODE, /* TSMODE */ - CAPAB_UNCONNECT, /* UNCONNECT */ - CAPAB_NICKIP, /* NICKIP */ - CAPAB_NSJOIN, /* SJOIN */ - CAPAB_ZIP, /* ZIP */ - CAPAB_BURST, /* BURST */ - CAPAB_TS5, /* TS5 */ - CAPAB_TS3, /* TS3 */ - CAPAB_DKEY, /* DKEY */ - 0, /* PT4 */ - 0, /* SCS */ - 0, /* QS */ - 0, /* UID */ - 0, /* KNOCK */ - 0, /* CLIENT */ - 0, /* IPV6 */ - 0, /* SSJ5 */ - 0, /* SN2 */ - 0, /* TOKEN */ - 0, /* VHOST */ - 0, /* SSJ3 */ - 0, /* NICK2 */ - 0, /* UMODE2 */ - 0, /* VL */ - 0, /* TLKEXT */ - CAPAB_DODKEY, /* DODKEY */ - CAPAB_DOZIP, /* DOZIP */ - 0, 0, 0} -}; - - - - -void viagra_set_umode(User * user, int ac, const char **av) -{ - int add = 1; /* 1 if adding modes, 0 if deleting */ - const char *modes = av[0]; - - ac--; - - if (debug) - alog("debug: Changing mode for %s to %s", user->nick, modes); - - while (*modes) { - - /* This looks better, much better than "add ? (do_add) : (do_remove)". - * At least this is readable without paying much attention :) -GD - */ - if (add) - user->mode |= umodes[(int) *modes]; - else - user->mode &= ~umodes[(int) *modes]; - - switch (*modes++) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'd': - if (ac == 0) { - alog("user: umode +d with no parameter (?) for user %s", - user->nick); - break; - } - - ac--; - av++; - user->svid = strtoul(*av, NULL, 0); - break; - case 'o': - if (add) { - opcnt++; - if (WallOper) { - anope_cmd_global(s_OperServ, - "\2%s\2 is now an IRC operator.", - user->nick); - } - display_news(user, NEWS_OPER); - } else { - opcnt--; - } - break; - case 'r': - if (add && !nick_identified(user)) { - common_svsmode(user, "-r", NULL); - user->mode &= ~UMODE_r; - } - break; - case 'x': - update_host(user); - break; - } - } -} - -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, UMODE_C, 0, 0, 0, 0, 0, UMODE_I, 0, 0, 0, 0, UMODE_N, - UMODE_O, - 0, - UMODE_Q, - UMODE_R, - UMODE_S, UMODE_T, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, UMODE_b, UMODE_c, UMODE_d, UMODE_e, UMODE_f, - UMODE_g, - UMODE_h, UMODE_i, 0, 0, 0, 0, UMODE_n, UMODE_o, - 0, - 0, UMODE_r, UMODE_s, 0, 0, 0, UMODE_w, - UMODE_x, - 0, - 0, - 0, 0, 0, 0, 0 -}; - - -char myCsmodes[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, - 'h', /* (37) % Channel halfops */ - 0, /* (38) & bans */ - 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, - - 'o', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a', 0 -}; - -CMMode myCmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, - {add_ban, del_ban}, - {NULL}, - {NULL}, - {add_exception, del_exception}, - {NULL}, - {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL} -}; - - - -CBMode myCbmodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, - {0}, /* A */ - {0}, /* B */ - {0}, /* C */ - {0}, /* D */ - {0}, /* E */ - {0}, /* F */ - {0}, /* G */ - {CMODE_H, 0, NULL, NULL}, /* H */ - {0}, /* I */ - {0}, /* J */ - {0}, /* K */ - {0}, /* L */ - {CMODE_M, 0, NULL, NULL}, /* M */ - {CMODE_N, 0, NULL, NULL}, /* N */ - {CMODE_O, CBM_NO_USER_MLOCK, NULL, NULL}, - {CMODE_P, 0, NULL, NULL}, /* P */ - {0}, /* Q */ - {CMODE_R, 0, NULL, NULL}, /* R */ - {CMODE_S, 0, NULL, NULL}, /* S */ - {0}, /* T */ - {0}, /* U */ - {0}, /* V */ - {0}, /* W */ - {0}, /* X */ - {0}, /* Y */ - {0}, /* Z */ - {0}, {0}, {0}, {0}, {0}, {0}, - {0}, /* a */ - {0}, /* b */ - {CMODE_c, 0, NULL, NULL}, - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {0}, /* h */ - {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ - {CMODE_k, 0, chan_set_key, cs_set_key}, - {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, - {CMODE_m, 0, NULL, NULL}, - {CMODE_n, 0, NULL, NULL}, - {0}, /* o */ - {CMODE_p, 0, NULL, NULL}, - {0}, /* q */ - {CMODE_r, CBM_NO_MLOCK, NULL, NULL}, - {CMODE_s, 0, NULL, NULL}, - {CMODE_t, 0, NULL, NULL}, - {0}, - {0}, /* v */ - {0}, /* w */ - {CMODE_x, 0, NULL, NULL}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0} -}; - -CBModeInfo myCbmodeinfos[] = { - {'c', CMODE_c, 0, NULL, NULL}, - {'i', CMODE_i, 0, NULL, NULL}, - {'k', CMODE_k, 0, get_key, cs_get_key}, - {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, - {'m', CMODE_m, 0, NULL, NULL}, - {'n', CMODE_n, 0, NULL, NULL}, - {'p', CMODE_p, 0, NULL, NULL}, - {'r', CMODE_r, 0, NULL, NULL}, - {'s', CMODE_s, 0, NULL, NULL}, - {'t', CMODE_t, 0, NULL, NULL}, - {'x', CMODE_x, 0, NULL, NULL}, - {'H', CMODE_H, 0, NULL, NULL}, - {'M', CMODE_M, 0, NULL, NULL}, - {'N', CMODE_N, 0, NULL, NULL}, - {'O', CMODE_O, 0, NULL, NULL}, - {'P', CMODE_P, 0, NULL, NULL}, - {'R', CMODE_R, 0, NULL, NULL}, - {'S', CMODE_S, 0, NULL, NULL}, - {0} -}; - -CUMode myCumodes[128] = { - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, - - {0}, - - {CUS_PROTECT, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* b */ - {0}, /* c */ - {0}, /* d */ - {0}, /* e */ - {0}, /* f */ - {0}, /* g */ - {CUS_HALFOP, 0, check_valid_op}, - {0}, /* i */ - {0}, /* j */ - {0}, /* k */ - {0}, /* l */ - {0}, /* m */ - {0}, /* n */ - {CUS_OP, CUF_PROTECT_BOTSERV, check_valid_op}, - {0}, /* p */ - {CUS_OWNER, 0, check_valid_op}, - {0}, /* r */ - {0}, /* s */ - {0}, /* t */ - {0}, /* u */ - {CUS_VOICE, 0, NULL}, - {0}, /* w */ - {0}, /* x */ - {0}, /* y */ - {0}, /* z */ - {0}, {0}, {0}, {0}, {0} -}; - - -void viagra_cmd_bot_unban(ChannelInfo * ci, const char *nick) -{ - send_cmd(ServerName, "SVSMODE %s -b %s", ci->name, nick); -} - -int anope_event_setname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETNAME for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetRealname(av[0]); - return MOD_CONT; -} - -int anope_event_sjoin(const char *source, int ac, const char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -int anope_event_chgname(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGNAME for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetRealname(av[1]); - return MOD_CONT; -} - -int anope_event_setident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETIDENT for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetIdent(av[0]); - return MOD_CONT; -} - -int anope_event_chgident(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGIDENT for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetIdent(av[1]); - return MOD_CONT; -} - -/* - * sethost - * parv[0] = sender - * parv[1] = newhost - */ -int anope_event_sethost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) { - alog("debug: SETHOST for nonexistent user %s", source); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[0]); - return MOD_CONT; -} - -int anope_event_nick(const char *source, int ac, const char **av) -{ - User *user; - - if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), - strtoul(av[8], NULL, 0), "*", NULL); - if (user) { - anope_set_umode(user, 1, &av[3]); - } - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); - } - return MOD_CONT; -} - -int anope_event_vs(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: VS for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; - -} - -int anope_event_chghost(const char *source, int ac, const char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) { - alog("debug: CHGHOST for nonexistent user %s", av[0]); - } - return MOD_CONT; - } - - u->SetDisplayedHost(av[1]); - return MOD_CONT; -} - -int anope_event_436(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - - m_nickcoll(av[0]); - return MOD_CONT; -} - -int anope_event_notice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_pass(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_svinfo(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -/* - * gnotice - * parv[0] = sender prefix - * parv[1] = message text - */ -int anope_event_gnotice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_sqline(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_burst(const char *source, int ac, const char **av) -{ - Server *s; - s = findserver(servlist, source); - if (!ac) { - /* for future use - start burst */ - } else { - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - if (!s && serv_uplink) - s = serv_uplink; - finish_sync(s, 1); - } - return MOD_CONT; -} - -int anope_event_tctrl(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -/* - * error - * parv[0] = sender prefix - * parv[*] = parameters - */ -int anope_event_error(const char *source, int ac, const char **av) -{ - if (ac >= 1) { - if (debug) { - alog("debug: %s", av[0]); - } - } - return MOD_CONT; -} - -/* *INDENT-OFF* */ -void moduleAddIRCDMsgs(void) { - Message *m; - - updateProtectDetails("PROTECT","PROTECTME","protect","deprotect","AUTOPROTECT","+a","-a"); - - m = createMessage("401", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("402", anope_event_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", 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", 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); - 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("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("WALLOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("AKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GLOBOPS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); - m = createMessage("GOPER", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("RAKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SILENCE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSKILL", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("SVSNICK", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVSNOOP", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); - m = createMessage("UNSQLINE", anope_event_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); - m = createMessage("MS", anope_event_ms); addCoreMessage(IRCD,m); - m = createMessage("NS", anope_event_ns); addCoreMessage(IRCD,m); - m = createMessage("OS", anope_event_os); addCoreMessage(IRCD,m); - m = createMessage("RS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); - m = createMessage("SS", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - m = createMessage("SZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSGLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("UNSZLINE", anope_event_null); addCoreMessage(IRCD,m); - m = createMessage("CHGHOST", anope_event_chghost); addCoreMessage(IRCD,m); - m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); - m = createMessage("CHGNAME", anope_event_chgname); addCoreMessage(IRCD,m); - 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("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* */ - - -/* SQLINE */ -void viagra_cmd_sqline(const char *mask, const char *reason) -{ - if (!mask || !reason) { - return; - } - - send_cmd(NULL, "SQLINE %s :%s", mask, reason); -} - -void viagra_cmd_unsgline(const char *mask) -{ - send_cmd(NULL, "UNSGLINE 0 :%s", mask); -} - -void viagra_cmd_unszline(const char *mask) -{ - send_cmd(NULL, "UNSZLINE 0 %s", mask); -} - -void viagra_cmd_szline(const char *mask, const char *reason, const char *whom) -{ - send_cmd(NULL, "SZLINE %s :%s", mask, reason); -} - -void ViagraIRCdProto::cmd_svsnoop(const char *server, int set) -{ - send_cmd(NULL, "SVSNOOP %s %s", server, set ? "+" : "-"); -} - -void viagra_cmd_svsadmin(const char *server, int set) -{ - ircd_proto.cmd_svsnoop(server, set); -} - -void viagra_cmd_sgline(const char *mask, const char *reason) -{ - send_cmd(NULL, "SGLINE %d :%s:%s", (int)strlen(mask), mask, reason); -} - -void ViagraIRCdProto::cmd_remove_akill(const char *user, const char *host) -{ - send_cmd(NULL, "RAKILL %s %s", host, user); -} - -/* PART */ -void viagra_cmd_part(const char *nick, const char *chan, const char *buf) -{ - if (!nick || !chan) { - return; - } - - if (buf) { - send_cmd(nick, "PART %s :%s", chan, buf); - } else { - send_cmd(nick, "PART %s", chan); - } -} - -void viagra_cmd_topic(const char *whosets, const char *chan, const char *whosetit, - const char *topic, time_t when) -{ - send_cmd(whosets, "TOPIC %s %s %lu :%s", chan, whosetit, - (unsigned long int) when, topic); -} - -void viagra_cmd_vhost_off(User * u) -{ - send_cmd(NULL, "SVSMODE %s -x", u->nick); - notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar); -} - -void viagra_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost) -{ - if (vIdent) { - send_cmd(NULL, "CHGIDENT %s %s", nick, vIdent); - } - send_cmd(NULL, "SVSMODE %s +x", nick); - send_cmd(NULL, "SVSCHGHOST %s %s", nick, vhost); -} - -void viagra_cmd_unsqline(const char *user) -{ - send_cmd(NULL, "UNSQLINE %s", user); -} - -void viagra_cmd_join(const char *user, const char *channel, time_t chantime) -{ - send_cmd(user, "SJOIN %ld %s", (long int) chantime, channel); -} - - -/* - * m_akill() - * parv[1]=host - * parv[2]=user - * parv[3]=length - * parv[4]=akiller - * parv[5]=time set - * parv[6]=reason - */ -void viagra_cmd_akill(const char *user, const char *host, const char *who, time_t when, - time_t expires, const char *reason) -{ - send_cmd(NULL, "AKILL %s %s %d %s %ld :%s", host, user, 86400 * 2, who, - (long int) time(NULL), reason); -} - - -/* - * svskill - * parv[0] = servername - * parv[1] = client - * parv[2] = nick stamp - * parv[3] = kill message - */ -void viagra_cmd_svskill(const char *source, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "SVSKILL %s :%s", user, buf); - } - return; -} - -void viagra_cmd_mode(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (ircdcap->tsmode) { - if (uplink_capab & ircdcap->tsmode) { - send_cmd(source, "MODE %s 0 %s", dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } -} - -/* QUIT */ -void viagra_cmd_quit(const char *source, const char *buf) -{ - if (buf) { - send_cmd(source, "QUIT :%s", buf); - } else { - send_cmd(source, "QUIT"); - } -} - -int anope_event_away(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - m_away(source, (ac ? av[0] : NULL)); - return MOD_CONT; -} - -int anope_event_ping(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - viagra_cmd_pong(ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -void viagra_cmd_svsmode(User * u, int ac, const char **av) -{ - send_cmd(ServerName, "SVSMODE %s %ld %s%s%s", u->nick, - (long int) u->timestamp, av[0], (ac == 2 ? " " : ""), - (ac == 2 ? av[1] : "")); -} - -void viagra_cmd_squit(const char *servname, const char *message) -{ - send_cmd(NULL, "SQUIT %s :%s", servname, message); -} - -/* PONG */ -void viagra_cmd_pong(const char *servname, const char *who) -{ - send_cmd(servname, "PONG %s", who); -} - -/* - * 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 viagra_cmd_svinfo() -{ - send_cmd(NULL, "SVINFO 5 3 0 :%ld", (long int) time(NULL)); -} - -/* CAPAB */ -void viagra_cmd_capab() -{ - send_cmd(NULL, "CAPAB TS5 NOQUIT SSJOIN BURST UNCONNECT NICKIP"); -} - -/* PASS */ -void viagra_cmd_pass(const char *pass) -{ - send_cmd(NULL, "PASS %s :TS", pass); -} - -/* SERVER */ -void viagra_cmd_server(const char *servname, int hop, const char *descript) -{ - send_cmd(NULL, "SERVER %s %d :%s", servname, hop, descript); -} - -void viagra_cmd_burst() -{ - send_cmd(NULL, "BURST"); -} - -void viagra_cmd_connect(int servernum) -{ - me_server = - new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); - - if (servernum == 1) { - viagra_cmd_pass(RemotePassword); - } else if (servernum == 2) { - viagra_cmd_pass(RemotePassword2); - } else if (servernum == 3) { - viagra_cmd_pass(RemotePassword3); - } - viagra_cmd_capab(); - viagra_cmd_server(ServerName, 1, ServerDesc); - viagra_cmd_svinfo(); - viagra_cmd_burst(); -} - -/* EVENT : OS */ -int anope_event_os(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_OperServ, av[0]); - return MOD_CONT; -} - -/* EVENT : NS */ -int anope_event_ns(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_NickServ, av[0]); - return MOD_CONT; -} - -/* EVENT : MS */ -int anope_event_ms(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_MemoServ, av[0]); - return MOD_CONT; -} - -/* EVENT : HS */ -int anope_event_hs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_HostServ, av[0]); - return MOD_CONT; -} - -/* EVENT : CS */ -int anope_event_cs(const char *source, int ac, const char **av) -{ - if (ac < 1) - return MOD_CONT; - m_privmsg(source, s_ChanServ, av[0]); - return MOD_CONT; -} - -int anope_event_server(const char *source, int ac, const char **av) -{ - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); - return MOD_CONT; -} - - -int anope_event_privmsg(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - m_privmsg(source, av[0], av[1]); - return MOD_CONT; -} - -int anope_event_part(const char *source, int ac, const char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -int anope_event_whois(const char *source, int ac, const char **av) -{ - if (source && ac >= 1) { - m_whois(source, av[0]); - } - return MOD_CONT; -} - -int anope_event_topic(const char *source, int ac, const char **av) -{ - if (ac != 4) - return MOD_CONT; - do_topic(source, ac, av); - return MOD_CONT; -} - -int anope_event_squit(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -int anope_event_quit(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - - -int anope_event_mode(const char *source, int ac, const char **av) -{ - if (ac < 2) - return MOD_CONT; - - if (*av[0] == '#' || *av[0] == '&') { - do_cmode(source, ac, av); - } else { - do_umode(source, ac, av); - } - return MOD_CONT; -} - -int anope_event_kill(const char *source, int ac, const char **av) -{ - if (ac != 2) - return MOD_CONT; - - m_kill(av[0], av[1]); - return MOD_CONT; -} - -int anope_event_kick(const char *source, int ac, const char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); - return MOD_CONT; -} - -int anope_event_join(const char *source, int ac, const char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -int anope_event_motd(const char *source, int ac, const char **av) -{ - if (!source) { - return MOD_CONT; - } - - m_motd(source); - return MOD_CONT; -} - -void viagra_cmd_notice_ops(const char *source, const char *dest, const char *buf) -{ - if (buf) { - send_cmd(NULL, "NOTICE @%s :%s", dest, buf); - } - return; -} - -void viagra_cmd_notice(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - if (NSDefFlags & NI_MSG) { - viagra_cmd_privmsg2(source, dest, buf); - } else { - send_cmd(source, "NOTICE %s :%s", dest, buf); - } -} - -void viagra_cmd_notice2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE %s :%s", dest, msg); -} - -void viagra_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - -void viagra_cmd_privmsg2(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG %s :%s", dest, msg); -} - -void viagra_cmd_serv_notice(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "NOTICE $%s :%s", dest, msg); -} - -void viagra_cmd_serv_privmsg(const char *source, const char *dest, const char *msg) -{ - send_cmd(source, "PRIVMSG $%s :%s", dest, msg); -} - -/* GLOBOPS */ -void viagra_cmd_global(const char *source, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source ? source : ServerName, "GLOBOPS :%s", buf); -} - -/* 391 */ -void viagra_cmd_391(const char *source, const char *timestr) -{ - if (!timestr) { - return; - } - send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr); -} - -/* 250 */ -void viagra_cmd_250(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "250 %s", buf); -} - -/* 307 */ -void viagra_cmd_307(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "307 %s", buf); -} - -/* 311 */ -void viagra_cmd_311(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "311 %s", buf); -} - -/* 312 */ -void viagra_cmd_312(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "312 %s", buf); -} - -/* 317 */ -void viagra_cmd_317(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(ServerName, "317 %s", buf); -} - -/* 219 */ -void viagra_cmd_219(const char *source, const char *letter) -{ - if (!source) { - return; - } - - if (letter) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *letter); - } else { - send_cmd(NULL, "219 %s l :End of /STATS report.", source); - } -} - -/* 401 */ -void viagra_cmd_401(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - send_cmd(ServerName, "401 %s %s :No such service.", source, who); -} - -/* 318 */ -void viagra_cmd_318(const char *source, const char *who) -{ - if (!source || !who) { - return; - } - - send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who); -} - -/* 242 */ -void viagra_cmd_242(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "242 %s", buf); -} - -/* 243 */ -void viagra_cmd_243(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "243 %s", buf); -} - -/* 211 */ -void viagra_cmd_211(const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(NULL, "211 %s", buf); -} - -void viagra_cmd_351(const char *source) -{ - send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s", - source, version_number, ServerName, ircd->name, version_flags, - EncModule, version_build); -} - -void viagra_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - EnforceQlinedNick(nick, s_BotServ); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); - viagra_cmd_sqline(nick, "Reserved for services"); -} - -void viagra_cmd_kick(const char *source, const char *chan, const char *user, const char *buf) -{ - if (buf) { - send_cmd(source, "KICK %s %s :%s", chan, user, buf); - } else { - send_cmd(source, "KICK %s %s", chan, user); - } -} - -void viagra_cmd_nick(const char *nick, const char *name, const char *modes) -{ - EnforceQlinedNick(nick, NULL); - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, ServiceUser, ServiceHost, - ServerName, name); - viagra_cmd_sqline(nick, "Reserved for services"); -} - -void viagra_cmd_372(const char *source, const char *msg) -{ - send_cmd(ServerName, "372 %s :- %s", source, msg); -} - -void viagra_cmd_372_error(const char *source) -{ - send_cmd(ServerName, "422 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); -} - -void viagra_cmd_375(const char *source) -{ - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); -} - -void viagra_cmd_376(const char *source) -{ - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); -} - -/* INVITE */ -void viagra_cmd_invite(const char *source, const char *chan, const char *nick) -{ - if (!source || !chan || !nick) { - return; - } - - send_cmd(source, "INVITE %s %s", nick, chan); -} - -void viagra_cmd_bot_chan_mode(const char *nick, const char *chan) -{ - anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); -} - -int anope_event_capab(const char *source, int ac, const char **av) -{ - capab_parse(ac, av); - return MOD_CONT; -} - -/* SVSHOLD - set */ -void viagra_cmd_svshold(const char *nick) -{ - /* Not supported by this IRCD */ -} - -/* SVSHOLD - release */ -void viagra_cmd_release_svshold(const char *nick) -{ - /* Not Supported by this IRCD */ -} - -/* SVSNICK */ -void viagra_cmd_svsnick(const char *source, const char *guest, time_t when) -{ - if (!source || !guest) { - return; - } - send_cmd(NULL, "SVSNICK %s %s :%ld", source, guest, (long int) when); -} - -void viagra_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, - const char *modes) -{ - send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, - (long int) time(NULL), modes, user, host, ServerName, real); -} - -void viagra_cmd_svso(const char *source, const char *nick, const char *flag) -{ - /* Not Supported by this IRCD */ -} - - -/* SVSMODE -b */ -void viagra_cmd_unban(const char *name, const char *nick) -{ - viagra_cmd_svsmode_chan(name, "-b", nick); -} - -/* SVSMODE channel modes */ - -void viagra_cmd_svsmode_chan(const char *name, const char *mode, const char *nick) -{ - if (nick) { - send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick); - } else { - send_cmd(ServerName, "SVSMODE %s %s", name, mode); - } -} - -/* SVSMODE +d */ -/* sent if svid is something weird */ -void viagra_cmd_svid_umode(const char *nick, time_t ts) -{ - send_cmd(ServerName, "SVSMODE %s %lu +d 1", nick, - (unsigned long int) ts); -} - -/* SVSMODE +d */ -/* nc_change was = 1, and there is no na->status */ -void viagra_cmd_nc_change(User * u) -{ - common_svsmode(u, "+d", "1"); -} - -/* SVSMODE +d */ -void viagra_cmd_svid_umode2(User * u, const char *ts) -{ - /* not used by bahamut ircds */ -} - -void viagra_cmd_svid_umode3(User * u, const char *ts) -{ - if (u->svid != u->timestamp) { - common_svsmode(u, "+rd", ts); - } else { - common_svsmode(u, "+r", NULL); - } -} - -/* NICK */ -void viagra_cmd_chg_nick(const char *oldnick, const char *newnick) -{ - if (!oldnick || !newnick) { - return; - } - - send_cmd(oldnick, "NICK %s", newnick); -} - -/* - * svsjoin - * parv[0] = sender - * parv[1] = nick to make join - * parv[2] = channel(s) to join - */ -void viagra_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param) -{ - 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 viagra_cmd_svspart(const char *source, const char *nick, const char *chan) -{ - send_cmd(source, "SVSPART %s :%s", nick, chan); -} - -void viagra_cmd_swhois(const char *source, const char *who, const char *mask) -{ - /* not supported */ -} - -int viagra_flood_mode_check(const char *value) -{ - return 0; -} - -int anope_event_rehash(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_admin(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_snotice(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -int anope_event_invite(const char *source, int ac, const char **av) -{ - return MOD_CONT; -} - -void viagra_cmd_eob() -{ - send_cmd(NULL, "BURST 0"); -} - -void viagra_cmd_jupe(const char *jserver, const char *who, const char *reason) -{ - char rbuf[256]; - - snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", who, - reason ? ": " : "", reason ? reason : ""); - - if (findserver(servlist, jserver)) - viagra_cmd_squit(jserver, rbuf); - viagra_cmd_server(jserver, 2, rbuf); - new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); -} - -/* GLOBOPS - to handle old WALLOPS */ -void viagra_cmd_global_legacy(const char *source, const char *fmt) -{ - send_cmd(source ? source : ServerName, "GLOBOPS :%s", fmt); -} - -/* - 1 = valid nick - 0 = nick is in valid -*/ -int viagra_valid_nick(const char *nick) -{ - /* no hard coded invalid nicks */ - return 1; -} - -/* - 1 = valid chan - 0 = chan is in valid -*/ -int viagra_valid_chan(const char *chan) -{ - /* no hard coded invalid chans */ - return 1; -} - - -void viagra_cmd_ctcp(const char *source, const char *dest, const char *buf) -{ - char *s; - - if (!buf) { - return; - } else { - s = normalizeBuffer(buf); - } - - send_cmd(source, "NOTICE %s :\1%s \1", dest, s); - free(s); -} - - -/** - * Tell anope which function we want to perform each task inside of anope. - * These prototypes must match what anope expects. - **/ -void moduleAddAnopeCmds() -{ - pmodule_cmd_topic(viagra_cmd_topic); - pmodule_cmd_vhost_off(viagra_cmd_vhost_off); - pmodule_cmd_akill(viagra_cmd_akill); - pmodule_cmd_svskill(viagra_cmd_svskill); - pmodule_cmd_svsmode(viagra_cmd_svsmode); - pmodule_cmd_372(viagra_cmd_372); - pmodule_cmd_372_error(viagra_cmd_372_error); - pmodule_cmd_375(viagra_cmd_375); - pmodule_cmd_376(viagra_cmd_376); - pmodule_cmd_nick(viagra_cmd_nick); - pmodule_cmd_guest_nick(viagra_cmd_guest_nick); - pmodule_cmd_mode(viagra_cmd_mode); - pmodule_cmd_bot_nick(viagra_cmd_bot_nick); - pmodule_cmd_kick(viagra_cmd_kick); - pmodule_cmd_notice_ops(viagra_cmd_notice_ops); - pmodule_cmd_notice(viagra_cmd_notice); - pmodule_cmd_notice2(viagra_cmd_notice2); - pmodule_cmd_privmsg(viagra_cmd_privmsg); - pmodule_cmd_privmsg2(viagra_cmd_privmsg2); - pmodule_cmd_serv_notice(viagra_cmd_serv_notice); - pmodule_cmd_serv_privmsg(viagra_cmd_serv_privmsg); - pmodule_cmd_bot_chan_mode(viagra_cmd_bot_chan_mode); - pmodule_cmd_351(viagra_cmd_351); - pmodule_cmd_quit(viagra_cmd_quit); - pmodule_cmd_pong(viagra_cmd_pong); - pmodule_cmd_join(viagra_cmd_join); - pmodule_cmd_unsqline(viagra_cmd_unsqline); - pmodule_cmd_invite(viagra_cmd_invite); - pmodule_cmd_part(viagra_cmd_part); - pmodule_cmd_391(viagra_cmd_391); - pmodule_cmd_250(viagra_cmd_250); - pmodule_cmd_307(viagra_cmd_307); - pmodule_cmd_311(viagra_cmd_311); - pmodule_cmd_312(viagra_cmd_312); - pmodule_cmd_317(viagra_cmd_317); - pmodule_cmd_219(viagra_cmd_219); - pmodule_cmd_401(viagra_cmd_401); - pmodule_cmd_318(viagra_cmd_318); - pmodule_cmd_242(viagra_cmd_242); - pmodule_cmd_243(viagra_cmd_243); - pmodule_cmd_211(viagra_cmd_211); - pmodule_cmd_global(viagra_cmd_global); - pmodule_cmd_global_legacy(viagra_cmd_global_legacy); - pmodule_cmd_sqline(viagra_cmd_sqline); - pmodule_cmd_squit(viagra_cmd_squit); - pmodule_cmd_svso(viagra_cmd_svso); - pmodule_cmd_chg_nick(viagra_cmd_chg_nick); - pmodule_cmd_svsnick(viagra_cmd_svsnick); - pmodule_cmd_vhost_on(viagra_cmd_vhost_on); - pmodule_cmd_connect(viagra_cmd_connect); - pmodule_cmd_svshold(viagra_cmd_svshold); - pmodule_cmd_release_svshold(viagra_cmd_release_svshold); - pmodule_cmd_unsgline(viagra_cmd_unsgline); - pmodule_cmd_unszline(viagra_cmd_unszline); - pmodule_cmd_szline(viagra_cmd_szline); - pmodule_cmd_sgline(viagra_cmd_sgline); - pmodule_cmd_unban(viagra_cmd_unban); - pmodule_cmd_svsmode_chan(viagra_cmd_svsmode_chan); - pmodule_cmd_svid_umode(viagra_cmd_svid_umode); - pmodule_cmd_nc_change(viagra_cmd_nc_change); - pmodule_cmd_svid_umode2(viagra_cmd_svid_umode2); - pmodule_cmd_svid_umode3(viagra_cmd_svid_umode3); - pmodule_cmd_svsjoin(viagra_cmd_svsjoin); - pmodule_cmd_svspart(viagra_cmd_svspart); - pmodule_cmd_swhois(viagra_cmd_swhois); - pmodule_cmd_eob(viagra_cmd_eob); - pmodule_flood_mode_check(viagra_flood_mode_check); - pmodule_cmd_jupe(viagra_cmd_jupe); - pmodule_valid_nick(viagra_valid_nick); - pmodule_valid_chan(viagra_valid_chan); - pmodule_cmd_ctcp(viagra_cmd_ctcp); - pmodule_set_umode(viagra_set_umode); -} - -/** - * Now tell anope how to use us. - **/ -int AnopeInit(int argc, char **argv) -{ - - moduleAddAuthor("Anope"); - moduleAddVersion("$Id$"); - moduleSetType(PROTOCOL); - - pmodule_ircd_version("ViagraIRCd 1.3.x"); - pmodule_ircd_cap(myIrcdcap); - pmodule_ircd_var(myIrcd); - pmodule_ircd_cbmodeinfos(myCbmodeinfos); - pmodule_ircd_cumodes(myCumodes); - pmodule_ircd_flood_mode_char_set(""); - pmodule_ircd_flood_mode_char_remove(""); - pmodule_ircd_cbmodes(myCbmodes); - pmodule_ircd_cmmodes(myCmmodes); - pmodule_ircd_csmodes(myCsmodes); - pmodule_ircd_useTSMode(0); - - /** Deal with modes anope _needs_ to know **/ - pmodule_invis_umode(UMODE_i); - pmodule_oper_umode(UMODE_o); - pmodule_invite_cmode(CMODE_i); - pmodule_secret_cmode(CMODE_s); - pmodule_private_cmode(CMODE_p); - pmodule_key_mode(CMODE_k); - pmodule_limit_mode(CMODE_l); - - moduleAddAnopeCmds(); - pmodule_ircd_proto(&ircd_proto); - moduleAddIRCDMsgs(); - - return MOD_CONT; -} diff --git a/src/protocol/viagra.h b/src/protocol/viagra.h deleted file mode 100644 index 3bdfec1e1..000000000 --- a/src/protocol/viagra.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Viagra IRCD functions - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ - -/* User Modes */ -#define UMODE_A 0x00000040 /* Is a Server Administrator. */ -#define UMODE_C 0x00002000 /* Is a Server Co Administrator. */ -#define UMODE_I 0x00008000 /* Stealth mode, makes you beeing hidden at channel. invisible joins/parts. */ -#define UMODE_N 0x00000400 /* Is a Network Administrator. */ -#define UMODE_O 0x00004000 /* Local IRC Operator. */ -#define UMODE_Q 0x00001000 /* Is an Abuse Administrator. */ -#define UMODE_R 0x08000000 /* Cant receive messages from non registered user. */ -#define UMODE_S 0x00000080 /* Is a Network Service. For Services only. */ -#define UMODE_T 0x00000800 /* Is a Technical Administrator. */ -#define UMODE_a 0x00000001 /* Is a Services Administrator. */ -#define UMODE_b 0x00040000 /* Can listen to generic bot warnings. */ -#define UMODE_c 0x00010000 /* See's all connects/disconnects on local server. */ -#define UMODE_d 0x00000100 /* Can listen to debug and channel cration notices. */ -#define UMODE_e 0x00080000 /* Can see client connections/exits on remote servers. */ -#define UMODE_f 0x00100000 /* Listen to flood/spam alerts from server. */ -#define UMODE_g 0x00000200 /* Can read & send to globops, and locops. */ -#define UMODE_h 0x00000002 /* Is a Help Operator. */ -#define UMODE_i 0x00000004 /* Invisible (Not shown in /who and /names searches). */ -#define UMODE_n 0x00020000 /* Can see client nick change notices. */ -#define UMODE_o 0x00000008 /* Global IRC Operator. */ -#define UMODE_r 0x00000010 /* Identifies the nick as being registered. */ -#define UMODE_s 0x00200000 /* Can listen to generic server messages. */ -#define UMODE_w 0x00000020 /* Can listen to wallop messages. */ -#define UMODE_x 0x40000000 /* Gives the user hidden hostname. */ - - -/* Channel Modes */ -#define CMODE_i 0x00000001 /* Invite-only allowed. */ -#define CMODE_m 0x00000002 /* Moderated channel, noone can speak and changing nick except users with mode +vho */ -#define CMODE_n 0x00000004 /* No messages from outside channel */ -#define CMODE_p 0x00000008 /* Private channel. */ -#define CMODE_s 0x00000010 /* Secret channel. */ -#define CMODE_t 0x00000020 /* Only channel operators may set the topic */ -#define CMODE_k 0x00000040 /* Needs the channel key to join the channel */ -#define CMODE_l 0x00000080 /* Channel may hold at most of users */ -#define CMODE_R 0x00000100 /* Requires a registered nickname to join the channel. */ -#define CMODE_r 0x00000200 /* Channel is registered. */ -#define CMODE_c 0x00000400 /* No ANSI color can be sent to the channel */ -#define CMODE_M 0x00000800 /* Requires a registered nickname to speak at the channel. */ -#define CMODE_H 0x00001000 /* HelpOps only channel. */ -#define CMODE_O 0x00008000 /* IRCOps only channel. */ -#define CMODE_S 0x00020000 /* Strips all mesages out of colors. */ -#define CMODE_N 0x01000000 /* No nickchanges allowed. */ -#define CMODE_P 0x02000000 /* "Peace mode" No kicks allowed unless by u:lines */ -#define CMODE_x 0x04000000 /* No bold/underlined or reversed text can be sent to the channel */ - -#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r - -void viagra_set_umode(User * user, int ac, const char **av); -void viagra_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when); -void viagra_cmd_vhost_off(User * u); -void viagra_cmd_akill(const char *user, const char *host, const char *who, time_t when,time_t expires, const char *reason); -void viagra_cmd_svskill(const char *source, const char *user, const char *buf); -void viagra_cmd_svsmode(User * u, int ac, const char **av); -void viagra_cmd_372(const char *source, const char *msg); -void viagra_cmd_372_error(const char *source); -void viagra_cmd_375(const char *source); -void viagra_cmd_376(const char *source); -void viagra_cmd_nick(const char *nick, const char *name, const char *modes); -void viagra_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void viagra_cmd_mode(const char *source, const char *dest, const char *buf); -void viagra_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); -void viagra_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); -void viagra_cmd_notice_ops(const char *source, const char *dest, const char *buf); -void viagra_cmd_notice(const char *source, const char *dest, const char *buf); -void viagra_cmd_notice2(const char *source, const char *dest, const char *msg); -void viagra_cmd_privmsg(const char *source, const char *dest, const char *buf); -void viagra_cmd_privmsg2(const char *source, const char *dest, const char *msg); -void viagra_cmd_serv_notice(const char *source, const char *dest, const char *msg); -void viagra_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); -void viagra_cmd_bot_chan_mode(const char *nick, const char *chan); -void viagra_cmd_351(const char *source); -void viagra_cmd_quit(const char *source, const char *buf); -void viagra_cmd_pong(const char *servname, const char *who); -void viagra_cmd_join(const char *user, const char *channel, time_t chantime); -void viagra_cmd_unsqline(const char *user); -void viagra_cmd_invite(const char *source, const char *chan, const char *nick); -void viagra_cmd_part(const char *nick, const char *chan, const char *buf); -void viagra_cmd_391(const char *source, const char *timestr); -void viagra_cmd_250(const char *buf); -void viagra_cmd_307(const char *buf); -void viagra_cmd_311(const char *buf); -void viagra_cmd_312(const char *buf); -void viagra_cmd_317(const char *buf); -void viagra_cmd_219(const char *source, const char *letter); -void viagra_cmd_401(const char *source, const char *who); -void viagra_cmd_318(const char *source, const char *who); -void viagra_cmd_242(const char *buf); -void viagra_cmd_243(const char *buf); -void viagra_cmd_211(const char *buf); -void viagra_cmd_global(const char *source, const char *buf); -void viagra_cmd_global_legacy(const char *source, const char *fmt); -void viagra_cmd_sqline(const char *mask, const char *reason); -void viagra_cmd_squit(const char *servname, const char *message); -void viagra_cmd_svso(const char *source, const char *nick, const char *flag); -void viagra_cmd_chg_nick(const char *oldnick, const char *newnick); -void viagra_cmd_svsnick(const char *source, const char *guest, time_t when); -void viagra_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost); -void viagra_cmd_connect(int servernum); -void viagra_cmd_svshold(const char *nick); -void viagra_cmd_release_svshold(const char *nick); -void viagra_cmd_unsgline(const char *mask); -void viagra_cmd_unszline(const char *mask); -void viagra_cmd_szline(const char *mask, const char *reason, const char *whom); -void viagra_cmd_sgline(const char *mask, const char *reason); -void viagra_cmd_unban(const char *name, const char *nick); -void viagra_cmd_svsmode_chan(const char *name, const char *mode, const char *nick); -void viagra_cmd_svid_umode(const char *nick, time_t ts); -void viagra_cmd_nc_change(User * u); -void viagra_cmd_svid_umode2(User * u, const char *ts); -void viagra_cmd_svid_umode3(User * u, const char *ts); -void viagra_cmd_eob(); -int viagra_flood_mode_check(const char *value); -void viagra_cmd_jupe(const char *jserver, const char *who, const char *reason); -int viagra_valid_nick(const char *nick); -void viagra_cmd_ctcp(const char *source, const char *dest, const char *buf); - -class ViagraIRCdProto : public IRCDProtoNew { - public: - void cmd_svsnoop(const char *, int); - void cmd_remove_akill(const char *, const char *); -} ircd_proto; diff --git a/src/tools/Makefile b/src/tools/Makefile index c0aa9fb85..da9c86827 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -1,4 +1,4 @@ -SRCS = anopesmtp.c db-merger.c epona2anope.c +SRCS = anopesmtp.c db-merger.c OBJS = $(SRCS:.c=.o) INCLUDES = ../../include/services.h diff --git a/src/tools/Makefile.win32 b/src/tools/Makefile.win32 index 77e7f2c91..54fe47f0c 100644 --- a/src/tools/Makefile.win32 +++ b/src/tools/Makefile.win32 @@ -1,6 +1,6 @@ include ../../Makefile.inc.win32 -SRCS=anopesmtp.c epona2anope.c db-merger.c +SRCS=anopesmtp.c db-merger.c OBJECTS= $(SRCS:.c=.exe) CFLAGS=$(CFLAGS) /I"../../include" LFLAGS=/link wsock32.lib $(LIBS) $(LFLAGS) diff --git a/src/tools/anopesmtp.c b/src/tools/anopesmtp.c index 4ff0c6fcf..f5981a851 100644 --- a/src/tools/anopesmtp.c +++ b/src/tools/anopesmtp.c @@ -181,7 +181,7 @@ char *strip(char *buf) */ char *lftocrlf(char *buf) { - char *result = malloc(strlen(buf) + 2); + char *result = (char *)malloc(strlen(buf) + 2); strip(buf); strcpy(result, buf); strcat(result, "\r\n"); @@ -193,7 +193,7 @@ char *lftocrlf(char *buf) /* Add a header to the list */ void smtp_add_header(char *header) { - struct smtp_header *head = malloc(sizeof(struct smtp_header)); + struct smtp_header *head = (struct smtp_header *)malloc(sizeof(struct smtp_header)); head->header = lftocrlf(header); head->next = NULL; @@ -276,7 +276,7 @@ void smtp_add_body_line(char *line) { struct smtp_body_line *body; - body = malloc(sizeof(struct smtp_body_line)); + body = (struct smtp_body_line *)malloc(sizeof(struct smtp_body_line)); body->line = lftocrlf(line); body->next = NULL; diff --git a/src/tools/db-merger.c b/src/tools/db-merger.c index 7ecbbbff6..fbcbf966c 100644 --- a/src/tools/db-merger.c +++ b/src/tools/db-merger.c @@ -362,7 +362,7 @@ int main(int argc, char *argv[]) exit(0); } - nc = calloc(1, sizeof(NickCore)); + nc = (NickCore *)calloc(1, sizeof(NickCore)); nc->aliascount = 0; nc->unused = 0; @@ -382,7 +382,7 @@ int main(int argc, char *argv[]) READ(read_uint16(&nc->accesscount, f)); if (nc->accesscount) { char **access; - access = calloc(sizeof(char *) * nc->accesscount, 1); + access = (char **)calloc(sizeof(char *) * nc->accesscount, 1); nc->access = access; for (j = 0; j < nc->accesscount; j++, access++) READ(read_string(access, f)); @@ -391,7 +391,7 @@ int main(int argc, char *argv[]) READ(read_int16(&nc->memos.memomax, f)); if (nc->memos.memocount) { Memo *memos; - memos = calloc(sizeof(Memo) * nc->memos.memocount, 1); + memos = (Memo *)calloc(sizeof(Memo) * nc->memos.memocount, 1); nc->memos.memos = memos; for (j = 0; j < nc->memos.memocount; j++, memos++) { READ(read_uint32(&memos->number, f)); @@ -421,7 +421,7 @@ int main(int argc, char *argv[]) exit(0); } - na = calloc(1, sizeof(NickAlias)); + na = (NickAlias *)calloc(1, sizeof(NickAlias)); READ(read_string(&na->nick, f)); READ(read_string(&na->last_usermask, f)); @@ -468,7 +468,7 @@ int main(int argc, char *argv[]) exit(0); } - nc = calloc(1, sizeof(NickCore)); + nc = (NickCore *)calloc(1, sizeof(NickCore)); READ(read_string(&nc->display, f)); READ(read_string(&nc->pass, f)); READ(read_string(&nc->email, f)); @@ -496,7 +496,7 @@ int main(int argc, char *argv[]) READ(read_uint16(&nc->accesscount, f)); if (nc->accesscount) { char **access; - access = calloc(sizeof(char *) * nc->accesscount, 1); + access = (char **)calloc(sizeof(char *) * nc->accesscount, 1); nc->access = access; for (j = 0; j < nc->accesscount; j++, access++) READ(read_string(access, f)); @@ -505,7 +505,7 @@ int main(int argc, char *argv[]) READ(read_int16(&nc->memos.memomax, f)); if (nc->memos.memocount) { Memo *memos; - memos = calloc(sizeof(Memo) * nc->memos.memocount, 1); + memos = (Memo *)calloc(sizeof(Memo) * nc->memos.memocount, 1); nc->memos.memos = memos; for (j = 0; j < nc->memos.memocount; j++, memos++) { READ(read_uint32(&memos->number, f)); @@ -532,7 +532,7 @@ int main(int argc, char *argv[]) exit(0); } - na = calloc(1, sizeof(NickAlias)); + na = (NickAlias *)calloc(1, sizeof(NickAlias)); READ(read_string(&na->nick, f)); READ(read_string(&na->last_usermask, f)); @@ -730,7 +730,7 @@ int main(int argc, char *argv[]) exit(0); } - ci = calloc(sizeof(ChannelInfo), 1); + ci = (ChannelInfo *)calloc(sizeof(ChannelInfo), 1); *last = ci; last = &ci->next; ci->prev = prev; @@ -761,7 +761,7 @@ int main(int argc, char *argv[]) ci->bantype = tmp16; READ(read_int16(&tmp16, f)); n_levels = tmp16; - ci->levels = calloc(36 * sizeof(*ci->levels), 1); + ci->levels = (int16 *)calloc(36 * sizeof(*ci->levels), 1); for (j = 0; j < n_levels; j++) { if (j < 36) READ(read_int16(&ci->levels[j], f)); @@ -770,7 +770,7 @@ int main(int argc, char *argv[]) } READ(read_uint16(&ci->accesscount, f)); if (ci->accesscount) { - ci->access = calloc(ci->accesscount, sizeof(ChanAccess)); + ci->access = (ChanAccess *)calloc(ci->accesscount, sizeof(ChanAccess)); for (j = 0; j < ci->accesscount; j++) { READ(read_uint16(&ci->access[j].in_use, f)); if (ci->access[j].in_use) { @@ -791,7 +791,7 @@ int main(int argc, char *argv[]) } READ(read_uint16(&ci->akickcount, f)); if (ci->akickcount) { - ci->akick = calloc(ci->akickcount, sizeof(AutoKick)); + ci->akick = (AutoKick *)calloc(ci->akickcount, sizeof(AutoKick)); for (j = 0; j < ci->akickcount; j++) { SAFE(read_uint16(&ci->akick[j].flags, f)); if (ci->akick[j].flags & 0x0001) { @@ -833,7 +833,7 @@ int main(int argc, char *argv[]) READ(read_int16(&ci->memos.memomax, f)); if (ci->memos.memocount) { Memo *memos; - memos = calloc(sizeof(Memo) * ci->memos.memocount, 1); + memos = (Memo *)calloc(sizeof(Memo) * ci->memos.memocount, 1); ci->memos.memos = memos; for (j = 0; j < ci->memos.memocount; j++, memos++) { READ(read_uint32(&memos->number, f)); @@ -852,7 +852,7 @@ int main(int argc, char *argv[]) ci->botflags = tmp32; READ(read_int16(&tmp16, f)); n_ttb = tmp16; - ci->ttb = calloc(2 * 8, 1); + ci->ttb = (int16 *)calloc(2 * 8, 1); for (j = 0; j < n_ttb; j++) { if (j < 8) READ(read_int16(&ci->ttb[j], f)); @@ -874,7 +874,7 @@ int main(int argc, char *argv[]) READ(read_uint16(&ci->bwcount, f)); if (ci->bwcount) { - ci->badwords = calloc(ci->bwcount, sizeof(BadWord)); + ci->badwords = (BadWord *)calloc(ci->bwcount, sizeof(BadWord)); for (j = 0; j < ci->bwcount; j++) { SAFE(read_uint16(&ci->badwords[j].in_use, f)); if (ci->badwords[j].in_use) { @@ -918,7 +918,7 @@ int main(int argc, char *argv[]) exit(0); } - ci = calloc(sizeof(ChannelInfo), 1); + ci = (ChannelInfo *)calloc(sizeof(ChannelInfo), 1); READ(read_buffer(ci->name, f)); READ(read_string(&ci->founder, f)); READ(read_string(&ci->successor, f)); @@ -945,7 +945,7 @@ int main(int argc, char *argv[]) ci->bantype = tmp16; READ(read_int16(&tmp16, f)); n_levels = tmp16; - ci->levels = calloc(36 * sizeof(*ci->levels), 1); + ci->levels = (int16 *)calloc(36 * sizeof(*ci->levels), 1); for (j = 0; j < n_levels; j++) { if (j < 36) READ(read_int16(&ci->levels[j], f)); @@ -954,7 +954,7 @@ int main(int argc, char *argv[]) } READ(read_uint16(&ci->accesscount, f)); if (ci->accesscount) { - ci->access = calloc(ci->accesscount, sizeof(ChanAccess)); + ci->access = (ChanAccess *)calloc(ci->accesscount, sizeof(ChanAccess)); for (j = 0; j < ci->accesscount; j++) { READ(read_uint16(&ci->access[j].in_use, f)); if (ci->access[j].in_use) { @@ -975,7 +975,7 @@ int main(int argc, char *argv[]) } READ(read_uint16(&ci->akickcount, f)); if (ci->akickcount) { - ci->akick = calloc(ci->akickcount, sizeof(AutoKick)); + ci->akick = (AutoKick *)calloc(ci->akickcount, sizeof(AutoKick)); for (j = 0; j < ci->akickcount; j++) { SAFE(read_uint16(&ci->akick[j].flags, f)); if (ci->akick[j].flags & 0x0001) { @@ -1017,7 +1017,7 @@ int main(int argc, char *argv[]) READ(read_int16(&ci->memos.memomax, f)); if (ci->memos.memocount) { Memo *memos; - memos = calloc(sizeof(Memo) * ci->memos.memocount, 1); + memos = (Memo *)calloc(sizeof(Memo) * ci->memos.memocount, 1); ci->memos.memos = memos; for (j = 0; j < ci->memos.memocount; j++, memos++) { READ(read_uint32(&memos->number, f)); @@ -1036,7 +1036,7 @@ int main(int argc, char *argv[]) ci->botflags = tmp32; READ(read_int16(&tmp16, f)); n_ttb = tmp16; - ci->ttb = calloc(32, 1); + ci->ttb = (int16 *)calloc(32, 1); for (j = 0; j < n_ttb; j++) { if (j < 8) READ(read_int16(&ci->ttb[j], f)); @@ -1058,7 +1058,7 @@ int main(int argc, char *argv[]) READ(read_uint16(&ci->bwcount, f)); if (ci->bwcount) { - ci->badwords = calloc(ci->bwcount, sizeof(BadWord)); + ci->badwords = (BadWord *)calloc(ci->bwcount, sizeof(BadWord)); for (j = 0; j < ci->bwcount; j++) { SAFE(read_uint16(&ci->badwords[j].in_use, f)); if (ci->badwords[j].in_use) { @@ -1384,7 +1384,7 @@ int main(int argc, char *argv[]) exit(0); } - bi = calloc(sizeof(BotInfo), 1); + bi = (BotInfo *)calloc(sizeof(BotInfo), 1); READ(read_string(&bi->nick, f)); READ(read_string(&bi->user, f)); READ(read_string(&bi->host, f)); @@ -1415,7 +1415,7 @@ int main(int argc, char *argv[]) exit(0); } - bi = calloc(sizeof(BotInfo), 1); + bi = (BotInfo *)calloc(sizeof(BotInfo), 1); READ(read_string(&bi->nick, f)); READ(read_string(&bi->user, f)); READ(read_string(&bi->host, f)); @@ -1517,7 +1517,7 @@ int main(int argc, char *argv[]) printf("Invalid format in %s.\n", HOST_DB_1); exit(0); } - hc = calloc(1, sizeof(HostCore)); + hc = (HostCore *)calloc(1, sizeof(HostCore)); READ(read_string(&hc->nick, f)); READ(read_string(&hc->vIdent, f)); READ(read_string(&hc->vHost, f)); @@ -1548,7 +1548,7 @@ int main(int argc, char *argv[]) exit(0); } collision = 0; - hc = calloc(1, sizeof(HostCore)); + hc = (HostCore *)calloc(1, sizeof(HostCore)); READ(read_string(&hc->nick, f)); READ(read_string(&hc->vIdent, f)); READ(read_string(&hc->vHost, f)); @@ -1651,7 +1651,7 @@ dbFILE *open_db_read(const char *service, const char *filename, int version) FILE *fp; int myversion; - f = calloc(sizeof(*f), 1); + f = (dbFILE *)calloc(sizeof(*f), 1); if (!f) { printf("Can't allocate memory for %s database %s.\n", service, filename); exit(0); @@ -1682,7 +1682,7 @@ dbFILE *open_db_write(const char *service, const char *filename, int version) dbFILE *f; int fd; - f = calloc(sizeof(*f), 1); + f = (dbFILE *)calloc(sizeof(*f), 1); if (!f) { printf("Can't allocate memory for %s database %s.\n", service, filename); exit(0); @@ -1829,7 +1829,7 @@ int read_string(char **ret, dbFILE * f) *ret = NULL; return 0; } - s = calloc(len, 1); + s = (char *)calloc(len, 1); if (len != fread(s, 1, len, f->fp)) { free(s); return -1; diff --git a/src/tools/epona2anope.c b/src/tools/epona2anope.c deleted file mode 100644 index d89be6d12..000000000 --- a/src/tools/epona2anope.c +++ /dev/null @@ -1,856 +0,0 @@ -/* - * IRC - Internet Relay Chat, epona2anope.c - * (C) Copyright 2005-2006, Florian Schulze (Certus) - * - * Based on the original code of Anope, (C) 2003-2005 Anope Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (see it online - * at http://www.gnu.org/copyleft/gpl.html) as published by the Free - * Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This program tries to convert epona-1.4.15+ dbs to anope standard dbs. - * At the moment this only affects chanserv dbs. - * - * - Certus - * February 26, 2005 - * - * Added win32 fix. Who needs that anyways? :P - * - Certus - * July 20, 2006 - */ - - -#include -#include -#include -#include -#include -#include - -#ifndef _WIN32 -#include -#else -#include "sysconf.h" -#include -#endif - -/* Some SUN fixs */ -#ifdef __sun -/* Solaris specific code, types that do not exist in Solaris' - * * sys/types.h - * **/ -#undef u_int8_t -#undef u_int16_t -#undef u_int32_t -#undef u_int_64_t -#define u_int8_t uint8_t -#define u_int16_t uint16_t -#define u_int32_t uint32_t -#define u_int64_t uint64_t - -#ifndef INADDR_NONE -#define INADDR_NONE (-1) -#endif - -#endif - - -/* CONFIGURATION BLOCK */ - -#define CHAN_DB_EPONA "chan1.db" -#define CHAN_DB_ANOPE "chan.db" - -/* END OF CONFIGURATION BLOCK */ - -#ifndef _WIN32 -#define C_LBLUE "\033[1;34m" -#define C_NONE "\033[m" -#else -#define C_LBLUE "" -#define C_NONE "" -#endif - -#define getc_db(f) (fgetc((f)->fp)) -#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31)) -#define HASH2(chan) ((chan)[1] ? ((chan)[1]&31)<<5 | ((chan)[2]&31) : 0) -#define read_buffer(buf,f) (read_db((f),(buf),sizeof(buf)) == sizeof(buf)) -#define write_buffer(buf,f) (write_db((f),(buf),sizeof(buf)) == sizeof(buf)) -#define read_db(f,buf,len) (fread((buf),1,(len),(f)->fp)) -#define write_db(f,buf,len) (fwrite((buf),1,(len),(f)->fp)) -#define read_int8(ret,f) ((*(ret)=fgetc((f)->fp))==EOF ? -1 : 0) -#define write_int8(val,f) (fputc((val),(f)->fp)==EOF ? -1 : 0) -#define SAFE(x) do { \ - if ((x) < 0) { \ - printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ - } \ -} while (0) -#define READ(x) do { \ - if ((x) < 0) { \ - printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ - exit(0); \ - } \ -} while (0) - -typedef int16_t int16; -typedef u_int16_t uint16; -typedef int32_t int32; -typedef u_int32_t uint32; -typedef struct memo_ Memo; -typedef struct dbFILE_ dbFILE; -typedef struct nickalias_ NickAlias; -typedef struct nickcore_ NickCore; -typedef struct chaninfo_ ChannelInfo; -typedef struct botinfo_ BotInfo; -typedef struct badword_ BadWord; -typedef struct hostcore_ HostCore; - -struct memo_ { - uint32 number; /* Index number -- not necessarily array position! */ - int16 flags; /* Flags */ - time_t time; /* When was it sent? */ - char sender[32]; /* Name of the sender */ - char *text; -}; - -struct dbFILE_ { - int mode; /* 'r' for reading, 'w' for writing */ - FILE *fp; /* The normal file descriptor */ - char filename[1024]; /* Name of the database file */ -}; - -typedef struct { - int16 memocount; /* Current # of memos */ - int16 memomax; /* Max # of memos one can hold*/ - Memo *memos; /* Pointer to original memos */ -} MemoInfo; - -typedef struct { - int16 in_use; /* 1 if this entry is in use, else 0 */ - int16 level; - NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */ - time_t last_seen; -} ChanAccess; - -typedef struct { - int16 in_use; /* Always 0 if not in use */ - int16 is_nick; /* 1 if a regged nickname, 0 if a nick!user@host mask */ - int16 flags; - union { - char *mask; /* Guaranteed to be non-NULL if in use, NULL if not */ - NickCore *nc; /* Same */ - } u; - char *reason; - char *creator; - time_t addtime; -} AutoKick; - -struct nickcore_ { - NickCore *next, *prev; - - char *display; /* How the nick is displayed */ - int unused; /* Used for nick collisions */ -}; - -struct chaninfo_ { - ChannelInfo *next, *prev; - - char name[64]; /* Channel name */ - char *founder; /* Who registered the channel */ - char *successor; /* Who gets the channel if the founder nick is dropped or expires */ - char founderpass[32]; /* Channel password */ - char *desc; /* Description */ - char *url; /* URL */ - char *email; /* Email address */ - time_t time_registered; /* When was it registered */ - time_t last_used; /* When was it used hte last time */ - char *last_topic; /* Last topic on the channel */ - char last_topic_setter[32]; /* Who set the last topic */ - time_t last_topic_time; /* When the last topic was set */ - uint32 flags; /* Flags */ - char *forbidby; /* if forbidden: who did it */ - char *forbidreason; /* if forbidden: why */ - int16 bantype; /* Bantype */ - int16 *levels; /* Access levels for commands */ - int16 accesscount; /* # of pple with access */ - ChanAccess *access; /* List of authorized users */ - int16 akickcount; /* # of akicked pple */ - AutoKick *akick; /* List of users to kickban */ - uint32 mlock_on, mlock_off; /* See channel modes below */ - uint32 mlock_limit; /* 0 if no limit */ - char *mlock_key; /* NULL if no key */ - char *mlock_flood; /* NULL if no +f */ - char *mlock_joinrate; /* NULL if no +j */ - char *mlock_redirect; /* NULL if no +L */ - char *entry_message; /* Notice sent on entering channel */ - MemoInfo memos; /* Memos */ - char *bi; /* Bot used on this channel */ - uint32 botflags; /* BS_* below */ - int16 *ttb; /* Times to ban for each kicker */ - int16 bwcount; /* Badword count */ - BadWord *badwords; /* For BADWORDS kicker */ - int16 capsmin, capspercent; /* For CAPS kicker */ - int16 floodlines, floodsecs; /* For FLOOD kicker */ - int16 repeattimes; /* For REPEAT kicker */ -}; - -struct botinfo_ { - BotInfo *next, *prev; - char *nick; /* Nickname of the bot */ - char *user; /* Its user name */ - char *host; /* Its hostname */ - char *real; /* Its real name */ - int16 flags; /* Bot flags */ - time_t created; /* Birth date */ - int16 chancount; /* Number of channels that use the bot. */ -}; - -struct badword_ { - int16 in_use; - char *word; - int16 type; -}; - -dbFILE *open_db_write(const char *service, const char *filename, int version); -dbFILE *open_db_read(const char *service, const char *filename, int version); -NickCore *findcore(const char *nick, int version); -ChannelInfo *cs_findchan(const char *chan); -char *strscpy(char *d, const char *s, size_t len); -int write_file_version(dbFILE * f, uint32 version); -int mystricmp(const char *s1, const char *s2); -int write_string(const char *s, dbFILE * f); -int write_ptr(const void *ptr, dbFILE * f); -int read_int16(int16 * ret, dbFILE * f); -int read_uint16(uint16 * ret, dbFILE * f); -int read_int32(int32 * ret, dbFILE * f); -int read_uint32(uint32 * ret, dbFILE * f); -int read_string(char **ret, dbFILE * f); -int write_int16(uint16 val, dbFILE * f); -int write_int32(uint32 val, dbFILE * f); -int read_ptr(void **ret, dbFILE * f); -void alpha_insert_chan(ChannelInfo * ci); -void close_db(dbFILE * f); - -ChannelInfo *chanlists[256]; -NickCore *nclists[1024]; - -int main(int argc, char *argv[]) -{ - dbFILE *f; - int i; - long countr = 0, countw = 0; - /* Unused variables - why? -GD - NickCore *nc, *ncnext; - */ - - printf("\n"C_LBLUE"Epona to Anope DB converter by Certus"C_NONE"\n\n"); - - /* Section I: Reading */ - if ((f = open_db_read("ChanServ", CHAN_DB_EPONA, 17))) { - ChannelInfo *ci, **last, *prev; - int c; - - printf("Trying to convert channel database...\n"); - - for (i = 0; i < 256; i++) { - int16 tmp16; - int32 tmp32; - int n_levels; - char *s; - int n_ttb; - /* Unused variable - why? -GD - int J; - */ - - last = &chanlists[i]; - prev = NULL; - - while ((c = getc_db(f)) == 1) { - int j; - - if (c != 1) { - printf("Invalid format in %s.\n", CHAN_DB_EPONA); - exit(0); - } - - ci = calloc(sizeof(ChannelInfo), 1); - *last = ci; - last = &ci->next; - ci->prev = prev; - prev = ci; - READ(read_buffer(ci->name, f)); - READ(read_string(&ci->founder, f)); - READ(read_string(&ci->successor, f)); - READ(read_buffer(ci->founderpass, f)); - READ(read_string(&ci->desc, f)); - if (!ci->desc) - ci->desc = strdup(""); - READ(read_string(&ci->url, f)); - READ(read_string(&ci->email, f)); - READ(read_int32(&tmp32, f)); - ci->time_registered = tmp32; - READ(read_int32(&tmp32, f)); - ci->last_used = tmp32; - READ(read_string(&ci->last_topic, f)); - READ(read_buffer(ci->last_topic_setter, f)); - READ(read_int32(&tmp32, f)); - ci->last_topic_time = tmp32; - READ(read_uint32(&ci->flags, f)); - /* Temporary flags cleanup */ - ci->flags &= ~0x80000000; - READ(read_string(&ci->forbidby, f)); - READ(read_string(&ci->forbidreason, f)); - READ(read_int16(&tmp16, f)); - ci->bantype = tmp16; - READ(read_int16(&tmp16, f)); - n_levels = tmp16; - ci->levels = calloc(36 * sizeof(*ci->levels), 1); - for (j = 0; j < n_levels; j++) { - if (j < 36) - READ(read_int16(&ci->levels[j], f)); - else - READ(read_int16(&tmp16, f)); - } - READ(read_int16(&ci->accesscount, f)); - if (ci->accesscount) { - ci->access = calloc(ci->accesscount, sizeof(ChanAccess)); - for (j = 0; j < ci->accesscount; j++) { - READ(read_int16(&ci->access[j].in_use, f)); - if (ci->access[j].in_use) { - READ(read_int16(&ci->access[j].level, f)); - READ(read_string(&s, f)); - if (s) { - ci->access[j].nc = findcore(s, 0); - free(s); - } - if (ci->access[j].nc == NULL) - ci->access[j].in_use = 0; - READ(read_int32(&tmp32, f)); - ci->access[j].last_seen = tmp32; - } - } - } else { - ci->access = NULL; - } - READ(read_int16(&ci->akickcount, f)); - if (ci->akickcount) { - ci->akick = calloc(ci->akickcount, sizeof(AutoKick)); - for (j = 0; j < ci->akickcount; j++) { - SAFE(read_int16(&ci->akick[j].flags, f)); - if (ci->akick[j].flags & 0x0001) { - SAFE(read_string(&s, f)); - if (ci->akick[j].flags & 0x0002) { - ci->akick[j].u.nc = findcore(s, 0); - if (!ci->akick[j].u.nc) - ci->akick[j].flags &= ~0x0001; - free(s); - } else { - ci->akick[j].u.mask = s; - } - SAFE(read_string(&s, f)); - if (ci->akick[j].flags & 0x0001) - ci->akick[j].reason = s; - else if (s) - free(s); - SAFE(read_string(&s, f)); - if (ci->akick[j].flags & 0x0001) { - ci->akick[j].creator = s; - } else if (s) { - free(s); - } - SAFE(read_int32(&tmp32, f)); - if (ci->akick[j].flags & 0x0001) - ci->akick[j].addtime = tmp32; - } - } - } else { - ci->akick = NULL; - } - READ(read_uint32(&ci->mlock_on, f)); - READ(read_uint32(&ci->mlock_off, f)); - READ(read_uint32(&ci->mlock_limit, f)); - READ(read_string(&ci->mlock_key, f)); - READ(read_string(&ci->mlock_flood, f)); - READ(read_string(&ci->mlock_joinrate, f)); - READ(read_string(&ci->mlock_redirect, f)); - READ(read_int16(&ci->memos.memocount, f)); - READ(read_int16(&ci->memos.memomax, f)); - if (ci->memos.memocount) { - Memo *memos; - memos = calloc(sizeof(Memo) * ci->memos.memocount, 1); - ci->memos.memos = memos; - for (j = 0; j < ci->memos.memocount; j++, memos++) { - READ(read_uint32(&memos->number, f)); - READ(read_int16(&memos->flags, f)); - READ(read_int32(&tmp32, f)); - memos->time = tmp32; - READ(read_buffer(memos->sender, f)); - READ(read_string(&memos->text, f)); - } - } - READ(read_string(&ci->entry_message, f)); - - /* BotServ options */ - READ(read_string(&ci->bi, f)); - READ(read_int32(&tmp32, f)); - ci->botflags = tmp32; - READ(read_int16(&tmp16, f)); - n_ttb = tmp16; - ci->ttb = calloc(2 * 8, 1); - for (j = 0; j < n_ttb; j++) { - if (j < 8) - READ(read_int16(&ci->ttb[j], f)); - else - READ(read_int16(&tmp16, f)); - } - for (j = n_ttb; j < 8; j++) - ci->ttb[j] = 0; - READ(read_int16(&tmp16, f)); - ci->capsmin = tmp16; - READ(read_int16(&tmp16, f)); - ci->capspercent = tmp16; - READ(read_int16(&tmp16, f)); - ci->floodlines = tmp16; - READ(read_int16(&tmp16, f)); - ci->floodsecs = tmp16; - READ(read_int16(&tmp16, f)); - ci->repeattimes = tmp16; - - READ(read_int16(&ci->bwcount, f)); - if (ci->bwcount) { - ci->badwords = calloc(ci->bwcount, sizeof(BadWord)); - for (j = 0; j < ci->bwcount; j++) { - SAFE(read_int16(&ci->badwords[j].in_use, f)); - if (ci->badwords[j].in_use) { - SAFE(read_string(&ci->badwords[j].word, f)); - SAFE(read_int16(&ci->badwords[j].type, f)); - } - } - } else { - ci->badwords = NULL; - } - countr++; - } /* getc_db() */ - *last = NULL; - } /* for() loop */ - close_db(f); - } - - /* II: Saving */ - { - if ((f = open_db_write("ChanServ", CHAN_DB_ANOPE, 16))) { - ChannelInfo *ci; - Memo *memos; - /* Unused variable - why? -GD - static time_t lastwarn = 0; - */ - - for (i = 0; i < 256; i++) { - int16 tmp16; - for (ci = chanlists[i]; ci; ci = ci->next) { - int j; - SAFE(write_int8(1, f)); - SAFE(write_buffer(ci->name, f)); - if (ci->founder) - SAFE(write_string(ci->founder, f)); - else - SAFE(write_string(NULL, f)); - if (ci->successor) - SAFE(write_string(ci->successor, f)); - else - SAFE(write_string(NULL, f)); - SAFE(write_buffer(ci->founderpass, f)); - SAFE(write_string(ci->desc, f)); - SAFE(write_string(ci->url, f)); - SAFE(write_string(ci->email, f)); - SAFE(write_int32(ci->time_registered, f)); - SAFE(write_int32(ci->last_used, f)); - SAFE(write_string(ci->last_topic, f)); - SAFE(write_buffer(ci->last_topic_setter, f)); - SAFE(write_int32(ci->last_topic_time, f)); - SAFE(write_int32(ci->flags, f)); - SAFE(write_string(ci->forbidby, f)); - SAFE(write_string(ci->forbidreason, f)); - SAFE(write_int16(ci->bantype, f)); - tmp16 = 36; - SAFE(write_int16(tmp16, f)); - for (j = 0; j < 36; j++) - SAFE(write_int16(ci->levels[j], f)); - - SAFE(write_int16(ci->accesscount, f)); - for (j = 0; j < ci->accesscount; j++) { - SAFE(write_int16(ci->access[j].in_use, f)); - if (ci->access[j].in_use) { - SAFE(write_int16(ci->access[j].level, f)); - SAFE(write_string(ci->access[j].nc->display, f)); - SAFE(write_int32(ci->access[j].last_seen, f)); - } - } - SAFE(write_int16(ci->akickcount, f)); - for (j = 0; j < ci->akickcount; j++) { - SAFE(write_int16(ci->akick[j].flags, f)); - if (ci->akick[j].flags & 0x0001) { - if (ci->akick[j].flags & 0x0002) - SAFE(write_string(ci->akick[j].u.nc->display, f)); - else - SAFE(write_string(ci->akick[j].u.mask, f)); - SAFE(write_string(ci->akick[j].reason, f)); - SAFE(write_string(ci->akick[j].creator, f)); - SAFE(write_int32(ci->akick[j].addtime, f)); - } - } - - SAFE(write_int32(ci->mlock_on, f)); - SAFE(write_int32(ci->mlock_off, f)); - SAFE(write_int32(ci->mlock_limit, f)); - SAFE(write_string(ci->mlock_key, f)); - SAFE(write_string(ci->mlock_flood, f)); - SAFE(write_string(ci->mlock_redirect, f)); - SAFE(write_int16(ci->memos.memocount, f)); - SAFE(write_int16(ci->memos.memomax, f)); - memos = ci->memos.memos; - for (j = 0; j < ci->memos.memocount; j++, memos++) { - SAFE(write_int32(memos->number, f)); - SAFE(write_int16(memos->flags, f)); - SAFE(write_int32(memos->time, f)); - SAFE(write_buffer(memos->sender, f)); - SAFE(write_string(memos->text, f)); - } - SAFE(write_string(ci->entry_message, f)); - if (ci->bi) - SAFE(write_string(ci->bi, f)); - else - SAFE(write_string(NULL, f)); - SAFE(write_int32(ci->botflags, f)); - tmp16 = 8; - SAFE(write_int16(tmp16, f)); - for (j = 0; j < 8; j++) - SAFE(write_int16(ci->ttb[j], f)); - SAFE(write_int16(ci->capsmin, f)); - SAFE(write_int16(ci->capspercent, f)); - SAFE(write_int16(ci->floodlines, f)); - SAFE(write_int16(ci->floodsecs, f)); - SAFE(write_int16(ci->repeattimes, f)); - - SAFE(write_int16(ci->bwcount, f)); - for (j = 0; j < ci->bwcount; j++) { - SAFE(write_int16(ci->badwords[j].in_use, f)); - if (ci->badwords[j].in_use) { - SAFE(write_string(ci->badwords[j].word, f)); - SAFE(write_int16(ci->badwords[j].type, f)); - } - } - countw++; - } /* for (chanlists[i]) */ - SAFE(write_int8(0, f)); - } /* for (i) */ - close_db(f); - printf("%ld channels read, %ld channels written. New database saved as %s.\n", countr, countw, CHAN_DB_ANOPE); - } - } - - printf("\n\nConverting is now done.\n"); - return 0; -} /* End of main() */ - -/* Open a database file for reading and check for the version */ -dbFILE *open_db_read(const char *service, const char *filename, int version) -{ - dbFILE *f; - FILE *fp; - int myversion; - - f = calloc(sizeof(*f), 1); - if (!f) { - printf("Can't allocate memory for %s database %s.\n", service, filename); - exit(0); - } - strscpy(f->filename, filename, sizeof(f->filename)); - f->mode = 'r'; - fp = fopen(f->filename, "rb"); - if (!fp) { - printf("Can't read %s database %s.\n", service, f->filename); - free(f); - return NULL; - } - f->fp = fp; - myversion = fgetc(fp) << 24 | fgetc(fp) << 16 | fgetc(fp) << 8 | fgetc(fp); - if (feof(fp)) { - printf("Error reading version number on %s: End of file detected.\n", f->filename); - exit(0); - } else if (myversion < version) { - printf("Unsuported database version (%d) on %s.\n", myversion, f->filename); - exit(0); - } - return f; -} - -/* Open a database file for reading and check for the version */ -dbFILE *open_db_write(const char *service, const char *filename, int version) -{ - dbFILE *f; - int fd; - - f = calloc(sizeof(*f), 1); - if (!f) { - printf("Can't allocate memory for %s database %s.\n", service, filename); - exit(0); - } - strscpy(f->filename, filename, sizeof(f->filename)); - filename = f->filename; -#ifndef _WIN32 - unlink(filename); -#else - DeleteFile(filename); -#endif - f->mode = 'w'; -#ifndef _WIN32 - fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666); -#else - fd = open(filename, O_WRONLY | O_CREAT | O_EXCL | _O_BINARY, 0666); -#endif - f->fp = fdopen(fd, "wb"); /* will fail and return NULL if fd < 0 */ - if (!f->fp || !write_file_version(f, version)) { - printf("Can't write to %s database %s.\n", service, filename); - if (f->fp) { - fclose(f->fp); -#ifndef _WIN32 - unlink(filename); -#else - DeleteFile(filename); -#endif - } - free(f); - return NULL; - } - return f; -} - -/* Close it */ -void close_db(dbFILE * f) -{ - fclose(f->fp); - free(f); -} - -int read_int16(int16 * ret, dbFILE * f) -{ - int c1, c2; - - c1 = fgetc(f->fp); - c2 = fgetc(f->fp); - if (c1 == EOF || c2 == EOF) - return -1; - *ret = c1 << 8 | c2; - return 0; -} - -int read_uint16(uint16 * ret, dbFILE * f) -{ - int c1, c2; - - c1 = fgetc(f->fp); - c2 = fgetc(f->fp); - if (c1 == EOF || c2 == EOF) - return -1; - *ret = c1 << 8 | c2; - return 0; -} - -int write_int16(uint16 val, dbFILE * f) -{ - if (fputc((val >> 8) & 0xFF, f->fp) == EOF - || fputc(val & 0xFF, f->fp) == EOF) - return -1; - return 0; -} - - -int read_int32(int32 * ret, dbFILE * f) -{ - int c1, c2, c3, c4; - - c1 = fgetc(f->fp); - c2 = fgetc(f->fp); - c3 = fgetc(f->fp); - c4 = fgetc(f->fp); - if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF) - return -1; - *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4; - return 0; -} - -int read_uint32(uint32 * ret, dbFILE * f) -{ - int c1, c2, c3, c4; - - c1 = fgetc(f->fp); - c2 = fgetc(f->fp); - c3 = fgetc(f->fp); - c4 = fgetc(f->fp); - if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF) - return -1; - *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4; - return 0; -} - -int write_int32(uint32 val, dbFILE * f) -{ - if (fputc((val >> 24) & 0xFF, f->fp) == EOF) - return -1; - if (fputc((val >> 16) & 0xFF, f->fp) == EOF) - return -1; - if (fputc((val >> 8) & 0xFF, f->fp) == EOF) - return -1; - if (fputc((val) & 0xFF, f->fp) == EOF) - return -1; - return 0; -} - - -int read_ptr(void **ret, dbFILE * f) -{ - int c; - - c = fgetc(f->fp); - if (c == EOF) - return -1; - *ret = (c ? (void *) 1 : (void *) 0); - return 0; -} - -int write_ptr(const void *ptr, dbFILE * f) -{ - if (fputc(ptr ? 1 : 0, f->fp) == EOF) - return -1; - return 0; -} - - -int read_string(char **ret, dbFILE * f) -{ - char *s; - uint16 len; - - if (read_uint16(&len, f) < 0) - return -1; - if (len == 0) { - *ret = NULL; - return 0; - } - s = calloc(len, 1); - if (len != fread(s, 1, len, f->fp)) { - free(s); - return -1; - } - *ret = s; - return 0; -} - -int write_string(const char *s, dbFILE * f) -{ - uint32 len; - - if (!s) - return write_int16(0, f); - len = strlen(s); - if (len > 65534) - len = 65534; - if (write_int16((uint16) (len + 1), f) < 0) - return -1; - if (len > 0 && fwrite(s, 1, len, f->fp) != len) - return -1; - if (fputc(0, f->fp) == EOF) - return -1; - return 0; -} - -NickCore *findcore(const char *nick, int unused) -{ - NickCore *nc; - - for (nc = nclists[HASH(nick)]; nc; nc = nc->next) { - if (!mystricmp(nc->display, nick)) - if ((nc->unused && unused) || (!nc->unused && !unused)) - return nc; - } - - return NULL; -} - -int write_file_version(dbFILE * f, uint32 version) -{ - FILE *fp = f->fp; - if (fputc(version >> 24 & 0xFF, fp) < 0 || - fputc(version >> 16 & 0xFF, fp) < 0 || - fputc(version >> 8 & 0xFF, fp) < 0 || - fputc(version & 0xFF, fp) < 0) { - printf("Error writing version number on %s.\n", f->filename); - exit(0); - } - return 1; -} - -/* strscpy: Copy at most len-1 characters from a string to a buffer, and - * add a null terminator after the last character copied. - */ - -char *strscpy(char *d, const char *s, size_t len) -{ - char *d_orig = d; - - if (!len) - return d; - while (--len && (*d++ = *s++)); - *d = '\0'; - return d_orig; -} - -int mystricmp(const char *s1, const char *s2) -{ - register int c; - - while ((c = tolower(*s1)) == tolower(*s2)) { - if (c == 0) - return 0; - s1++; - s2++; - } - if (c < tolower(*s2)) - return -1; - return 1; -} - -ChannelInfo *cs_findchan(const char *chan) -{ - ChannelInfo *ci; - for (ci = chanlists[tolower(chan[1])]; ci; ci = ci->next) { - if (!mystricmp(ci->name, chan)) - return ci; - } - return NULL; -} - -void alpha_insert_chan(ChannelInfo * ci) -{ - ChannelInfo *ptr, *prev; - char *chan = ci->name; - - for (prev = NULL, ptr = chanlists[tolower(chan[1])]; - ptr != NULL && mystricmp(ptr->name, chan) < 0; - prev = ptr, ptr = ptr->next); - ci->prev = prev; - ci->next = ptr; - if (!prev) - chanlists[tolower(chan[1])] = ci; - else - prev->next = ci; - if (ptr) - ptr->prev = ci; -} - diff --git a/src/tools/obsolete/epona2anope.c b/src/tools/obsolete/epona2anope.c new file mode 100644 index 000000000..d89be6d12 --- /dev/null +++ b/src/tools/obsolete/epona2anope.c @@ -0,0 +1,856 @@ +/* + * IRC - Internet Relay Chat, epona2anope.c + * (C) Copyright 2005-2006, Florian Schulze (Certus) + * + * Based on the original code of Anope, (C) 2003-2005 Anope Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License (see it online + * at http://www.gnu.org/copyleft/gpl.html) as published by the Free + * Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This program tries to convert epona-1.4.15+ dbs to anope standard dbs. + * At the moment this only affects chanserv dbs. + * + * - Certus + * February 26, 2005 + * + * Added win32 fix. Who needs that anyways? :P + * - Certus + * July 20, 2006 + */ + + +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 +#include +#else +#include "sysconf.h" +#include +#endif + +/* Some SUN fixs */ +#ifdef __sun +/* Solaris specific code, types that do not exist in Solaris' + * * sys/types.h + * **/ +#undef u_int8_t +#undef u_int16_t +#undef u_int32_t +#undef u_int_64_t +#define u_int8_t uint8_t +#define u_int16_t uint16_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t + +#ifndef INADDR_NONE +#define INADDR_NONE (-1) +#endif + +#endif + + +/* CONFIGURATION BLOCK */ + +#define CHAN_DB_EPONA "chan1.db" +#define CHAN_DB_ANOPE "chan.db" + +/* END OF CONFIGURATION BLOCK */ + +#ifndef _WIN32 +#define C_LBLUE "\033[1;34m" +#define C_NONE "\033[m" +#else +#define C_LBLUE "" +#define C_NONE "" +#endif + +#define getc_db(f) (fgetc((f)->fp)) +#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31)) +#define HASH2(chan) ((chan)[1] ? ((chan)[1]&31)<<5 | ((chan)[2]&31) : 0) +#define read_buffer(buf,f) (read_db((f),(buf),sizeof(buf)) == sizeof(buf)) +#define write_buffer(buf,f) (write_db((f),(buf),sizeof(buf)) == sizeof(buf)) +#define read_db(f,buf,len) (fread((buf),1,(len),(f)->fp)) +#define write_db(f,buf,len) (fwrite((buf),1,(len),(f)->fp)) +#define read_int8(ret,f) ((*(ret)=fgetc((f)->fp))==EOF ? -1 : 0) +#define write_int8(val,f) (fputc((val),(f)->fp)==EOF ? -1 : 0) +#define SAFE(x) do { \ + if ((x) < 0) { \ + printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ + } \ +} while (0) +#define READ(x) do { \ + if ((x) < 0) { \ + printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ + exit(0); \ + } \ +} while (0) + +typedef int16_t int16; +typedef u_int16_t uint16; +typedef int32_t int32; +typedef u_int32_t uint32; +typedef struct memo_ Memo; +typedef struct dbFILE_ dbFILE; +typedef struct nickalias_ NickAlias; +typedef struct nickcore_ NickCore; +typedef struct chaninfo_ ChannelInfo; +typedef struct botinfo_ BotInfo; +typedef struct badword_ BadWord; +typedef struct hostcore_ HostCore; + +struct memo_ { + uint32 number; /* Index number -- not necessarily array position! */ + int16 flags; /* Flags */ + time_t time; /* When was it sent? */ + char sender[32]; /* Name of the sender */ + char *text; +}; + +struct dbFILE_ { + int mode; /* 'r' for reading, 'w' for writing */ + FILE *fp; /* The normal file descriptor */ + char filename[1024]; /* Name of the database file */ +}; + +typedef struct { + int16 memocount; /* Current # of memos */ + int16 memomax; /* Max # of memos one can hold*/ + Memo *memos; /* Pointer to original memos */ +} MemoInfo; + +typedef struct { + int16 in_use; /* 1 if this entry is in use, else 0 */ + int16 level; + NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */ + time_t last_seen; +} ChanAccess; + +typedef struct { + int16 in_use; /* Always 0 if not in use */ + int16 is_nick; /* 1 if a regged nickname, 0 if a nick!user@host mask */ + int16 flags; + union { + char *mask; /* Guaranteed to be non-NULL if in use, NULL if not */ + NickCore *nc; /* Same */ + } u; + char *reason; + char *creator; + time_t addtime; +} AutoKick; + +struct nickcore_ { + NickCore *next, *prev; + + char *display; /* How the nick is displayed */ + int unused; /* Used for nick collisions */ +}; + +struct chaninfo_ { + ChannelInfo *next, *prev; + + char name[64]; /* Channel name */ + char *founder; /* Who registered the channel */ + char *successor; /* Who gets the channel if the founder nick is dropped or expires */ + char founderpass[32]; /* Channel password */ + char *desc; /* Description */ + char *url; /* URL */ + char *email; /* Email address */ + time_t time_registered; /* When was it registered */ + time_t last_used; /* When was it used hte last time */ + char *last_topic; /* Last topic on the channel */ + char last_topic_setter[32]; /* Who set the last topic */ + time_t last_topic_time; /* When the last topic was set */ + uint32 flags; /* Flags */ + char *forbidby; /* if forbidden: who did it */ + char *forbidreason; /* if forbidden: why */ + int16 bantype; /* Bantype */ + int16 *levels; /* Access levels for commands */ + int16 accesscount; /* # of pple with access */ + ChanAccess *access; /* List of authorized users */ + int16 akickcount; /* # of akicked pple */ + AutoKick *akick; /* List of users to kickban */ + uint32 mlock_on, mlock_off; /* See channel modes below */ + uint32 mlock_limit; /* 0 if no limit */ + char *mlock_key; /* NULL if no key */ + char *mlock_flood; /* NULL if no +f */ + char *mlock_joinrate; /* NULL if no +j */ + char *mlock_redirect; /* NULL if no +L */ + char *entry_message; /* Notice sent on entering channel */ + MemoInfo memos; /* Memos */ + char *bi; /* Bot used on this channel */ + uint32 botflags; /* BS_* below */ + int16 *ttb; /* Times to ban for each kicker */ + int16 bwcount; /* Badword count */ + BadWord *badwords; /* For BADWORDS kicker */ + int16 capsmin, capspercent; /* For CAPS kicker */ + int16 floodlines, floodsecs; /* For FLOOD kicker */ + int16 repeattimes; /* For REPEAT kicker */ +}; + +struct botinfo_ { + BotInfo *next, *prev; + char *nick; /* Nickname of the bot */ + char *user; /* Its user name */ + char *host; /* Its hostname */ + char *real; /* Its real name */ + int16 flags; /* Bot flags */ + time_t created; /* Birth date */ + int16 chancount; /* Number of channels that use the bot. */ +}; + +struct badword_ { + int16 in_use; + char *word; + int16 type; +}; + +dbFILE *open_db_write(const char *service, const char *filename, int version); +dbFILE *open_db_read(const char *service, const char *filename, int version); +NickCore *findcore(const char *nick, int version); +ChannelInfo *cs_findchan(const char *chan); +char *strscpy(char *d, const char *s, size_t len); +int write_file_version(dbFILE * f, uint32 version); +int mystricmp(const char *s1, const char *s2); +int write_string(const char *s, dbFILE * f); +int write_ptr(const void *ptr, dbFILE * f); +int read_int16(int16 * ret, dbFILE * f); +int read_uint16(uint16 * ret, dbFILE * f); +int read_int32(int32 * ret, dbFILE * f); +int read_uint32(uint32 * ret, dbFILE * f); +int read_string(char **ret, dbFILE * f); +int write_int16(uint16 val, dbFILE * f); +int write_int32(uint32 val, dbFILE * f); +int read_ptr(void **ret, dbFILE * f); +void alpha_insert_chan(ChannelInfo * ci); +void close_db(dbFILE * f); + +ChannelInfo *chanlists[256]; +NickCore *nclists[1024]; + +int main(int argc, char *argv[]) +{ + dbFILE *f; + int i; + long countr = 0, countw = 0; + /* Unused variables - why? -GD + NickCore *nc, *ncnext; + */ + + printf("\n"C_LBLUE"Epona to Anope DB converter by Certus"C_NONE"\n\n"); + + /* Section I: Reading */ + if ((f = open_db_read("ChanServ", CHAN_DB_EPONA, 17))) { + ChannelInfo *ci, **last, *prev; + int c; + + printf("Trying to convert channel database...\n"); + + for (i = 0; i < 256; i++) { + int16 tmp16; + int32 tmp32; + int n_levels; + char *s; + int n_ttb; + /* Unused variable - why? -GD + int J; + */ + + last = &chanlists[i]; + prev = NULL; + + while ((c = getc_db(f)) == 1) { + int j; + + if (c != 1) { + printf("Invalid format in %s.\n", CHAN_DB_EPONA); + exit(0); + } + + ci = calloc(sizeof(ChannelInfo), 1); + *last = ci; + last = &ci->next; + ci->prev = prev; + prev = ci; + READ(read_buffer(ci->name, f)); + READ(read_string(&ci->founder, f)); + READ(read_string(&ci->successor, f)); + READ(read_buffer(ci->founderpass, f)); + READ(read_string(&ci->desc, f)); + if (!ci->desc) + ci->desc = strdup(""); + READ(read_string(&ci->url, f)); + READ(read_string(&ci->email, f)); + READ(read_int32(&tmp32, f)); + ci->time_registered = tmp32; + READ(read_int32(&tmp32, f)); + ci->last_used = tmp32; + READ(read_string(&ci->last_topic, f)); + READ(read_buffer(ci->last_topic_setter, f)); + READ(read_int32(&tmp32, f)); + ci->last_topic_time = tmp32; + READ(read_uint32(&ci->flags, f)); + /* Temporary flags cleanup */ + ci->flags &= ~0x80000000; + READ(read_string(&ci->forbidby, f)); + READ(read_string(&ci->forbidreason, f)); + READ(read_int16(&tmp16, f)); + ci->bantype = tmp16; + READ(read_int16(&tmp16, f)); + n_levels = tmp16; + ci->levels = calloc(36 * sizeof(*ci->levels), 1); + for (j = 0; j < n_levels; j++) { + if (j < 36) + READ(read_int16(&ci->levels[j], f)); + else + READ(read_int16(&tmp16, f)); + } + READ(read_int16(&ci->accesscount, f)); + if (ci->accesscount) { + ci->access = calloc(ci->accesscount, sizeof(ChanAccess)); + for (j = 0; j < ci->accesscount; j++) { + READ(read_int16(&ci->access[j].in_use, f)); + if (ci->access[j].in_use) { + READ(read_int16(&ci->access[j].level, f)); + READ(read_string(&s, f)); + if (s) { + ci->access[j].nc = findcore(s, 0); + free(s); + } + if (ci->access[j].nc == NULL) + ci->access[j].in_use = 0; + READ(read_int32(&tmp32, f)); + ci->access[j].last_seen = tmp32; + } + } + } else { + ci->access = NULL; + } + READ(read_int16(&ci->akickcount, f)); + if (ci->akickcount) { + ci->akick = calloc(ci->akickcount, sizeof(AutoKick)); + for (j = 0; j < ci->akickcount; j++) { + SAFE(read_int16(&ci->akick[j].flags, f)); + if (ci->akick[j].flags & 0x0001) { + SAFE(read_string(&s, f)); + if (ci->akick[j].flags & 0x0002) { + ci->akick[j].u.nc = findcore(s, 0); + if (!ci->akick[j].u.nc) + ci->akick[j].flags &= ~0x0001; + free(s); + } else { + ci->akick[j].u.mask = s; + } + SAFE(read_string(&s, f)); + if (ci->akick[j].flags & 0x0001) + ci->akick[j].reason = s; + else if (s) + free(s); + SAFE(read_string(&s, f)); + if (ci->akick[j].flags & 0x0001) { + ci->akick[j].creator = s; + } else if (s) { + free(s); + } + SAFE(read_int32(&tmp32, f)); + if (ci->akick[j].flags & 0x0001) + ci->akick[j].addtime = tmp32; + } + } + } else { + ci->akick = NULL; + } + READ(read_uint32(&ci->mlock_on, f)); + READ(read_uint32(&ci->mlock_off, f)); + READ(read_uint32(&ci->mlock_limit, f)); + READ(read_string(&ci->mlock_key, f)); + READ(read_string(&ci->mlock_flood, f)); + READ(read_string(&ci->mlock_joinrate, f)); + READ(read_string(&ci->mlock_redirect, f)); + READ(read_int16(&ci->memos.memocount, f)); + READ(read_int16(&ci->memos.memomax, f)); + if (ci->memos.memocount) { + Memo *memos; + memos = calloc(sizeof(Memo) * ci->memos.memocount, 1); + ci->memos.memos = memos; + for (j = 0; j < ci->memos.memocount; j++, memos++) { + READ(read_uint32(&memos->number, f)); + READ(read_int16(&memos->flags, f)); + READ(read_int32(&tmp32, f)); + memos->time = tmp32; + READ(read_buffer(memos->sender, f)); + READ(read_string(&memos->text, f)); + } + } + READ(read_string(&ci->entry_message, f)); + + /* BotServ options */ + READ(read_string(&ci->bi, f)); + READ(read_int32(&tmp32, f)); + ci->botflags = tmp32; + READ(read_int16(&tmp16, f)); + n_ttb = tmp16; + ci->ttb = calloc(2 * 8, 1); + for (j = 0; j < n_ttb; j++) { + if (j < 8) + READ(read_int16(&ci->ttb[j], f)); + else + READ(read_int16(&tmp16, f)); + } + for (j = n_ttb; j < 8; j++) + ci->ttb[j] = 0; + READ(read_int16(&tmp16, f)); + ci->capsmin = tmp16; + READ(read_int16(&tmp16, f)); + ci->capspercent = tmp16; + READ(read_int16(&tmp16, f)); + ci->floodlines = tmp16; + READ(read_int16(&tmp16, f)); + ci->floodsecs = tmp16; + READ(read_int16(&tmp16, f)); + ci->repeattimes = tmp16; + + READ(read_int16(&ci->bwcount, f)); + if (ci->bwcount) { + ci->badwords = calloc(ci->bwcount, sizeof(BadWord)); + for (j = 0; j < ci->bwcount; j++) { + SAFE(read_int16(&ci->badwords[j].in_use, f)); + if (ci->badwords[j].in_use) { + SAFE(read_string(&ci->badwords[j].word, f)); + SAFE(read_int16(&ci->badwords[j].type, f)); + } + } + } else { + ci->badwords = NULL; + } + countr++; + } /* getc_db() */ + *last = NULL; + } /* for() loop */ + close_db(f); + } + + /* II: Saving */ + { + if ((f = open_db_write("ChanServ", CHAN_DB_ANOPE, 16))) { + ChannelInfo *ci; + Memo *memos; + /* Unused variable - why? -GD + static time_t lastwarn = 0; + */ + + for (i = 0; i < 256; i++) { + int16 tmp16; + for (ci = chanlists[i]; ci; ci = ci->next) { + int j; + SAFE(write_int8(1, f)); + SAFE(write_buffer(ci->name, f)); + if (ci->founder) + SAFE(write_string(ci->founder, f)); + else + SAFE(write_string(NULL, f)); + if (ci->successor) + SAFE(write_string(ci->successor, f)); + else + SAFE(write_string(NULL, f)); + SAFE(write_buffer(ci->founderpass, f)); + SAFE(write_string(ci->desc, f)); + SAFE(write_string(ci->url, f)); + SAFE(write_string(ci->email, f)); + SAFE(write_int32(ci->time_registered, f)); + SAFE(write_int32(ci->last_used, f)); + SAFE(write_string(ci->last_topic, f)); + SAFE(write_buffer(ci->last_topic_setter, f)); + SAFE(write_int32(ci->last_topic_time, f)); + SAFE(write_int32(ci->flags, f)); + SAFE(write_string(ci->forbidby, f)); + SAFE(write_string(ci->forbidreason, f)); + SAFE(write_int16(ci->bantype, f)); + tmp16 = 36; + SAFE(write_int16(tmp16, f)); + for (j = 0; j < 36; j++) + SAFE(write_int16(ci->levels[j], f)); + + SAFE(write_int16(ci->accesscount, f)); + for (j = 0; j < ci->accesscount; j++) { + SAFE(write_int16(ci->access[j].in_use, f)); + if (ci->access[j].in_use) { + SAFE(write_int16(ci->access[j].level, f)); + SAFE(write_string(ci->access[j].nc->display, f)); + SAFE(write_int32(ci->access[j].last_seen, f)); + } + } + SAFE(write_int16(ci->akickcount, f)); + for (j = 0; j < ci->akickcount; j++) { + SAFE(write_int16(ci->akick[j].flags, f)); + if (ci->akick[j].flags & 0x0001) { + if (ci->akick[j].flags & 0x0002) + SAFE(write_string(ci->akick[j].u.nc->display, f)); + else + SAFE(write_string(ci->akick[j].u.mask, f)); + SAFE(write_string(ci->akick[j].reason, f)); + SAFE(write_string(ci->akick[j].creator, f)); + SAFE(write_int32(ci->akick[j].addtime, f)); + } + } + + SAFE(write_int32(ci->mlock_on, f)); + SAFE(write_int32(ci->mlock_off, f)); + SAFE(write_int32(ci->mlock_limit, f)); + SAFE(write_string(ci->mlock_key, f)); + SAFE(write_string(ci->mlock_flood, f)); + SAFE(write_string(ci->mlock_redirect, f)); + SAFE(write_int16(ci->memos.memocount, f)); + SAFE(write_int16(ci->memos.memomax, f)); + memos = ci->memos.memos; + for (j = 0; j < ci->memos.memocount; j++, memos++) { + SAFE(write_int32(memos->number, f)); + SAFE(write_int16(memos->flags, f)); + SAFE(write_int32(memos->time, f)); + SAFE(write_buffer(memos->sender, f)); + SAFE(write_string(memos->text, f)); + } + SAFE(write_string(ci->entry_message, f)); + if (ci->bi) + SAFE(write_string(ci->bi, f)); + else + SAFE(write_string(NULL, f)); + SAFE(write_int32(ci->botflags, f)); + tmp16 = 8; + SAFE(write_int16(tmp16, f)); + for (j = 0; j < 8; j++) + SAFE(write_int16(ci->ttb[j], f)); + SAFE(write_int16(ci->capsmin, f)); + SAFE(write_int16(ci->capspercent, f)); + SAFE(write_int16(ci->floodlines, f)); + SAFE(write_int16(ci->floodsecs, f)); + SAFE(write_int16(ci->repeattimes, f)); + + SAFE(write_int16(ci->bwcount, f)); + for (j = 0; j < ci->bwcount; j++) { + SAFE(write_int16(ci->badwords[j].in_use, f)); + if (ci->badwords[j].in_use) { + SAFE(write_string(ci->badwords[j].word, f)); + SAFE(write_int16(ci->badwords[j].type, f)); + } + } + countw++; + } /* for (chanlists[i]) */ + SAFE(write_int8(0, f)); + } /* for (i) */ + close_db(f); + printf("%ld channels read, %ld channels written. New database saved as %s.\n", countr, countw, CHAN_DB_ANOPE); + } + } + + printf("\n\nConverting is now done.\n"); + return 0; +} /* End of main() */ + +/* Open a database file for reading and check for the version */ +dbFILE *open_db_read(const char *service, const char *filename, int version) +{ + dbFILE *f; + FILE *fp; + int myversion; + + f = calloc(sizeof(*f), 1); + if (!f) { + printf("Can't allocate memory for %s database %s.\n", service, filename); + exit(0); + } + strscpy(f->filename, filename, sizeof(f->filename)); + f->mode = 'r'; + fp = fopen(f->filename, "rb"); + if (!fp) { + printf("Can't read %s database %s.\n", service, f->filename); + free(f); + return NULL; + } + f->fp = fp; + myversion = fgetc(fp) << 24 | fgetc(fp) << 16 | fgetc(fp) << 8 | fgetc(fp); + if (feof(fp)) { + printf("Error reading version number on %s: End of file detected.\n", f->filename); + exit(0); + } else if (myversion < version) { + printf("Unsuported database version (%d) on %s.\n", myversion, f->filename); + exit(0); + } + return f; +} + +/* Open a database file for reading and check for the version */ +dbFILE *open_db_write(const char *service, const char *filename, int version) +{ + dbFILE *f; + int fd; + + f = calloc(sizeof(*f), 1); + if (!f) { + printf("Can't allocate memory for %s database %s.\n", service, filename); + exit(0); + } + strscpy(f->filename, filename, sizeof(f->filename)); + filename = f->filename; +#ifndef _WIN32 + unlink(filename); +#else + DeleteFile(filename); +#endif + f->mode = 'w'; +#ifndef _WIN32 + fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666); +#else + fd = open(filename, O_WRONLY | O_CREAT | O_EXCL | _O_BINARY, 0666); +#endif + f->fp = fdopen(fd, "wb"); /* will fail and return NULL if fd < 0 */ + if (!f->fp || !write_file_version(f, version)) { + printf("Can't write to %s database %s.\n", service, filename); + if (f->fp) { + fclose(f->fp); +#ifndef _WIN32 + unlink(filename); +#else + DeleteFile(filename); +#endif + } + free(f); + return NULL; + } + return f; +} + +/* Close it */ +void close_db(dbFILE * f) +{ + fclose(f->fp); + free(f); +} + +int read_int16(int16 * ret, dbFILE * f) +{ + int c1, c2; + + c1 = fgetc(f->fp); + c2 = fgetc(f->fp); + if (c1 == EOF || c2 == EOF) + return -1; + *ret = c1 << 8 | c2; + return 0; +} + +int read_uint16(uint16 * ret, dbFILE * f) +{ + int c1, c2; + + c1 = fgetc(f->fp); + c2 = fgetc(f->fp); + if (c1 == EOF || c2 == EOF) + return -1; + *ret = c1 << 8 | c2; + return 0; +} + +int write_int16(uint16 val, dbFILE * f) +{ + if (fputc((val >> 8) & 0xFF, f->fp) == EOF + || fputc(val & 0xFF, f->fp) == EOF) + return -1; + return 0; +} + + +int read_int32(int32 * ret, dbFILE * f) +{ + int c1, c2, c3, c4; + + c1 = fgetc(f->fp); + c2 = fgetc(f->fp); + c3 = fgetc(f->fp); + c4 = fgetc(f->fp); + if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF) + return -1; + *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4; + return 0; +} + +int read_uint32(uint32 * ret, dbFILE * f) +{ + int c1, c2, c3, c4; + + c1 = fgetc(f->fp); + c2 = fgetc(f->fp); + c3 = fgetc(f->fp); + c4 = fgetc(f->fp); + if (c1 == EOF || c2 == EOF || c3 == EOF || c4 == EOF) + return -1; + *ret = c1 << 24 | c2 << 16 | c3 << 8 | c4; + return 0; +} + +int write_int32(uint32 val, dbFILE * f) +{ + if (fputc((val >> 24) & 0xFF, f->fp) == EOF) + return -1; + if (fputc((val >> 16) & 0xFF, f->fp) == EOF) + return -1; + if (fputc((val >> 8) & 0xFF, f->fp) == EOF) + return -1; + if (fputc((val) & 0xFF, f->fp) == EOF) + return -1; + return 0; +} + + +int read_ptr(void **ret, dbFILE * f) +{ + int c; + + c = fgetc(f->fp); + if (c == EOF) + return -1; + *ret = (c ? (void *) 1 : (void *) 0); + return 0; +} + +int write_ptr(const void *ptr, dbFILE * f) +{ + if (fputc(ptr ? 1 : 0, f->fp) == EOF) + return -1; + return 0; +} + + +int read_string(char **ret, dbFILE * f) +{ + char *s; + uint16 len; + + if (read_uint16(&len, f) < 0) + return -1; + if (len == 0) { + *ret = NULL; + return 0; + } + s = calloc(len, 1); + if (len != fread(s, 1, len, f->fp)) { + free(s); + return -1; + } + *ret = s; + return 0; +} + +int write_string(const char *s, dbFILE * f) +{ + uint32 len; + + if (!s) + return write_int16(0, f); + len = strlen(s); + if (len > 65534) + len = 65534; + if (write_int16((uint16) (len + 1), f) < 0) + return -1; + if (len > 0 && fwrite(s, 1, len, f->fp) != len) + return -1; + if (fputc(0, f->fp) == EOF) + return -1; + return 0; +} + +NickCore *findcore(const char *nick, int unused) +{ + NickCore *nc; + + for (nc = nclists[HASH(nick)]; nc; nc = nc->next) { + if (!mystricmp(nc->display, nick)) + if ((nc->unused && unused) || (!nc->unused && !unused)) + return nc; + } + + return NULL; +} + +int write_file_version(dbFILE * f, uint32 version) +{ + FILE *fp = f->fp; + if (fputc(version >> 24 & 0xFF, fp) < 0 || + fputc(version >> 16 & 0xFF, fp) < 0 || + fputc(version >> 8 & 0xFF, fp) < 0 || + fputc(version & 0xFF, fp) < 0) { + printf("Error writing version number on %s.\n", f->filename); + exit(0); + } + return 1; +} + +/* strscpy: Copy at most len-1 characters from a string to a buffer, and + * add a null terminator after the last character copied. + */ + +char *strscpy(char *d, const char *s, size_t len) +{ + char *d_orig = d; + + if (!len) + return d; + while (--len && (*d++ = *s++)); + *d = '\0'; + return d_orig; +} + +int mystricmp(const char *s1, const char *s2) +{ + register int c; + + while ((c = tolower(*s1)) == tolower(*s2)) { + if (c == 0) + return 0; + s1++; + s2++; + } + if (c < tolower(*s2)) + return -1; + return 1; +} + +ChannelInfo *cs_findchan(const char *chan) +{ + ChannelInfo *ci; + for (ci = chanlists[tolower(chan[1])]; ci; ci = ci->next) { + if (!mystricmp(ci->name, chan)) + return ci; + } + return NULL; +} + +void alpha_insert_chan(ChannelInfo * ci) +{ + ChannelInfo *ptr, *prev; + char *chan = ci->name; + + for (prev = NULL, ptr = chanlists[tolower(chan[1])]; + ptr != NULL && mystricmp(ptr->name, chan) < 0; + prev = ptr, ptr = ptr->next); + ci->prev = prev; + ci->next = ptr; + if (!prev) + chanlists[tolower(chan[1])] = ci; + else + prev->next = ci; + if (ptr) + ptr->prev = ci; +} + -- cgit