diff options
Diffstat (limited to 'modules')
29 files changed, 203 insertions, 221 deletions
diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp index 94186c13b..c0f702a94 100644 --- a/modules/commands/bs_control.cpp +++ b/modules/commands/bs_control.cpp @@ -55,7 +55,7 @@ class CommandBSSay : public Command return; } - IRCD->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str()); + IRCD->SendPrivmsg(*ci->bi, ci->name, "%s", text.c_str()); ci->bi->lastmsg = Anope::CurTime; bool override = !source.AccessFor(ci).HasPriv("SAY"); @@ -113,7 +113,7 @@ class CommandBSAct : public Command if (message.empty()) return; - IRCD->SendAction(ci->bi, ci->name, "%s", message.c_str()); + IRCD->SendAction(*ci->bi, ci->name, "%s", message.c_str()); ci->bi->lastmsg = Anope::CurTime; bool override = !source.AccessFor(ci).HasPriv("SAY"); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 7fa7d3c7a..c3f40c799 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -351,7 +351,7 @@ class CSSeen : public Module UpdateUser(u, PART, u->nick, "", channel, msg); } - void OnPreUserKicked(MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) anope_override + void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &msg) anope_override { UpdateUser(cu->user, KICK, cu->user->nick, source.GetSource(), cu->chan->name, msg); } diff --git a/modules/commands/greet.cpp b/modules/commands/greet.cpp index dd3fce66f..90f263557 100644 --- a/modules/commands/greet.cpp +++ b/modules/commands/greet.cpp @@ -188,7 +188,7 @@ class Greet : public Module Anope::string *greet = ns_greet.Get(user->Account()); if (bs_greet.HasExt(c->ci) && greet != NULL && !greet->empty() && c->FindUser(c->ci->bi) && c->ci->AccessFor(user).HasPriv("GREET")) { - IRCD->SendPrivmsg(c->ci->bi, c->name, "[%s] %s", user->Account()->display.c_str(), greet->c_str()); + IRCD->SendPrivmsg(*c->ci->bi, c->name, "[%s] %s", user->Account()->display.c_str(), greet->c_str()); c->ci->bi->lastmsg = Anope::CurTime; } } diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index fd19590e8..abe3d314b 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -11,7 +11,7 @@ #include "module.h" -static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi); +static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi); class CommandNSConfirm : public Command { @@ -381,7 +381,7 @@ class NSRegister : public Module } }; -static bool SendRegmail(User *u, const NickAlias *na, const BotInfo *bi) +static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi) { NickCore *nc = na->nc; diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index 871864b6d..6af3af0c2 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -11,7 +11,7 @@ #include "module.h" -static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi); +static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi); class CommandNSResetPass : public Command { @@ -112,7 +112,7 @@ class NSResetPass : public Module } }; -static bool SendResetEmail(User *u, const NickAlias *na, const BotInfo *bi) +static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi) { int min = 1, max = 62; int chars[] = { diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index df35f0582..83c03924d 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -367,7 +367,7 @@ class CommandNSSASetDisplay : public CommandNSSetDisplay class CommandNSSetEmail : public Command { - static bool SendConfirmMail(User *u, const BotInfo *bi, const Anope::string &new_email) + static bool SendConfirmMail(User *u, BotInfo *bi, const Anope::string &new_email) { int chars[] = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 6ea3ab71b..45a857474 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -65,6 +65,8 @@ struct NSMiscData : Serializable ExtensibleItem<NSMiscData> *item = GetItem(sname); if (item) d = item->Set(nc, NSMiscData(nc, sname, sdata)); + else + d = NULL; } return d; diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 58d18558b..1a335bc04 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -284,7 +284,7 @@ class OSDefcon : public Module if ((cm = ModeManager::FindChannelModeByChar(mode))) { - if (cm->type == MODE_STATUS || cm->type == MODE_LIST || !cm->CanSet(NULL)) + if (cm->type == MODE_STATUS || cm->type == MODE_LIST) { Log(this) << "DefConChanModes mode character '" << mode << "' cannot be locked"; continue; diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index cb6a9fcfa..bdff3c5eb 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -387,7 +387,7 @@ class OSNews : public Module { } - void OnUserModeSet(User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override { if (mname == "OPER") DisplayNews(u, NEWS_OPER); diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp index 0b5dc74d9..cae4d6f68 100644 --- a/modules/commands/os_noop.cpp +++ b/modules/commands/os_noop.cpp @@ -85,7 +85,7 @@ class OSNOOP : public Module } - void OnUserModeSet(User *u, const Anope::string &mname) anope_override + void OnUserModeSet(const MessageSource &, User *u, const Anope::string &mname) anope_override { Anope::string *setter; if (mname == "OPER" && (setter = noop.Get(u->server))) diff --git a/modules/commands/os_svs.cpp b/modules/commands/os_svs.cpp index 4e9a31e6b..1c492579c 100644 --- a/modules/commands/os_svs.cpp +++ b/modules/commands/os_svs.cpp @@ -99,7 +99,7 @@ class CommandOSSVSJoin : public Command source.Reply(_("\002%s\002 is already in \002%s\002."), target->nick.c_str(), c->name.c_str()); else { - IRCD->SendSVSJoin(source.service, target, params[1], ""); + IRCD->SendSVSJoin(*source.service, target, params[1], ""); Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1]; source.Reply(_("\002%s\002 has been joined to \002%s\002."), target->nick.c_str(), params[1].c_str()); } @@ -143,7 +143,7 @@ class CommandOSSVSPart : public Command source.Reply(_("\002%s\002 is not in \002%s\002."), target->nick.c_str(), c->name.c_str()); else { - IRCD->SendSVSPart(source.service, target, params[1], ""); + IRCD->SendSVSPart(*source.service, target, params[1], ""); Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; source.Reply(_("\002%s\002 has been parted from \002%s\002."), target->nick.c_str(), c->name.c_str()); } diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp index 7f8adb60e..c772a28a0 100644 --- a/modules/extra/m_proxyscan.cpp +++ b/modules/extra/m_proxyscan.cpp @@ -341,7 +341,7 @@ class ModuleProxyScan : public Module if (!this->con_notice.empty() && !this->con_source.empty()) { - const BotInfo *bi = BotInfo::Find(this->con_source); + BotInfo *bi = BotInfo::Find(this->con_source); if (bi) user->SendMessage(bi, this->con_notice); } diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp index c1db97603..17dd8b96f 100644 --- a/modules/extra/m_xmlrpc_main.cpp +++ b/modules/extra/m_xmlrpc_main.cpp @@ -91,7 +91,7 @@ class MyXMLRPCEvent : public XMLRPCEvent XMLRPCommandReply(Anope::string &s) : str(s) { } - void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override + void SendMessage(BotInfo *, const Anope::string &msg) anope_override { str += msg + "\n"; }; diff --git a/modules/extra/webcpanel/webcpanel.cpp b/modules/extra/webcpanel/webcpanel.cpp index c8926a150..f92dda579 100644 --- a/modules/extra/webcpanel/webcpanel.cpp +++ b/modules/extra/webcpanel/webcpanel.cpp @@ -247,7 +247,7 @@ namespace WebPanel MyComandReply(TemplateFileServer::Replacements &_r, const Anope::string &_k) : re(_r), k(_k) { } - void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override + void SendMessage(BotInfo *source, const Anope::string &msg) anope_override { re[k] = msg; } 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 { |
