diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-29 08:12:54 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-29 08:12:54 -0400 |
commit | 04200cc8382519c8ea18d214002bc0f063be7d3c (patch) | |
tree | 19537e1d5a53f3f0a5b8e965bec21ae2aa405974 /modules/protocol | |
parent | 06cb137fdea7ef68d020482ffac326c4d988945f (diff) |
Made all of IRCDProto use const pointers, with the exception of SendVhostDel because of the Unreal protocol module, it makes me sad.
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/bahamut.cpp | 44 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 36 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 40 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 40 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 36 | ||||
-rw-r--r-- | modules/protocol/unreal32.cpp | 53 |
6 files changed, 113 insertions, 136 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 9e28b1f9f..724c59879 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -87,7 +87,7 @@ void bahamut_cmd_capab() class BahamutIRCdProto : public IRCDProto { - void SendModeInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; @@ -97,7 +97,7 @@ class BahamutIRCdProto : public IRCDProto send_cmd(source->nick, "MODE %s %s", dest->name.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; @@ -117,13 +117,13 @@ class BahamutIRCdProto : public IRCDProto } /* SVSMODE -b */ - void SendBanDel(Channel *c, const Anope::string &nick) + void SendBanDel(const Channel *c, const Anope::string &nick) { SendSVSModeChan(c, "-b", nick); } /* SVSMODE channel modes */ - void SendSVSModeChan(Channel *c, const Anope::string &mode, const Anope::string &nick) + void SendSVSModeChan(const Channel *c, const Anope::string &mode, const Anope::string &nick) { if (!nick.empty()) send_cmd(Config.ServerName, "SVSMODE %s %s %s", c->name.c_str(), mode.c_str(), nick.c_str()); @@ -132,19 +132,19 @@ class BahamutIRCdProto : public IRCDProto } /* SQLINE */ - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd("", "SQLINE %s :%s", x->Mask.c_str(), x->Reason.c_str()); } /* UNSLINE */ - void SendSGLineDel(XLine *x) + void SendSGLineDel(const XLine *x) { send_cmd("", "UNSGLINE 0 :%s", x->Mask.c_str()); } /* UNSZLINE */ - void SendSZLineDel(XLine *x) + void SendSZLineDel(const XLine *x) { /* this will likely fail so its only here for legacy */ send_cmd("", "UNSZLINE 0 %s", x->Mask.c_str()); @@ -153,7 +153,7 @@ class BahamutIRCdProto : public IRCDProto } /* SZLINE */ - void SendSZLine(XLine *x) + void SendSZLine(const XLine *x) { /* this will likely fail so its only here for legacy */ send_cmd("", "SZLINE %s :%s", x->Mask.c_str(), x->Reason.c_str()); @@ -168,36 +168,36 @@ class BahamutIRCdProto : public IRCDProto } /* SGLINE */ - void SendSGLine(XLine *x) + void SendSGLine(const XLine *x) { send_cmd("", "SGLINE %d :%s:%s", static_cast<int>(x->Mask.length()), x->Mask.c_str(), x->Reason.c_str()); } /* RAKILL */ - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { send_cmd("", "RAKILL %s %s", x->GetHost().c_str(), x->GetUser().c_str()); } /* TOPIC */ - void SendTopic(BotInfo *whosets, Channel *c, const Anope::string &whosetit, const Anope::string &topic) + void SendTopic(const BotInfo *whosets, const Channel *c, const Anope::string &whosetit, const Anope::string &topic) { send_cmd(whosets->nick, "TOPIC %s %s %lu :%s", c->name.c_str(), whosetit.c_str(), static_cast<unsigned long>(c->topic_time), topic.c_str()); } /* UNSQLINE */ - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd("", "UNSQLINE %s", x->Mask.c_str()); } /* JOIN - SJOIN */ - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(chantime), channel.c_str()); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - time(NULL); @@ -209,7 +209,7 @@ class BahamutIRCdProto : public IRCDProto /* Note: if the stamp is null 0, the below usage is correct of Bahamut */ - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->nick : "", "SVSKILL %s :%s", user->nick.c_str(), buf.c_str()); } @@ -221,7 +221,7 @@ class BahamutIRCdProto : public IRCDProto * parv[3] - mode (or services id if old svs version) * parv[4] - optional arguement (services id) */ - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { this->SendModeInternal(NULL, u, merge_args(ac, av)); } @@ -231,14 +231,14 @@ class BahamutIRCdProto : public IRCDProto send_cmd("", "BURST 0"); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; send_cmd("", "NOTICE @%s :%s", dest->name.c_str(), buf.c_str()); } - void SendKickInternal(BotInfo *source, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf.c_str()); @@ -254,15 +254,13 @@ class BahamutIRCdProto : public IRCDProto /* SVSMODE +d */ /* nc_change was = 1, and there is no na->status */ - void SendUnregisteredNick(User *u) + void SendUnregisteredNick(const User *u) { - BotInfo *bi = NickServ; - u->RemoveMode(bi, UMODE_REGISTERED); - ircdproto->SendMode(bi, u, "+d 1"); + ircdproto->SendMode(NickServ, u, "+d 1"); } /* SERVER */ - void SendServer(Server *server) + void SendServer(const Server *server) { send_cmd("", "SERVER %s %d :%s", server->GetName().c_str(), server->GetHops(), server->GetDescription().c_str()); } diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 3234ae81e..7f98433d7 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -93,12 +93,12 @@ void inspircd_cmd_pass(const Anope::string &pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { send_cmd(Config.s_OperServ, "GLINE %s", x->Mask.c_str()); } - void SendTopic(BotInfo *whosets, Channel *c, const Anope::string &whosetit, const Anope::string &topic) + void SendTopic(const BotInfo *whosets, const Channel *c, const Anope::string &whosetit, const Anope::string &topic) { send_cmd(whosets->nick, "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit.c_str(), topic.c_str()); } @@ -114,7 +114,7 @@ class InspIRCdProto : public IRCDProto inspircd_cmd_chgident(u->nick, u->GetIdent()); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - time(NULL); @@ -123,12 +123,12 @@ class InspIRCdProto : public IRCDProto send_cmd(Config.ServerName, "ADDLINE G %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->nick : Config.ServerName, "KILL %s :%s", user->nick.c_str(), buf.c_str()); } - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { this->SendModeInternal(NULL, u, merge_args(ac, av)); } @@ -138,14 +138,14 @@ class InspIRCdProto : public IRCDProto send_cmd(source, "PUSH %s ::%s %03d %s %s", dest.c_str(), source.c_str(), numeric, dest.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; send_cmd(source ? source->nick : Config.s_OperServ, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; @@ -158,7 +158,7 @@ class InspIRCdProto : public IRCDProto send_cmd(nick, "OPERTYPE Service"); } - void SendKickInternal(BotInfo *source, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf.c_str()); @@ -166,7 +166,7 @@ class InspIRCdProto : public IRCDProto send_cmd(source->nick, "KICK %s %s :%s", chan->name.c_str(), user->nick.c_str(), user->nick.c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; @@ -174,25 +174,25 @@ class InspIRCdProto : public IRCDProto } /* SERVER services-dev.chatspike.net password 0 :Description here */ - void SendServer(Server *server) + void SendServer(const Server *server) { send_cmd(Config.ServerName, "SERVER %s %s %d :%s", server->GetName().c_str(), currentpass.c_str(), server->GetHops(), server->GetDescription().c_str()); } /* JOIN */ - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd(user->nick, "JOIN %s %ld", channel.c_str(), static_cast<long>(chantime)); } /* UNSQLINE */ - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd(Config.s_OperServ, "QLINE %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd(Config.ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } @@ -249,23 +249,17 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(XLine *x) + void SendSZLineDel(const XLine *x) { send_cmd(Config.s_OperServ, "ZLINE %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(XLine *x) + void SendSZLine(const XLine *x) { send_cmd(Config.ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } - /* SVSMODE +- */ - void SendUnregisteredNick(User *u) - { - u->RemoveMode(NickServ, UMODE_REGISTERED); - } - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) { send_cmd(source, "SVSJOIN %s %s", nick.c_str(), chan.c_str()); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index f8d0c1563..97cfbac29 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -98,12 +98,12 @@ void inspircd_cmd_pass(const Anope::string &pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { send_cmd(OperServ->GetUID(), "GLINE %s", x->Mask.c_str()); } - void SendTopic(BotInfo *whosets, Channel *c, const Anope::string &whosetit, const Anope::string &topic) + void SendTopic(const BotInfo *whosets, const Channel *c, const Anope::string &whosetit, const Anope::string &topic) { send_cmd(whosets->GetUID(), "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit.c_str(), topic.c_str()); } @@ -119,7 +119,7 @@ class InspIRCdProto : public IRCDProto inspircd_cmd_chgident(u->nick, u->GetIdent()); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - time(NULL); @@ -128,12 +128,12 @@ class InspIRCdProto : public IRCDProto send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->GetUID() : TS6SID, "KILL %s :%s", user->GetUID().c_str(), buf.c_str()); } - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { this->SendModeInternal(NULL, u, merge_args(ac, av)); } @@ -143,12 +143,12 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "PUSH %s ::%s %03d %s %s", dest.c_str(), source.c_str(), numeric, dest.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { send_cmd(source ? source->GetUID() : TS6SID, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; @@ -160,7 +160,7 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld %s :%s", uid.c_str(), static_cast<long>(time(NULL)), nick.c_str(), host.c_str(), host.c_str(), user.c_str(), static_cast<long>(time(NULL)), modes.c_str(), real.c_str()); } - void SendKickInternal(BotInfo *source, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(source->GetUID(), "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf.c_str()); @@ -168,31 +168,31 @@ class InspIRCdProto : public IRCDProto send_cmd(source->GetUID(), "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), user->nick.c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { send_cmd(TS6SID, "NOTICE @%s :%s", dest->name.c_str(), buf.c_str()); } /* SERVER services-dev.chatspike.net password 0 :Description here */ - void SendServer(Server *server) + void SendServer(const Server *server) { send_cmd("", "SERVER %s %s %d %s :%s", server->GetName().c_str(), currentpass.c_str(), server->GetHops(), server->GetSID().c_str(), server->GetDescription().c_str()); } /* JOIN */ - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd(TS6SID, "FJOIN %s %ld + :,%s", channel.c_str(), static_cast<long>(chantime), user->GetUID().c_str()); } /* UNSQLINE */ - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd(TS6SID, "DELLINE Q %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } @@ -243,23 +243,17 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(XLine *x) + void SendSZLineDel(const XLine *x) { send_cmd(TS6SID, "DELLINE Z %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(XLine *x) + void SendSZLine(const XLine *x) { send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } - /* SVSMODE -r */ - void SendUnregisteredNick(User *u) - { - u->RemoveMode(NickServ, UMODE_REGISTERED); - } - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) { User *u = finduser(nick); @@ -294,12 +288,12 @@ class InspIRCdProto : public IRCDProto send_cmd(source ? source->GetUID() : TS6SID, "SNONOTICE A :%s", buf.c_str()); } - void SendAccountLogin(User *u, const NickCore *account) + void SendAccountLogin(const User *u, const NickCore *account) { send_cmd(TS6SID, "METADATA %s accountname :%s", u->GetUID().c_str(), account->display.c_str()); } - void SendAccountLogout(User *u, const NickCore *account) + void SendAccountLogout(const User *u, const NickCore *account) { send_cmd(TS6SID, "METADATA %s accountname :", u->GetUID().c_str()); } diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 043e3d256..6ca1727c6 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -96,12 +96,12 @@ void inspircd_cmd_pass(const Anope::string &pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { send_cmd(OperServ->GetUID(), "GLINE %s", x->Mask.c_str()); } - void SendTopic(BotInfo *whosets, Channel *c, const Anope::string &whosetit, const Anope::string &topic) + void SendTopic(const BotInfo *whosets, const Channel *c, const Anope::string &whosetit, const Anope::string &topic) { send_cmd(whosets->GetUID(), "FTOPIC %s %lu %s :%s", c->name.c_str(), static_cast<unsigned long>(c->topic_time), whosetit.c_str(), topic.c_str()); } @@ -117,7 +117,7 @@ class InspIRCdProto : public IRCDProto inspircd_cmd_chgident(u->nick, u->GetIdent()); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - time(NULL); @@ -126,12 +126,12 @@ class InspIRCdProto : public IRCDProto send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->GetUID() : TS6SID, "KILL %s :%s", user->GetUID().c_str(), buf.c_str()); } - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { this->SendModeInternal(NULL, u, merge_args(ac, av)); } @@ -141,12 +141,12 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "PUSH %s ::%s %03d %s %s", dest.c_str(), source.c_str(), numeric, dest.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { send_cmd(source ? source->GetUID() : TS6SID, "FMODE %s %u %s", dest->name.c_str(), static_cast<unsigned>(dest->creation_time), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; @@ -158,7 +158,7 @@ class InspIRCdProto : public IRCDProto send_cmd(TS6SID, "UID %s %ld %s %s %s %s 0.0.0.0 %ld %s :%s", uid.c_str(), static_cast<long>(time(NULL)), nick.c_str(), host.c_str(), host.c_str(), user.c_str(), static_cast<long>(time(NULL)), modes.c_str(), real.c_str()); } - void SendKickInternal(BotInfo *source, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(source->GetUID(), "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf.c_str()); @@ -166,31 +166,31 @@ class InspIRCdProto : public IRCDProto send_cmd(source->GetUID(), "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), user->nick.c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { send_cmd(TS6SID, "NOTICE @%s :%s", dest->name.c_str(), buf.c_str()); } /* SERVER services-dev.chatspike.net password 0 :Description here */ - void SendServer(Server *server) + void SendServer(const Server *server) { send_cmd("", "SERVER %s %s %d %s :%s", server->GetName().c_str(), currentpass.c_str(), server->GetHops(), server->GetSID().c_str(), server->GetDescription().c_str()); } /* JOIN */ - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd(TS6SID, "FJOIN %s %ld + :,%s", channel.c_str(), static_cast<long>(chantime), user->GetUID().c_str()); } /* UNSQLINE */ - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd(TS6SID, "DELLINE Q %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } @@ -244,23 +244,17 @@ class InspIRCdProto : public IRCDProto } /* UNSZLINE */ - void SendSZLineDel(XLine *x) + void SendSZLineDel(const XLine *x) { send_cmd(TS6SID, "DELLINE Z %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(XLine *x) + void SendSZLine(const XLine *x) { send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } - /* SVSMODE -r */ - void SendUnregisteredNick(User *u) - { - u->RemoveMode(NickServ, UMODE_REGISTERED); - } - void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) { User *u = finduser(nick); @@ -292,12 +286,12 @@ class InspIRCdProto : public IRCDProto send_cmd(source ? source->GetUID() : TS6SID, "SNONOTICE g :%s", buf.c_str()); } - void SendAccountLogin(User *u, const NickCore *account) + void SendAccountLogin(const User *u, const NickCore *account) { send_cmd(TS6SID, "METADATA %s accountname :%s", u->GetUID().c_str(), account->display.c_str()); } - void SendAccountLogout(User *u, const NickCore *account) + void SendAccountLogout(const User *u, const NickCore *account) { send_cmd(TS6SID, "METADATA %s accountname :", u->GetUID().c_str()); } diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index df241e3fc..623d5a31e 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -112,57 +112,57 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "OPERWALL :%s", buf.c_str()); } - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd(TS6SID, "RESV * %s :%s", x->Mask.c_str(), x->Reason.c_str()); } - void SendSGLineDel(XLine *x) + void SendSGLineDel(const XLine *x) { BotInfo *bi = OperServ; send_cmd(bi ? bi->GetUID() : Config.s_OperServ, "UNXLINE * %s", x->Mask.c_str()); } - void SendSGLine(XLine *x) + void SendSGLine(const XLine *x) { BotInfo *bi = OperServ; send_cmd(bi ? bi->GetUID() : Config.s_OperServ, "XLINE * %s 0 :%s", x->Mask.c_str(), x->Reason.c_str()); } - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { BotInfo *bi = OperServ; send_cmd(bi ? bi->GetUID() : Config.s_OperServ, "UNKLINE * %s %s", x->GetUser().c_str(), x->GetHost().c_str()); } - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd(TS6SID, "UNRESV * %s", x->Mask.c_str()); } - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd("", "SJOIN %ld %s + :%s", static_cast<long>(chantime), channel.c_str(), user->GetUID().c_str()); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { BotInfo *bi = OperServ; send_cmd(bi ? bi->GetUID() : Config.s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(x->Expires - time(NULL)), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str()); } - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->GetUID() : TS6SID, "KILL %s :%s", user->GetUID().c_str(), buf.c_str()); } - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { this->SendModeInternal(NULL, u, merge_args(ac, av)); } /* SERVER name hop descript */ - void SendServer(Server *server) + void SendServer(const Server *server) { send_cmd("", "SERVER %s %d :%s", server->GetName().c_str(), server->GetHops(), server->GetDescription().c_str()); } @@ -182,7 +182,7 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "UID %s 1 %ld %s %s %s 0 %s :%s", nick.c_str(), static_cast<long>(time(NULL)), modes.c_str(), user.c_str(), host.c_str(), uid.c_str(), real.c_str()); } - void SendPartInternal(BotInfo *bi, Channel *chan, const Anope::string &buf) + void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) { if (!buf.empty()) send_cmd(bi->GetUID(), "PART %s :%s", chan->name.c_str(), buf.c_str()); @@ -196,7 +196,7 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "%03d %s %s", numeric, dest.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *bi, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf) { if (bi) send_cmd(bi->GetUID(), "MODE %s %s", dest->name.c_str(), buf.c_str()); @@ -204,14 +204,14 @@ class RatboxProto : public IRCDTS6Proto send_cmd(TS6SID, "MODE %s %s", dest->name.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; send_cmd(bi ? bi->GetUID() : TS6SID, "SVSMODE %s %s", u->nick.c_str(), buf.c_str()); } - void SendKickInternal(BotInfo *bi, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(bi->GetUID(), "KICK %s %s :%s", chan->name.c_str(), user->GetUID().c_str(), buf.c_str()); @@ -219,7 +219,7 @@ class RatboxProto : public IRCDTS6Proto send_cmd(bi->GetUID(), "KICK %s %s", chan->name.c_str(), user->GetUID().c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { send_cmd("", "NOTICE @%s :%s", dest->name.c_str(), buf.c_str()); } @@ -240,12 +240,12 @@ class RatboxProto : public IRCDTS6Proto send_cmd(source->GetUID(), "INVITE %s %s", u ? u->GetUID().c_str() : nick.c_str(), chan.c_str()); } - void SendAccountLogin(User *u, const NickCore *account) + void SendAccountLogin(const User *u, const NickCore *account) { send_cmd(TS6SID, "ENCAP * SU %s %s", u->GetUID().c_str(), account->display.c_str()); } - void SendAccountLogout(User *u, const NickCore *account) + void SendAccountLogout(const User *u, const NickCore *account) { send_cmd(TS6SID, "ENCAP * SU %s", u->GetUID().c_str()); } @@ -259,7 +259,7 @@ class RatboxProto : public IRCDTS6Proto return true; } - void SendTopic(BotInfo *bi, Channel *c, const Anope::string &, const Anope::string &topic) + void SendTopic(const BotInfo *bi, const Channel *c, const Anope::string &, const Anope::string &topic) { send_cmd(bi->GetUID(), "TOPIC %s :%s", c->name.c_str(), topic.c_str()); } diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp index 486e248d4..064efdaa7 100644 --- a/modules/protocol/unreal32.cpp +++ b/modules/protocol/unreal32.cpp @@ -113,27 +113,26 @@ class UnrealIRCdProto : public IRCDProto send_cmd("", "f %s %s", server.c_str(), set ? "+" : "-"); } - void SendAkillDel(XLine *x) + void SendAkillDel(const XLine *x) { send_cmd("", "BD - G %s %s %s", x->GetUser().c_str(), x->GetHost().c_str(), Config.s_OperServ.c_str()); } - void SendTopic(BotInfo *whosets, Channel *c, const Anope::string &whosetit, const Anope::string &topic) + void SendTopic(const BotInfo *whosets, const Channel *c, const Anope::string &whosetit, const Anope::string &topic) { send_cmd(whosets->nick, ") %s %s %lu :%s", c->name.c_str(), whosetit.c_str(), static_cast<unsigned long>(c->topic_time), topic.c_str()); } void SendVhostDel(User *u) { - BotInfo *bi = HostServ; - u->RemoveMode(bi, UMODE_CLOAK); - u->RemoveMode(bi, UMODE_VHOST); + u->RemoveMode(HostServ, UMODE_CLOAK); + u->RemoveMode(HostServ, UMODE_VHOST); ModeManager::ProcessModes(); - u->SetMode(bi, UMODE_CLOAK); + u->SetMode(HostServ, UMODE_CLOAK); ModeManager::ProcessModes(); } - void SendAkill(XLine *x) + void SendAkill(const XLine *x) { // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->Expires - time(NULL); @@ -142,7 +141,7 @@ class UnrealIRCdProto : public IRCDProto send_cmd("", "BD + G %s %s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL) + timeleft), static_cast<long>(x->Expires), x->Reason.c_str()); } - void SendSVSKillInternal(BotInfo *source, User *user, const Anope::string &buf) + void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) { send_cmd(source ? source->nick : Config.ServerName, "h %s :%s", user->nick.c_str(), buf.c_str()); } @@ -154,7 +153,7 @@ class UnrealIRCdProto : public IRCDProto * parv[2] - modes to change * parv[3] - Service Stamp (if mode == d) */ - void SendSVSMode(User *u, int ac, const char **av) + void SendSVSMode(const User *u, int ac, const char **av) { if (ac >= 1) { @@ -164,14 +163,14 @@ class UnrealIRCdProto : public IRCDProto } } - void SendModeInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; send_cmd(source->nick, "G %s %s", dest->name.c_str(), buf.c_str()); } - void SendModeInternal(BotInfo *bi, User *u, const Anope::string &buf) + void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) { if (buf.empty()) return; @@ -184,7 +183,7 @@ class UnrealIRCdProto : public IRCDProto send_cmd("", "& %s 1 %ld %s %s %s 0 %s %s%s :%s", nick.c_str(), static_cast<long>(time(NULL)), user.c_str(), host.c_str(), Config.ServerName.c_str(), modes.c_str(), host.c_str(), myIrcd->nickip ? " *" : "", real.c_str()); } - void SendKickInternal(BotInfo *source, Channel *chan, User *user, const Anope::string &buf) + void SendKickInternal(const BotInfo *source, const Channel *chan, const User *user, const Anope::string &buf) { if (!buf.empty()) send_cmd(source->nick, "H %s %s :%s", chan->name.c_str(), user->nick.c_str(), buf.c_str()); @@ -192,7 +191,7 @@ class UnrealIRCdProto : public IRCDProto send_cmd(source->nick, "H %s %s", chan->name.c_str(), user->nick.c_str()); } - void SendNoticeChanopsInternal(BotInfo *source, Channel *dest, const Anope::string &buf) + void SendNoticeChanopsInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) { if (buf.empty()) return; @@ -201,7 +200,7 @@ class UnrealIRCdProto : public IRCDProto /* SERVER name hop descript */ /* Unreal 3.2 actually sends some info about itself in the descript area */ - void SendServer(Server *server) + void SendServer(const Server *server) { if (!Config.Numeric.empty()) send_cmd("", "SERVER %s %d :U0-*-%s %s", server->GetName().c_str(), server->GetHops(), Config.Numeric.c_str(), server->GetDescription().c_str()); @@ -210,14 +209,14 @@ class UnrealIRCdProto : public IRCDProto } /* JOIN */ - void SendJoin(BotInfo *user, const Anope::string &channel, time_t chantime) + void SendJoin(const BotInfo *user, const Anope::string &channel, time_t chantime) { send_cmd(Config.ServerName, "~ %ld %s :%s", static_cast<long>(chantime), channel.c_str(), user->nick.c_str()); } /* unsqline */ - void SendSQLineDel(XLine *x) + void SendSQLineDel(const XLine *x) { send_cmd("", "d %s", x->Mask.c_str()); } @@ -227,7 +226,7 @@ class UnrealIRCdProto : public IRCDProto ** - Unreal will translate this to TKL for us ** */ - void SendSQLine(XLine *x) + void SendSQLine(const XLine *x) { send_cmd("", "c %s :%s", x->Mask.c_str(), x->Reason.c_str()); } @@ -246,7 +245,7 @@ class UnrealIRCdProto : public IRCDProto } /* NICK <newnick> */ - void SendChangeBotNick(BotInfo *oldnick, const Anope::string &newnick) + void SendChangeBotNick(const BotInfo *oldnick, const Anope::string &newnick) { if (!oldnick || newnick.empty()) return; @@ -286,19 +285,19 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE - :realname mask */ - void SendSGLineDel(XLine *x) + void SendSGLineDel(const XLine *x) { send_cmd("", "BR - :%s", x->Mask.c_str()); } /* UNSZLINE */ - void SendSZLineDel(XLine *x) + void SendSZLineDel(const XLine *x) { send_cmd("", "BD - Z * %s %s", x->Mask.c_str(), Config.s_OperServ.c_str()); } /* SZLINE */ - void SendSZLine(XLine *x) + void SendSZLine(const XLine *x) { send_cmd("", "BD + Z * %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), x->Reason.c_str()); } @@ -307,7 +306,7 @@ class UnrealIRCdProto : public IRCDProto /* * SVSNLINE + reason_where_is_space :realname mask with spaces */ - void SendSGLine(XLine *x) + void SendSGLine(const XLine *x) { Anope::string edited_reason = x->Reason; edited_reason = edited_reason.replace_all_cs(" ", "_"); @@ -315,14 +314,14 @@ class UnrealIRCdProto : public IRCDProto } /* SVSMODE -b */ - void SendBanDel(Channel *c, const Anope::string &nick) + void SendBanDel(const Channel *c, const Anope::string &nick) { SendSVSModeChan(c, "-b", nick); } /* SVSMODE channel modes */ - void SendSVSModeChan(Channel *c, const Anope::string &mode, const Anope::string &nick) + void SendSVSModeChan(const Channel *c, const Anope::string &mode, const Anope::string &nick) { if (!nick.empty()) send_cmd(Config.ServerName, "n %s %s %s", c->name.c_str(), mode.c_str(), nick.c_str()); @@ -400,11 +399,9 @@ class UnrealIRCdProto : public IRCDProto ircdproto->SendMode(bi, u, "+d %s", svidbuf.c_str()); } - void SendUnregisteredNick(User *u) + void SendUnregisteredNick(const User *u) { - BotInfo *bi = NickServ; - u->RemoveMode(bi, UMODE_REGISTERED); - ircdproto->SendMode(bi, u, "+d 1"); + ircdproto->SendMode(NickServ, u, "+d 1"); } } ircd_proto; |