diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.c | 18 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/modules.c | 20 | ||||
-rw-r--r-- | src/protocol/Makefile.win32 | 4 | ||||
-rw-r--r-- | src/protocol/obsolete/charybdis.c (renamed from src/protocol/charybdis.c) | 0 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 137 | ||||
-rw-r--r-- | src/servers.c | 23 | ||||
-rw-r--r-- | src/users.c | 2 |
8 files changed, 83 insertions, 125 deletions
diff --git a/src/channels.c b/src/channels.c index 2cce6266c..8a24b3ddf 100644 --- a/src/channels.c +++ b/src/channels.c @@ -241,7 +241,7 @@ void chan_set_modes(const char *source, Channel * chan, int ac, const char **av, } if (!(user = finduser(*av)) - && !(UseTS6 && ircd->ts6 && (user = find_byuid(*av)))) { + && !(ircd->ts6 && (user = find_byuid(*av)))) { if (debug) { alog("debug: MODE %s %c%c for nonexistent user %s", chan->name, (add ? '+' : '-'), mode, *av); @@ -524,7 +524,7 @@ void do_join(const char *source, int ac, const char **av) char *channame; time_t ts = time(NULL); - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(source); if (!user) user = finduser(source); @@ -620,7 +620,7 @@ void do_kick(const char *source, int ac, const char **av) continue; } - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(s); if (!user) { user = finduser(s); @@ -668,7 +668,7 @@ void do_part(const char *source, int ac, const char **av) struct u_chanlist *c; char *channame; - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(source); if (!user) user = finduser(source); @@ -855,7 +855,7 @@ void do_sjoin(const char *source, int ac, const char **av) *end2 = 0; - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(s); if (!user) user = finduser(s); @@ -940,7 +940,7 @@ void do_sjoin(const char *source, int ac, const char **av) *end2++ = csmodes[(int) *s++]; *end2 = 0; - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(s); if (!user) user = finduser(s); @@ -1015,7 +1015,7 @@ void do_sjoin(const char *source, int ac, const char **av) *end2++ = csmodes[(int) *s++]; *end2 = 0; - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(s); if (!user) user = finduser(s); @@ -1069,7 +1069,7 @@ void do_sjoin(const char *source, int ac, const char **av) } free((char *)s); } else if (ac == 2) { - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { user = find_byuid(source); if (!user) user = finduser(source); @@ -1144,7 +1144,7 @@ void do_cmode(const char *source, int ac, const char **av) } /* :42XAAAAAO TMODE 1106409026 #ircops +b *!*@*.aol.com */ - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { if (isdigit(av[0][0])) { ac--; av++; diff --git a/src/config.c b/src/config.c index 0cac86802..c47ccda51 100644 --- a/src/config.c +++ b/src/config.c @@ -296,9 +296,6 @@ char *UlineServers; char **Ulines; int NumUlines; -int UseTS6; - - /*************************************************************************/ ServerConfig::ServerConfig() : include_stack(), errstr(""), newconfig(), config_data() @@ -1392,7 +1389,6 @@ Directive directives[] = { {PARAM_STRING, 0, &RemotePassword3}}}, {"RestrictOperNicks", {{PARAM_SET, PARAM_RELOAD, &RestrictOperNicks}}}, {"AnonymousGlobal", {{PARAM_SET, PARAM_RELOAD, &AnonymousGlobal}}}, - {"UseTS6", {{PARAM_SET, 0, &UseTS6}}}, {"UlineServers", {{PARAM_STRING, PARAM_RELOAD, &UlineServers}}}, }; diff --git a/src/modules.c b/src/modules.c index 7120d5c4e..34025a9af 100644 --- a/src/modules.c +++ b/src/modules.c @@ -90,15 +90,17 @@ int protocol_module_init(void) * as we only have the ircd struct filled here, we have to over * here. -GD */ - if (UseTS6 && !(ircd->ts6)) { - alog("Chosen IRCd does not support TS6, unsetting UseTS6"); - UseTS6 = 0; - } - - /* We can assume the ircd supports TS6 here */ - if (UseTS6 && !Numeric) { - alog("UseTS6 requires the setting of Numeric to be enabled."); - ret = -1; + if (ircd->ts6) + { + if (!Numeric) + { + alog("This IRCd protocol requires a server numeric to be set in Anope's configuration."); + ret = -1; + } + else + { + ts6_uid_init(); + } } } diff --git a/src/protocol/Makefile.win32 b/src/protocol/Makefile.win32 index 8383c828c..da1f018c4 100644 --- a/src/protocol/Makefile.win32 +++ b/src/protocol/Makefile.win32 @@ -1,7 +1,7 @@ include ../../Makefile.inc.win32 -SRCS=bahamut.c charybdis.c inspircd11.c inspircd12.cpp \ - ratbox.c shadowircd.c unreal32.c +SRCS=bahamut.c inspircd11.c inspircd12.cpp \ + ratbox.c unreal32.c OBJECTS= $(SRCS:.c=.dll) CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include" diff --git a/src/protocol/charybdis.c b/src/protocol/obsolete/charybdis.c index cee42ce1c..cee42ce1c 100644 --- a/src/protocol/charybdis.c +++ b/src/protocol/obsolete/charybdis.c diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 7e29d09d5..bfceeab0c 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -475,11 +475,7 @@ void ratbox_cmd_capab() /* PASS */ void ratbox_cmd_pass(const char *pass) { - if (UseTS6) { - send_cmd(NULL, "PASS %s TS 6 :%s", pass, TS6SID); - } else { - send_cmd(NULL, "PASS %s :TS", pass); - } + send_cmd(NULL, "PASS %s TS 6 :%s", pass, TS6SID); } class RatboxProto : public IRCDTS6Proto @@ -520,46 +516,46 @@ class RatboxProto : public IRCDTS6Proto BotInfo *bi = findbot(source); if (bi) { - send_cmd(UseTS6 ? bi->uid : source, "OPERWALL :%s", buf); + send_cmd(bi->uid, "OPERWALL :%s", buf); return; } } - send_cmd(UseTS6 ? TS6SID : ServerName, "OPERWALL :%s", buf); + send_cmd(TS6SID, "OPERWALL :%s", buf); } void SendSQLine(const char *mask, const char *reason) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "RESV * %s :%s", mask, reason); + send_cmd(bi ? bi->uid : s_OperServ, "RESV * %s :%s", mask, reason); } void SendSGLineDel(const char *mask) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "UNXLINE * %s", mask); + send_cmd(bi ? bi->uid : s_OperServ, "UNXLINE * %s", mask); } void SendSGLine(const char *mask, const char *reason) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "XLINE * %s 0 :%s", mask, reason); + send_cmd(bi ? bi->uid : s_OperServ, "XLINE * %s 0 :%s", mask, reason); } void SendAkillDel(const char *user, const char *host) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "UNKLINE * %s %s", user, host); + send_cmd(bi ? bi->uid : s_OperServ, "UNKLINE * %s %s", user, host); } void SendSQLineDel(const char *user) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "UNRESV * %s", user); + send_cmd(bi ? bi->uid : s_OperServ, "UNRESV * %s", user); } void SendJoin(BotInfo *user, const char *channel, time_t chantime) { - send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, UseTS6 ? user->uid.c_str() : user->nick); + send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, user->uid.c_str()); } /* @@ -574,19 +570,19 @@ class RatboxProto : public IRCDTS6Proto void SendAkill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason) { BotInfo *bi = findbot(s_OperServ); - send_cmd(UseTS6 ? (bi ? bi->uid : s_OperServ) : s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(expires - time(NULL)), user, host, reason); + send_cmd(bi ? bi->uid : s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(expires - time(NULL)), user, host, reason); } void SendSVSKillInternal(const char *source, const char *user, const char *buf) { BotInfo *bi = findbot(source); User *u = find_byuid(user); - send_cmd(UseTS6 ? (bi ? bi->uid : source) : source, "KILL %s :%s", UseTS6 ? (u ? u->uid : user) : user, buf); + send_cmd(bi ? bi->uid : source, "KILL %s :%s", u ? u->uid : user, buf); } void SendSVSMode(User *u, int ac, const char **av) { - send_cmd(UseTS6 ? TS6SID : ServerName, "SVSMODE %s %s", u->nick, av[0]); + send_cmd(TS6SID, "SVSMODE %s %s", u->nick, av[0]); } /* SERVER name hop descript */ @@ -598,8 +594,7 @@ class RatboxProto : public IRCDTS6Proto void SendConnect() { /* Make myself known to myself in the serverlist */ - if (UseTS6) me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, TS6SID); - else me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME, TS6SID); if (servernum == 1) ratbox_cmd_pass(RemotePassword); else if (servernum == 2) ratbox_cmd_pass(RemotePassword2); else if (servernum == 3) ratbox_cmd_pass(RemotePassword3); @@ -611,78 +606,70 @@ class RatboxProto : public IRCDTS6Proto void SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes, const char *uid) { EnforceQlinedNick(nick, NULL); - if (UseTS6) { - const char *uidbuf = ts6_uid_retrieve(); - send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick, static_cast<long>(time(NULL)), modes, user, host, uidbuf, real); - } - else send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, static_cast<long>(time(NULL)), modes, user, host, ServerName, real); + const char *uidbuf = ts6_uid_retrieve(); + send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick, static_cast<long>(time(NULL)), modes, user, host, uidbuf, real); SendSQLine(nick, "Reserved for services"); } void SendPartInternal(BotInfo *bi, const char *chan, const char *buf) { if (buf) - send_cmd(UseTS6 ? bi->uid : bi->nick, "PART %s :%s", chan, buf); + send_cmd(bi->uid, "PART %s :%s", chan, buf); else - send_cmd(UseTS6 ? bi->uid : bi->nick, "PART %s", chan); + send_cmd(bi->uid, "PART %s", chan); } void SendNumericInternal(const char *source, int numeric, const char *dest, const char *buf) { // This might need to be set in the call to SendNumeric instead of here, will review later -- CyberBotX - send_cmd(UseTS6 ? TS6SID : source, "%03d %s %s", numeric, dest, buf); + send_cmd(TS6SID, "%03d %s %s", numeric, dest, buf); } void SendModeInternal(BotInfo *bi, const char *dest, const char *buf) { if (bi) { - send_cmd(UseTS6 ? bi->uid : bi->nick, "MODE %s %s", dest, buf); + send_cmd(bi->uid, "MODE %s %s", dest, buf); } - else send_cmd(UseTS6 ? TS6SID : ServerName, "MODE %s %s", dest, buf); + else send_cmd(TS6SID, "MODE %s %s", dest, buf); } void SendKickInternal(BotInfo *bi, const char *chan, const char *user, const char *buf) { User *u = finduser(user); - if (buf) send_cmd(UseTS6 ? bi->uid : bi->nick, "KICK %s %s :%s", chan, UseTS6 ? (u ? u->uid : user) : user, buf); - else send_cmd(UseTS6 ? bi->uid : bi->nick, "KICK %s %s", chan, UseTS6 ? (u ? u->uid : user) : user); + if (buf) send_cmd(bi->uid, "KICK %s %s :%s", chan, u ? u->uid : user, buf); + else send_cmd(bi->uid, "KICK %s %s", chan, u ? u->uid : user); } void SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { - if (!buf) return; send_cmd(NULL, "NOTICE @%s :%s", dest, buf); } void SendBotOp(const char *nick, const char *chan) { - if (UseTS6) { - BotInfo *bi = findbot(nick); - ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, bi ? bi->uid.c_str() : nick); - } - else SendMode(findbot(nick), chan, "%s %s", ircd->botchanumode, nick); + BotInfo *bi = findbot(nick); + ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, bi ? bi->uid.c_str() : nick); } /* QUIT */ void SendQuitInternal(BotInfo *bi, const char *buf) { - if (buf) send_cmd(UseTS6 ? bi->uid : bi->nick, "QUIT :%s", buf); - else send_cmd(UseTS6 ? bi->uid : bi->nick, "QUIT"); + if (buf) send_cmd(bi->uid, "QUIT :%s", buf); + else send_cmd(bi->uid, "QUIT"); } /* PONG */ void SendPong(const char *servname, const char *who) { - if (UseTS6) send_cmd(TS6SID, "PONG %s", who); - else send_cmd(servname, "PONG %s", who); + send_cmd(TS6SID, "PONG %s", who); } /* INVITE */ void SendInvite(BotInfo *source, const char *chan, const char *nick) { User *u = finduser(nick); - send_cmd(UseTS6 ? source->uid : source->nick, "INVITE %s %s", UseTS6 ? (u ? u->uid : nick) : nick, chan); + send_cmd(source->uid, "INVITE %s %s", u ? u->uid : nick, chan); } /* @@ -698,7 +685,7 @@ class RatboxProto : public IRCDTS6Proto void SendTopic(BotInfo *bi, const char *chan, const char *whosetit, const char *topic, time_t when) { - send_cmd(UseTS6 ? bi->uid : bi->nick, "TOPIC %s :%s", chan, topic); + send_cmd(bi->uid, "TOPIC %s :%s", chan, topic); } } ircd_proto; @@ -740,21 +727,19 @@ int anope_event_nick(const char *source, int ac, const char **av) Server *s; User *user; - if (UseTS6 && ac == 9) { + if (ac == 9) + { s = findserver_uid(servlist, source); /* Source is always the server */ user = do_nick("", av[0], av[4], av[5], s->name, av[8], strtoul(av[2], NULL, 10), 0, 0, "*", av[7]); - if (user) { + if (user) + { ircdproto->ProcessUsermodes(user, 1, &av[3]); } } else { - if (ac != 2) { - user = do_nick(source, av[0], av[4], av[5], av[6], av[7], - strtoul(av[2], NULL, 10), 0, 0, "*", NULL); - if (user) - ircdproto->ProcessUsermodes(user, 1, &av[3]); - } else { + if (ac == 2) + { do_nick(source, av[0], NULL, NULL, NULL, NULL, strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); } @@ -790,13 +775,9 @@ int anope_event_topic(const char *source, int ac, const char **av) if (ac > 1 && *av[1]) c->topic = sstrdup(av[1]); - if (UseTS6) { - 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)); - } + 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)); } @@ -881,12 +862,8 @@ int anope_event_away(const char *source, int ac, const char **av) { User *u = NULL; - if (UseTS6) { - u = find_byuid(source); - } - - m_away((UseTS6 ? (u ? u->nick : source) : source), - (ac ? av[0] : NULL)); + u = find_byuid(source); + m_away(u ? u->nick : source, (ac ? av[0] : NULL)); return MOD_CONT; } @@ -953,7 +930,7 @@ int anope_event_part(const char *source, int ac, const char **av) } u = find_byuid(source); - do_part((UseTS6 ? (u ? u->nick : source) : source), ac, av); + do_part(u ? u->nick : source, ac, av); return MOD_CONT; } @@ -964,7 +941,7 @@ int anope_event_whois(const char *source, int ac, const char **av) if (source && ac >= 1) { bi = findbot(av[0]); - m_whois(source, (UseTS6 ? bi->uid.c_str() : bi->nick)); + m_whois(source, bi->uid.c_str()); } return MOD_CONT; } @@ -974,7 +951,7 @@ int anope_event_server(const char *source, int ac, const char **av) { if (!stricmp(av[1], "1")) { uplink = sstrdup(av[0]); - if (UseTS6 && TS6UPLINK) { + if (TS6UPLINK) { do_server(source, av[0], av[1], av[2], TS6UPLINK); } else { do_server(source, av[0], av[1], av[2], NULL); @@ -1015,7 +992,7 @@ int anope_event_quit(const char *source, int ac, const char **av) u = find_byuid(source); - do_quit((UseTS6 ? (u ? u->nick : source) : source), ac, av); + do_quit(u ? u->nick : source, ac, av); return MOD_CONT; } @@ -1030,14 +1007,10 @@ int anope_event_mode(const char *source, int ac, const char **av) if (*av[0] == '#' || *av[0] == '&') { do_cmode(source, ac, av); } else { - if (UseTS6) { - u = find_byuid(source); - u2 = find_byuid(av[0]); - av[0] = u2->nick; - do_umode(u->nick, ac, av); - } else { - do_umode(source, ac, av); - } + u = find_byuid(source); + u2 = find_byuid(av[0]); + av[0] = u2->nick; + do_umode(u->nick, ac, av); } return MOD_CONT; } @@ -1086,9 +1059,7 @@ int anope_event_capab(const char *source, int ac, const char **av) int anope_event_pass(const char *source, int ac, const char **av) { - if (UseTS6) { - TS6UPLINK = sstrdup(av[3]); - } + TS6UPLINK = sstrdup(av[3]); return MOD_CONT; } @@ -1177,11 +1148,8 @@ class ProtoRatbox : public Module this->SetVersion("$Id$"); this->SetType(PROTOCOL); - if (UseTS6) - { - TS6SID = sstrdup(Numeric); - UseTSMODE = 1; /* TMODE */ - } + TS6SID = sstrdup(Numeric); + UseTSMODE = 1; /* TMODE */ pmodule_ircd_version("Ratbox IRCD 2.0+"); pmodule_ircd_cap(myIrcdcap); @@ -1210,8 +1178,7 @@ class ProtoRatbox : public Module ~ProtoRatbox() { - if (UseTS6) - free(TS6SID); + free(TS6SID); } }; diff --git a/src/servers.c b/src/servers.c index 2de1d1489..d42e08108 100644 --- a/src/servers.c +++ b/src/servers.c @@ -409,7 +409,7 @@ void do_squit(const char *source, int ac, const char **av) char buf[BUFSIZE]; Server *s; - if (UseTS6 && ircd->ts6) { + if (ircd->ts6) { s = findserver_uid(servlist, av[0]); if (!s) { s = findserver(servlist, av[0]); @@ -592,16 +592,8 @@ static unsigned int ts6_uid_index = 9; /* last slot in uid buf */ void ts6_uid_init(void) { - /* check just in case... you can never be too safe. */ - if (TS6SID != NULL) { - snprintf(ts6_new_uid, 10, "%sAAAAAA", TS6SID); - ts6_uid_initted = 1; - } else { - alog("warning: no TS6SID specified, disabling TS6 support."); - UseTS6 = 0; - - return; - } + snprintf(ts6_new_uid, 10, "%sAAAAAA", TS6SID); + ts6_uid_initted = 1; } void ts6_uid_increment(unsigned int slot) @@ -625,17 +617,18 @@ void ts6_uid_increment(unsigned int slot) const char *ts6_uid_retrieve(void) { - if (UseTS6 == 0) + if (!ircd->ts6 == 0) { - alog("TS6 disabled, returning nothing"); + alog("TS6 not supported on this ircd"); return ""; } if (ts6_uid_initted != 1) - ts6_uid_init(); + { + throw CoreException("TS6 IRCd and ts6_uid_init() hasn't been called!"); + } ts6_uid_increment(ts6_uid_index - 1); - return ts6_new_uid; } diff --git a/src/users.c b/src/users.c index 40750d221..6c0cecc7c 100644 --- a/src/users.c +++ b/src/users.c @@ -668,7 +668,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const } else { /* An old user changing nicks. */ - if (UseTS6) + if (ircd->ts6) user = find_byuid(source); if (!user) |