diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:11 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:11 +0000 |
commit | 00466f884cca8975972d0802999288da2c0b9fdf (patch) | |
tree | bc6a5351dc09820330d6b3429b654bf9377f06b7 /src | |
parent | 7a167d97af6ef7e97c05488ae37c8f482173adb9 (diff) |
Added cmd_mode() function to IRCDProtoNew class.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1218 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/ircd.c | 23 | ||||
-rw-r--r-- | src/protocol/bahamut.c | 19 | ||||
-rw-r--r-- | src/protocol/bahamut.h | 2 | ||||
-rw-r--r-- | src/protocol/charybdis.c | 21 | ||||
-rw-r--r-- | src/protocol/charybdis.h | 2 | ||||
-rw-r--r-- | src/protocol/inspircd11.c | 13 | ||||
-rwxr-xr-x | src/protocol/inspircd11.h | 2 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 21 | ||||
-rw-r--r-- | src/protocol/ratbox.h | 2 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 10 | ||||
-rw-r--r-- | src/protocol/unreal32.h | 2 |
11 files changed, 38 insertions, 79 deletions
diff --git a/src/ircd.c b/src/ircd.c index 25336fb5d..be80b742f 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -50,7 +50,6 @@ void initIrcdProto() ircdproto.ircd_cmd_372_error = NULL; ircdproto.ircd_cmd_375 = NULL; ircdproto.ircd_cmd_376 = NULL; - ircdproto.ircd_cmd_mode = NULL; ircdproto.ircd_cmd_bot_nick = NULL; ircdproto.ircd_cmd_kick = NULL; ircdproto.ircd_cmd_notice_ops = NULL; @@ -200,15 +199,14 @@ void anope_cmd_guest_nick(const char *nick, const char *user, const char *host, void anope_cmd_mode(const char *source, const char *dest, const char *fmt, ...) { - va_list args; - char buf[BUFSIZE]; - *buf = '\0'; - if (fmt) { - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - } - ircdproto.ircd_cmd_mode(source, dest, buf); + va_list args; + char buf[BUFSIZE] = ""; + if (fmt) { + va_start(args, fmt); + vsnprintf(buf, BUFSIZE - 1, fmt, args); + va_end(args); + } + ircdprotonew->cmd_mode(source, dest, buf); } void anope_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes) @@ -700,11 +698,6 @@ void pmodule_cmd_376(void (*func) (const char *source)) ircdproto.ircd_cmd_376 = func; } -void pmodule_cmd_mode(void (*func) (const char *source, const char *dest, const char *buf)) -{ - ircdproto.ircd_cmd_mode = func; -} - void pmodule_cmd_bot_nick(void (*func) (const char *nick, const char *user, const char *host, const char *real, const char *modes)) diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 7e41af3db..102dde806 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -471,21 +471,11 @@ CUMode myCumodes[128] = { -void bahamut_cmd_mode(const char *source, const char *dest, const char *buf) +void BahamutIRCdProto::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); - } + 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); } /* SVSHOLD - set */ @@ -1542,7 +1532,6 @@ void moduleAddAnopeCmds() pmodule_cmd_372_error(bahamut_cmd_372_error); pmodule_cmd_375(bahamut_cmd_375); pmodule_cmd_376(bahamut_cmd_376); - pmodule_cmd_mode(bahamut_cmd_mode); pmodule_cmd_bot_nick(bahamut_cmd_bot_nick); pmodule_cmd_kick(bahamut_cmd_kick); pmodule_cmd_notice_ops(bahamut_cmd_notice_ops); diff --git a/src/protocol/bahamut.h b/src/protocol/bahamut.h index d3758eca8..f72b78ad0 100644 --- a/src/protocol/bahamut.h +++ b/src/protocol/bahamut.h @@ -63,7 +63,6 @@ void bahamut_cmd_372(const char *source, const char *msg); void bahamut_cmd_372_error(const char *source); void bahamut_cmd_375(const char *source); void bahamut_cmd_376(const char *source); -void bahamut_cmd_mode(const char *source, const char *dest, const char *buf); void bahamut_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); void bahamut_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); void bahamut_cmd_notice_ops(const char *source, const char *dest, const char *buf); @@ -128,4 +127,5 @@ class BahamutIRCdProto : public IRCDProtoNew { void cmd_svsmode(User *u, int ac, const char **av); void cmd_nick(const char *, const char *, const char *); void cmd_guest_nick(const char *, const char *, const char *, const char *, const char *); + void cmd_mode(const char *source, const char *dest, const char *buf); } ircd_proto; diff --git a/src/protocol/charybdis.c b/src/protocol/charybdis.c index a6a885c09..ac701a3f6 100644 --- a/src/protocol/charybdis.c +++ b/src/protocol/charybdis.c @@ -1320,20 +1320,14 @@ void charybdis_cmd_211(const char *buf) send_cmd(NULL, "211 %s", buf); } -void charybdis_cmd_mode(const char *source, const char *dest, const char *buf) +void CharybdisProto::cmd_mode(const char *source, const char *dest, const char *buf) { - Uid *ud; - if (!buf) { - return; - } - - if (source) { - ud = find_uid(source); - send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "MODE %s %s", - dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } + if (!buf) return; + if (source) { + Uid *ud = find_uid(source); + send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "MODE %s %s", dest, buf); + } + else send_cmd(source, "MODE %s %s", dest, buf); } void charybdis_cmd_tmode(const char *source, const char *dest, const char *fmt, ...) @@ -1802,7 +1796,6 @@ void moduleAddAnopeCmds() pmodule_cmd_372_error(charybdis_cmd_372_error); pmodule_cmd_375(charybdis_cmd_375); pmodule_cmd_376(charybdis_cmd_376); - pmodule_cmd_mode(charybdis_cmd_mode); pmodule_cmd_bot_nick(charybdis_cmd_bot_nick); pmodule_cmd_kick(charybdis_cmd_kick); pmodule_cmd_notice_ops(charybdis_cmd_notice_ops); diff --git a/src/protocol/charybdis.h b/src/protocol/charybdis.h index b8d196f00..95b046afd 100644 --- a/src/protocol/charybdis.h +++ b/src/protocol/charybdis.h @@ -51,7 +51,6 @@ void charybdis_cmd_372(const char *source, const char *msg); void charybdis_cmd_372_error(const char *source); void charybdis_cmd_375(const char *source); void charybdis_cmd_376(const char *source); -void charybdis_cmd_mode(const char *source, const char *dest, const char *buf); void charybdis_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); void charybdis_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); void charybdis_cmd_notice_ops(const char *source, const char *dest, const char *buf); @@ -115,4 +114,5 @@ class CharybdisProto : public IRCDProtoNew { void cmd_svskill(const char *source, const char *user, const char *buf); void cmd_svsmode(User *u, int ac, const char **av); void cmd_nick(const char *, const char *, const char *); + void cmd_mode(const char *source, const char *dest, const char *buf); } ircd_proto; diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index ea49c1ee4..5190de86d 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -615,15 +615,11 @@ void InspIRCdProto::cmd_guest_nick(const char *nick, const char *user, const cha 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 inspircd_cmd_mode(const char *source, const char *dest, const char *buf) +void InspIRCdProto::cmd_mode(const char *source, const char *dest, const char *buf) { - Channel *c; - if (!buf) { - return; - } - - c = findchan(dest); - send_cmd(source ? source : s_OperServ, "FMODE %s %u %s", dest, (unsigned int)((c) ? c->creation_time : time(NULL)), 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); } int anope_event_version(const char *source, int ac, const char **av) @@ -1785,7 +1781,6 @@ void moduleAddAnopeCmds() pmodule_cmd_372_error(inspircd_cmd_372_error); pmodule_cmd_375(inspircd_cmd_375); pmodule_cmd_376(inspircd_cmd_376); - 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); diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h index 914bf10f0..a4ed659d7 100755 --- a/src/protocol/inspircd11.h +++ b/src/protocol/inspircd11.h @@ -56,7 +56,6 @@ 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_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); @@ -132,4 +131,5 @@ class InspIRCdProto : public IRCDProtoNew { void cmd_svsmode(User *u, int ac, const char **av); void cmd_nick(const char *, const char *, const char *); void cmd_guest_nick(const char *, const char *, const char *, const char *, const char *); + void cmd_mode(const char *source, const char *dest, const char *buf); } ircd_proto; diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 5d2983518..b4a9c4b9a 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -1253,20 +1253,14 @@ void ratbox_cmd_211(const char *buf) send_cmd(NULL, "211 %s", buf); } -void ratbox_cmd_mode(const char *source, const char *dest, const char *buf) +void RatboxProto::cmd_mode(const char *source, const char *dest, const char *buf) { - Uid *ud; - if (!buf) { - return; - } - - if (source) { - ud = find_uid(source); - send_cmd((UseTS6 ? (ud ? ud->uid : source) : source), "MODE %s %s", - dest, buf); - } else { - send_cmd(source, "MODE %s %s", dest, buf); - } + if (!buf) return; + if (source) { + Uid *ud = find_uid(source); + send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "MODE %s %s", dest, buf); + } + else send_cmd(source, "MODE %s %s", dest, buf); } void ratbox_cmd_tmode(const char *source, const char *dest, const char *fmt, ...) @@ -1694,7 +1688,6 @@ void moduleAddAnopeCmds() pmodule_cmd_372_error(ratbox_cmd_372_error); pmodule_cmd_375(ratbox_cmd_375); pmodule_cmd_376(ratbox_cmd_376); - pmodule_cmd_mode(ratbox_cmd_mode); pmodule_cmd_bot_nick(ratbox_cmd_bot_nick); pmodule_cmd_kick(ratbox_cmd_kick); pmodule_cmd_notice_ops(ratbox_cmd_notice_ops); diff --git a/src/protocol/ratbox.h b/src/protocol/ratbox.h index 82d7ed6d7..4882012e9 100644 --- a/src/protocol/ratbox.h +++ b/src/protocol/ratbox.h @@ -50,7 +50,6 @@ void ratbox_cmd_372(const char *source, const char *msg); void ratbox_cmd_372_error(const char *source); void ratbox_cmd_375(const char *source); void ratbox_cmd_376(const char *source); -void ratbox_cmd_mode(const char *source, const char *dest, const char *buf); void ratbox_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes); void ratbox_cmd_kick(const char *source, const char *chan, const char *user, const char *buf); void ratbox_cmd_notice_ops(const char *source, const char *dest, const char *buf); @@ -113,4 +112,5 @@ class RatboxProto : public IRCDProtoNew { void cmd_svskill(const char *source, const char *user, const char *buf); void cmd_svsmode(User *u, int ac, const char **av); void cmd_nick(const char *, const char *, const char *); + void cmd_mode(const char *source, const char *dest, const char *buf); } ircd_proto; diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index cf92b6530..f74e15b7e 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -602,13 +602,10 @@ void UnrealIRCdProto::cmd_guest_nick(const char *nick, const char *user, const c myIrcd->nickip ? " *" : " ", real); } -void unreal_cmd_mode(const char *source, const char *dest, const char *buf) +void UnrealIRCdProto::cmd_mode(const char *source, const char *dest, const char *buf) { - if (!buf) { - return; - } - - send_cmd(source, "%s %s %s", send_token("MODE", "G"), dest, buf); + if (!buf) return; + send_cmd(source, "%s %s %s", send_token("MODE", "G"), dest, buf); } void unreal_cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, @@ -2086,7 +2083,6 @@ void moduleAddAnopeCmds() pmodule_cmd_372_error(unreal_cmd_372_error); pmodule_cmd_375(unreal_cmd_375); pmodule_cmd_376(unreal_cmd_376); - 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); diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h index 857fdeee6..7112c845e 100644 --- a/src/protocol/unreal32.h +++ b/src/protocol/unreal32.h @@ -85,7 +85,6 @@ 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_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); @@ -151,4 +150,5 @@ class UnrealIRCdProto : public IRCDProtoNew { void cmd_svsmode(User *u, int ac, const char **av); void cmd_nick(const char *, const char *, const char *); void cmd_guest_nick(const char *, const char *, const char *, const char *, const char *); + void cmd_mode(const char *source, const char *dest, const char *buf); } ircd_proto; |