summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-08-01 13:16:18 +0000
committerAdam <Adam@anope.org>2013-08-01 13:39:35 +0000
commit1e625b6837fdf96616cfc49700aa28d184a7c171 (patch)
tree6b6f06deaf769dd6b1a7853f90d26183828986f1 /modules/protocol
parent402c624e455d13cc811bef2e8d1639846e892a34 (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.cpp51
-rw-r--r--modules/protocol/charybdis.cpp22
-rw-r--r--modules/protocol/hybrid.cpp46
-rw-r--r--modules/protocol/inspircd12.cpp46
-rw-r--r--modules/protocol/inspircd20.cpp40
-rw-r--r--modules/protocol/ngircd.cpp54
-rw-r--r--modules/protocol/plexus.cpp31
-rw-r--r--modules/protocol/ratbox.cpp14
-rw-r--r--modules/protocol/unreal.cpp68
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 &param) anope_override
+ void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) 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> &params) 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 &param) 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 &param) 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) <