diff options
| author | Adam <Adam@anope.org> | 2013-08-01 13:16:18 +0000 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2013-08-01 13:39:35 +0000 |
| commit | 1e625b6837fdf96616cfc49700aa28d184a7c171 (patch) | |
| tree | 6b6f06deaf769dd6b1a7853f90d26183828986f1 /modules/protocol | |
| parent | 402c624e455d13cc811bef2e8d1639846e892a34 (diff) | |
Use MessageSource as the source for many IRCDProto funcs
Keep track of what user modes are oper only/server only/etc
Diffstat (limited to 'modules/protocol')
| -rw-r--r-- | modules/protocol/bahamut.cpp | 51 | ||||
| -rw-r--r-- | modules/protocol/charybdis.cpp | 22 | ||||
| -rw-r--r-- | modules/protocol/hybrid.cpp | 46 | ||||
| -rw-r--r-- | modules/protocol/inspircd12.cpp | 46 | ||||
| -rw-r--r-- | modules/protocol/inspircd20.cpp | 40 | ||||
| -rw-r--r-- | modules/protocol/ngircd.cpp | 54 | ||||
| -rw-r--r-- | modules/protocol/plexus.cpp | 31 | ||||
| -rw-r--r-- | modules/protocol/ratbox.cpp | 14 | ||||
| -rw-r--r-- | modules/protocol/unreal.cpp | 68 |
9 files changed, 176 insertions, 196 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 162b80e0b..c9ad9c5fd 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -45,33 +45,27 @@ class BahamutIRCdProto : public IRCDProto MaxModes = 60; } - void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { if (Servers::Capab.count("TSMODE") > 0) { - if (source) - UplinkSocket::Message(source) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; - else - UplinkSocket::Message(Me) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; + UplinkSocket::Message(source) << "MODE " << dest->name << " " << dest->creation_time << " " << buf; } else IRCDProto::SendModeInternal(source, dest, buf); } - void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { - if (bi) - UplinkSocket::Message(bi) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; - else - UplinkSocket::Message(Me) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; + UplinkSocket::Message(source) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } @@ -155,9 +149,9 @@ class BahamutIRCdProto : public IRCDProto } /* TOPIC */ - void SendTopic(BotInfo *whosets, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { - UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; + UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } /* UNSQLINE */ @@ -233,12 +227,9 @@ class BahamutIRCdProto : public IRCDProto /* Note: if the stamp is null 0, the below usage is correct of Bahamut */ - void SendSVSKillInternal(const BotInfo *source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override { - if (source) - UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; - else - UplinkSocket::Message() << "SVSKILL " << user->nick << " :" << buf; + UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; } void SendBOB() anope_override @@ -251,7 +242,7 @@ class BahamutIRCdProto : public IRCDProto UplinkSocket::Message() << "BURST 0"; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 0 :" << u->realname; @@ -341,7 +332,7 @@ struct IRCDMessageMode : IRCDMessage { User *u = User::Find(params[0]); if (u) - u->SetModesInternal("%s", params[1].c_str()); + u->SetModesInternal(source, "%s", params[1].c_str()); } } }; @@ -506,14 +497,14 @@ class ProtoBahamut : public Module void AddModes() { /* Add user modes */ - ModeManager::AddUserMode(new UserMode("SERV_ADMIN", 'A')); + ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - ModeManager::AddUserMode(new UserMode("ADMIN", 'a')); + ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - ModeManager::AddUserMode(new UserMode("OPER", 'o')); - ModeManager::AddUserMode(new UserMode("REGISTERED", 'r')); - ModeManager::AddUserMode(new UserMode("SNOMASK", 's')); - ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); + ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); + ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); + ModeManager::AddUserMode(new UserModeOperOnly("WALLOPS", 'w')); ModeManager::AddUserMode(new UserMode("DEAF", 'd')); /* b/e/I */ @@ -532,11 +523,11 @@ class ProtoBahamut : public Module ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm')); ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n')); ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p')); - ModeManager::AddChannelMode(new ChannelModeRegistered('r')); + ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M')); - ModeManager::AddChannelMode(new ChannelModeOper('O')); + ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); } @@ -558,7 +549,7 @@ class ProtoBahamut : public Module void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); IRCD->SendLogout(u); } }; diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index 0ef438b7d..490092a67 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -46,9 +46,9 @@ class CharybdisProto : public IRCDProto MaxModes = 4; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalPrivmsg(bi, dest, msg); } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override { ratbox->SendGlobopsInternal(source, buf); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { ratbox->SendGlobalPrivmsg(bi, dest, msg); } + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { ratbox->SendGlobopsInternal(source, buf); } void SendSGLine(User *u, const XLine *x) anope_override { ratbox->SendSGLine(u, x); } void SendSGLineDel(const XLine *x) anope_override { ratbox->SendSGLineDel(x); } void SendAkill(User *u, XLine *x) anope_override { ratbox->SendAkill(u, x); } @@ -57,7 +57,7 @@ class CharybdisProto : public IRCDProto void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { ratbox->SendJoin(user, c, status); } void SendServer(const Server *server) anope_override { ratbox->SendServer(server); } void SendChannel(Channel *c) anope_override { ratbox->SendChannel(c); } - void SendTopic(BotInfo *bi, Channel *c) anope_override { ratbox->SendTopic(bi, c); } + void SendTopic(const MessageSource &source, Channel *c) anope_override { ratbox->SendTopic(source, c); } void SendSQLine(User *, const XLine *x) anope_override { @@ -105,7 +105,7 @@ class CharybdisProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 6 0 :" << Anope::CurTime; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "EUID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " * * :" << u->realname; @@ -124,7 +124,7 @@ class CharybdisProto : public IRCDProto UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } - void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override { UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " RSFNC " << u->GetUID() << " " << newnick << " " << when << " " << u->timestamp; @@ -362,13 +362,13 @@ class ProtoCharybdis : public Module void AddModes() { /* Add user modes */ - ModeManager::AddUserMode(new UserMode("DEAF", 'D')); + ModeManager::AddUserMode(new UserModeOperOnly("DEAF", 'D')); ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - ModeManager::AddUserMode(new UserMode("SSL", 'Z')); - ModeManager::AddUserMode(new UserMode("LOCOPS", 'l')); - ModeManager::AddUserMode(new UserMode("OPERWALLS", 'z')); - ModeManager::AddUserMode(new UserMode("PROTECTED", 'S')); + ModeManager::AddUserMode(new UserModeNoone("SSL", 'Z')); + ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); + ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z')); + ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'S')); ModeManager::AddUserMode(new UserMode("NOFORWARD", 'Q')); // charybdis has no usermode for registered users diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 41c1a37f1..07977b961 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -30,17 +30,17 @@ class HybridProto : public IRCDProto MaxModes = 4; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "NOTICE $$" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "PRIVMSG $$" << dest->GetName() << " :" << msg; } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { UplinkSocket::Message(source) << "GLOBOPS :" << buf; } @@ -186,7 +186,7 @@ class HybridProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); @@ -199,12 +199,9 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "EOB"; } - void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { - if (bi) - UplinkSocket::Message(bi) << "SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; - else - UplinkSocket::Message(Me) << "SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; + UplinkSocket::Message(source) << "SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } void SendLogin(User *u) anope_override @@ -227,8 +224,9 @@ class HybridProto : public IRCDProto UplinkSocket::Message() << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :"; } - void SendTopic(BotInfo *bi, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { + BotInfo *bi = source.GetBot(); bool needjoin = c->FindUser(bi) == NULL; if (needjoin) @@ -239,13 +237,13 @@ class HybridProto : public IRCDProto bi->Join(c, &status); } - IRCDProto::SendTopic(bi, c); + IRCDProto::SendTopic(source, c); if (needjoin) bi->Part(c); } - void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override { UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick << " " << when; } @@ -440,7 +438,7 @@ struct IRCDMessageSVSMode : IRCDMessage if (!params[1].is_pos_number_only() || convertTo<time_t>(params[1]) != u->timestamp) return; - u->SetModesInternal("%s", params[2].c_str()); + u->SetModesInternal(source, "%s", params[2].c_str()); } }; @@ -569,19 +567,19 @@ class ProtoHybrid : public Module void AddModes() { /* Add user modes */ - ModeManager::AddUserMode(new UserMode("ADMIN", 'a')); - ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); + ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a')); + ModeManager::AddUserMode(new UserModeOperOnly("CALLERID", 'g')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - ModeManager::AddUserMode(new UserMode("LOCOPS", 'l')); + ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); ModeManager::AddUserMode(new UserMode("OPER", 'o')); - ModeManager::AddUserMode(new UserMode("REGISTERED", 'r')); - ModeManager::AddUserMode(new UserMode("SNOMASK", 's')); + ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); + ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); - ModeManager::AddUserMode(new UserMode("OPERWALLS", 'z')); + ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z')); ModeManager::AddUserMode(new UserMode("DEAF", 'D')); - ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H')); + ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - ModeManager::AddUserMode(new UserMode("SSL", 'S')); + ModeManager::AddUserMode(new UserModeNoone("SSL", 'S')); /* b/e/I */ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b')); @@ -603,10 +601,10 @@ class ProtoHybrid : public Module ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm')); ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n')); ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p')); - ModeManager::AddChannelMode(new ChannelModeRegistered('r')); + ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); - ModeManager::AddChannelMode(new ChannelModeOper('O')); + ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M')); ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); ModeManager::AddChannelMode(new ChannelMode("SSL", 'S')); @@ -629,7 +627,7 @@ public: void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } }; diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index ca8fdc608..c4254537a 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -43,10 +43,10 @@ class ChannelModeFlood : public ChannelModeParam class InspIRCd12Proto : public IRCDProto { private: - void SendSVSKillInternal(const BotInfo *source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override { IRCDProto::SendSVSKillInternal(source, user, buf); - user->KillInternal(source ? source->nick : Me->GetName(), buf); + user->KillInternal(source, buf); } void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent) @@ -91,12 +91,12 @@ class InspIRCd12Proto : public IRCDProto MaxModes = 20; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } @@ -119,7 +119,7 @@ class InspIRCd12Proto : public IRCDProto SendDelLine("G", x->mask); } - void SendTopic(BotInfo *whosets, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { if (Servers::Capab.count("SVSTOPIC")) { @@ -132,7 +132,7 @@ class InspIRCd12Proto : public IRCDProto if (c->topic_time > ts) ts = Anope::CurTime; /* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */ - UplinkSocket::Message(whosets) << "FTOPIC " << c->name << " " << ts << " " << c->topic_setter << " :" << c->topic; + UplinkSocket::Message(source) << "FTOPIC " << c->name << " " << ts << " " << c->topic_setter << " :" << c->topic; } } @@ -206,12 +206,12 @@ class InspIRCd12Proto : public IRCDProto UplinkSocket::Message() << "PUSH " << dest << " ::" << Me->GetName() << " " << numeric << " " << dest << " " << buf; } - void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname; @@ -319,12 +319,12 @@ class InspIRCd12Proto : public IRCDProto SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason()); } - void SendSVSJoin(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &) anope_override + void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) anope_override { UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; } - void SendSVSPart(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override { if (!param.empty()) UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; @@ -332,7 +332,7 @@ class InspIRCd12Proto : public IRCDProto UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; } - void SendSWhois(const BotInfo *, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) anope_override { User *u = User::Find(who); @@ -349,7 +349,7 @@ class InspIRCd12Proto : public IRCDProto UplinkSocket::Message(Me) << "ENDBURST"; } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) + void SendGlobopsInternal(BotInfo *source, const Anope::string &buf) { if (Servers::Capab.count("GLOBOPS")) UplinkSocket::Message(source) << "SNONOTICE g :" << buf; @@ -577,7 +577,7 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N')); continue; case 'O': - ModeManager::AddChannelMode(new ChannelModeOper('O')); + ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); continue; case 'P': ModeManager::AddChannelMode(new ChannelMode("PERM", 'P')); @@ -610,7 +610,7 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p')); continue; case 'r': - ModeManager::AddChannelMode(new ChannelModeRegistered('r')); + ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); continue; case 's': ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); @@ -642,7 +642,7 @@ struct IRCDMessageCapab : Message::Capab switch (modebuf[t]) { case 'h': - ModeManager::AddUserMode(new UserMode("HELPOP", 'h')); + ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h')); continue; case 'B': ModeManager::AddUserMode(new UserMode("BOT", 'B')); @@ -651,13 +651,13 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddUserMode(new UserMode("FILTER", 'G')); continue; case 'H': - ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H')); + ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); continue; case 'I': ModeManager::AddUserMode(new UserMode("PRIV", 'I')); continue; case 'Q': - ModeManager::AddUserMode(new UserMode("HIDDEN", 'Q')); + ModeManager::AddUserMode(new UserModeOperOnly("HIDDEN", 'Q')); continue; case 'R': ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); @@ -678,13 +678,13 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddUserMode(new UserMode("INVIS", 'i')); continue; case 'k': - ModeManager::AddUserMode(new UserMode("PROTECTED", 'k')); + ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'k')); continue; case 'o': - ModeManager::AddUserMode(new UserMode("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); continue; case 'r': - ModeManager::AddUserMode(new UserMode("REGISTERED", 'r')); + ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); continue; case 'w': ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); @@ -1008,7 +1008,7 @@ struct IRCDMessageIdle : IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { - const BotInfo *bi = BotInfo::Find(params[0]); + BotInfo *bi = BotInfo::Find(params[0]); if (bi) UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg); } @@ -1145,7 +1145,7 @@ struct IRCDMessageMode : IRCDMessage // if it's still null, drop it like fire. // most likely situation was that server introduced a nick which we subsequently akilled if (u) - u->SetModesInternal("%s", params[1].c_str()); + u->SetModesInternal(source, "%s", params[1].c_str()); } } }; @@ -1170,7 +1170,7 @@ struct IRCDMessageOperType : IRCDMessage dont do this directly */ User *u = source.GetUser(); if (!u->HasMode("OPER")) - u->SetModesInternal("+o"); + u->SetModesInternal(source, "+o"); } }; diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index d4fac12aa..34e87935a 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -42,16 +42,16 @@ class InspIRCd20Proto : public IRCDProto insp12->SendConnect(); } - void SendSVSKillInternal(const BotInfo *source, User *user, const Anope::string &buf) anope_override { insp12->SendSVSKillInternal(source, user, buf); } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalPrivmsg(bi, dest, msg); } + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override { insp12->SendSVSKillInternal(source, user, buf); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { insp12->SendGlobalPrivmsg(bi, dest, msg); } void SendAkillDel(const XLine *x) anope_override { insp12->SendAkillDel(x); } - void SendTopic(BotInfo *whosets, Channel *c) anope_override { insp12->SendTopic(whosets, c); }; + void SendTopic(const MessageSource &whosets, Channel *c) anope_override { insp12->SendTopic(whosets, c); }; void SendVhostDel(User *u) anope_override { insp12->SendVhostDel(u); } void SendAkill(User *u, XLine *x) anope_override { insp12->SendAkill(u, x); } void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf) anope_override { insp12->SendNumericInternal(numeric, dest, buf); } - void SendModeInternal(const BotInfo *source, const Channel *dest, const Anope::string &buf) anope_override { insp12->SendModeInternal(source, dest, buf); } - void SendClientIntroduction(const User *u) anope_override { insp12->SendClientIntroduction(u); } + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { insp12->SendModeInternal(source, dest, buf); } + void SendClientIntroduction(User *u) anope_override { insp12->SendClientIntroduction(u); } void SendServer(const Server *server) anope_override { insp12->SendServer(server); } void SendSquit(Server *s, const Anope::string &message) anope_override { insp12->SendSquit(s, message); } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { insp12->SendJoin(user, c, status); } @@ -62,12 +62,12 @@ class InspIRCd20Proto : public IRCDProto void SendSVSHoldDel(const Anope::string &nick) anope_override { insp12->SendSVSHoldDel(nick); } void SendSZLineDel(const XLine *x) anope_override { insp12->SendSZLineDel(x); } void SendSZLine(User *u, const XLine *x) anope_override { insp12->SendSZLine(u, x); } - void SendSVSJoin(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string &other) anope_override { insp12->SendSVSJoin(source, u, chan, other); } - void SendSVSPart(const BotInfo *source, const User *u, const Anope::string &chan, const Anope::string ¶m) anope_override { insp12->SendSVSPart(source, u, chan, param); } - void SendSWhois(const BotInfo *bi, const Anope::string &who, const Anope::string &mask) anope_override { insp12->SendSWhois(bi, who, mask); } + void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) anope_override { insp12->SendSVSJoin(source, u, chan, other); } + void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) anope_override { insp12->SendSVSPart(source, u, chan, param); } + void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) anope_override { insp12->SendSWhois(bi, who, mask); } void SendBOB() anope_override { insp12->SendBOB(); } void SendEOB() anope_override { insp12->SendEOB(); } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) { insp12->SendGlobopsInternal(source, buf); } + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) { insp12->SendGlobopsInternal(source, buf); } void SendLogin(User *u) anope_override { insp12->SendLogin(u); } void SendLogout(User *u) anope_override { insp12->SendLogout(u); } void SendChannel(Channel *c) anope_override { insp12->SendChannel(c); } @@ -313,7 +313,7 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("blockcolor")) cm = new ChannelMode("BLOCKCOLOR", modechar[0]); else if (modename.equals_cs("c_registered")) - cm = new ChannelModeRegistered(modechar[0]); + cm = new ChannelModeNoone("REGISTERED", modechar[0]); else if (modename.equals_cs("censor")) cm = new ChannelMode("FILTER", modechar[0]); else if (modename.equals_cs("delayjoin")) @@ -361,7 +361,7 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("op")) cm = new ChannelModeStatus("OP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2); else if (modename.equals_cs("operonly")) - cm = new ChannelModeOper(modechar[0]); + cm = new ChannelModeOperOnly("OPERONLY", modechar[0]); else if (modename.equals_cs("permanent")) cm = new ChannelMode("PERM", modechar[0]); else if (modename.equals_cs("private")) @@ -415,30 +415,30 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("deaf_commonchan")) um = new UserMode("COMMONCHANS", modechar[0]); else if (modename.equals_cs("helpop")) - um = new UserMode("HELPOP", modechar[0]); + um = new UserModeOperOnly("HELPOP", modechar[0]); else if (modename.equals_cs("hidechans")) um = new UserMode("PRIV", modechar[0]); else if (modename.equals_cs("hideoper")) - um = new UserMode("HIDEOPER", modechar[0]); + um = new UserModeOperOnly("HIDEOPER", modechar[0]); else if (modename.equals_cs("invisible")) um = new UserMode("INVIS", modechar[0]); else if (modename.equals_cs("invis-oper")) - um = new UserMode("INVISIBLE_OPER", modechar[0]); + um = new UserModeOperOnly("INVISIBLE_OPER", modechar[0]); else if (modename.equals_cs("oper")) - um = new UserMode("OPER", modechar[0]); + um = new UserModeOperOnly("OPER", modechar[0]); else if (modename.equals_cs("regdeaf")) um = new UserMode("REGPRIV", modechar[0]); else if (modename.equals_cs("servprotect")) { - um = new UserMode("PROTECTED", modechar[0]); - IRCD->DefaultPseudoclientModes += "k"; + um = new UserModeNoone("PROTECTED", modechar[0]); + IRCD->DefaultPseudoclientModes += modechar; } else if (modename.equals_cs("showwhois")) um = new UserMode("WHOIS", modechar[0]); else if (modename.equals_cs("u_censor")) um = new UserMode("FILTER", modechar[0]); else if (modename.equals_cs("u_registered")) - um = new UserMode("REGISTERED", modechar[0]); + um = new UserModeNoone("REGISTERED", modechar[0]); else if (modename.equals_cs("u_stripcolor")) um = new UserMode("STRIPCOLOR", modechar[0]); else if (modename.equals_cs("wallops")) @@ -751,7 +751,7 @@ class ProtoInspIRCd : public Module void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } void OnChannelSync(Channel *c) anope_override diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 0b76cddb8..d5513aab7 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -45,7 +45,7 @@ class ngIRCdProto : public IRCDProto } // Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "NICK " << u->nick << " 1 " << u->GetIdent() << " " << u->host << " 1 " << modes << " :" << u->realname; @@ -60,27 +60,24 @@ class ngIRCdProto : public IRCDProto this->SendNumeric(376, "*", ":End of MOTD command"); } - void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override { UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { - if (source) - UplinkSocket::Message(source) << "WALLOPS :" << buf; - else - UplinkSocket::Message(Me) << "WALLOPS :" << buf; + UplinkSocket::Message(source) << "WALLOPS :" << buf; } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override @@ -103,32 +100,29 @@ class ngIRCdProto : public IRCDProto } } - void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf) anope_override + void SendKickInternal(const MessageSource &source, const Channel *chan, User *user, const Anope::string &buf) anope_override { if (!buf.empty()) - UplinkSocket::Message(bi) << "KICK " << chan->name << " " << user->nick << " :" << buf; + UplinkSocket::Message(source) << "KICK " << chan->name << " " << user->nick << " :" << buf; else - UplinkSocket::Message(bi) << "KICK " << chan->name << " " << user->nick; + UplinkSocket::Message(source) << "KICK " << chan->name << " " << user->nick; } void SendLogin(User *u) anope_override { } void SendLogout(User *u) anope_override { } - void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { - if (bi) - UplinkSocket::Message(bi) << "MODE " << dest->name << " " << buf; - else - UplinkSocket::Message(Me) << "MODE " << dest->name << " " << buf; + UplinkSocket::Message(source) << "MODE " << dest->name << " " << buf; } - void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) anope_override + void SendPartInternal(User *u, const Channel *chan, const Anope::string &buf) anope_override { if (!buf.empty()) - UplinkSocket::Message(bi) << "PART " << chan->name << " :" << buf; + UplinkSocket::Message(u) << "PART " << chan->name << " :" << buf; else - UplinkSocket::Message(bi) << "PART " << chan->name; + UplinkSocket::Message(u) << "PART " << chan->name; } /* SERVER name hop descript */ @@ -137,9 +131,9 @@ class ngIRCdProto : public IRCDProto UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); } - void SendTopic(BotInfo *bi, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { - UplinkSocket::Message(bi) << "TOPIC " << c->name << " :" << c->topic; + UplinkSocket::Message(source) << "TOPIC " << c->name << " :" << c->topic; } void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) anope_override @@ -382,7 +376,7 @@ struct IRCDMessageMode : IRCDMessage User *u = User::Find(params[0]); if (u) - u->SetModesInternal("%s", params[1].c_str()); + u->SetModesInternal(source, "%s", params[1].c_str()); } } }; @@ -604,11 +598,11 @@ class ProtongIRCd : public Module ModeManager::AddUserMode(new UserMode("BOT", 'B')); ModeManager::AddUserMode(new UserMode("COMMONCHANS", 'C')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - ModeManager::AddUserMode(new UserMode("OPER", 'o')); - ModeManager::AddUserMode(new UserMode("PROTECTED", 'q')); - ModeManager::AddUserMode(new UserMode("RESTRICTED", 'r')); - ModeManager::AddUserMode(new UserMode("REGISTERED", 'R')); - ModeManager::AddUserMode(new UserMode("SNOMASK", 's')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'q')); + ModeManager::AddUserMode(new UserModeOperOnly("RESTRICTED", 'r')); + ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'R')); + ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); ModeManager::AddUserMode(new UserMode("CLOAK", 'x')); @@ -634,7 +628,7 @@ class ProtongIRCd : public Module ModeManager::AddChannelMode(new ChannelMode("OPERONLY", 'O')); ModeManager::AddChannelMode(new ChannelMode("PERM", 'P')); ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q')); - ModeManager::AddChannelMode(new ChannelModeRegistered('r')); + ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); ModeManager::AddChannelMode(new ChannelMode("SECRET", 's')); ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't')); @@ -663,7 +657,7 @@ class ProtongIRCd : public Module void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); } }; diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 91a588f5a..1839b1fb9 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -34,9 +34,9 @@ class PlexusProto : public IRCDProto MaxModes = 4; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override { hybrid->SendGlobopsInternal(source, buf); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { hybrid->SendGlobopsInternal(source, buf); } void SendSQLine(User *u, const XLine *x) anope_override { hybrid->SendSQLine(u, x); } void SendSQLineDel(const XLine *x) anope_override { hybrid->SendSQLineDel(x); } void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); } @@ -68,7 +68,7 @@ class PlexusProto : public IRCDProto } } - void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override + void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_override { UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; } @@ -125,15 +125,15 @@ class PlexusProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; } - void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; + UplinkSocket::Message(source) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } void SendLogin(User *u) anope_override @@ -149,17 +149,17 @@ class PlexusProto : public IRCDProto UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } - void SendTopic(BotInfo *bi, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { - UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; + UplinkSocket::Message(source) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } - void SendSVSJoin(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSJOIN " << user->GetUID() << " " << chan; } - void SendSVSPart(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSPART " << user->GetUID() << " " << chan; } @@ -325,15 +325,12 @@ class ProtoPlexus : public Module /* Add user modes */ ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("HIDEOPER")); ModeManager::AddUserMode(new UserMode("NOCTCP", 'C')); - ModeManager::AddUserMode(new UserMode("DEAF", 'D')); ModeManager::AddUserMode(new UserMode("SOFTCALLERID", 'G')); - ModeManager::AddUserMode(new UserMode("NETADMIN", 'N')); - ModeManager::AddUserMode(new UserMode("SSL", 'S')); - ModeManager::AddUserMode(new UserMode("WEBIRC", 'W')); - ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); + ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N')); + ModeManager::AddUserMode(new UserModeNoone("WEBIRC", 'W')); ModeManager::AddUserMode(new UserMode("PRIV", 'p')); ModeManager::AddUserMode(new UserMode("CLOAK", 'x')); - ModeManager::AddUserMode(new UserMode("PROTECTED", 'U')); + ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'U')); /* v/h/o/a/q */ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3)); diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 570448db2..98b7bae6c 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -28,9 +28,9 @@ class RatboxProto : public IRCDProto MaxModes = 4; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } - void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override { hybrid->SendGlobopsInternal(source, buf); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override { hybrid->SendGlobopsInternal(source, buf); } void SendSQLine(User *u, const XLine *x) anope_override { hybrid->SendSQLine(u, x); } void SendSGLine(User *u, const XLine *x) anope_override { hybrid->SendSGLine(u, x); } void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); } @@ -39,9 +39,9 @@ class RatboxProto : public IRCDProto void SendSQLineDel(const XLine *x) anope_override { hybrid->SendSQLineDel(x); } void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { hybrid->SendJoin(user, c, status); } void SendServer(const Server *server) anope_override { hybrid->SendServer(server); } - void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override { hybrid->SendModeInternal(bi, u, buf); } + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { hybrid->SendModeInternal(source, u, buf); } void SendChannel(Channel *c) anope_override { hybrid->SendChannel(c); } - void SendTopic(BotInfo *bi, Channel *c) anope_override { hybrid->SendTopic(bi, c); } + void SendTopic(const MessageSource &source, Channel *c) anope_override { hybrid->SendTopic(source, c); } void SendConnect() anope_override { @@ -70,7 +70,7 @@ class RatboxProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 3 0 :" << Anope::CurTime; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname; @@ -221,7 +221,7 @@ class ProtoRatbox : public Module ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("HIDEOPER")); ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("REGPRIV")); ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("SSL")); - ModeManager::AddUserMode(new UserMode("PROTECTED", 'S')); + ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'S')); /* v/h/o/a/q */ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("HALFOP")); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 0f4147554..2da4af3e8 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -58,17 +58,17 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; } - void SendTopic(BotInfo *whosets, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) anope_override { - UplinkSocket::Message(whosets) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; + UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; } - void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; } - void SendGlobalPrivmsg(const BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; } @@ -126,18 +126,18 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason(); } - void SendSVSKillInternal(const BotInfo *source, User *user, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) anope_override { UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; - user->KillInternal(source ? source->nick : Me->GetName(), buf); + user->KillInternal(source, buf); } - void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override { - UplinkSocket::Message(bi) << "SVS2MODE " << u->nick <<" " << buf; + UplinkSocket::Message(source) << "SVS2MODE " << u->nick <<" " << buf; } - void SendClientIntroduction(const User *u) anope_override + void SendClientIntroduction(User *u) anope_override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 " << modes << " " << u->host << " * :" << u->realname; @@ -197,7 +197,7 @@ class UnrealIRCdProto : public IRCDProto ** parv[1] = nick ** parv[2] = options */ - void SendSVSO(const BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override + void SendSVSO(BotInfo *source, const Anope::string &nick, const Anope::string &flag) anope_override { UplinkSocket::Message(source) << "SVSO " << nick << " " << flag; } @@ -294,7 +294,7 @@ class UnrealIRCdProto : public IRCDProto /* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken when coming from a none TOKEN'd server */ - void SendSVSJoin(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override { if (!param.empty()) UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param; @@ -302,7 +302,7 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message(source) << "SVSJOIN " << user->GetUID() << " " << chan; } - void SendSVSPart(const BotInfo *source, const User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override { if (!param.empty()) UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan << " :" << param; @@ -310,7 +310,7 @@ class UnrealIRCdProto : public IRCDProto UplinkSocket::Message(source) << "SVSPART " << user->GetUID() << " " << chan; } - void SendSWhois(const BotInfo *source, const Anope::string &who, const Anope::string &mask) anope_override + void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) anope_override { UplinkSocket::Message(source) << "SWHOIS " << who << " :" << mask; } @@ -600,7 +600,7 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i')); continue; case 'r': - ModeManager::AddChannelMode(new ChannelModeRegistered('r')); + ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r')); continue; case 'R': ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R')); @@ -609,10 +609,10 @@ struct IRCDMessageCapab : Message::Capab ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c')); continue; case 'O': - ModeManager::AddChannelMode(new ChannelModeOper('O')); + ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O')); continue; case 'A': - ModeManager::AddChannelMode(new ChannelModeAdmin('A')); + ModeManager::AddChannelMode(new ChannelModeOperOnly("ADMINONLY", 'A')); continue; case 'Q': ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q')); @@ -727,7 +727,7 @@ struct IRCDMessageMode : IRCDMessage { User *u = User::Find(params[0]); if (u) - u->SetModesInternal("%s", params[1].c_str()); + u->SetModesInternal(source, "%s", params[1].c_str()); } } }; @@ -1108,7 +1108,7 @@ struct IRCDMessageUmode2 : IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { - source.GetUser()->SetModesInternal("%s", params[0].c_str()); + source.GetUser()->SetModesInternal(source, "%s", params[0].c_str()); } }; @@ -1166,32 +1166,32 @@ class ProtoUnreal : public Module ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '*', 4)); /* Add user modes */ - ModeManager::AddUserMode(new UserMode("SERV_ADMIN", 'A')); + ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A')); ModeManager::AddUserMode(new UserMode("BOT", 'B')); - ModeManager::AddUserMode(new UserMode("CO_ADMIN", 'C')); + ModeManager::AddUserMode(new UserModeOperOnly("CO_ADMIN", 'C')); ModeManager::AddUserMode(new UserMode("FILTER", 'G')); - ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H')); + ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H')); ModeManager::AddUserMode(new UserMode("HIDEIDLE", 'I')); - ModeManager::AddUserMode(new UserMode("NETADMIN", 'N')); + ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); - ModeManager::AddUserMode(new UserMode("PROTECTED", 'S')); + ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'S')); ModeManager::AddUserMode(new UserMode("NOCTCP", 'T')); ModeManager::AddUserMode(new UserMode("WEBTV", 'V')); - ModeManager::AddUserMode(new UserMode("WHOIS", 'W')); - ModeManager::AddUserMode(new UserMode("ADMIN", 'a')); + ModeManager::AddUserMode(new UserModeOperOnly("WHOIS", 'W')); + ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a')); ModeManager::AddUserMode(new UserMode("DEAF", 'd')); - ModeManager::AddUserMode(new UserMode("GLOBOPS", 'g')); - ModeManager::AddUserMode(new UserMode("HELPOP", 'h')); + ModeManager::AddUserMode(new UserModeOperOnly("GLOBOPS", 'g')); + ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); - ModeManager::AddUserMode(new UserMode("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); ModeManager::AddUserMode(new UserMode("PRIV", 'p')); - ModeManager::AddUserMode(new UserMode("GOD", 'q')); - ModeManager::AddUserMode(new UserMode("REGISTERED", 'r')); - ModeManager::AddUserMode(new UserMode("SNOMASK", 's')); - ModeManager::AddUserMode(new UserMode("VHOST", 't')); + ModeManager::AddUserMode(new UserModeOperOnly("GOD", 'q')); + ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); + ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); + ModeManager::AddUserMode(new UserModeNoone("VHOST", 't')); ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); ModeManager::AddUserMode(new UserMode("CLOAK", 'x')); - ModeManager::AddUserMode(new UserMode("SSL", 'z')); + ModeManager::AddUserMode(new UserModeNoone("SSL", 'z')); } public: @@ -1221,7 +1221,7 @@ class ProtoUnreal : public Module void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); if (Servers::Capab.count("ESVID") == 0) IRCD->SendLogout(u); } |
