summaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bahamut.c22
-rw-r--r--src/protocol/bahamut.h8
-rw-r--r--src/protocol/charybdis.c53
-rw-r--r--src/protocol/charybdis.h16
-rw-r--r--src/protocol/inspircd11.c22
-rwxr-xr-xsrc/protocol/inspircd11.h10
-rw-r--r--src/protocol/ratbox.c44
-rw-r--r--src/protocol/ratbox.h16
-rw-r--r--src/protocol/unreal32.c28
-rw-r--r--src/protocol/unreal32.h10
10 files changed, 110 insertions, 119 deletions
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 *);