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 | |
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.
-rw-r--r-- | include/services.h | 94 | ||||
-rw-r--r-- | modules/core/ns_logout.cpp | 1 | ||||
-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 | ||||
-rw-r--r-- | src/nickalias.cpp | 1 | ||||
-rw-r--r-- | src/nickcore.cpp | 1 | ||||
-rw-r--r-- | src/protocol.cpp | 50 | ||||
-rw-r--r-- | src/users.cpp | 1 |
12 files changed, 189 insertions, 208 deletions
diff --git a/include/services.h b/include/services.h index fdbaccbfc..73dc205ab 100644 --- a/include/services.h +++ b/include/services.h @@ -924,40 +924,40 @@ class ServerConfig; class CoreExport IRCDProto { private: - virtual void SendSVSKillInternal(BotInfo *, User *, const Anope::string &) = 0; - virtual void SendModeInternal(BotInfo *, Channel *, const Anope::string &) = 0; - virtual void SendModeInternal(BotInfo *, User *, const Anope::string &) = 0; - virtual void SendKickInternal(BotInfo *, Channel *, User *, const Anope::string &) = 0; - virtual void SendNoticeChanopsInternal(BotInfo *bi, Channel *, const Anope::string &) = 0; - virtual void SendMessageInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf); - virtual void SendNoticeInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &msg); - virtual void SendPrivmsgInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf); - virtual void SendQuitInternal(BotInfo *bi, const Anope::string &buf); - virtual void SendPartInternal(BotInfo *bi, Channel *chan, const Anope::string &buf); - virtual void SendGlobopsInternal(BotInfo *source, const Anope::string &buf); - virtual void SendCTCPInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf); + virtual void SendSVSKillInternal(const BotInfo *, const User *, const Anope::string &) = 0; + virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &) = 0; + virtual void SendModeInternal(const BotInfo *, const User *, const Anope::string &) = 0; + virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &) = 0; + virtual void SendNoticeChanopsInternal(const BotInfo *bi, const Channel *, const Anope::string &) = 0; + virtual void SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf); + virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg); + virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf); + virtual void SendQuitInternal(const BotInfo *bi, const Anope::string &buf); + virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf); + virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf); + virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf); virtual void SendNumericInternal(const Anope::string &source, int numeric, const Anope::string &dest, const Anope::string &buf); public: virtual ~IRCDProto() { } virtual void SendSVSNOOP(const Anope::string &, int) { } - virtual void SendTopic(BotInfo *, Channel *, const Anope::string &, const Anope::string &) = 0; + virtual void SendTopic(const BotInfo *, const Channel *, const Anope::string &, const Anope::string &) = 0; virtual void SendVhostDel(User *) { } - virtual void SendAkill(XLine *) = 0; - virtual void SendAkillDel(XLine *) = 0; - virtual void SendSVSKill(BotInfo *source, User *user, const char *fmt, ...); - virtual void SendSVSMode(User *, int, const char **) = 0; - virtual void SendMode(BotInfo *bi, Channel *dest, const char *fmt, ...); - virtual void SendMode(BotInfo *bi, User *u, const char *fmt, ...); + virtual void SendAkill(const XLine *) = 0; + virtual void SendAkillDel(const XLine *) = 0; + virtual void SendSVSKill(const BotInfo *source, const User *user, const char *fmt, ...); + virtual void SendSVSMode(const User *, int, const char **) = 0; + virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...); + virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...); virtual void SendClientIntroduction(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &uid) = 0; - virtual void SendKick(BotInfo *bi, Channel *chan, User *user, const char *fmt, ...); - virtual void SendNoticeChanops(BotInfo *bi, Channel *dest, const char *fmt, ...); - virtual void SendMessage(BotInfo *bi, const Anope::string &dest, const char *fmt, ...); - virtual void SendNotice(BotInfo *bi, const Anope::string &dest, const char *fmt, ...); - virtual void SendAction(BotInfo *bi, const Anope::string &dest, const char *fmt, ...); - virtual void SendPrivmsg(BotInfo *bi, const Anope::string &dest, const char *fmt, ...); - virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg); - virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg); + virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...); + virtual void SendNoticeChanops(const BotInfo *bi, const Channel *dest, const char *fmt, ...); + virtual void SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendNotice(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendPrivmsg(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg); + virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg); /** XXX: This is a hack for NickServ enforcers. It is deprecated. * If I catch any developer using this in new code, I will RIP YOUR BALLS OFF. @@ -965,36 +965,36 @@ class CoreExport IRCDProto * -- w00t */ virtual void SendQuit(const Anope::string &nick, const Anope::string &) MARK_DEPRECATED; - virtual void SendQuit(BotInfo *bi, const char *fmt, ...); + virtual void SendQuit(const BotInfo *bi, const char *fmt, ...); virtual void SendPing(const Anope::string &servname, const Anope::string &who); virtual void SendPong(const Anope::string &servname, const Anope::string &who); - virtual void SendJoin(BotInfo *bi, const Anope::string &, time_t) = 0; - virtual void SendSQLineDel(XLine *x) = 0; - virtual void SendInvite(BotInfo *bi, const Anope::string &chan, const Anope::string &nick); - virtual void SendPart(BotInfo *bi, Channel *chan, const char *fmt, ...); - virtual void SendGlobops(BotInfo *source, const char *fmt, ...); - virtual void SendSQLine(XLine *x) = 0; + virtual void SendJoin(const BotInfo *bi, const Anope::string &, time_t) = 0; + virtual void SendSQLineDel(const XLine *x) = 0; + virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick); + virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...); + virtual void SendGlobops(const BotInfo *source, const char *fmt, ...); + virtual void SendSQLine(const XLine *x) = 0; virtual void SendSquit(const Anope::string &servname, const Anope::string &message); virtual void SendSVSO(const Anope::string &, const Anope::string &, const Anope::string &) { } - virtual void SendChangeBotNick(BotInfo *bi, const Anope::string &newnick); - virtual void SendForceNickChange(User *u, const Anope::string &newnick, time_t when); + virtual void SendChangeBotNick(const BotInfo *bi, const Anope::string &newnick); + virtual void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when); virtual void SendVhost(User *, const Anope::string &, const Anope::string &) { } virtual void SendConnect() = 0; virtual void SendSVSHold(const Anope::string &) { } virtual void SendSVSHoldDel(const Anope::string &) { } - virtual void SendSGLineDel(XLine *) { } - virtual void SendSZLineDel(XLine *) { } - virtual void SendSZLine(XLine *) { } - virtual void SendSGLine(XLine *) { } - virtual void SendBanDel(Channel *, const Anope::string &) { } - virtual void SendSVSModeChan(Channel *, const Anope::string &, const Anope::string &) { } - virtual void SendUnregisteredNick(User *) { } - virtual void SendCTCP(BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendSGLineDel(const XLine *) { } + virtual void SendSZLineDel(const XLine *) { } + virtual void SendSZLine(const XLine *) { } + virtual void SendSGLine(const XLine *) { } + virtual void SendBanDel(const Channel *, const Anope::string &) { } + virtual void SendSVSModeChan(const Channel *, const Anope::string &, const Anope::string &) { } + virtual void SendUnregisteredNick(const User *) { } + virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); virtual void SendSVSJoin(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &) { } virtual void SendSVSPart(const Anope::string &, const Anope::string &, const Anope::string &) { } virtual void SendSWhois(const Anope::string &, const Anope::string &, const Anope::string &) { } virtual void SendEOB() { } - virtual void SendServer(Server *) = 0; + virtual void SendServer(const Server *) = 0; virtual bool IsNickValid(const Anope::string &) { return true; } virtual bool IsChannelValid(const Anope::string &); virtual void SendNumeric(const Anope::string &source, int numeric, const Anope::string &dest, const char *fmt, ...); @@ -1003,13 +1003,13 @@ class CoreExport IRCDProto * @param u The user logging in * @param account The account the user is logging into */ - virtual void SendAccountLogin(User *u, const NickCore *account) { } + virtual void SendAccountLogin(const User *u, const NickCore *account) { } /** Sends a message logging a user out of an account, where ircds support such a feature. * @param u The user logging out * @param account The account the user is logging out of */ - virtual void SendAccountLogout(User *u, const NickCore *account) { } + virtual void SendAccountLogout(const User *u, const NickCore *account) { } /** Set a users auto identification token * @param u The user diff --git a/modules/core/ns_logout.cpp b/modules/core/ns_logout.cpp index dc744bbad..e0e8f0c7b 100644 --- a/modules/core/ns_logout.cpp +++ b/modules/core/ns_logout.cpp @@ -47,6 +47,7 @@ class CommandNSLogout : public Command notice_lang(Config.s_NickServ, u, NICK_LOGOUT_SUCCEEDED); ircdproto->SendAccountLogout(u2, u2->Account()); + u2->RemoveMode(NickServ, UMODE_REGISTERED); ircdproto->SendUnregisteredNick(u2); u2->Logout(); 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; diff --git a/src/nickalias.cpp b/src/nickalias.cpp index c18f93005..0abfa860b 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -73,6 +73,7 @@ NickAlias::~NickAlias() if ((u = finduser(this->nick)) && u->Account()) { ircdproto->SendAccountLogout(u, u->Account()); + u->RemoveMode(NickServ, UMODE_REGISTERED); ircdproto->SendUnregisteredNick(u); u->Logout(); } diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 565a23a26..2996c6afc 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -36,6 +36,7 @@ NickCore::~NickCore() { User *user = *it; ircdproto->SendAccountLogout(user, user->Account()); + user->RemoveMode(NickServ, UMODE_REGISTERED); ircdproto->SendUnregisteredNick(user); user->Logout(); FOREACH_MOD(I_OnNickLogout, OnNickLogout(user)); diff --git a/src/protocol.cpp b/src/protocol.cpp index f11c591b2..0ff642cf0 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1,6 +1,6 @@ #include "services.h" -void IRCDProto::SendMessageInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf) +void IRCDProto::SendMessageInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf) { if (Config.NSDefFlags.HasFlag(NI_MSG)) SendPrivmsgInternal(bi, dest, buf); @@ -8,17 +8,17 @@ void IRCDProto::SendMessageInternal(BotInfo *bi, const Anope::string &dest, cons SendNoticeInternal(bi, dest, buf); } -void IRCDProto::SendNoticeInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &msg) +void IRCDProto::SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "NOTICE %s :%s", dest.c_str(), msg.c_str()); } -void IRCDProto::SendPrivmsgInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf) +void IRCDProto::SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "PRIVMSG %s :%s", dest.c_str(), buf.c_str()); } -void IRCDProto::SendQuitInternal(BotInfo *bi, const Anope::string &buf) +void IRCDProto::SendQuitInternal(const BotInfo *bi, const Anope::string &buf) { if (!buf.empty()) send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "QUIT :%s", buf.c_str()); @@ -26,7 +26,7 @@ void IRCDProto::SendQuitInternal(BotInfo *bi, const Anope::string &buf) send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "QUIT"); } -void IRCDProto::SendPartInternal(BotInfo *bi, Channel *chan, const Anope::string &buf) +void IRCDProto::SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) { if (!buf.empty()) send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "PART %s :%s", chan->name.c_str(), buf.c_str()); @@ -34,7 +34,7 @@ void IRCDProto::SendPartInternal(BotInfo *bi, Channel *chan, const Anope::string send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "PART %s", chan->name.c_str()); } -void IRCDProto::SendGlobopsInternal(BotInfo *source, const Anope::string &buf) +void IRCDProto::SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) { if (source) send_cmd(ircd->ts6 ? source->GetUID() : source->nick, "GLOBOPS :%s", buf.c_str()); @@ -42,7 +42,7 @@ void IRCDProto::SendGlobopsInternal(BotInfo *source, const Anope::string &buf) send_cmd(Config.ServerName, "GLOBOPS :%s", buf.c_str()); } -void IRCDProto::SendCTCPInternal(BotInfo *bi, const Anope::string &dest, const Anope::string &buf) +void IRCDProto::SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf) { Anope::string s = normalizeBuffer(buf); send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "NOTICE %s :\1%s\1", dest.c_str(), s.c_str()); @@ -53,7 +53,7 @@ void IRCDProto::SendNumericInternal(const Anope::string &source, int numeric, co send_cmd(source, "%03d %s %s", numeric, dest.c_str(), buf.c_str()); } -void IRCDProto::SendSVSKill(BotInfo *source, User *user, const char *fmt, ...) +void IRCDProto::SendSVSKill(const BotInfo *source, const User *user, const char *fmt, ...) { if (!user || !fmt) return; @@ -66,7 +66,7 @@ void IRCDProto::SendSVSKill(BotInfo *source, User *user, const char *fmt, ...) SendSVSKillInternal(source, user, buf); } -void IRCDProto::SendMode(BotInfo *bi, Channel *dest, const char *fmt, ...) +void IRCDProto::SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -76,7 +76,7 @@ void IRCDProto::SendMode(BotInfo *bi, Channel *dest, const char *fmt, ...) SendModeInternal(bi, dest, buf); } -void IRCDProto::SendMode(BotInfo *bi, User *u, const char *fmt, ...) +void IRCDProto::SendMode(const BotInfo *bi, const User *u, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -86,7 +86,7 @@ void IRCDProto::SendMode(BotInfo *bi, User *u, const char *fmt, ...) SendModeInternal(bi, u, buf); } -void IRCDProto::SendKick(BotInfo *bi, Channel *chan, User *user, const char *fmt, ...) +void IRCDProto::SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...) { if (!bi || !chan || !user) return; @@ -99,7 +99,7 @@ void IRCDProto::SendKick(BotInfo *bi, Channel *chan, User *user, const char *fmt SendKickInternal(bi, chan, user, buf); } -void IRCDProto::SendNoticeChanops(BotInfo *bi, Channel *dest, const char *fmt, ...) +void IRCDProto::SendNoticeChanops(const BotInfo *bi, const Channel *dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -109,7 +109,7 @@ void IRCDProto::SendNoticeChanops(BotInfo *bi, Channel *dest, const char *fmt, . SendNoticeChanopsInternal(bi, dest, buf); } -void IRCDProto::SendMessage(BotInfo *bi, const Anope::string &dest, const char *fmt, ...) +void IRCDProto::SendMessage(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -119,7 +119,7 @@ void IRCDProto::SendMessage(BotInfo *bi, const Anope::string &dest, const char * SendMessageInternal(bi, dest, buf); } -void IRCDProto::SendNotice(BotInfo *bi, const Anope::string &dest, const char *fmt, ...) +void IRCDProto::SendNotice(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -129,7 +129,7 @@ void IRCDProto::SendNotice(BotInfo *bi, const Anope::string &dest, const char *f SendNoticeInternal(bi, dest, buf); } -void IRCDProto::SendAction(BotInfo *bi, const Anope::string &dest, const char *fmt, ...) +void IRCDProto::SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -140,7 +140,7 @@ void IRCDProto::SendAction(BotInfo *bi, const Anope::string &dest, const char *f SendPrivmsgInternal(bi, dest, actionbuf); } -void IRCDProto::SendPrivmsg(BotInfo *bi, const Anope::string &dest, const char *fmt, ...) +void IRCDProto::SendPrivmsg(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -150,12 +150,12 @@ void IRCDProto::SendPrivmsg(BotInfo *bi, const Anope::string &dest, const char * SendPrivmsgInternal(bi, dest, buf); } -void IRCDProto::SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) +void IRCDProto::SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "NOTICE %s%s :%s", ircd->globaltldprefix, dest->GetName().c_str(), msg.c_str()); } -void IRCDProto::SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) +void IRCDProto::SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "PRIVMSG %s%s :%s", ircd->globaltldprefix, dest->GetName().c_str(), msg.c_str()); } @@ -165,7 +165,7 @@ void IRCDProto::SendQuit(const Anope::string &nick, const Anope::string &) send_cmd(nick, "QUIT"); } -void IRCDProto::SendQuit(BotInfo *bi, const char *fmt, ...) +void IRCDProto::SendQuit(const BotInfo *bi, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -197,12 +197,12 @@ void IRCDProto::SendPong(const Anope::string &servname, const Anope::string &who send_cmd(ircd->ts6 ? TS6SID : Config.ServerName, "PONG %s %s", servname.c_str(), who.c_str()); } -void IRCDProto::SendInvite(BotInfo *bi, const Anope::string &chan, const Anope::string &nick) +void IRCDProto::SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "INVITE %s %s", nick.c_str(), chan.c_str()); } -void IRCDProto::SendPart(BotInfo *bi, Channel *chan, const char *fmt, ...) +void IRCDProto::SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...) { if (fmt) { @@ -217,7 +217,7 @@ void IRCDProto::SendPart(BotInfo *bi, Channel *chan, const char *fmt, ...) SendPartInternal(bi, chan, ""); } -void IRCDProto::SendGlobops(BotInfo *source, const char *fmt, ...) +void IRCDProto::SendGlobops(const BotInfo *source, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; @@ -232,17 +232,17 @@ void IRCDProto::SendSquit(const Anope::string &servname, const Anope::string &me send_cmd("", "SQUIT %s :%s", servname.c_str(), message.c_str()); } -void IRCDProto::SendChangeBotNick(BotInfo *bi, const Anope::string &newnick) +void IRCDProto::SendChangeBotNick(const BotInfo *bi, const Anope::string &newnick) { send_cmd(ircd->ts6 ? bi->GetUID() : bi->nick, "NICK %s %ld", newnick.c_str(), static_cast<long>(time(NULL))); } -void IRCDProto::SendForceNickChange(User *u, const Anope::string &newnick, time_t when) +void IRCDProto::SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) { send_cmd("", "SVSNICK %s %s :%ld", u->nick.c_str(), newnick.c_str(), static_cast<long>(when)); } -void IRCDProto::SendCTCP(BotInfo *bi, const Anope::string &dest, const char *fmt, ...) +void IRCDProto::SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...) { va_list args; char buf[BUFSIZE] = ""; diff --git a/src/users.cpp b/src/users.cpp index 6d1b1fb7f..dd21a1ef9 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -826,6 +826,7 @@ User *do_nick(const Anope::string &source, const Anope::string &nick, const Anop /* If the new nick isnt registerd or its registerd and not yours */ if (!na || na->nc != user->Account()) { + user->RemoveMode(NickServ, UMODE_REGISTERED); ircdproto->SendUnregisteredNick(user); validate_user(user); |