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 | 5587d9a543020f88ac05785921b719d87db98911 (patch) | |
tree | c3ec59a4aa6b76af00d2f4e46529e2bf05fcffe4 /src | |
parent | 914e0359e0225f84698990117b45f8218a788983 (diff) |
Added cmd_privmsg() function to IRCDProtoNew class.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1225 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/ircd.c | 73 | ||||
-rw-r--r-- | src/protocol/bahamut.c | 12 | ||||
-rw-r--r-- | src/protocol/bahamut.h | 1 | ||||
-rw-r--r-- | src/protocol/charybdis.c | 18 | ||||
-rw-r--r-- | src/protocol/charybdis.h | 2 | ||||
-rw-r--r-- | src/protocol/inspircd11.c | 12 | ||||
-rwxr-xr-x | src/protocol/inspircd11.h | 1 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 18 | ||||
-rw-r--r-- | src/protocol/ratbox.h | 2 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 12 | ||||
-rw-r--r-- | src/protocol/unreal32.h | 1 |
11 files changed, 34 insertions, 118 deletions
diff --git a/src/ircd.c b/src/ircd.c index 2b890ca97..91ec0d474 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -52,7 +52,6 @@ void initIrcdProto() ircdproto.ircd_cmd_376 = NULL; ircdproto.ircd_cmd_notice = NULL; ircdproto.ircd_cmd_notice2 = NULL; - ircdproto.ircd_cmd_privmsg = NULL; ircdproto.ircd_cmd_serv_notice = NULL; ircdproto.ircd_cmd_serv_privmsg = NULL; ircdproto.ircd_cmd_bot_chan_mode = NULL; @@ -255,57 +254,29 @@ void anope_cmd_notice2(const char *source, const char *dest, const char *msg) void anope_cmd_action(const char *source, const char *dest, const char *fmt, ...) { - -va_list args; - -char buf[BUFSIZE]; - -char actionbuf[BUFSIZE]; - - -*buf = '\0'; - -*actionbuf = '\0'; - - -if (fmt) { - -va_start(args, fmt); - -vsnprintf(buf, BUFSIZE - 1, fmt, args); - -va_end(args); - -} else { - -return; - -} - - -if (!buf) { - -return; - -} - -snprintf(actionbuf, BUFSIZE - 1, "%cACTION %s %c", 1, buf, 1); - -ircdproto.ircd_cmd_privmsg(source, dest, actionbuf); - + va_list args; + char buf[BUFSIZE] = "", actionbuf[BUFSIZE] = ""; + if (fmt) { + va_start(args, fmt); + vsnprintf(buf, BUFSIZE - 1, fmt, args); + va_end(args); + } + else return; + if (!*buf) return; + snprintf(actionbuf, BUFSIZE - 1, "%cACTION %s%c", 1, buf, 1); + ircdprotonew->cmd_privmsg(source, dest, actionbuf); } void anope_cmd_privmsg(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_privmsg(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_privmsg(source, dest, buf); } void anope_cmd_serv_notice(const char *source, const char *dest, const char *msg) @@ -705,12 +676,6 @@ pmodule_cmd_notice2(void (*func) (const char *source, const char *dest, const ch } void -pmodule_cmd_privmsg(void (*func) (const char *source, const char *dest, const char *buf)) -{ - ircdproto.ircd_cmd_privmsg = func; -} - -void pmodule_cmd_serv_notice(void (*func) (const char *source, const char *dest, const char *msg)) { ircdproto.ircd_cmd_serv_notice = func; diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 767450a43..3b11e732e 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -1035,7 +1035,7 @@ void bahamut_cmd_notice(const char *source, const char *dest, const char *buf) } if (NSDefFlags & NI_MSG) { - bahamut_cmd_privmsg(source, dest, buf); + ircd_proto.cmd_privmsg(source, dest, buf); } else { send_cmd(source, "NOTICE %s :%s", dest, buf); } @@ -1046,15 +1046,6 @@ void bahamut_cmd_notice2(const char *source, const char *dest, const char *msg) send_cmd(source, "NOTICE %s :%s", dest, msg); } -void bahamut_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "PRIVMSG %s :%s", dest, buf); -} - void bahamut_cmd_serv_notice(const char *source, const char *dest, const char *msg) { send_cmd(source, "NOTICE $%s :%s", dest, msg); @@ -1527,7 +1518,6 @@ void moduleAddAnopeCmds() pmodule_cmd_376(bahamut_cmd_376); pmodule_cmd_notice(bahamut_cmd_notice); pmodule_cmd_notice2(bahamut_cmd_notice2); - pmodule_cmd_privmsg(bahamut_cmd_privmsg); pmodule_cmd_serv_notice(bahamut_cmd_serv_notice); pmodule_cmd_serv_privmsg(bahamut_cmd_serv_privmsg); pmodule_cmd_bot_chan_mode(bahamut_cmd_bot_chan_mode); diff --git a/src/protocol/bahamut.h b/src/protocol/bahamut.h index b75d5bb0d..c81c9df65 100644 --- a/src/protocol/bahamut.h +++ b/src/protocol/bahamut.h @@ -65,7 +65,6 @@ void bahamut_cmd_375(const char *source); void bahamut_cmd_376(const char *source); void bahamut_cmd_notice(const char *source, const char *dest, const char *buf); void bahamut_cmd_notice2(const char *source, const char *dest, const char *msg); -void bahamut_cmd_privmsg(const char *source, const char *dest, const char *buf); void bahamut_cmd_serv_notice(const char *source, const char *dest, const char *msg); void bahamut_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); void bahamut_cmd_bot_chan_mode(const char *nick, const char *chan); diff --git a/src/protocol/charybdis.c b/src/protocol/charybdis.c index 5b52fd334..30d4bf2b4 100644 --- a/src/protocol/charybdis.c +++ b/src/protocol/charybdis.c @@ -461,7 +461,7 @@ void charybdis_cmd_notice(const char *source, const char *dest, const char *buf) } if (NSDefFlags & NI_MSG) { - charybdis_cmd_privmsg(source, dest, buf); + ircd_proto.cmd_privmsg(source, dest, buf); } else { ud = find_uid(source); u = finduser(dest); @@ -482,18 +482,11 @@ void charybdis_cmd_notice2(const char *source, const char *dest, const char *msg (UseTS6 ? (u ? u->uid : dest) : dest), msg); } -void charybdis_cmd_privmsg(const char *source, const char *dest, const char *buf) +void CharybdisProto::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((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s", - (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf); + if (!buf) return; + Uid *ud = find_uid(source), *ud2 = find_uid(dest); + send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "PRIVMSG %s :%s", UseTS6 ? (ud2 ? ud2->uid : dest) : dest, buf); } void charybdis_cmd_serv_notice(const char *source, const char *dest, const char *msg) @@ -1777,7 +1770,6 @@ void moduleAddAnopeCmds() pmodule_cmd_376(charybdis_cmd_376); pmodule_cmd_notice(charybdis_cmd_notice); pmodule_cmd_notice2(charybdis_cmd_notice2); - pmodule_cmd_privmsg(charybdis_cmd_privmsg); pmodule_cmd_serv_notice(charybdis_cmd_serv_notice); pmodule_cmd_serv_privmsg(charybdis_cmd_serv_privmsg); pmodule_cmd_bot_chan_mode(charybdis_cmd_bot_chan_mode); diff --git a/src/protocol/charybdis.h b/src/protocol/charybdis.h index e83da41f7..ba6020f0b 100644 --- a/src/protocol/charybdis.h +++ b/src/protocol/charybdis.h @@ -53,7 +53,6 @@ void charybdis_cmd_375(const char *source); void charybdis_cmd_376(const char *source); void charybdis_cmd_notice(const char *source, const char *dest, const char *buf); void charybdis_cmd_notice2(const char *source, const char *dest, const char *msg); -void charybdis_cmd_privmsg(const char *source, const char *dest, const char *buf); void charybdis_cmd_serv_notice(const char *source, const char *dest, const char *msg); void charybdis_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); void charybdis_cmd_bot_chan_mode(const char *nick, const char *chan); @@ -115,4 +114,5 @@ class CharybdisProto : public IRCDProtoNew { void cmd_bot_nick(const char *, const char *, const char *, const char *, const char *); void cmd_kick(const char *, const char *, const char *, const char *); void cmd_notice_ops(const char *, const char *, const char *); + void cmd_privmsg(const char *, const char *, const char *); } ircd_proto; diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index 5fe853f7f..8de15c5b6 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -787,7 +787,7 @@ void inspircd_cmd_notice(const char *source, const char *dest, const char *buf) } if (NSDefFlags & NI_MSG) { - inspircd_cmd_privmsg(source, dest, buf); + ircd_proto.cmd_privmsg(source, dest, buf); } else { send_cmd(source, "NOTICE %s :%s", dest, buf); } @@ -798,15 +798,6 @@ 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_serv_notice(const char *source, const char *dest, const char *msg) { send_cmd(source, "NOTICE $%s :%s", dest, msg); @@ -1774,7 +1765,6 @@ void moduleAddAnopeCmds() pmodule_cmd_376(inspircd_cmd_376); pmodule_cmd_notice(inspircd_cmd_notice); pmodule_cmd_notice2(inspircd_cmd_notice2); - pmodule_cmd_privmsg(inspircd_cmd_privmsg); 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); diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h index f8b290734..74df13f70 100755 --- a/src/protocol/inspircd11.h +++ b/src/protocol/inspircd11.h @@ -58,7 +58,6 @@ void inspircd_cmd_375(const char *source); void inspircd_cmd_376(const char *source); 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_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); diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index d38ef0eea..42cb65f84 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -450,7 +450,7 @@ void ratbox_cmd_notice(const char *source, const char *dest, const char *buf) } if (NSDefFlags & NI_MSG) { - ratbox_cmd_privmsg(source, dest, buf); + ircd_proto.cmd_privmsg(source, dest, buf); } else { ud = find_uid(source); u = finduser(dest); @@ -471,18 +471,11 @@ void ratbox_cmd_notice2(const char *source, const char *dest, const char *msg) (UseTS6 ? (u ? u->uid : dest) : dest), msg); } -void ratbox_cmd_privmsg(const char *source, const char *dest, const char *buf) +void RatboxProto::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((UseTS6 ? (ud ? ud->uid : source) : source), "PRIVMSG %s :%s", - (UseTS6 ? (ud2 ? ud2->uid : dest) : dest), buf); + if (!buf) return; + Uid *ud = find_uid(source), *ud2 = find_uid(dest); + send_cmd(UseTS6 ? (ud ? ud->uid : source) : source, "PRIVMSG %s :%s", UseTS6 ? (ud2 ? ud2->uid : dest) : dest, buf); } void ratbox_cmd_serv_notice(const char *source, const char *dest, const char *msg) @@ -1671,7 +1664,6 @@ void moduleAddAnopeCmds() pmodule_cmd_376(ratbox_cmd_376); pmodule_cmd_notice(ratbox_cmd_notice); pmodule_cmd_notice2(ratbox_cmd_notice2); - pmodule_cmd_privmsg(ratbox_cmd_privmsg); pmodule_cmd_serv_notice(ratbox_cmd_serv_notice); pmodule_cmd_serv_privmsg(ratbox_cmd_serv_privmsg); pmodule_cmd_bot_chan_mode(ratbox_cmd_bot_chan_mode); diff --git a/src/protocol/ratbox.h b/src/protocol/ratbox.h index 08a66cbfc..4dbe09096 100644 --- a/src/protocol/ratbox.h +++ b/src/protocol/ratbox.h @@ -52,7 +52,6 @@ void ratbox_cmd_375(const char *source); void ratbox_cmd_376(const char *source); void ratbox_cmd_notice(const char *source, const char *dest, const char *buf); void ratbox_cmd_notice2(const char *source, const char *dest, const char *msg); -void ratbox_cmd_privmsg(const char *source, const char *dest, const char *buf); void ratbox_cmd_serv_notice(const char *source, const char *dest, const char *msg); void ratbox_cmd_serv_privmsg(const char *source, const char *dest, const char *msg); void ratbox_cmd_bot_chan_mode(const char *nick, const char *chan); @@ -113,4 +112,5 @@ class RatboxProto : public IRCDProtoNew { void cmd_bot_nick(const char *, const char *, const char *, const char *, const char *); void cmd_kick(const char *, const char *, const char *, const char *); void cmd_notice_ops(const char *, const char *, const char *); + void cmd_privmsg(const char *, const char *, const char *); } ircd_proto; diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 2794ffeb9..6d41b2412 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -636,7 +636,7 @@ void unreal_cmd_notice(const char *source, const char *dest, const char *buf) } if (NSDefFlags & NI_MSG) { - unreal_cmd_privmsg(source, dest, buf); + ircd_proto.cmd_privmsg(source, dest, buf); } else { send_cmd(source, "%s %s :%s", send_token("NOTICE", "B"), dest, buf); @@ -648,15 +648,6 @@ void unreal_cmd_notice2(const char *source, const char *dest, const char *msg) send_cmd(source, "%s %s :%s", send_token("NOTICE", "B"), dest, msg); } -void unreal_cmd_privmsg(const char *source, const char *dest, const char *buf) -{ - if (!buf) { - return; - } - - send_cmd(source, "%s %s :%s", send_token("PRIVMSG", "!"), dest, buf); -} - void unreal_cmd_serv_notice(const char *source, const char *dest, const char *msg) { send_cmd(source, "%s $%s :%s", send_token("NOTICE", "B"), dest, msg); @@ -2075,7 +2066,6 @@ void moduleAddAnopeCmds() pmodule_cmd_376(unreal_cmd_376); pmodule_cmd_notice(unreal_cmd_notice); pmodule_cmd_notice2(unreal_cmd_notice2); - pmodule_cmd_privmsg(unreal_cmd_privmsg); 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); diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h index fe59ab540..ba1214522 100644 --- a/src/protocol/unreal32.h +++ b/src/protocol/unreal32.h @@ -87,7 +87,6 @@ void unreal_cmd_375(const char *source); void unreal_cmd_376(const char *source); 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_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); |