summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-01 21:20:54 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-01 21:20:54 +0000
commite46bc26a06cecb72ffe8587ec84997d89b75d852 (patch)
tree9d005b4f035494962cfbbdfd06a0fd23c9890f1e /src
parent8aa6436d7380d160d1fc2eb2235d71b57dacea17 (diff)
Merge commit 'cbx/anopeng-protocol' into anopeng
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1295 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/ircd.c389
-rw-r--r--src/messages.c108
-rw-r--r--src/protocol/bahamut.c179
-rw-r--r--src/protocol/bahamut.h20
-rw-r--r--src/protocol/charybdis.c182
-rw-r--r--src/protocol/charybdis.h21
-rw-r--r--src/protocol/inspircd11.c178
-rwxr-xr-xsrc/protocol/inspircd11.h20
-rw-r--r--src/protocol/ratbox.c183
-rw-r--r--src/protocol/ratbox.h21
-rw-r--r--src/protocol/unreal32.c179
-rw-r--r--src/protocol/unreal32.h20
12 files changed, 127 insertions, 1373 deletions
diff --git a/src/ircd.c b/src/ircd.c
index e02df19ca..a4ef94855 100644
--- a/src/ircd.c
+++ b/src/ircd.c
@@ -15,8 +15,7 @@
#include "services.h"
#include "extern.h"
-IRCDProto ircdproto;
-IRCDProtoNew *ircdprotonew;
+IRCDProto *ircdproto;
IRCDModes ircd_modes;
/**
@@ -34,63 +33,39 @@ CMMode cmmodes[128];
char csmodes[128];
int UseTSMODE;
-void pmodule_ircd_proto(IRCDProtoNew *proto)
+void pmodule_ircd_proto(IRCDProto *proto)
{
- ircdprotonew = proto;
-}
-
-/**
- * Initiate a protocol struct ready for use
- **/
-void initIrcdProto()
-{
- ircdproto.ircd_cmd_372 = NULL;
- ircdproto.ircd_cmd_372_error = NULL;
- ircdproto.ircd_cmd_375 = NULL;
- ircdproto.ircd_cmd_376 = NULL;
- ircdproto.ircd_cmd_351 = NULL;
- ircdproto.ircd_cmd_391 = NULL;
- ircdproto.ircd_cmd_250 = NULL;
- ircdproto.ircd_cmd_307 = NULL;
- ircdproto.ircd_cmd_311 = NULL;
- ircdproto.ircd_cmd_312 = NULL;
- ircdproto.ircd_cmd_317 = NULL;
- ircdproto.ircd_cmd_219 = NULL;
- ircdproto.ircd_cmd_401 = NULL;
- ircdproto.ircd_cmd_318 = NULL;
- ircdproto.ircd_cmd_242 = NULL;
- ircdproto.ircd_cmd_243 = NULL;
- ircdproto.ircd_cmd_211 = NULL;
+ ircdproto = proto;
}
void anope_set_umode(User *user, int ac, const char **av)
{
- ircdprotonew->set_umode(user, ac, av);
+ ircdproto->set_umode(user, ac, av);
}
void anope_cmd_svsnoop(const char *server, int set)
{
- ircdprotonew->cmd_svsnoop(server, set);
+ ircdproto->cmd_svsnoop(server, set);
}
void anope_cmd_remove_akill(const char *user, const char *host)
{
- ircdprotonew->cmd_remove_akill(user, host);
+ ircdproto->cmd_remove_akill(user, host);
}
void anope_cmd_topic(const char *whosets, const char *chan, const char *whosetit, const char *topic, time_t when)
{
- ircdprotonew->cmd_topic(whosets, chan, whosetit, topic, when);
+ ircdproto->cmd_topic(whosets, chan, whosetit, topic, when);
}
void anope_cmd_vhost_off(User *u)
{
- ircdprotonew->cmd_vhost_off(u);
+ ircdproto->cmd_vhost_off(u);
}
void anope_cmd_akill(const char *user, const char *host, const char *who, time_t when, time_t expires, const char *reason)
{
- ircdprotonew->cmd_akill(user, host, who, when, expires, reason);
+ ircdproto->cmd_akill(user, host, who, when, expires, reason);
}
void anope_cmd_svskill(const char *source, const char *user, const char *fmt, ...)
@@ -102,37 +77,17 @@ void anope_cmd_svskill(const char *source, const char *user, const char *fmt, ..
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_svskill(source, user, buf);
+ ircdproto->cmd_svskill(source, user, buf);
}
void anope_cmd_svsmode(User *u, int ac, const char **av)
{
- ircdprotonew->cmd_svsmode(u, ac, av);
-}
-
-void anope_cmd_372(const char *source, const char *msg)
-{
- ircdproto.ircd_cmd_372(source, msg);
-}
-
-void anope_cmd_372_error(const char *source)
-{
- ircdproto.ircd_cmd_372_error(source);
-}
-
-void anope_cmd_375(const char *source)
-{
- ircdproto.ircd_cmd_375(source);
-}
-
-void anope_cmd_376(const char *source)
-{
- ircdproto.ircd_cmd_376(source);
+ ircdproto->cmd_svsmode(u, ac, av);
}
void anope_cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes)
{
- ircdprotonew->cmd_guest_nick(nick, user, host, real, modes);
+ ircdproto->cmd_guest_nick(nick, user, host, real, modes);
}
void anope_cmd_mode(const char *source, const char *dest, const char *fmt, ...)
@@ -144,12 +99,12 @@ void anope_cmd_mode(const char *source, const char *dest, const char *fmt, ...)
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_mode(source, dest, buf);
+ ircdproto->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)
{
- ircdprotonew->cmd_bot_nick(nick, user, host, real, modes);
+ ircdproto->cmd_bot_nick(nick, user, host, real, modes);
}
void anope_cmd_kick(const char *source, const char *chan, const char *user, const char *fmt, ...)
@@ -161,7 +116,7 @@ void anope_cmd_kick(const char *source, const char *chan, const char *user, cons
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_kick(source, chan, user, buf);
+ ircdproto->cmd_kick(source, chan, user, buf);
}
void anope_cmd_notice_ops(const char *source, const char *dest, const char *fmt, ...)
@@ -173,7 +128,7 @@ void anope_cmd_notice_ops(const char *source, const char *dest, const char *fmt,
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_notice_ops(source, dest, buf);
+ ircdproto->cmd_notice_ops(source, dest, buf);
}
void anope_cmd_message(const char *source, const char *dest, const char *fmt, ...)
@@ -185,12 +140,12 @@ void anope_cmd_message(const char *source, const char *dest, const char *fmt, ..
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_message(source, dest, buf);
+ ircdproto->cmd_message(source, dest, buf);
}
void anope_cmd_notice(const char *source, const char *dest, const char *msg)
{
- ircdprotonew->cmd_notice(source, dest, msg);
+ ircdproto->cmd_notice(source, dest, msg);
}
void anope_cmd_action(const char *source, const char *dest, const char *fmt, ...)
@@ -205,7 +160,7 @@ void anope_cmd_action(const char *source, const char *dest, const char *fmt, ...
else return;
if (!*buf) return;
snprintf(actionbuf, BUFSIZE - 1, "%cACTION %s%c", 1, buf, 1);
- ircdprotonew->cmd_privmsg(source, dest, actionbuf);
+ ircdproto->cmd_privmsg(source, dest, actionbuf);
}
void anope_cmd_privmsg(const char *source, const char *dest, const char *fmt, ...)
@@ -217,27 +172,22 @@ void anope_cmd_privmsg(const char *source, const char *dest, const char *fmt, ..
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_privmsg(source, dest, buf);
+ ircdproto->cmd_privmsg(source, dest, buf);
}
void anope_cmd_serv_notice(const char *source, const char *dest, const char *msg)
{
- ircdprotonew->cmd_serv_notice(source, dest, msg);
+ ircdproto->cmd_serv_notice(source, dest, msg);
}
void anope_cmd_serv_privmsg(const char *source, const char *dest, const char *msg)
{
- ircdprotonew->cmd_serv_privmsg(source, dest, msg);
+ ircdproto->cmd_serv_privmsg(source, dest, msg);
}
void anope_cmd_bot_chan_mode(const char *nick, const char *chan)
{
- ircdprotonew->cmd_bot_chan_mode(nick, chan);
-}
-
-void anope_cmd_351(const char *source)
-{
- ircdproto.ircd_cmd_351(source);
+ ircdproto->cmd_bot_chan_mode(nick, chan);
}
void anope_cmd_quit(const char *source, const char *fmt, ...)
@@ -249,27 +199,27 @@ void anope_cmd_quit(const char *source, const char *fmt, ...)
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_quit(source, buf);
+ ircdproto->cmd_quit(source, buf);
}
void anope_cmd_pong(const char *servname, const char *who)
{
- ircdprotonew->cmd_pong(servname, who);
+ ircdproto->cmd_pong(servname, who);
}
void anope_cmd_join(const char *user, const char *channel, time_t chantime)
{
- ircdprotonew->cmd_join(user, channel, chantime);
+ ircdproto->cmd_join(user, channel, chantime);
}
void anope_cmd_unsqline(const char *user)
{
- ircdprotonew->cmd_unsqline(user);
+ ircdproto->cmd_unsqline(user);
}
void anope_cmd_invite(const char *source, const char *chan, const char *nick)
{
- ircdprotonew->cmd_invite(source, chan, nick);
+ ircdproto->cmd_invite(source, chan, nick);
}
void anope_cmd_part(const char *nick, const char *chan, const char *fmt, ...)
@@ -280,133 +230,9 @@ void anope_cmd_part(const char *nick, const char *chan, const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
- ircdprotonew->cmd_part(nick, chan, buf);
+ ircdproto->cmd_part(nick, chan, buf);
}
- else ircdprotonew->cmd_part(nick, chan, NULL);
-}
-
-void anope_cmd_391(const char *source, const char *timestr)
-{
- ircdproto.ircd_cmd_391(source, timestr);
-}
-
-void anope_cmd_250(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_250(buf);
-}
-
-void anope_cmd_307(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_307(buf);
-}
-
-void anope_cmd_311(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_311(buf);
-}
-
-void anope_cmd_312(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_312(buf);
-}
-
-void anope_cmd_317(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_317(buf);
-}
-
-void anope_cmd_219(const char *source, const char *letter)
-{
- ircdproto.ircd_cmd_219(source, letter);
-}
-
-void anope_cmd_401(const char *source, const char *who)
-{
- ircdproto.ircd_cmd_401(source, who);
-}
-
-void anope_cmd_318(const char *source, const char *who)
-{
- ircdproto.ircd_cmd_318(source, who);
-}
-
-void anope_cmd_242(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_242(buf);
-}
-
-void anope_cmd_243(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_243(buf);
-}
-
-void anope_cmd_211(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_211(buf);
+ else ircdproto->cmd_part(nick, chan, NULL);
}
void anope_cmd_global(const char *source, const char *fmt, ...)
@@ -418,142 +244,142 @@ void anope_cmd_global(const char *source, const char *fmt, ...)
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_global(source, buf);
+ ircdproto->cmd_global(source, buf);
}
void anope_cmd_sqline(const char *mask, const char *reason)
{
- ircdprotonew->cmd_sqline(mask, reason);
+ ircdproto->cmd_sqline(mask, reason);
}
void anope_cmd_squit(const char *servname, const char *message)
{
- ircdprotonew->cmd_squit(servname, message);
+ ircdproto->cmd_squit(servname, message);
}
void anope_cmd_svso(const char *source, const char *nick, const char *flag)
{
- ircdprotonew->cmd_svso(source, nick, flag);
+ ircdproto->cmd_svso(source, nick, flag);
}
void anope_cmd_chg_nick(const char *oldnick, const char *newnick)
{
- ircdprotonew->cmd_chg_nick(oldnick, newnick);
+ ircdproto->cmd_chg_nick(oldnick, newnick);
}
void anope_cmd_svsnick(const char *source, const char *guest, time_t when)
{
- ircdprotonew->cmd_svsnick(source, guest, when);
+ ircdproto->cmd_svsnick(source, guest, when);
}
void anope_cmd_vhost_on(const char *nick, const char *vIdent, const char *vhost)
{
- ircdprotonew->cmd_vhost_on(nick, vIdent, vhost);
+ ircdproto->cmd_vhost_on(nick, vIdent, vhost);
}
void anope_cmd_connect()
{
- ircdprotonew->cmd_connect();
+ ircdproto->cmd_connect();
}
void anope_cmd_svshold(const char *nick)
{
- ircdprotonew->cmd_svshold(nick);
+ ircdproto->cmd_svshold(nick);
}
void anope_cmd_release_svshold(const char *nick)
{
- ircdprotonew->cmd_release_svshold(nick);
+ ircdproto->cmd_release_svshold(nick);
}
void anope_cmd_unsgline(const char *mask)
{
- ircdprotonew->cmd_unsgline(mask);
+ ircdproto->cmd_unsgline(mask);
}
void anope_cmd_unszline(const char *mask)
{
- ircdprotonew->cmd_unszline(mask);
+ ircdproto->cmd_unszline(mask);
}
void anope_cmd_szline(const char *mask, const char *reason, const char *whom)
{
- ircdprotonew->cmd_szline(mask, reason, whom);
+ ircdproto->cmd_szline(mask, reason, whom);
}
void anope_cmd_sgline(const char *mask, const char *reason)
{
- ircdprotonew->cmd_sgline(mask, reason);
+ ircdproto->cmd_sgline(mask, reason);
}
void anope_cmd_unban(const char *name, const char *nick)
{
- ircdprotonew->cmd_unban(name, nick);
+ ircdproto->cmd_unban(name, nick);
}
void anope_cmd_svsmode_chan(const char *name, const char *mode, const char *nick)
{
- ircdprotonew->cmd_svsmode_chan(name, mode, nick);
+ ircdproto->cmd_svsmode_chan(name, mode, nick);
}
void anope_cmd_svid_umode(const char *nick, time_t ts)
{
- ircdprotonew->cmd_svid_umode(nick, ts);
+ ircdproto->cmd_svid_umode(nick, ts);
}
void anope_cmd_nc_change(User *u)
{
- ircdprotonew->cmd_nc_change(u);
+ ircdproto->cmd_nc_change(u);
}
void anope_cmd_svid_umode2(User *u, const char *ts)
{
- ircdprotonew->cmd_svid_umode2(u, ts);
+ ircdproto->cmd_svid_umode2(u, ts);
}
void anope_cmd_svid_umode3(User *u, const char *ts)
{
- ircdprotonew->cmd_svid_umode3(u, ts);
+ ircdproto->cmd_svid_umode3(u, ts);
}
void anope_cmd_svsjoin(const char *source, const char *nick, const char *chan, const char *param)
{
- ircdprotonew->cmd_svsjoin(source, nick, chan, param);
+ ircdproto->cmd_svsjoin(source, nick, chan, param);
}
void anope_cmd_svspart(const char *source, const char *nick, const char *chan)
{
- ircdprotonew->cmd_svspart(source, nick, chan);
+ ircdproto->cmd_svspart(source, nick, chan);
}
void anope_cmd_swhois(const char *source, const char *who, const char *mask)
{
- ircdprotonew->cmd_swhois(source, who, mask);
+ ircdproto->cmd_swhois(source, who, mask);
}
void anope_cmd_eob()
{
- ircdprotonew->cmd_eob();
+ ircdproto->cmd_eob();
}
int anope_flood_mode_check(const char *value)
{
- return ircdprotonew->flood_mode_check(value);
+ return ircdproto->flood_mode_check(value);
}
void anope_cmd_jupe(const char *jserver, const char *who, const char *reason)
{
- ircdprotonew->cmd_jupe(jserver, who, reason);
+ ircdproto->cmd_jupe(jserver, who, reason);
}
int anope_valid_nick(const char *nick)
{
- return ircdprotonew->valid_nick(nick);
+ return ircdproto->valid_nick(nick);
}
int anope_valid_chan(const char *chan)
{
- return ircdprotonew->valid_chan(chan);
+ return ircdproto->valid_chan(chan);
}
@@ -566,99 +392,24 @@ void anope_cmd_ctcp(const char *source, const char *dest, const char *fmt, ...)
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
}
- ircdprotonew->cmd_ctcp(source, dest, buf);
+ ircdproto->cmd_ctcp(source, dest, buf);
}
-
+void anope_cmd_numeric(const char *source, int numeric, 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);
+ }
+ ircdproto->cmd_numeric(source, numeric, dest, *buf ? buf : NULL);
+}
/**
* Set routines for modules to set the prefered function for dealing with things.
**/
-void pmodule_cmd_372(void (*func) (const char *source, const char *msg))
-{
- ircdproto.ircd_cmd_372 = func;
-}
-
-void pmodule_cmd_372_error(void (*func) (const char *source))
-{
- ircdproto.ircd_cmd_372_error = func;
-}
-
-void pmodule_cmd_375(void (*func) (const char *source))
-{
- ircdproto.ircd_cmd_375 = func;
-}
-
-void pmodule_cmd_376(void (*func) (const char *source))
-{
- ircdproto.ircd_cmd_376 = func;
-}
-
-void pmodule_cmd_351(void (*func) (const char *source))
-{
- ircdproto.ircd_cmd_351 = func;
-}
-
-void pmodule_cmd_391(void (*func) (const char *source, const char *timestr))
-{
- ircdproto.ircd_cmd_391 = func;
-}
-
-void pmodule_cmd_250(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_250 = func;
-}
-
-void pmodule_cmd_307(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_307 = func;
-}
-
-void pmodule_cmd_311(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_311 = func;
-}
-
-void pmodule_cmd_312(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_312 = func;
-}
-
-void pmodule_cmd_317(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_317 = func;
-}
-
-void pmodule_cmd_219(void (*func) (const char *source, const char *letter))
-{
- ircdproto.ircd_cmd_219 = func;
-}
-
-void pmodule_cmd_401(void (*func) (const char *source, const char *who))
-{
- ircdproto.ircd_cmd_401 = func;
-}
-
-void pmodule_cmd_318(void (*func) (const char *source, const char *who))
-{
- ircdproto.ircd_cmd_318 = func;
-}
-
-void pmodule_cmd_242(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_242 = func;
-}
-
-void pmodule_cmd_243(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_243 = func;
-}
-
-void pmodule_cmd_211(void (*func) (const char *buf))
-{
- ircdproto.ircd_cmd_211 = func;
-}
-
void pmodule_ircd_var(IRCDVar * ircdvar)
{
ircd = ircdvar;
diff --git a/src/messages.c b/src/messages.c
index 6b119bd8f..926c24dcc 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_cmd_391(source, buf);
+ anope_cmd_numeric(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_cmd_375(source);
+ anope_cmd_numeric(ServerName, 375, source, ":- %s Message of the Day", ServerName);
while (fgets(buf, sizeof(buf), f)) {
buf[strlen(buf) - 1] = 0;
- anope_cmd_372(source, buf);
+ anope_cmd_numeric(ServerName, 372, source, ":- %s", buf);
}
fclose(f);
- anope_cmd_376(source);
+ anope_cmd_numeric(ServerName, 376, source, ":End of /MOTD command.");
} else {
- anope_cmd_372_error(source);
+ anope_cmd_numeric(ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator.");
}
return MOD_CONT;
}
@@ -237,71 +237,54 @@ int m_stats(const char *source, int ac, const char **av)
if (u && is_oper(u)) {
if (servernum == 1) {
- anope_cmd_211
- ("%s Server SendBuf SentBytes SentMsgs RecvBuf "
- "RecvBytes RecvMsgs ConnTime", source);
- anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source,
- RemoteServer, write_buffer_len(),
- total_written, -1, read_buffer_len(),
- total_read, -1, time(NULL) - start_time);
+ anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
+ anope_cmd_numeric(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_cmd_211
- ("%s Server SendBuf SentBytes SentMsgs RecvBuf "
- "RecvBytes RecvMsgs ConnTime", source);
- anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source,
- RemoteServer2, write_buffer_len(),
- total_written, -1, read_buffer_len(),
- total_read, -1, time(NULL) - start_time);
+ anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
+ anope_cmd_numeric(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_cmd_211
- ("%s Server SendBuf SentBytes SentMsgs RecvBuf "
- "RecvBytes RecvMsgs ConnTime", source);
- anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source,
- RemoteServer3, write_buffer_len(),
- total_written, -1, read_buffer_len(),
- total_read, -1, time(NULL) - start_time);
+ anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime");
+ anope_cmd_numeric(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_cmd_219(source, av[0]);
+ anope_cmd_numeric(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_cmd_219(source, av[0]);
+ anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
} else {
for (i = 0; i < RootNumber; i++)
- anope_cmd_243("%s O * * %s Root 0", source,
- ServicesRoots[i]);
+ anope_cmd_numeric(ServerName, 243, source, "O * * %s Root 0", ServicesRoots[i]);
for (i = 0; i < servadmins.count && (nc = (NickCore *)servadmins.list[i]);
i++)
- anope_cmd_243("%s O * * %s Admin 0", source, nc->display);
+ anope_cmd_numeric(ServerName, 243, source, "O * * %s Admin 0", nc->display);
for (i = 0; i < servopers.count && (nc = (NickCore *)servopers.list[i]);
i++)
- anope_cmd_243("%s O * * %s Oper 0", source, nc->display);
+ anope_cmd_numeric(ServerName, 243, source, "O * * %s Oper 0", nc->display);
- anope_cmd_219(source, av[0]);
+ anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
}
break;
case 'u':{
int uptime = time(NULL) - start_time;
- anope_cmd_242("%s :Services up %d day%s, %02d:%02d:%02d",
- source, uptime / 86400,
- (uptime / 86400 == 1) ? "" : "s",
- (uptime / 3600) % 24, (uptime / 60) % 60,
- uptime % 60);
- anope_cmd_250("%s :Current users: %d (%d ops); maximum %d",
- source, usercnt, opcnt, maxusercnt);
- anope_cmd_219(source, av[0]);
+ anope_cmd_numeric(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_cmd_numeric(ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt);
+ anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
break;
} /* case 'u' */
default:
- anope_cmd_219(source, av[0]);
+ anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*');
break;
}
return MOD_CONT;
@@ -311,10 +294,9 @@ 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_cmd_351(source);
- }
- return MOD_CONT;
+ if (source) anope_cmd_numeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags,
+ EncModule, version_build);
+ return MOD_CONT;
}
@@ -347,15 +329,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_cmd_311("%s %s %s %s * :%s", source, bi->nick,
- bi->user, bi->host, bi->real);
- anope_cmd_307("%s %s :is a registered nick", source, bi->nick);
- anope_cmd_312("%s %s %s :%s", source, bi->nick, ServerName,
- ServerDesc);
- anope_cmd_317("%s %s %ld %ld :seconds idle, signon time",
- source, bi->nick, time(NULL) - bi->lastmsg,
- start_time);
- anope_cmd_318(source, bi->nick);
+ anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real);
+ anope_cmd_numeric(ServerName, 307, source, "%s :is a registered nick", bi->nick);
+ anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", bi->nick, ServerName, ServerDesc);
+ anope_cmd_numeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time);
+ anope_cmd_numeric(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)) {
@@ -363,22 +341,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_cmd_311("%s %s %s %s * :Services Enforcer", source,
- na->nick, NSEnforcerUser, NSEnforcerHost);
- anope_cmd_312("%s %s %s :%s", source, na->nick, ServerName,
- ServerDesc);
- anope_cmd_318(source, na->nick);
+ anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, NSEnforcerUser, NSEnforcerHost);
+ anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", na->nick, ServerName, ServerDesc);
+ anope_cmd_numeric(ServerName, 318, source, "%s :End of /WHOIS list.", who);
return MOD_CONT;
} else {
- anope_cmd_401(source, who);
+ anope_cmd_numeric(ServerName, 401, source, "%s :No such service.", who);
return MOD_CONT;
}
- anope_cmd_311("%s %s %s %s * :%s", source, who,
- ServiceUser, ServiceHost, clientdesc);
- anope_cmd_312("%s %s %s :%s", source, who, ServerName, ServerDesc);
- anope_cmd_317("%s %s %ld %ld :seconds idle, signon time", source,
- who, time(NULL) - start_time, start_time);
- anope_cmd_318(source, who);
+ anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :%s", who, ServiceUser, ServiceHost, clientdesc);
+ anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", who, ServerName, ServerDesc);
+ anope_cmd_numeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time);
+ anope_cmd_numeric(ServerName, 318, source, "%s :End of /WHOIS list.", who);
}
return MOD_CONT;
}
diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c
index a7b7a7fd0..fb18101ad 100644
--- a/src/protocol/bahamut.c
+++ b/src/protocol/bahamut.c
@@ -963,157 +963,12 @@ void BahamutIRCdProto::cmd_notice_ops(const char *source, const char *dest, cons
send_cmd(NULL, "NOTICE @%s :%s", dest, buf);
}
-/* 391 */
-void bahamut_cmd_391(const char *source, const char *timestr)
-{
- if (!timestr) {
- return;
- }
- send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
-}
-
-/* 250 */
-void bahamut_cmd_250(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "250 %s", buf);
-}
-
-/* 307 */
-void bahamut_cmd_307(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "307 %s", buf);
-}
-
-/* 311 */
-void bahamut_cmd_311(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "311 %s", buf);
-}
-
-/* 312 */
-void bahamut_cmd_312(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "312 %s", buf);
-}
-
-/* 317 */
-void bahamut_cmd_317(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "317 %s", buf);
-}
-
-/* 219 */
-void bahamut_cmd_219(const char *source, const char *letter)
-{
- if (!source) {
- return;
- }
-
- if (letter) {
- send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
- *letter);
- } else {
- send_cmd(NULL, "219 %s l :End of /STATS report.", source);
- }
-}
-
-/* 401 */
-void bahamut_cmd_401(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
- send_cmd(ServerName, "401 %s %s :No such service.", source, who);
-}
-
-/* 318 */
-void bahamut_cmd_318(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
-
- send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
-}
-
-/* 242 */
-void bahamut_cmd_242(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "242 %s", buf);
-}
-
-/* 243 */
-void bahamut_cmd_243(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "243 %s", buf);
-}
-
-/* 211 */
-void bahamut_cmd_211(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "211 %s", buf);
-}
-
void BahamutIRCdProto::cmd_kick(const char *source, const char *chan, const char *user, const char *buf)
{
if (buf) send_cmd(source, "KICK %s %s :%s", chan, user, buf);
else send_cmd(source, "KICK %s %s", chan, user);
}
-void bahamut_cmd_372(const char *source, const char *msg)
-{
- send_cmd(ServerName, "372 %s :- %s", source, msg);
-}
-
-void bahamut_cmd_372_error(const char *source)
-{
- send_cmd(ServerName, "422 %s :- MOTD file not found! Please "
- "contact your IRC administrator.", source);
-}
-
-void bahamut_cmd_375(const char *source)
-{
- send_cmd(ServerName, "375 %s :- %s Message of the Day",
- source, ServerName);
-}
-
-void bahamut_cmd_376(const char *source)
-{
- send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
-}
-
int anope_event_away(const char *source, int ac, const char **av)
{
if (!source) {
@@ -1131,14 +986,6 @@ int anope_event_ping(const char *source, int ac, const char **av)
return MOD_CONT;
}
-void bahamut_cmd_351(const char *source)
-{
- send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
- source, version_number, ServerName, ircd->name, version_flags,
- EncModule, version_build);
-
-}
-
void BahamutIRCdProto::cmd_bot_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes)
{
EnforceQlinedNick(nick, s_BotServ);
@@ -1263,31 +1110,6 @@ void bahamut_cmd_chghost(const char *nick, const char *vhost)
}
/**
- * Tell anope which function we want to perform each task inside of anope.
- * These prototypes must match what anope expects.
- **/
-void moduleAddAnopeCmds()
-{
- pmodule_cmd_372(bahamut_cmd_372);
- pmodule_cmd_372_error(bahamut_cmd_372_error);
- pmodule_cmd_375(bahamut_cmd_375);
- pmodule_cmd_376(bahamut_cmd_376);
- pmodule_cmd_351(bahamut_cmd_351);
- pmodule_cmd_391(bahamut_cmd_391);
- pmodule_cmd_250(bahamut_cmd_250);
- pmodule_cmd_307(bahamut_cmd_307);
- pmodule_cmd_311(bahamut_cmd_311);
- pmodule_cmd_312(bahamut_cmd_312);
- pmodule_cmd_317(bahamut_cmd_317);
- pmodule_cmd_219(bahamut_cmd_219);
- pmodule_cmd_401(bahamut_cmd_401);
- pmodule_cmd_318(bahamut_cmd_318);
- pmodule_cmd_242(bahamut_cmd_242);
- pmodule_cmd_243(bahamut_cmd_243);
- pmodule_cmd_211(bahamut_cmd_211);
-}
-
-/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@@ -1319,7 +1141,6 @@ int AnopeInit(int argc, char **argv)
pmodule_key_mode(CMODE_k);
pmodule_limit_mode(CMODE_l);
- moduleAddAnopeCmds();
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
diff --git a/src/protocol/bahamut.h b/src/protocol/bahamut.h
index a6e73c07a..1935c19eb 100644
--- a/src/protocol/bahamut.h
+++ b/src/protocol/bahamut.h
@@ -58,25 +58,7 @@
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
-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_351(const char *source);
-void bahamut_cmd_391(const char *source, const char *timestr);
-void bahamut_cmd_250(const char *buf);
-void bahamut_cmd_307(const char *buf);
-void bahamut_cmd_311(const char *buf);
-void bahamut_cmd_312(const char *buf);
-void bahamut_cmd_317(const char *buf);
-void bahamut_cmd_219(const char *source, const char *letter);
-void bahamut_cmd_401(const char *source, const char *who);
-void bahamut_cmd_318(const char *source, const char *who);
-void bahamut_cmd_242(const char *buf);
-void bahamut_cmd_243(const char *buf);
-void bahamut_cmd_211(const char *buf);
-
-class BahamutIRCdProto : public IRCDProtoNew {
+class BahamutIRCdProto : public IRCDProto {
public:
void cmd_svsnoop(const char *, int);
void cmd_remove_akill(const char *, const char *);
diff --git a/src/protocol/charybdis.c b/src/protocol/charybdis.c
index e2983561f..3a714a2f7 100644
--- a/src/protocol/charybdis.c
+++ b/src/protocol/charybdis.c
@@ -1063,153 +1063,10 @@ int anope_event_quit(const char *source, int ac, const char **av)
return MOD_CONT;
}
-void charybdis_cmd_372(const char *source, const char *msg)
+void CharybdisProto::cmd_numeric(const char *source, int numeric, const char *dest, const char *buf)
{
- send_cmd((UseTS6 ? TS6SID : ServerName), "372 %s :- %s", source, msg);
-}
-
-void charybdis_cmd_372_error(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "422 %s :- MOTD file not found! Please "
- "contact your IRC administrator.", source);
-}
-
-void charybdis_cmd_375(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "375 %s :- %s Message of the Day", source, ServerName);
-}
-
-void charybdis_cmd_376(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "376 %s :End of /MOTD command.", source);
-}
-
-/* 391 */
-void charybdis_cmd_391(const char *source, const char *timestr)
-{
- if (!timestr) {
- return;
- }
- send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
-}
-
-/* 250 */
-void charybdis_cmd_250(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "250 %s", buf);
-}
-
-/* 307 */
-void charybdis_cmd_307(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "307 %s", buf);
-}
-
-/* 311 */
-void charybdis_cmd_311(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "311 %s", buf);
-}
-
-/* 312 */
-void charybdis_cmd_312(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "312 %s", buf);
-}
-
-/* 317 */
-void charybdis_cmd_317(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "317 %s", buf);
-}
-
-/* 219 */
-void charybdis_cmd_219(const char *source, const char *letter)
-{
- if (!source) {
- return;
- }
-
- if (letter) {
- send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
- *letter);
- } else {
- send_cmd(NULL, "219 %s l :End of /STATS report.", source);
- }
-}
-
-/* 401 */
-void charybdis_cmd_401(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
- send_cmd((UseTS6 ? TS6SID : ServerName), "401 %s %s :No such service.",
- source, who);
-}
-
-/* 318 */
-void charybdis_cmd_318(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "318 %s %s :End of /WHOIS list.", source, who);
-}
-
-/* 242 */
-void charybdis_cmd_242(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "242 %s", buf);
-}
-
-/* 243 */
-void charybdis_cmd_243(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "243 %s", buf);
-}
-
-/* 211 */
-void charybdis_cmd_211(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "211 %s", buf);
+ // This might need to be set in the call to cmd_numeric instead of here, will review later -- CyberBotX
+ send_cmd(UseTS6 ? TS6SID : source, "%03d %s %s", numeric, dest, buf);
}
void CharybdisProto::cmd_mode(const char *source, const char *dest, const char *buf)
@@ -1320,13 +1177,6 @@ int anope_event_tmode(const char *source, int ac, const char **av)
return MOD_CONT;
}
-void charybdis_cmd_351(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "351 %s Anope-%s %s :%s - %s (%s) -- %s", source, version_number,
- ServerName, ircd->name, version_flags, EncModule, version_build);
-}
-
/* Event: PROTOCTL */
int anope_event_capab(const char *source, int ac, const char **av)
{
@@ -1499,31 +1349,6 @@ int charybdis_send_deaccount(int argc, char **argv)
}
/**
- * Tell anope which function we want to perform each task inside of anope.
- * These prototypes must match what anope expects.
- **/
-void moduleAddAnopeCmds()
-{
- pmodule_cmd_372(charybdis_cmd_372);
- pmodule_cmd_372_error(charybdis_cmd_372_error);
- pmodule_cmd_375(charybdis_cmd_375);
- pmodule_cmd_376(charybdis_cmd_376);
- pmodule_cmd_351(charybdis_cmd_351);
- pmodule_cmd_391(charybdis_cmd_391);
- pmodule_cmd_250(charybdis_cmd_250);
- pmodule_cmd_307(charybdis_cmd_307);
- pmodule_cmd_311(charybdis_cmd_311);
- pmodule_cmd_312(charybdis_cmd_312);
- pmodule_cmd_317(charybdis_cmd_317);
- pmodule_cmd_219(charybdis_cmd_219);
- pmodule_cmd_401(charybdis_cmd_401);
- pmodule_cmd_318(charybdis_cmd_318);
- pmodule_cmd_242(charybdis_cmd_242);
- pmodule_cmd_243(charybdis_cmd_243);
- pmodule_cmd_211(charybdis_cmd_211);
-}
-
-/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@@ -1555,7 +1380,6 @@ int AnopeInit(int argc, char **argv)
pmodule_key_mode(CMODE_k);
pmodule_limit_mode(CMODE_l);
- moduleAddAnopeCmds();
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
diff --git a/src/protocol/charybdis.h b/src/protocol/charybdis.h
index 2613abf40..f5754accb 100644
--- a/src/protocol/charybdis.h
+++ b/src/protocol/charybdis.h
@@ -46,25 +46,7 @@
#define DEFAULT_MLOCK CMODE_n | CMODE_t
-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_351(const char *source);
-void charybdis_cmd_391(const char *source, const char *timestr);
-void charybdis_cmd_250(const char *buf);
-void charybdis_cmd_307(const char *buf);
-void charybdis_cmd_311(const char *buf);
-void charybdis_cmd_312(const char *buf);
-void charybdis_cmd_317(const char *buf);
-void charybdis_cmd_219(const char *source, const char *letter);
-void charybdis_cmd_401(const char *source, const char *who);
-void charybdis_cmd_318(const char *source, const char *who);
-void charybdis_cmd_242(const char *buf);
-void charybdis_cmd_243(const char *buf);
-void charybdis_cmd_211(const char *buf);
-
-class CharybdisProto : public IRCDProtoNew {
+class CharybdisProto : public IRCDProto {
public:
void cmd_remove_akill(const char *, const char *);
void cmd_topic(const char *, const char *, const char *, const char *, time_t);
@@ -99,4 +81,5 @@ class CharybdisProto : public IRCDProtoNew {
void set_umode(User *, int, const char **);
int valid_nick(const char *);
int flood_mode_check(const char *);
+ void cmd_numeric(const char *, int, const char *, const char *);
} ircd_proto;
diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c
index e196539aa..e4937a674 100644
--- a/src/protocol/inspircd11.c
+++ b/src/protocol/inspircd11.c
@@ -560,27 +560,9 @@ void InspIRCdProto::cmd_svsmode(User *u, int ac, const char **av)
send_cmd(s_NickServ, "MODE %s %s", u->nick, merge_args(ac, av));
}
-
-void inspircd_cmd_372(const char *source, const char *msg)
-{
- send_cmd(ServerName, "372 %s :- %s", source, msg);
-}
-
-void inspircd_cmd_372_error(const char *source)
-{
- send_cmd(ServerName, "422 %s :- MOTD file not found! Please "
- "contact your IRC administrator.", source);
-}
-
-void inspircd_cmd_375(const char *source)
-{
- send_cmd(ServerName, "375 %s :- %s Message of the Day",
- source, ServerName);
-}
-
-void inspircd_cmd_376(const char *source)
+void InspIRCdProto::cmd_numeric(const char *source, int numeric, const char *dest, const char *buf)
{
- send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
+ send_cmd(source, "PUSH %s ::%s %03d %s %s", dest, source, numeric, dest, buf);
}
void InspIRCdProto::cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes)
@@ -757,13 +739,6 @@ void InspIRCdProto::cmd_bot_chan_mode(const char *nick, const char *chan)
anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick);
}
-void inspircd_cmd_351(const char *source)
-{
- send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
- source, version_number, ServerName, ircd->name, version_flags,
- EncModule, version_build);
-}
-
/* PROTOCTL */
void inspircd_cmd_protoctl()
{
@@ -809,129 +784,6 @@ void inspircd_cmd_chgident(const char *nick, const char *vIdent)
}
}
-/* 391 */
-void inspircd_cmd_391(const char *source, const char *timestr)
-{
- if (!timestr) {
- return;
- }
- send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
-}
-
-/* 250 */
-void inspircd_cmd_250(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "250 %s", buf);
-}
-
-/* 307 */
-void inspircd_cmd_307(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "307 %s", buf);
-}
-
-/* 311 */
-void inspircd_cmd_311(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "311 %s", buf);
-}
-
-/* 312 */
-void inspircd_cmd_312(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "312 %s", buf);
-}
-
-/* 317 */
-void inspircd_cmd_317(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "317 %s", buf);
-}
-
-/* 219 */
-void inspircd_cmd_219(const char *source, const char *letter)
-{
- if (!source) {
- return;
- }
-
- if (letter) {
- send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
- *letter);
- } else {
- send_cmd(NULL, "219 %s l :End of /STATS report.", source);
- }
-}
-
-/* 401 */
-void inspircd_cmd_401(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
- send_cmd(ServerName, "401 %s %s :No such service.", source, who);
-}
-
-/* 318 */
-void inspircd_cmd_318(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
-
- send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
-}
-
-/* 242 */
-void inspircd_cmd_242(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "242 %s", buf);
-}
-
-/* 243 */
-void inspircd_cmd_243(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "243 %s", buf);
-}
-
-/* 211 */
-void inspircd_cmd_211(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "211 %s", buf);
-}
-
/* SQLINE */
void InspIRCdProto::cmd_sqline(const char *mask, const char *reason)
{
@@ -1502,31 +1354,6 @@ int InspIRCdProto::flood_mode_check(const char *value)
}
/**
- * Tell anope which function we want to perform each task inside of anope.
- * These prototypes must match what anope expects.
- **/
-void moduleAddAnopeCmds()
-{
- pmodule_cmd_372(inspircd_cmd_372);
- pmodule_cmd_372_error(inspircd_cmd_372_error);
- pmodule_cmd_375(inspircd_cmd_375);
- pmodule_cmd_376(inspircd_cmd_376);
- pmodule_cmd_351(inspircd_cmd_351);
- pmodule_cmd_391(inspircd_cmd_391);
- pmodule_cmd_250(inspircd_cmd_250);
- pmodule_cmd_307(inspircd_cmd_307);
- pmodule_cmd_311(inspircd_cmd_311);
- pmodule_cmd_312(inspircd_cmd_312);
- pmodule_cmd_317(inspircd_cmd_317);
- pmodule_cmd_219(inspircd_cmd_219);
- pmodule_cmd_401(inspircd_cmd_401);
- pmodule_cmd_318(inspircd_cmd_318);
- pmodule_cmd_242(inspircd_cmd_242);
- pmodule_cmd_243(inspircd_cmd_243);
- pmodule_cmd_211(inspircd_cmd_211);
-}
-
-/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@@ -1558,7 +1385,6 @@ int AnopeInit(int argc, char **argv)
pmodule_key_mode(CMODE_k);
pmodule_limit_mode(CMODE_l);
- moduleAddAnopeCmds();
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h
index 547ec945b..a54a82e14 100755
--- a/src/protocol/inspircd11.h
+++ b/src/protocol/inspircd11.h
@@ -51,23 +51,6 @@
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
-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_351(const char *source);
-void inspircd_cmd_391(const char *source, const char *timestr);
-void inspircd_cmd_250(const char *buf);
-void inspircd_cmd_307(const char *buf);
-void inspircd_cmd_311(const char *buf);
-void inspircd_cmd_312(const char *buf);
-void inspircd_cmd_317(const char *buf);
-void inspircd_cmd_219(const char *source, const char *letter);
-void inspircd_cmd_401(const char *source, const char *who);
-void inspircd_cmd_318(const char *source, const char *who);
-void inspircd_cmd_242(const char *buf);
-void inspircd_cmd_243(const char *buf);
-void inspircd_cmd_211(const char *buf);
int anope_event_fjoin(const char *source, int ac, const char **av);
int anope_event_fmode(const char *source, int ac, const char **av);
int anope_event_ftopic(const char *source, int ac, const char **av);
@@ -80,7 +63,7 @@ int anope_event_opertype(const char *source, int ac, const char **av);
int anope_event_idle(const char *source, int ac, const char **av);
int anope_event_rsquit(const char *source, int ac, const char **av);
-class InspIRCdProto : public IRCDProtoNew {
+class InspIRCdProto : public IRCDProto {
public:
void cmd_remove_akill(const char *, const char *);
void cmd_topic(const char *, const char *, const char *, const char *, time_t);
@@ -112,4 +95,5 @@ class InspIRCdProto : public IRCDProtoNew {
void cmd_server(const char *, int, const char *);
void set_umode(User *, int, const char **);
int flood_mode_check(const char *);
+ void cmd_numeric(const char *, int, const char *, const char *);
} ircd_proto;
diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c
index 0a3b510ca..4f1162c0e 100644
--- a/src/protocol/ratbox.c
+++ b/src/protocol/ratbox.c
@@ -991,153 +991,10 @@ int anope_event_quit(const char *source, int ac, const char **av)
return MOD_CONT;
}
-void ratbox_cmd_372(const char *source, const char *msg)
+void RatboxProto::cmd_numeric(const char *source, int numeric, const char *dest, const char *buf)
{
- send_cmd((UseTS6 ? TS6SID : ServerName), "372 %s :- %s", source, msg);
-}
-
-void ratbox_cmd_372_error(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "422 %s :- MOTD file not found! Please "
- "contact your IRC administrator.", source);
-}
-
-void ratbox_cmd_375(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "375 %s :- %s Message of the Day", source, ServerName);
-}
-
-void ratbox_cmd_376(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "376 %s :End of /MOTD command.", source);
-}
-
-/* 391 */
-void ratbox_cmd_391(const char *source, const char *timestr)
-{
- if (!timestr) {
- return;
- }
- send_cmd(NULL, "391 :%s %s :%s", source, ServerName, timestr);
-}
-
-/* 250 */
-void ratbox_cmd_250(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "250 %s", buf);
-}
-
-/* 307 */
-void ratbox_cmd_307(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "307 %s", buf);
-}
-
-/* 311 */
-void ratbox_cmd_311(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "311 %s", buf);
-}
-
-/* 312 */
-void ratbox_cmd_312(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "312 %s", buf);
-}
-
-/* 317 */
-void ratbox_cmd_317(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName), "317 %s", buf);
-}
-
-/* 219 */
-void ratbox_cmd_219(const char *source, const char *letter)
-{
- if (!source) {
- return;
- }
-
- if (letter) {
- send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
- *letter);
- } else {
- send_cmd(NULL, "219 %s l :End of /STATS report.", source);
- }
-}
-
-/* 401 */
-void ratbox_cmd_401(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
- send_cmd((UseTS6 ? TS6SID : ServerName), "401 %s %s :No such service.",
- source, who);
-}
-
-/* 318 */
-void ratbox_cmd_318(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
-
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "318 %s %s :End of /WHOIS list.", source, who);
-}
-
-/* 242 */
-void ratbox_cmd_242(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "242 %s", buf);
-}
-
-/* 243 */
-void ratbox_cmd_243(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "243 %s", buf);
-}
-
-/* 211 */
-void ratbox_cmd_211(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "211 %s", buf);
+ // This might need to be set in the call to cmd_numeric instead of here, will review later -- CyberBotX
+ send_cmd(UseTS6 ? TS6SID : source, "%03d %s %s", numeric, dest, buf);
}
void RatboxProto::cmd_mode(const char *source, const char *dest, const char *buf)
@@ -1246,14 +1103,6 @@ int anope_event_tmode(const char *source, int ac, const char **av)
return MOD_CONT;
}
-void ratbox_cmd_351(const char *source)
-{
- send_cmd((UseTS6 ? TS6SID : ServerName),
- "351 %s Anope-%s %s :%s - %s (%s) -- %s", source, version_number,
- ServerName, ircd->name, version_flags, EncModule, version_build);
-
-}
-
/* Event: PROTOCTL */
int anope_event_capab(const char *source, int ac, const char **av)
{
@@ -1380,31 +1229,6 @@ int RatboxProto::valid_nick(const char *nick)
}
/**
- * Tell anope which function we want to perform each task inside of anope.
- * These prototypes must match what anope expects.
- **/
-void moduleAddAnopeCmds()
-{
- pmodule_cmd_372(ratbox_cmd_372);
- pmodule_cmd_372_error(ratbox_cmd_372_error);
- pmodule_cmd_375(ratbox_cmd_375);
- pmodule_cmd_376(ratbox_cmd_376);
- pmodule_cmd_351(ratbox_cmd_351);
- pmodule_cmd_391(ratbox_cmd_391);
- pmodule_cmd_250(ratbox_cmd_250);
- pmodule_cmd_307(ratbox_cmd_307);
- pmodule_cmd_311(ratbox_cmd_311);
- pmodule_cmd_312(ratbox_cmd_312);
- pmodule_cmd_317(ratbox_cmd_317);
- pmodule_cmd_219(ratbox_cmd_219);
- pmodule_cmd_401(ratbox_cmd_401);
- pmodule_cmd_318(ratbox_cmd_318);
- pmodule_cmd_242(ratbox_cmd_242);
- pmodule_cmd_243(ratbox_cmd_243);
- pmodule_cmd_211(ratbox_cmd_211);
-}
-
-/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@@ -1435,7 +1259,6 @@ int AnopeInit(int argc, char **argv)
pmodule_key_mode(CMODE_k);
pmodule_limit_mode(CMODE_l);
- moduleAddAnopeCmds();
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
diff --git a/src/protocol/ratbox.h b/src/protocol/ratbox.h
index 3096e6e01..9b2f0ba99 100644
--- a/src/protocol/ratbox.h
+++ b/src/protocol/ratbox.h
@@ -45,25 +45,7 @@
#define DEFAULT_MLOCK CMODE_n | CMODE_t
-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_351(const char *source);
-void ratbox_cmd_391(const char *source, const char *timestr);
-void ratbox_cmd_250(const char *buf);
-void ratbox_cmd_307(const char *buf);
-void ratbox_cmd_311(const char *buf);
-void ratbox_cmd_312(const char *buf);
-void ratbox_cmd_317(const char *buf);
-void ratbox_cmd_219(const char *source, const char *letter);
-void ratbox_cmd_401(const char *source, const char *who);
-void ratbox_cmd_318(const char *source, const char *who);
-void ratbox_cmd_242(const char *buf);
-void ratbox_cmd_243(const char *buf);
-void ratbox_cmd_211(const char *buf);
-
-class RatboxProto : public IRCDProtoNew {
+class RatboxProto : public IRCDProto {
public:
void cmd_remove_akill(const char *, const char *);
void cmd_topic(const char *, const char *, const char *, const char *, time_t);
@@ -93,4 +75,5 @@ class RatboxProto : public IRCDProtoNew {
void cmd_server(const char *, int, const char *);
void set_umode(User *, int, const char **);
int valid_nick(const char *);
+ void cmd_numeric(const char *, int, const char *, const char *);
} ircd_proto;
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 2f1775e01..d893797a8 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -541,29 +541,6 @@ void UnrealIRCdProto::cmd_svsmode(User *u, int ac, const char **av)
}
}
-/* 372 */
-void unreal_cmd_372(const char *source, const char *msg)
-{
- send_cmd(ServerName, "372 %s :- %s", source, msg);
-}
-
-void unreal_cmd_372_error(const char *source)
-{
- send_cmd(ServerName, "422 %s :- MOTD file not found! Please "
- "contact your IRC administrator.", source);
-}
-
-void unreal_cmd_375(const char *source)
-{
- send_cmd(ServerName, "375 %s :- %s Message of the Day",
- source, ServerName);
-}
-
-void unreal_cmd_376(const char *source)
-{
- send_cmd(ServerName, "376 %s :End of /MOTD command.", source);
-}
-
void UnrealIRCdProto::cmd_guest_nick(const char *nick, const char *user, const char *host, const char *real, const char *modes)
{
send_cmd(NULL, "%s %s 1 %ld %s %s %s 0 %s %s%s :%s", send_token("NICK", "&"), nick, static_cast<long>(time(NULL)), user, host, ServerName, modes, host,
@@ -602,13 +579,6 @@ void UnrealIRCdProto::cmd_bot_chan_mode(const char *nick, const char *chan)
anope_cmd_mode(nick, chan, "%s %s %s", myIrcd->botchanumode, nick, nick);
}
-void unreal_cmd_351(const char *source)
-{
- send_cmd(ServerName, "351 %s Anope-%s %s :%s - %s (%s) -- %s",
- source, version_number, ServerName, myIrcd->name,
- version_flags, EncModule, version_build);
-}
-
/* PROTOCTL */
/*
NICKv2 = Nick Version 2
@@ -696,129 +666,6 @@ void unreal_cmd_chgident(const char *nick, const char *vIdent)
vIdent);
}
-/* 391 RPL_TIME ":%s 391 %s %s :%s" */
-void unreal_cmd_391(const char *source, const char *timestr)
-{
- if (!timestr) {
- return;
- }
- send_cmd(ServerName, "391 %s %s :%s", source, ServerName, timestr);
-}
-
-/* 250 */
-void unreal_cmd_250(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "250 %s", buf);
-}
-
-/* 307 */
-void unreal_cmd_307(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "307 %s", buf);
-}
-
-/* 311 */
-void unreal_cmd_311(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "311 %s", buf);
-}
-
-/* 312 */
-void unreal_cmd_312(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "312 %s", buf);
-}
-
-/* 317 */
-void unreal_cmd_317(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(ServerName, "317 %s", buf);
-}
-
-/* 219 */
-void unreal_cmd_219(const char *source, const char *letter)
-{
- if (!source) {
- return;
- }
-
- if (letter) {
- send_cmd(NULL, "219 %s %c :End of /STATS report.", source,
- *letter);
- } else {
- send_cmd(NULL, "219 %s l :End of /STATS report.", source);
- }
-}
-
-/* 401 */
-void unreal_cmd_401(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
- send_cmd(ServerName, "401 %s %s :No such service.", source, who);
-}
-
-/* 318 */
-void unreal_cmd_318(const char *source, const char *who)
-{
- if (!source || !who) {
- return;
- }
-
- send_cmd(ServerName, "318 %s %s :End of /WHOIS list.", source, who);
-}
-
-/* 242 */
-void unreal_cmd_242(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "242 %s", buf);
-}
-
-/* 243 */
-void unreal_cmd_243(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "243 %s", buf);
-}
-
-/* 211 */
-void unreal_cmd_211(const char *buf)
-{
- if (!buf) {
- return;
- }
-
- send_cmd(NULL, "211 %s", buf);
-}
-
/* SQLINE */
/*
** parv[0] = sender
@@ -1802,31 +1649,6 @@ void moduleAddIRCDMsgs(void) {
/* *INDENT-ON* */
/**
- * Tell anope which function we want to perform each task inside of anope.
- * These prototypes must match what anope expects.
- **/
-void moduleAddAnopeCmds()
-{
- pmodule_cmd_372(unreal_cmd_372);
- pmodule_cmd_372_error(unreal_cmd_372_error);
- pmodule_cmd_375(unreal_cmd_375);
- pmodule_cmd_376(unreal_cmd_376);
- pmodule_cmd_351(unreal_cmd_351);
- pmodule_cmd_391(unreal_cmd_391);
- pmodule_cmd_250(unreal_cmd_250);
- pmodule_cmd_307(unreal_cmd_307);
- pmodule_cmd_311(unreal_cmd_311);
- pmodule_cmd_312(unreal_cmd_312);
- pmodule_cmd_317(unreal_cmd_317);
- pmodule_cmd_219(unreal_cmd_219);
- pmodule_cmd_401(unreal_cmd_401);
- pmodule_cmd_318(unreal_cmd_318);
- pmodule_cmd_242(unreal_cmd_242);
- pmodule_cmd_243(unreal_cmd_243);
- pmodule_cmd_211(unreal_cmd_211);
-}
-
-/**
* Now tell anope how to use us.
**/
int AnopeInit(int argc, char **argv)
@@ -1857,7 +1679,6 @@ int AnopeInit(int argc, char **argv)
pmodule_key_mode(CMODE_k);
pmodule_limit_mode(CMODE_l);
- moduleAddAnopeCmds();
pmodule_ircd_proto(&ircd_proto);
moduleAddIRCDMsgs();
diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h
index 7d6a3b635..1114e175f 100644
--- a/src/protocol/unreal32.h
+++ b/src/protocol/unreal32.h
@@ -80,25 +80,7 @@
#define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r
-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_351(const char *source);
-void unreal_cmd_391(const char *source, const char *timestr);
-void unreal_cmd_250(const char *buf);
-void unreal_cmd_307(const char *buf);
-void unreal_cmd_311(const char *buf);
-void unreal_cmd_312(const char *buf);
-void unreal_cmd_317(const char *buf);
-void unreal_cmd_219(const char *source, const char *letter);
-void unreal_cmd_401(const char *source, const char *who);
-void unreal_cmd_318(const char *source, const char *who);
-void unreal_cmd_242(const char *buf);
-void unreal_cmd_243(const char *buf);
-void unreal_cmd_211(const char *buf);
-
-class UnrealIRCdProto : public IRCDProtoNew {
+class UnrealIRCdProto : public IRCDProto {
public:
void cmd_svsnoop(const char *, int);
void cmd_remove_akill(const char *, const char *);