diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-03 08:00:31 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-03 08:00:31 +0000 |
commit | 968616980cea24f38b7c15301a29f3adad7cb6b3 (patch) | |
tree | 299d93b502c9e4498304033134ce12e04e7f519c /src | |
parent | 797bdccb9ba4d5bd82021d8de1ae671629c41f96 (diff) |
Merge commit 'cbx/anopeng-uid' into anopeng-uid
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1395 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/actions.c | 2 | ||||
-rw-r--r-- | src/botserv.c | 6 | ||||
-rw-r--r-- | src/chanserv.c | 4 | ||||
-rw-r--r-- | src/core/bs_bot.c | 4 | ||||
-rw-r--r-- | src/core/cs_forbid.c | 2 | ||||
-rw-r--r-- | src/core/cs_register.c | 2 | ||||
-rw-r--r-- | src/core/ns_forbid.c | 2 | ||||
-rw-r--r-- | src/core/ns_register.c | 12 | ||||
-rw-r--r-- | src/core/os_jupe.c | 6 | ||||
-rw-r--r-- | src/helpserv.c | 8 | ||||
-rw-r--r-- | src/hostserv.c | 2 | ||||
-rw-r--r-- | src/init.c | 2 | ||||
-rw-r--r-- | src/ircd.c | 74 | ||||
-rw-r--r-- | src/memoserv.c | 6 | ||||
-rw-r--r-- | src/messages.c | 70 | ||||
-rw-r--r-- | src/modules/cs_appendtopic.c | 2 | ||||
-rw-r--r-- | src/nickserv.c | 2 | ||||
-rw-r--r-- | src/operserv.c | 2 | ||||
-rw-r--r-- | src/protocol/bahamut.c | 22 | ||||
-rw-r--r-- | src/protocol/bahamut.h | 8 | ||||
-rw-r--r-- | src/protocol/charybdis.c | 53 | ||||
-rw-r--r-- | src/protocol/charybdis.h | 16 | ||||
-rw-r--r-- | src/protocol/inspircd11.c | 22 | ||||
-rwxr-xr-x | src/protocol/inspircd11.h | 10 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 44 | ||||
-rw-r--r-- | src/protocol/ratbox.h | 16 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 28 | ||||
-rw-r--r-- | src/protocol/unreal32.h | 10 | ||||
-rw-r--r-- | src/users.c | 10 |
29 files changed, 184 insertions, 263 deletions
diff --git a/src/actions.c b/src/actions.c index 36ce888cc..2a4a9a1de 100644 --- a/src/actions.c +++ b/src/actions.c @@ -219,7 +219,7 @@ void common_svsmode(User * u, const char *modes, const char *arg) } ircdproto->SendSVSMode(u, ac, av); - anope_ProcessUsermodes(u, ac, av); + ircdproto->ProcessUsermodes(u, ac, av); } /*************************************************************************/ diff --git a/src/botserv.c b/src/botserv.c index f19c1fdff..7ff55c9c1 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -92,7 +92,7 @@ void botserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_BotServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_BotServ), u->nick, "PING %s", s); } else { mod_run_cmd(s_BotServ, u, BOTSERV, cmd); } @@ -115,7 +115,7 @@ void botmsgs(User * u, BotInfo * bi, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(bi->nick, u->nick, "PING %s", s); + ircdproto->SendCTCP(bi, u->nick, "PING %s", s); } } @@ -139,7 +139,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) /* Answer to ping if needed, without breaking the buffer. */ if (!strnicmp(buf, "\1PING", 5)) { - anope_SendCTCP(ci->bi->nick, u->nick, "PING %s", buf); + ircdproto->SendCTCP(ci->bi, u->nick, "PING %s", buf); } /* If it's a /me, cut the CTCP part at the beginning (not diff --git a/src/chanserv.c b/src/chanserv.c index 232a24eb3..a878d0882 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -276,7 +276,7 @@ void chanserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_ChanServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_ChanServ), u->nick, "PING %s", s); } else { mod_run_cmd(s_ChanServ, u, CHANSERV, cmd); } @@ -2160,7 +2160,7 @@ void cs_set_flood(ChannelInfo * ci, const char *value) free(ci->mlock_flood); /* This looks ugly, but it works ;) */ - if (anope_IsFloodModeParamValid(value)) { + if (ircdproto->IsFloodModeParamValid(value)) { ci->mlock_flood = sstrdup(value); } else { ci->mlock_on &= ~ircd->chan_fmode; diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c index 035dbcfff..d56f93539 100644 --- a/src/core/bs_bot.c +++ b/src/core/bs_bot.c @@ -111,7 +111,7 @@ int do_bot(User * u) } /* check for hardcored ircd forbidden nicks */ - if (!anope_IsNickValid(nick)) { + if (!ircdproto->IsNickValid(nick)) { notice_lang(s_BotServ, u, BOT_BAD_NICK); return MOD_CONT; } @@ -229,7 +229,7 @@ int do_bot(User * u) } /* check for hardcored ircd forbidden nicks */ - if (!anope_IsNickValid(nick)) { + if (!ircdproto->IsNickValid(nick)) { notice_lang(s_BotServ, u, BOT_BAD_NICK); return MOD_CONT; } diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c index 3085c80bf..5bee0ade4 100644 --- a/src/core/cs_forbid.c +++ b/src/core/cs_forbid.c @@ -84,7 +84,7 @@ int do_forbid(User * u) if (*chan != '#') { notice_lang(s_ChanServ, u, CHAN_SYMBOL_REQUIRED); return MOD_CONT; - } else if (!anope_IsChannelValid(chan)) { + } else if (!ircdproto->IsChannelValid(chan)) { notice_lang(s_ChanServ, u, CHAN_X_INVALID, chan); return MOD_CONT; } diff --git a/src/core/cs_register.c b/src/core/cs_register.c index efd601c98..c553a63a4 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -95,7 +95,7 @@ int do_register(User * u) notice_lang(s_ChanServ, u, CHAN_REGISTER_NOT_LOCAL); } else if (*chan != '#') { notice_lang(s_ChanServ, u, CHAN_SYMBOL_REQUIRED); - } else if (!anope_IsChannelValid(chan)) { + } else if (!ircdproto->IsChannelValid(chan)) { notice_lang(s_ChanServ, u, CHAN_X_INVALID, chan); } else if (!u->na || !(nc = u->na->nc)) { notice_lang(s_ChanServ, u, CHAN_MUST_REGISTER_NICK, s_NickServ); diff --git a/src/core/ns_forbid.c b/src/core/ns_forbid.c index 336b44c53..e244c2dc5 100644 --- a/src/core/ns_forbid.c +++ b/src/core/ns_forbid.c @@ -85,7 +85,7 @@ int do_forbid(User * u) if (readonly) notice_lang(s_NickServ, u, READ_ONLY_MODE); - if (!anope_IsNickValid(nick)) { + if (!ircdproto->IsNickValid(nick)) { notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, nick); return MOD_CONT; } diff --git a/src/core/ns_register.c b/src/core/ns_register.c index 8908a1917..1b84a67a7 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -6,8 +6,8 @@ * 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. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -133,7 +133,7 @@ int do_register(User * u) return MOD_CONT; } - if (!anope_IsNickValid(u->nick)) { + if (!ircdproto->IsNickValid(u->nick)) { notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, u->nick); return MOD_CONT; } @@ -357,15 +357,15 @@ int do_confirm(User * u) notice_lang(s_NickServ, u, NICK_REGISTERED_NO_MASK, u->nick); send_event(EVENT_NICK_REGISTERED, 1, u->nick); - - if(enc_decrypt(na->nc->pass, tmp_pass, PASSMAX - 1)==1) + + if(enc_decrypt(na->nc->pass, tmp_pass, PASSMAX - 1)==1) notice_lang(s_NickServ, u, NICK_PASSWORD_IS, tmp_pass); u->lastnickreg = time(NULL); if (ircd->modeonreg) { len = strlen(ircd->modeonreg); strncpy(modes,ircd->modeonreg,512); - if(ircd->rootmodeonid && is_services_root(u)) { + if(ircd->rootmodeonid && is_services_root(u)) { strncat(modes,ircd->rootmodeonid,512-len); } else if(ircd->adminmodeonid && is_services_admin(u)) { strncat(modes,ircd->adminmodeonid,512-len); diff --git a/src/core/os_jupe.c b/src/core/os_jupe.c index 5cab65795..ea5d0a98a 100644 --- a/src/core/os_jupe.c +++ b/src/core/os_jupe.c @@ -77,7 +77,11 @@ int do_jupe(User * u) if (!isValidHost(jserver, 3)) { notice_lang(s_OperServ, u, OPER_JUPE_HOST_ERROR); } else { - anope_SendJupe(jserver, u->nick, reason); + char rbuf[256]; + snprintf(rbuf, sizeof(rbuf), "Juped by %s%s%s", u->nick, reason ? ": " : "", reason ? reason : ""); + if (findserver(servlist, jserver)) ircdproto->SendSquit(jserver, rbuf); + ircdproto->SendServer(jserver, 2, rbuf); + new_server(me_server, jserver, rbuf, SERVER_JUPED, NULL); if (WallOSJupe) ircdproto->SendGlobops(s_OperServ, "\2%s\2 used JUPE on \2%s\2", diff --git a/src/helpserv.c b/src/helpserv.c index 5a971f48c..b3ca08929 100644 --- a/src/helpserv.c +++ b/src/helpserv.c @@ -6,9 +6,9 @@ * 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$ + * Based on the original code of Services by Andy Church. + * + * $Id$ * */ @@ -60,7 +60,7 @@ void helpserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_HelpServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_HelpServ), u->nick, "PING %s", s); } else { mod_run_cmd(s_HelpServ, u, HELPSERV, cmd); } diff --git a/src/hostserv.c b/src/hostserv.c index d1cf68a21..be2e52e00 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -69,7 +69,7 @@ void hostserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_HostServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_HostServ), u->nick, "PING %s", s); } else { if (ircd->vhost) { mod_run_cmd(s_HostServ, u, HOSTSERV, cmd); diff --git a/src/init.c b/src/init.c index a6a91617c..3e59d4d81 100644 --- a/src/init.c +++ b/src/init.c @@ -739,7 +739,7 @@ int init_secondary(int ac, char **av) ircdproto->SendJoin(findbot(s_GlobalNoticer), LogChannel, time(NULL)); } - anope_SendEOB(); + ircdproto->SendEOB(); /** * Load our delayed modeles - modules that are planing on making clients need to wait till now diff --git a/src/ircd.c b/src/ircd.c index d7de214b1..d9b729ef0 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -38,80 +38,6 @@ void pmodule_ircd_proto(IRCDProto *proto) ircdproto = proto; } -void anope_ProcessUsermodes(User *user, int ac, const char **av) -{ - ircdproto->ProcessUsermodes(user, ac, av); -} - -void anope_SendUnregisteredNick(User *u) -{ - ircdproto->SendUnregisteredNick(u); -} - -void anope_SendSVID2(User *u, const char *ts) -{ - ircdproto->SendSVID2(u, ts); -} - -void anope_SendSVID3(User *u, const char *ts) -{ - ircdproto->SendSVID3(u, ts); -} - -void anope_SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param) -{ - ircdproto->SendSVSJoin(source, nick, chan, param); -} - -void anope_SendSVSPart(const char *source, const char *nick, const char *chan) -{ - ircdproto->SendSVSPart(source, nick, chan); -} - -void anope_SendSWhois(const char *source, const char *who, const char *mask) -{ - ircdproto->SendSWhois(source, who, mask); -} - -void anope_SendEOB() -{ - ircdproto->SendEOB(); -} - -int anope_IsFloodModeParamValid(const char *value) -{ - return ircdproto->IsFloodModeParamValid(value); -} - -void anope_SendJupe(const char *jserver, const char *who, const char *reason) -{ - ircdproto->SendJupe(jserver, who, reason); -} - -int anope_IsNickValid(const char *nick) -{ - return ircdproto->IsNickValid(nick); -} - -int anope_IsChannelValid(const char *chan) -{ - return ircdproto->IsChannelValid(chan); -} - - -void anope_SendCTCP(const char *source, const char *dest, const char *fmt, ...) -{ - va_list args; - char buf[BUFSIZE] = ""; - if (fmt) { - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - } - // XXX: CBX, when you move this to ircdproto, please make it take BotInfo * directly, thx :) - ircdproto->SendCTCP(findbot(source), dest, buf); -} - void anope_SendNumeric(const char *source, int numeric, const char *dest, const char *fmt, ...) { va_list args; diff --git a/src/memoserv.c b/src/memoserv.c index 77661a79d..34e0061f9 100644 --- a/src/memoserv.c +++ b/src/memoserv.c @@ -6,8 +6,8 @@ * 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. -* +* Based on the original code of Services by Andy Church. +* * $Id$ * */ @@ -63,7 +63,7 @@ void memoserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_MemoServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_MemoServ), u->nick, "PING %s", s); } else { if (!u->na && stricmp(cmd, "HELP") != 0) notice_lang(s_MemoServ, u, NICK_NOT_REGISTERED_HELP, diff --git a/src/messages.c b/src/messages.c index 6894cd43d..4b3f2bb94 100644 --- a/src/messages.c +++ b/src/messages.c @@ -71,7 +71,7 @@ int m_time(const char *source, int ac, const char **av) time(&t); tm = localtime(&t); strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm); - anope_SendNumeric(ServerName, 391, source, "%s :%s", ServerName, buf); + ircdproto->SendNumeric(ServerName, 391, source, "%s :%s", ServerName, buf); return MOD_CONT; } @@ -88,15 +88,15 @@ int m_motd(const char *source) f = fopen(MOTDFilename, "r"); if (f) { - anope_SendNumeric(ServerName, 375, source, ":- %s Message of the Day", ServerName); + ircdproto->SendNumeric(ServerName, 375, source, ":- %s Message of the Day", ServerName); while (fgets(buf, sizeof(buf), f)) { buf[strlen(buf) - 1] = 0; - anope_SendNumeric(ServerName, 372, source, ":- %s", buf); + ircdproto->SendNumeric(ServerName, 372, source, ":- %s", buf); } fclose(f); - anope_SendNumeric(ServerName, 376, source, ":End of /MOTD command."); + ircdproto->SendNumeric(ServerName, 376, source, ":End of /MOTD command."); } else { - anope_SendNumeric(ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator."); + ircdproto->SendNumeric(ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator."); } return MOD_CONT; } @@ -241,54 +241,54 @@ int m_stats(const char *source, int ac, const char **av) if (u && is_oper(u)) { if (servernum == 1) { - anope_SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); - anope_SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer, write_buffer_len(), total_written, -1, read_buffer_len(), + ircdproto->SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + ircdproto->SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer, write_buffer_len(), total_written, -1, read_buffer_len(), total_read, -1, time(NULL) - start_time); } else if (servernum == 2) { - anope_SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); - anope_SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer2, write_buffer_len(), total_written, -1, read_buffer_len(), + ircdproto->SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + ircdproto->SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer2, write_buffer_len(), total_written, -1, read_buffer_len(), total_read, -1, time(NULL) - start_time); } else if (servernum == 3) { - anope_SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); - anope_SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer3, write_buffer_len(), total_written, -1, read_buffer_len(), + ircdproto->SendNumeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + ircdproto->SendNumeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer3, write_buffer_len(), total_written, -1, read_buffer_len(), total_read, -1, time(NULL) - start_time); } } - anope_SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); + ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; case 'o': case 'O': /* Check whether the user is an operator */ u = finduser(source); if (u && !is_oper(u) && HideStatsO) { - anope_SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); + ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); } else { for (i = 0; i < RootNumber; i++) - anope_SendNumeric(ServerName, 243, source, "O * * %s Root 0", ServicesRoots[i]); + ircdproto->SendNumeric(ServerName, 243, source, "O * * %s Root 0", ServicesRoots[i]); for (i = 0; i < servadmins.count && (nc = (NickCore *)servadmins.list[i]); i++) - anope_SendNumeric(ServerName, 243, source, "O * * %s Admin 0", nc->display); + ircdproto->SendNumeric(ServerName, 243, source, "O * * %s Admin 0", nc->display); for (i = 0; i < servopers.count && (nc = (NickCore *)servopers.list[i]); i++) - anope_SendNumeric(ServerName, 243, source, "O * * %s Oper 0", nc->display); + ircdproto->SendNumeric(ServerName, 243, source, "O * * %s Oper 0", nc->display); - anope_SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); + ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); } break; case 'u':{ int uptime = time(NULL) - start_time; - anope_SendNumeric(ServerName, 242, source, ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s", + ircdproto->SendNumeric(ServerName, 242, source, ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s", (uptime / 3600) % 24, (uptime / 60) % 60, uptime % 60); - anope_SendNumeric(ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt); - anope_SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); + ircdproto->SendNumeric(ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt); + ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; } /* case 'u' */ default: - anope_SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); + ircdproto->SendNumeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; } return MOD_CONT; @@ -298,7 +298,7 @@ int m_stats(const char *source, int ac, const char **av) int m_version(const char *source, int ac, const char **av) { - if (source) anope_SendNumeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, + if (source) ircdproto->SendNumeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, EncModule, version_build); return MOD_CONT; } @@ -333,11 +333,11 @@ int m_whois(const char *source, const char *who) clientdesc = desc_DevNull; else if (s_BotServ && (bi = findbot(who))) { /* Bots are handled separately */ - anope_SendNumeric(ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real); - anope_SendNumeric(ServerName, 307, source, "%s :is a registered nick", bi->nick); - anope_SendNumeric(ServerName, 312, source, "%s %s :%s", bi->nick, ServerName, ServerDesc); - anope_SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time); - anope_SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); + ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real); + ircdproto->SendNumeric(ServerName, 307, source, "%s :is a registered nick", bi->nick); + ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", bi->nick, ServerName, ServerDesc); + ircdproto->SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time); + ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); return MOD_CONT; } else if (!(ircd->svshold && UseSVSHOLD) && (na = findnick(who)) && (na->status & NS_KILL_HELD)) { @@ -345,18 +345,18 @@ int m_whois(const char *source, const char *who) * We can't just say it doesn't exist here, even tho it does for * other servers :) -GD */ - anope_SendNumeric(ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, NSEnforcerUser, NSEnforcerHost); - anope_SendNumeric(ServerName, 312, source, "%s %s :%s", na->nick, ServerName, ServerDesc); - anope_SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); + ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, NSEnforcerUser, NSEnforcerHost); + ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", na->nick, ServerName, ServerDesc); + ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); return MOD_CONT; } else { - anope_SendNumeric(ServerName, 401, source, "%s :No such service.", who); + ircdproto->SendNumeric(ServerName, 401, source, "%s :No such service.", who); return MOD_CONT; } - anope_SendNumeric(ServerName, 311, source, "%s %s %s * :%s", who, ServiceUser, ServiceHost, clientdesc); - anope_SendNumeric(ServerName, 312, source, "%s %s :%s", who, ServerName, ServerDesc); - anope_SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time); - anope_SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); + ircdproto->SendNumeric(ServerName, 311, source, "%s %s %s * :%s", who, ServiceUser, ServiceHost, clientdesc); + ircdproto->SendNumeric(ServerName, 312, source, "%s %s :%s", who, ServerName, ServerDesc); + ircdproto->SendNumeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time); + ircdproto->SendNumeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); } return MOD_CONT; } diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c index 12678cd7f..cbdae1533 100644 --- a/src/modules/cs_appendtopic.c +++ b/src/modules/cs_appendtopic.c @@ -147,7 +147,7 @@ int my_cs_appendtopic(User * u) s_ChanServ, u->nick, u->username, u->host, c->name); if (ircd->join2set) { if (whosends(ci) == s_ChanServ) { - ircdproto->SendJoin(s_ChanServ, c->name, c->creation_time); + ircdproto->SendJoin(findbot(s_ChanServ), c->name, c->creation_time); ircdproto->SendMode(NULL, c->name, "+o %s", s_ChanServ); } } diff --git a/src/nickserv.c b/src/nickserv.c index 32572a212..e4a48bd56 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -144,7 +144,7 @@ void nickserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_NickServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_NickServ), u->nick, "PING %s", s); } else { mod_run_cmd(s_NickServ, u, NICKSERV, cmd); } diff --git a/src/operserv.c b/src/operserv.c index 85e0f3dc7..d1613e365 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -141,7 +141,7 @@ void operserv(User * u, char *buf) if (!(s = strtok(NULL, ""))) { s = ""; } - anope_SendCTCP(s_OperServ, u->nick, "PING %s", s); + ircdproto->SendCTCP(findbot(s_OperServ), u->nick, "PING %s", s); } else { mod_run_cmd(s_OperServ, u, OPERSERV, cmd); } diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 0c8b0ebef..c82103cc8 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -452,11 +452,11 @@ CUMode myCumodes[128] = { -void BahamutIRCdProto::SendModeInternal(const char *source, const char *dest, const char *buf) +void BahamutIRCdProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; - if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source, "MODE %s 0 %s", dest, buf); - else send_cmd(source, "MODE %s %s", dest, buf); + if (ircdcap->tsmode && (uplink_capab & ircdcap->tsmode)) send_cmd(source->nick, "MODE %s 0 %s", dest, buf); + else send_cmd(source->nick, "MODE %s %s", dest, buf); } /* SVSHOLD - set */ @@ -488,7 +488,7 @@ void BahamutIRCdProto::SendSVSModeChan(const char *name, const char *mode, const void BahamutIRCdProto::SendBotOp(const char *nick, const char *chan) { - SendMode(nick, chan, "%s %s", ircd->botchanumode, nick); + SendMode(findbot(nick), chan, "%s %s", ircd->botchanumode, nick); } /* EVENT: SJOIN */ @@ -525,7 +525,7 @@ int anope_event_nick(const char *source, int ac, const char **av) strtoul(av[2], NULL, 10), strtoul(av[7], NULL, 0), strtoul(av[8], NULL, 0), NULL, NULL); if (user) { - anope_ProcessUsermodes(user, 1, &av[3]); + ircdproto->ProcessUsermodes(user, 1, &av[3]); } } else { do_nick(source, av[0], NULL, NULL, NULL, NULL, @@ -658,9 +658,9 @@ void BahamutIRCdProto::SendSQLineDel(const char *user) } /* JOIN - SJOIN */ -void BahamutIRCdProto::SendJoin(const char *user, const char *channel, time_t chantime) +void BahamutIRCdProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) { - send_cmd(user, "SJOIN %ld %s", static_cast<long>(chantime), channel); + send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel); } void bahamut_cmd_burst() @@ -872,16 +872,16 @@ int anope_event_motd(const char *source, int ac, const char **av) return MOD_CONT; } -void BahamutIRCdProto::SendNoticeChanopsInternal(const char *source, const char *dest, const char *buf) +void BahamutIRCdProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; send_cmd(NULL, "NOTICE @%s :%s", dest, buf); } -void BahamutIRCdProto::SendKickInternal(const char *source, const char *chan, const char *user, const char *buf) +void BahamutIRCdProto::SendKickInternal(BotInfo *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); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan, user, buf); + else send_cmd(source->nick, "KICK %s %s", chan, user); } int anope_event_away(const char *source, int ac, const char **av) diff --git a/src/protocol/bahamut.h b/src/protocol/bahamut.h index a1da77a92..200dc3d6a 100644 --- a/src/protocol/bahamut.h +++ b/src/protocol/bahamut.h @@ -60,9 +60,9 @@ class BahamutIRCdProto : public IRCDProto { void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(const char *, const char *, const char *); - void SendKickInternal(const char *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(const char *, const char *, const char *); + void SendModeInternal(BotInfo *, const char *, const char *); + void SendKickInternal(BotInfo *, const char *, const char *, const char *); + void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); public: void SendSVSNOOP(const char *, int); void SendAkillDel(const char *, const char *); @@ -72,7 +72,7 @@ class BahamutIRCdProto : public IRCDProto { void SendGuestNick(const char *, const char *, const char *, const char *, const char *); void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); void SendBotOp(const char *, const char *); - void SendJoin(const char *, const char *, time_t); + void SendJoin(BotInfo *, const char *, time_t); void SendSQLineDel(const char *); void SendSQLine(const char *, const char *); void SendConnect(); diff --git a/src/protocol/charybdis.c b/src/protocol/charybdis.c index 7cc31bc56..0717b722c 100644 --- a/src/protocol/charybdis.c +++ b/src/protocol/charybdis.c @@ -489,14 +489,14 @@ int anope_event_nick(const char *source, int ac, const char **av) user = do_nick("", av[0], av[4], av[5], s->name, av[8], strtoul(av[2], NULL, 10), 0, 0, NULL, av[7]); if (user) { - anope_ProcessUsermodes(user, 1, &av[3]); + 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, NULL); if (user) - anope_ProcessUsermodes(user, 1, &av[3]); + ircdproto->ProcessUsermodes(user, 1, &av[3]); } else { do_nick(source, av[0], NULL, NULL, NULL, NULL, strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); @@ -533,7 +533,7 @@ int anope_event_euid(const char *source, int ac, const char **av) user = do_nick("", av[0], av[4], !strcmp(av[8], "*") ? av[5] : av[8], s->name, av[10], ts, !stricmp(av[0], av[9]) ? ts : 0, 0, av[5], av[7]); if (user) { - anope_ProcessUsermodes(user, 1, &av[3]); + ircdproto->ProcessUsermodes(user, 1, &av[3]); } } return MOD_CONT; @@ -694,10 +694,9 @@ void CharybdisProto::SendSQLineDel(const char *user) send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : s_OperServ) : s_OperServ, "UNRESV * %s", user); } -void CharybdisProto::SendJoin(const char *user, const char *channel, time_t chantime) +void CharybdisProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) { - User *u = finduser(user); - send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, UseTS6 ? (u ? u->uid : user) : user); + send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, UseTS6 ? user->uid.c_str() : user->nick); } /* @@ -813,11 +812,10 @@ void CharybdisProto::SendClientIntroduction(const char *nick, const char *user, SendSQLine(nick, "Reserved for services"); } -void CharybdisProto::SendPartInternal(const char *nick, const char *chan, const char *buf) +void CharybdisProto::SendPartInternal(BotInfo *nick, const char *chan, const char *buf) { - User *u = finduser(nick); - if (buf) send_cmd(UseTS6 ? u->uid : nick, "PART %s :%s", chan, buf); - else send_cmd(UseTS6 ? u->uid : nick, "PART %s", chan); + if (buf) send_cmd(UseTS6 ? nick->uid : nick->nick, "PART %s :%s", chan, buf); + else send_cmd(UseTS6 ? nick->uid : nick->nick, "PART %s", chan); } int anope_event_ping(const char *source, int ac, const char **av) @@ -977,20 +975,19 @@ int anope_event_quit(const char *source, int ac, const char **av) return MOD_CONT; } -void CharybdisProto::SendNumeric(const char *source, int numeric, const char *dest, const char *buf) +void CharybdisProto::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); } -void CharybdisProto::SendModeInternal(const char *source, const char *dest, const char *buf) +void CharybdisProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; if (source) { - BotInfo *bi = findbot(source); - send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "MODE %s %s", dest, buf); + send_cmd(UseTS6 ? source->uid.c_str() : source->nick, "MODE %s %s", dest, buf); } - else send_cmd(source, "MODE %s %s", dest, buf); + else send_cmd(source->nick, "MODE %s %s", dest, buf); } void charybdis_cmd_tmode(const char *source, const char *dest, const char *fmt, ...) @@ -1011,19 +1008,17 @@ void charybdis_cmd_tmode(const char *source, const char *dest, const char *fmt, send_cmd(NULL, "MODE %s %s", dest, buf); } -void CharybdisProto::SendKickInternal(const char *source, const char *chan, const char *user, const char *buf) +void CharybdisProto::SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) { - BotInfo *bi = findbot(source); User *u = finduser(user); - if (buf) send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "KICK %s %s :%s", chan, UseTS6 ? (u ? u->uid : user) : user, buf); - else send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "KICK %s %s", chan, UseTS6 ? (u ? u->uid : user) : user); + if (buf) send_cmd(UseTS6 ? source->uid.c_str() : source->nick, "KICK %s %s :%s", chan, UseTS6 ? (u ? u->uid : user) : user, buf); + else send_cmd(UseTS6 ? source->uid.c_str() : source->nick, "KICK %s %s", chan, UseTS6 ? (u ? u->uid : user) : user); } -void CharybdisProto::SendNoticeChanopsInternal(const char *source, const char *dest, const char *buf) +void CharybdisProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; - BotInfo *bi = findbot(source); - send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "NOTICE @%s :%s", dest, buf); + send_cmd(UseTS6 ? source->uid.c_str() : source->nick, "NOTICE @%s :%s", dest, buf); } void CharybdisProto::SendBotOp(const char *nick, const char *chan) @@ -1032,15 +1027,14 @@ void CharybdisProto::SendBotOp(const char *nick, const char *chan) User *u = finduser(nick); charybdis_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, u ? u->uid : nick); } - else SendMode(ServerName, chan, "%s %s", ircd->botchanumode, nick); + else SendMode(findbot(nick), chan, "%s %s", ircd->botchanumode, nick); } /* QUIT */ -void CharybdisProto::SendQuitInternal(const char *source, const char *buf) +void CharybdisProto::SendQuitInternal(BotInfo *source, const char *buf) { - BotInfo *bi = findbot(source); - if (buf) send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "QUIT :%s", buf); - else send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "QUIT"); + if (buf) send_cmd(UseTS6 ? source->uid : source->nick, "QUIT :%s", buf); + else send_cmd(UseTS6 ? source->uid : source->nick, "QUIT"); } /* PONG */ @@ -1052,12 +1046,11 @@ void CharybdisProto::SendPong(const char *servname, const char *who) } /* INVITE */ -void CharybdisProto::SendInvite(const char *source, const char *chan, const char *nick) +void CharybdisProto::SendInvite(BotInfo *source, const char *chan, const char *nick) { if (!source || !chan || !nick) return; - BotInfo *bi = findbot(source); User *u = finduser(nick); - send_cmd(UseTS6 ? (bi ? bi->uid.c_str() : source) : source, "INVITE %s %s", UseTS6 ? (u ? u->uid : nick) : nick, chan); + send_cmd(UseTS6 ? source->uid : source->nick, "INVITE %s %s", UseTS6 ? (u ? u->uid : nick) : nick, chan); } int anope_event_mode(const char *source, int ac, const char **av) diff --git a/src/protocol/charybdis.h b/src/protocol/charybdis.h index 32834e845..a43e3a2da 100644 --- a/src/protocol/charybdis.h +++ b/src/protocol/charybdis.h @@ -48,12 +48,13 @@ class CharybdisProto : public IRCDTS6Proto { void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(const char *, const char *, const char *); - void SendKickInternal(const char *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(const char *, const char *, const char *); - void SendQuitInternal(const char *, const char *); - void SendPartInternal(const char *, const char *, const char *); + void SendModeInternal(BotInfo *, const char *, const char *); + void SendKickInternal(BotInfo *, const char *, const char *, const char *); + void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); + void SendQuitInternal(BotInfo *, const char *); + void SendPartInternal(BotInfo *, const char *, const char *); void SendGlobopsInternal(const char *, const char *); + void SendNumericInternal(const char *, int, const char *, const char *); public: void SendAkillDel(const char *, const char *); void SendVhostDel(User *); @@ -62,9 +63,9 @@ class CharybdisProto : public IRCDTS6Proto { void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); void SendBotOp(const char *, const char *); void SendPong(const char *, const char *); - void SendJoin(const char *, const char *, time_t); + void SendJoin(BotInfo *, const char *, time_t); void SendSQLineDel(const char *); - void SendInvite(const char *, const char *, const char *); + void SendInvite(BotInfo *, const char *, const char *); void SendSQLine(const char *, const char *); void SendForceNickChange(const char *, const char *, time_t); void SendVhost(const char *, const char *, const char *); @@ -77,5 +78,4 @@ class CharybdisProto : public IRCDTS6Proto { void ProcessUsermodes(User *, int, const char **); int IsNickValid(const char *); int IsFloodModeParamValid(const char *); - void SendNumeric(const char *, int, const char *, const char *); } ircd_proto; diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index a25e4290d..5249b9aea 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -555,7 +555,7 @@ void InspIRCdProto::SendSVSMode(User *u, int ac, const char **av) send_cmd(s_NickServ, "MODE %s %s", u->nick, merge_args(ac, av)); } -void InspIRCdProto::SendNumeric(const char *source, int numeric, const char *dest, const char *buf) +void InspIRCdProto::SendNumericInternal(const char *source, int numeric, const char *dest, const char *buf) { send_cmd(source, "PUSH %s ::%s %03d %s %s", dest, source, numeric, dest, buf); } @@ -565,11 +565,11 @@ void InspIRCdProto::SendGuestNick(const char *nick, const char *user, const char send_cmd(ServerName, "NICK %ld %s %s %s %s +%s 0.0.0.0 :%s", static_cast<long>(time(NULL)), nick, host, host, user, modes, real); } -void InspIRCdProto::SendModeInternal(const char *source, const char *dest, const char *buf) +void InspIRCdProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; Channel *c = findchan(dest); - send_cmd(source ? source : s_OperServ, "FMODE %s %u %s", dest, static_cast<unsigned>(c ? c->creation_time : time(NULL)), buf); + send_cmd(source ? source->nick : s_OperServ, "FMODE %s %u %s", dest, static_cast<unsigned>(c ? c->creation_time : time(NULL)), buf); } int anope_event_idle(const char *source, int ac, const char **av) @@ -733,13 +733,13 @@ void InspIRCdProto::SendClientIntroduction(const char *nick, const char *user, c send_cmd(nick, "OPERTYPE Service"); } -void InspIRCdProto::SendKickInternal(const char *source, const char *chan, const char *user, const char *buf) +void InspIRCdProto::SendKickInternal(BotInfo *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); + if (buf) send_cmd(source->nick, "KICK %s %s :%s", chan, user, buf); + else send_cmd(source->nick, "KICK %s %s :%s", chan, user, user); } -void InspIRCdProto::SendNoticeChanopsInternal(const char *source, const char *dest, const char *buf) +void InspIRCdProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; send_cmd(ServerName, "NOTICE @%s :%s", dest, buf); @@ -747,7 +747,7 @@ void InspIRCdProto::SendNoticeChanopsInternal(const char *source, const char *de void InspIRCdProto::SendBotOp(const char *nick, const char *chan) { - SendMode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); + SendMode(findbot(nick), chan, "%s %s %s", ircd->botchanumode, nick, nick); } /* PROTOCTL */ @@ -770,9 +770,9 @@ void InspIRCdProto::SendServer(const char *servname, int hop, const char *descri } /* JOIN */ -void InspIRCdProto::SendJoin(const char *user, const char *channel, time_t chantime) +void InspIRCdProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) { - send_cmd(user, "JOIN %s", channel); + send_cmd(user->nick, "JOIN %s", channel); } /* UNSQLINE */ @@ -1081,7 +1081,7 @@ int anope_event_nick(const char *source, int ac, const char **av) av[7], /* realname */ ts, svid, htonl(*ad), av[3], NULL); if (user) { - anope_ProcessUsermodes(user, 1, &av[5]); + ircdproto->ProcessUsermodes(user, 1, &av[5]); user->chost = av[3]; } } diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h index c0073fc0f..7988071eb 100755 --- a/src/protocol/inspircd11.h +++ b/src/protocol/inspircd11.h @@ -53,9 +53,10 @@ class InspIRCdProto : public IRCDProto { void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(const char *, const char *, const char *); - void SendKickInternal(const char *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(const char *, const char *, const char *); + void SendModeInternal(BotInfo *, const char *, const char *); + void SendKickInternal(BotInfo *, const char *, const char *, const char *); + void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); + void SendNumericInternal(const char *, int, const char *, const char *); public: void SendAkillDel(const char *, const char *); void SendTopic(BotInfo *, const char *, const char *, const char *, time_t); @@ -65,7 +66,7 @@ class InspIRCdProto : public IRCDProto { void SendGuestNick(const char *, const char *, const char *, const char *, const char *); void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); void SendBotOp(const char *, const char *); - void SendJoin(const char *, const char *, time_t); + void SendJoin(BotInfo *, const char *, time_t); void SendSQLineDel(const char *); void SendSQLine(const char *, const char *); void SendSquit(const char *, const char *); @@ -83,5 +84,4 @@ class InspIRCdProto : public IRCDProto { void SendServer(const char *, int, const char *); void ProcessUsermodes(User *, int, const char **); int IsFloodModeParamValid(const char *); - void SendNumeric(const char *, int, const char *, const char *); } ircd_proto; diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 94a0dd625..bf579c7e1 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -479,14 +479,14 @@ int anope_event_nick(const char *source, int ac, const char **av) user = do_nick("", av[0], av[4], av[5], s->name, av[8], strtoul(av[2], NULL, 10), 0, 0, "*", av[7]); if (user) { - anope_ProcessUsermodes(user, 1, &av[3]); + 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) - anope_ProcessUsermodes(user, 1, &av[3]); + ircdproto->ProcessUsermodes(user, 1, &av[3]); } else { do_nick(source, av[0], NULL, NULL, NULL, NULL, strtoul(av[1], NULL, 10), 0, 0, NULL, NULL); @@ -633,10 +633,9 @@ void RatboxProto::SendSQLineDel(const char *user) send_cmd(UseTS6 ? (ud ? ud->uid : s_OperServ) : s_OperServ, "UNRESV * %s", user); } -void RatboxProto::SendJoin(const char *user, const char *channel, time_t chantime) +void RatboxProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) { - Uid *ud = find_uid(user); - send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, UseTS6 ? (ud ? ud->uid : user) : user); + send_cmd(NULL, "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel, UseTS6 ? user->uid : user->nick); } /* @@ -750,11 +749,11 @@ void RatboxProto::SendClientIntroduction(const char *nick, const char *user, con SendSQLine(nick, "Reserved for services"); } -void RatboxProto::SendPartInternal(const char *nick, const char *chan, const char *buf) +void RatboxProto::SendPartInternal(BotInfo *nick, const char *chan, const char *buf) { Uid *ud = find_uid(nick); - if (buf) send_cmd(UseTS6 ? ud->uid : nick, "PART %s :%s", chan, buf); - else send_cmd(UseTS6 ? ud->uid : nick, "PART %s", chan); + if (buf) send_cmd(UseTS6 ? ud->uid : nick->nick, "PART %s :%s", chan, buf); + else send_cmd(UseTS6 ? ud->uid : nick->nick, "PART %s", chan); } int anope_event_ping(const char *source, int ac, const char **av) @@ -907,20 +906,20 @@ int anope_event_quit(const char *source, int ac, const char **av) return MOD_CONT; } -void RatboxProto::SendNumeric(const char *source, int numeric, const char *dest, const char *buf) +void RatboxProto::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); } -void RatboxProto::SendModeInternal(const char *source, const char *dest, const char *buf) +void RatboxProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; if (source) { Uid *ud = find_uid(source); - send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "MODE %s %s", dest, buf); + send_cmd(UseTS6 ? (ud ? ud->uid : source->nick) : source->nick, "MODE %s %s", dest, buf); } - else send_cmd(source, "MODE %s %s", dest, buf); + else send_cmd(source->nick, "MODE %s %s", dest, buf); } void ratbox_cmd_tmode(const char *source, const char *dest, const char *fmt, ...) @@ -941,15 +940,15 @@ void ratbox_cmd_tmode(const char *source, const char *dest, const char *fmt, ... send_cmd(NULL, "MODE %s %s", dest, buf); } -void RatboxProto::SendKickInternal(const char *source, const char *chan, const char *user, const char *buf) +void RatboxProto::SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) { Uid *ud = find_uid(source); User *u = finduser(user); - if (buf) send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "KICK %s %s :%s", chan, UseTS6 ? (u ? u->uid : user) : user, buf); - else send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "KICK %s %s", chan, UseTS6 ? (u ? u->uid : user) : user); + if (buf) send_cmd(UseTS6 ? (ud ? ud->uid : source->nick) : source->nick, "KICK %s %s :%s", chan, UseTS6 ? (u ? u->uid : user) : user, buf); + else send_cmd(UseTS6 ? (ud ? ud->uid : source->nick) : source->nick, "KICK %s %s", chan, UseTS6 ? (u ? u->uid : user) : user); } -void RatboxProto::SendNoticeChanopsInternal(const char *source, const char *dest, const char *buf) +void RatboxProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; send_cmd(NULL, "NOTICE @%s :%s", dest, buf); @@ -961,15 +960,15 @@ void RatboxProto::SendBotOp(const char *nick, const char *chan) Uid *u = find_uid(nick); ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, u ? u->uid : nick); } - else SendMode(nick, chan, "%s %s", ircd->botchanumode, nick); + else SendMode(findbot(nick), chan, "%s %s", ircd->botchanumode, nick); } /* QUIT */ -void RatboxProto::SendQuitInternal(const char *source, const char *buf) +void RatboxProto::SendQuitInternal(BotInfo *source, const char *buf) { Uid *ud = find_uid(source); - if (buf) send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "QUIT :%s", buf); - else send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "QUIT"); + if (buf) send_cmd(UseTS6 ? (ud ? ud->uid : source->nick) : source->nick, "QUIT :%s", buf); + else send_cmd(UseTS6 ? (ud ? ud->uid : source->nick) : source->nick, "QUIT"); } /* PONG */ @@ -980,12 +979,11 @@ void RatboxProto::SendPong(const char *servname, const char *who) } /* INVITE */ -void RatboxProto::SendInvite(const char *source, const char *chan, const char *nick) +void RatboxProto::SendInvite(BotInfo *source, const char *chan, const char *nick) { if (!source || !chan || !nick) return; - Uid *ud = find_uid(source); User *u = finduser(nick); - send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "INVITE %s %s", UseTS6 ? (u ? u->uid : nick) : nick, chan); + send_cmd(UseTS6 ? source->uid : source->nick, "INVITE %s %s", UseTS6 ? (u ? u->uid : nick) : nick, chan); } int anope_event_mode(const char *source, int ac, const char **av) diff --git a/src/protocol/ratbox.h b/src/protocol/ratbox.h index fa4c94989..5687d2698 100644 --- a/src/protocol/ratbox.h +++ b/src/protocol/ratbox.h @@ -47,12 +47,13 @@ class RatboxProto : public IRCDTS6Proto { void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(const char *, const char *, const char *); - void SendKickInternal(const char *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(const char *, const char *, const char *); - void SendQuitInternal(const char *, const char *); - void SendPartInternal(const char *, const char *, const char *); + void SendModeInternal(BotInfo *, const char *, const char *); + void SendKickInternal(BotInfo *, const char *, const char *, const char *); + void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); + void SendQuitInternal(BotInfo *, const char *); + void SendPartInternal(BotInfo *, const char *, const char *); void SendGlobopsInternal(const char *, const char *); + void SendNumericInternal(const char *, int, const char *, const char *); public: void SendAkillDel(const char *, const char *); void SendAkill(const char *, const char *, const char *, time_t, time_t, const char *); @@ -60,9 +61,9 @@ class RatboxProto : public IRCDTS6Proto { void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); void SendBotOp(const char *, const char *); void SendPong(const char *, const char *); - void SendJoin(const char *, const char *, time_t); + void SendJoin(BotInfo *, const char *, time_t); void SendSQLineDel(const char *); - void SendInvite(const char *, const char *, const char *); + void SendInvite(BotInfo *, const char *, const char *); void SendSQLine(const char *, const char *); void SendForceNickChange(const char *, const char *, time_t) { } // Ratbox doesn't have an SVSNICK command void SendConnect(); @@ -71,5 +72,4 @@ class RatboxProto : public IRCDTS6Proto { void SendServer(const char *, int, const char *); void ProcessUsermodes(User *, int, const char **); int IsNickValid(const char *); - void SendNumeric(const char *, int, const char *, const char *); } ircd_proto; diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 3e7089953..850034731 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -542,10 +542,10 @@ void UnrealIRCdProto::SendGuestNick(const char *nick, const char *user, const ch myIrcd->nickip ? " *" : " ", real); } -void UnrealIRCdProto::SendModeInternal(const char *source, const char *dest, const char *buf) +void UnrealIRCdProto::SendModeInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; - send_cmd(source, "%s %s %s", send_token("MODE", "G"), dest, buf); + send_cmd(source->nick, "%s %s %s", send_token("MODE", "G"), dest, buf); } void UnrealIRCdProto::SendClientIntroduction(const char *nick, const char *user, const char *host, const char *real, const char *modes) @@ -556,22 +556,22 @@ void UnrealIRCdProto::SendClientIntroduction(const char *nick, const char *user, SendSQLine(nick, "Reserved for services"); } -void UnrealIRCdProto::SendKickInternal(const char *source, const char *chan, const char *user, const char *buf) +void UnrealIRCdProto::SendKickInternal(BotInfo *source, const char *chan, const char *user, const char *buf) { - if (buf) send_cmd(source, "%s %s %s :%s", send_token("KICK", "H"), chan, user, buf); - else send_cmd(source, "%s %s %s", send_token("KICK", "H"), chan, user); + if (buf) send_cmd(source->nick, "%s %s %s :%s", send_token("KICK", "H"), chan, user, buf); + else send_cmd(source->nick, "%s %s %s", send_token("KICK", "H"), chan, user); } -void UnrealIRCdProto::SendNoticeChanopsInternal(const char *source, const char *dest, const char *buf) +void UnrealIRCdProto::SendNoticeChanopsInternal(BotInfo *source, const char *dest, const char *buf) { if (!buf) return; - send_cmd(source, "%s @%s :%s", send_token("NOTICE", "B"), dest, buf); + send_cmd(source->nick, "%s @%s :%s", send_token("NOTICE", "B"), dest, buf); } void UnrealIRCdProto::SendBotOp(const char *nick, const char *chan) { - SendMode(nick, chan, "%s %s %s", myIrcd->botchanumode, nick, nick); + SendMode(findbot(nick), chan, "%s %s %s", myIrcd->botchanumode, nick, nick); } /* PROTOCTL */ @@ -625,9 +625,9 @@ void UnrealIRCdProto::SendServer(const char *servname, int hop, const char *desc } /* JOIN */ -void UnrealIRCdProto::SendJoin(const char *user, const char *channel, time_t chantime) +void UnrealIRCdProto::SendJoin(BotInfo *user, const char *channel, time_t chantime) { - send_cmd(ServerName, "%s !%s %s :%s", send_token("SJOIN", "~"), base64enc(static_cast<long>(chantime)), channel, user); + send_cmd(ServerName, "%s !%s %s :%s", send_token("SJOIN", "~"), base64enc(static_cast<long>(chantime)), channel, user->nick); /* send_cmd(user, "%s %s", send_token("JOIN", "C"), channel); */ } @@ -689,10 +689,10 @@ void UnrealIRCdProto::SendSVSO(const char *source, const char *nick, const char } /* NICK <newnick> */ -void UnrealIRCdProto::SendChangeBotNick(const char *oldnick, const char *newnick) +void UnrealIRCdProto::SendChangeBotNick(BotInfo *oldnick, const char *newnick) { if (!oldnick || !newnick) return; - send_cmd(oldnick, "%s %s %ld", send_token("NICK", "&"), newnick, static_cast<long>(time(NULL))); + send_cmd(oldnick->nick, "%s %s %ld", send_token("NICK", "&"), newnick, static_cast<long>(time(NULL))); } /* Functions that use serval cmd functions */ @@ -1031,7 +1031,7 @@ int anope_event_nick(const char *source, int ac, const char **av) 0), ntohl(decode_ip(av[9])), av[8], NULL); if (user) - anope_ProcessUsermodes(user, 1, &av[7]); + ircdproto->ProcessUsermodes(user, 1, &av[7]); } else { /* NON NICKIP */ @@ -1040,7 +1040,7 @@ int anope_event_nick(const char *source, int ac, const char **av) 0), 0, av[8], NULL); if (user) - anope_ProcessUsermodes(user, 1, &av[7]); + ircdproto->ProcessUsermodes(user, 1, &av[7]); } } else { do_nick(source, av[0], NULL, NULL, NULL, NULL, diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h index f34af0659..594780d3e 100644 --- a/src/protocol/unreal32.h +++ b/src/protocol/unreal32.h @@ -82,9 +82,9 @@ class UnrealIRCdProto : public IRCDProto { void SendSVSKillInternal(const char *, const char *, const char *); - void SendModeInternal(const char *, const char *, const char *); - void SendKickInternal(const char *, const char *, const char *, const char *); - void SendNoticeChanopsInternal(const char *, const char *, const char *); + void SendModeInternal(BotInfo *, const char *, const char *); + void SendKickInternal(BotInfo *, const char *, const char *, const char *); + void SendNoticeChanopsInternal(BotInfo *, const char *, const char *); public: void SendSVSNOOP(const char *, int); void SendAkillDel(const char *, const char *); @@ -95,11 +95,11 @@ class UnrealIRCdProto : public IRCDProto { void SendGuestNick(const char *, const char *, const char *, const char *, const char *); void SendClientIntroduction(const char *, const char *, const char *, const char *, const char *); void SendBotOp(const char *, const char *); - void SendJoin(const char *, const char *, time_t); + void SendJoin(BotInfo *, const char *, time_t); void SendSQLineDel(const char *); void SendSQLine(const char *, const char *); void SendSVSO(const char *, const char *, const char *); - void SendChangeBotNick(const char *, const char *); + void SendChangeBotNick(BotInfo *, const char *); void SendVhost(const char *, const char *, const char *); void SendConnect(); void SendSVSHold(const char *); diff --git a/src/users.c b/src/users.c index 64e361f98..5dbff3e5c 100644 --- a/src/users.c +++ b/src/users.c @@ -727,7 +727,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const if (!nc_changed && (user->na)) user->na->status |= status; else { - anope_SendUnregisteredNick(user); + ircdproto->SendUnregisteredNick(user); } } @@ -763,7 +763,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const snprintf(tsbuf, sizeof(tsbuf), "%lu", (unsigned long int) user->timestamp); - anope_SendSVID2(user, tsbuf); + ircdproto->SendSVID2(user, tsbuf); alog("%s: %s!%s@%s automatically identified for nick %s", s_NickServ, user->nick, user->username, @@ -777,7 +777,7 @@ User *do_nick(const char *source, const char *nick, const char *username, const char tsbuf[16]; snprintf(tsbuf, sizeof(tsbuf), "%lu", (unsigned long int) user->timestamp); - anope_SendSVID3(user, tsbuf); + ircdproto->SendSVID3(user, tsbuf); } } @@ -802,7 +802,7 @@ void do_umode(const char *source, int ac, const char **av) return; } - anope_ProcessUsermodes(user, ac - 1, &av[1]); + ircdproto->ProcessUsermodes(user, ac - 1, &av[1]); } /* Handle a UMODE2 command for a user. @@ -820,7 +820,7 @@ void do_umode2(const char *source, int ac, const char **av) return; } - anope_ProcessUsermodes(user, ac, &av[0]); + ircdproto->ProcessUsermodes(user, ac, &av[0]); } /*************************************************************************/ |