From 72b26043b2f1729a2d183b01310747303fe385fd Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 18 Apr 2014 02:21:06 -0400 Subject: Remove unused event. Mark some oper only usermodes as oper only. Fix reading SID in TS6_SID_Retrieve --- modules/protocol/hybrid.cpp | 2 +- modules/protocol/plexus.cpp | 4 ++-- modules/protocol/ratbox.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 9d928a106..84f7db001 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -610,7 +610,7 @@ class ProtoHybrid : public Module ModeManager::AddUserMode(new UserModeOperOnly("CALLERID", 'g')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); - ModeManager::AddUserMode(new UserMode("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); ModeManager::AddUserMode(new UserMode("WALLOPS", 'w')); diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 0770d20a4..04d90be7e 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -333,10 +333,10 @@ class ProtoPlexus : public Module ModeManager::AddUserMode(new UserMode("CALLERID", 'g')); ModeManager::AddUserMode(new UserMode("INVIS", 'i')); ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); - ModeManager::AddUserMode(new UserMode("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N')); ModeManager::AddUserMode(new UserMode("PRIV", 'p')); - ModeManager::AddUserMode(new UserMode("ROUTING", 'q')); + ModeManager::AddUserMode(new UserModeOperOnly("ROUTING", 'q')); ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r')); ModeManager::AddUserMode(new UserMode("REGPRIV", 'R')); ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 89e0f0176..8fd9a30cf 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -253,7 +253,7 @@ class ProtoRatbox : public Module // k = skill? ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l')); // n = nchange - ModeManager::AddUserMode(new UserMode("OPER", 'o')); + ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o')); // r = rej ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's')); ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'S')); -- cgit From 6a03eb69ebbe773f1d4139ff88d74ecdb2b0af4b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Apr 2014 16:51:06 -0400 Subject: Add "virtual mode" support This allows fully tracking extbans and other modes set by a different underlying mode, such as InspIRCd's namedmodes Add two configuration options to cs_ban to configure which mode is set and whether or not to kick banned users. Add default "mute" fantasy command to botserv.example.conf --- modules/protocol/inspircd20.cpp | 195 ++++++++++++++++++++++++++++++++-------- modules/protocol/unreal.cpp | 124 +++++++++++++++++++------ 2 files changed, 257 insertions(+), 62 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 4e88d01a8..1e439da30 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -77,25 +77,61 @@ class InspIRCd20Proto : public IRCDProto bool IsIdentValid(const Anope::string &ident) anope_override { return insp12->IsIdentValid(ident); } }; -class InspIRCdExtBan : public ChannelModeList +class InspIRCdExtBan : public ChannelModeVirtual { + char ext; + public: - InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { } + InspIRCdExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual(mname, basename) + , ext(extban) + { + } + + ChannelMode *Wrap(Anope::string ¶m) anope_override + { + param = Anope::string(ext) + ":" + param; + return ChannelModeVirtual::Wrap(param); + } - bool Matches(User *u, const Entry *e) anope_override + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override { - const Anope::string &mask = e->GetMask(); + if (cm->type != MODE_LIST || param.length() < 3 || param[0] != ext || param[1] != ':') + return cm; - if (mask.find("m:") == 0 || mask.find("N:") == 0) + param = param.substr(2); + return this; + } +}; + +namespace InspIRCdExtban +{ + class EntryMatcher : public InspIRCdExtBan + { + public: + EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - Entry en(this->name, real_mask); - if (en.Matches(u)) - return true; + return Entry(this->name, real_mask).Matches(u); + } + }; + + class ChannelMatcher : public InspIRCdExtBan + { + public: + ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { } - else if (mask.find("j:") == 0) + + bool Matches(User *u, const Entry *e) anope_override { + const Anope::string &mask = e->GetMask(); + Anope::string channel = mask.substr(3); ChannelMode *cm = NULL; @@ -116,39 +152,87 @@ class InspIRCdExtBan : public ChannelModeList if (cm == NULL || uc->status.HasMode(cm->mchar)) return true; } - } - else if (mask.find("R:") == 0) - { - Anope::string real_mask = mask.substr(2); - if (u->IsIdentified() && real_mask.equals_ci(u->Account()->display)) - return true; + return false; } - else if (mask.find("r:") == 0) - { - Anope::string real_mask = mask.substr(2); + }; - if (Anope::Match(u->realname, real_mask)) - return true; - } - else if (mask.find("s:") == 0) + class AccountMatcher : public InspIRCdExtBan + { + public: + AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override { + const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(2); - if (Anope::Match(u->server->GetName(), real_mask)) - return true; + return u->IsIdentified() && real_mask.equals_ci(u->Account()->display); } - else if (mask.find("z:") == 0) - { - Anope::string real_mask = mask.substr(2); + }; - if (!u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask)) - return true; + class RealnameMatcher : public InspIRCdExtBan + { + public: + RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); + Anope::string real_mask = mask.substr(2); + return Anope::Match(u->realname, real_mask); + } + }; + + class ServerMatcher : public InspIRCdExtBan + { + public: + ServerMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); + Anope::string real_mask = mask.substr(2); + return Anope::Match(u->server->GetName(), real_mask); + } + }; + + class FinerprintMatcher : public InspIRCdExtBan + { + public: + FinerprintMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); + Anope::string real_mask = mask.substr(2); + return !u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask); + } + }; + + class UnidentifiedMatcher : public InspIRCdExtBan + { + public: + UnidentifiedMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c) + { } - return false; - } -}; + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); + Anope::string real_mask = mask.substr(2); + return !u->Account() && Entry("BAN", real_mask).Matches(u); + } + }; +} class ColonDelimitedParamMode : public ChannelModeParam { @@ -304,17 +388,26 @@ struct IRCDMessageCapab : Message::Capab if (modename.equals_cs("admin")) cm = new ChannelModeStatus("PROTECT", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 3); else if (modename.equals_cs("allowinvite")) + { cm = new ChannelMode("ALLINVITE", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("INVITEBAN", "BAN", 'A')); + } else if (modename.equals_cs("auditorium")) cm = new ChannelMode("AUDITORIUM", modechar[0]); else if (modename.equals_cs("ban")) - cm = new InspIRCdExtBan("BAN", modechar[0]); + cm = new ChannelModeList("BAN", modechar[0]); else if (modename.equals_cs("banexception")) - cm = new InspIRCdExtBan("EXCEPT", 'e'); + cm = new ChannelModeList("EXCEPT", modechar[0]); else if (modename.equals_cs("blockcaps")) + { cm = new ChannelMode("BLOCKCAPS", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCAPSBAN", "BAN", 'B')); + } else if (modename.equals_cs("blockcolor")) + { cm = new ChannelMode("BLOCKCOLOR", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCOLORBAN", "BAN", 'c')); + } else if (modename.equals_cs("c_registered")) cm = new ChannelModeNoone("REGISTERED", modechar[0]); else if (modename.equals_cs("censor")) @@ -334,7 +427,7 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("history")) cm = new ChannelModeHistory(modechar[0]); else if (modename.equals_cs("invex")) - cm = new InspIRCdExtBan("INVITEOVERRIDE", 'I'); + cm = new ChannelModeList("INVITEOVERRIDE", modechar[0]); else if (modename.equals_cs("inviteonly")) cm = new ChannelMode("INVITE", modechar[0]); else if (modename.equals_cs("joinflood")) @@ -350,17 +443,29 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("nickflood")) cm = new ColonDelimitedParamMode("NICKFLOOD", modechar[0]); else if (modename.equals_cs("noctcp")) + { cm = new ChannelMode("NOCTCP", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOCTCPBAN", "BAN", 'C')); + } else if (modename.equals_cs("noextmsg")) cm = new ChannelMode("NOEXTERNAL", modechar[0]); else if (modename.equals_cs("nokick")) + { cm = new ChannelMode("NOKICK", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOKICKBAN", "BAN", 'Q')); + } else if (modename.equals_cs("noknock")) cm = new ChannelMode("NOKNOCK", modechar[0]); else if (modename.equals_cs("nonick")) + { cm = new ChannelMode("NONICK", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONICKBAN", "BAN", 'N')); + } else if (modename.equals_cs("nonotice")) + { cm = new ChannelMode("NONOTICE", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONOTICEBAN", "BAN", 'T')); + } 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")) @@ -378,9 +483,15 @@ struct IRCDMessageCapab : Message::Capab else if (modename.equals_cs("secret")) cm = new ChannelMode("SECRET", modechar[0]); else if (modename.equals_cs("sslonly")) + { cm = new ChannelMode("SSL", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::FinerprintMatcher("SSLBAN", "BAN", 'z')); + } else if (modename.equals_cs("stripcolor")) + { cm = new ChannelMode("STRIPCOLOR", modechar[0]); + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("STRIPCOLORBAN", "BAN", 'S')); + } else if (modename.equals_cs("topiclock")) cm = new ChannelMode("TOPIC", modechar[0]); else if (modename.equals_cs("voice")) @@ -481,11 +592,25 @@ struct IRCDMessageCapab : Message::Capab while (ssep.GetToken(module)) { if (module.equals_cs("m_services_account.so")) + { Servers::Capab.insert("SERVICES"); + ModeManager::AddChannelMode(new InspIRCdExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'R')); + ModeManager::AddChannelMode(new InspIRCdExtban::UnidentifiedMatcher("UNREGISTEREDBAN", "BAN", 'U')); + } else if (module.equals_cs("m_chghost.so")) Servers::Capab.insert("CHGHOST"); else if (module.equals_cs("m_chgident.so")) Servers::Capab.insert("CHGIDENT"); + else if (module == "m_channelban.so") + ModeManager::AddChannelMode(new InspIRCdExtban::ChannelMatcher("CHANNELBAN", "BAN", 'j')); + else if (module == "m_gecosban.so") + ModeManager::AddChannelMode(new InspIRCdExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r')); + else if (module == "m_nopartmessage.so") + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("PARTMESSAGEBAN", "BAN", 'p')); + else if (module == "m_serverban.so") + ModeManager::AddChannelMode(new InspIRCdExtban::ServerMatcher("SERVERBAN", "BAN", 's')); + else if (module == "m_muteban.so") + ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("QUIET", "BAN", 'm')); } } else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index d7bc8fa14..f444947f6 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -415,17 +415,44 @@ class UnrealIRCdProto : public IRCDProto } }; -class UnrealExtBan : public ChannelModeList +class UnrealExtBan : public ChannelModeVirtual { + char ext; + public: - UnrealExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { } + UnrealExtBan(const Anope::string &mname, const Anope::string &basename, char extban) : ChannelModeVirtual(mname, basename) + , ext(extban) + { + } + + ChannelMode *Wrap(Anope::string ¶m) anope_override + { + param = "~" + Anope::string(ext) + ":" + param; + return ChannelModeVirtual::Wrap(param); + } - bool Matches(User *u, const Entry *e) anope_override + ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override { - const Anope::string &mask = e->GetMask(); + if (cm->type != MODE_LIST || param.length() < 4 || param[0] != '~' || param[1] != ext || param[2] != ':') + return cm; - if (mask.find("~c:") == 0) + param = param.substr(3); + return this; + } +}; + +namespace UnrealExtban +{ + class ChannelMatcher : public UnrealExtBan + { + public: + ChannelMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); Anope::string channel = mask.substr(3); ChannelMode *cm = NULL; @@ -446,38 +473,73 @@ class UnrealExtBan : public ChannelModeList if (cm == NULL || uc->status.HasMode(cm->mchar)) return true; } + + return false; } - else if (mask.find("~j:") == 0 || mask.find("~n:") == 0 || mask.find("~q:") == 0) + }; + + class EntryMatcher : public UnrealExtBan + { + public: + EntryMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override { + const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - Entry en(this->name, real_mask); - if (en.Matches(u)) - return true; + return Entry(this->name, real_mask).Matches(u); } - else if (mask.find("~r:") == 0) + }; + + class RealnameMatcher : public UnrealExtBan + { + public: + RealnameMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override { + const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - if (Anope::Match(u->realname, real_mask)) - return true; + return Anope::Match(u->realname, real_mask); } - else if (mask.find("~R:") == 0) + }; + + class RegisteredMatcher : public UnrealExtBan + { + public: + RegisteredMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override { - if (u->HasMode("REGISTERED") && mask.equals_ci(u->nick)) - return true; + const Anope::string &mask = e->GetMask(); + return u->HasMode("REGISTERED") && mask.equals_ci(u->nick); } - else if (mask.find("~a:") == 0) - { + }; + + class AccountMatcher : public UnrealExtBan + { + public: + AccountMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : UnrealExtBan(mname, mbase, c) + { + } + + bool Matches(User *u, const Entry *e) anope_override + { + const Anope::string &mask = e->GetMask(); Anope::string real_mask = mask.substr(3); - if (u->Account() && Anope::Match(u->Account()->display, real_mask)) - return true; - } - - return false; - } -}; + return u->Account() && Anope::Match(u->Account()->display, real_mask); + } + }; +} class ChannelModeFlood : public ChannelModeParam { @@ -565,13 +627,21 @@ struct IRCDMessageCapab : Message::Capab switch (modebuf[t]) { case 'b': - ModeManager::AddChannelMode(new UnrealExtBan("BAN", 'b')); + ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b')); + + ModeManager::AddChannelMode(new UnrealExtban::ChannelMatcher("CHANNELBAN", "BAN", 'c')); + ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("JOINBAN", "BAN", 'j')); + ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("NONICKBAN", "BAN", 'n')); + ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("QUIET", "BAN", 'q')); + ModeManager::AddChannelMode(new UnrealExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r')); + ModeManager::AddChannelMode(new UnrealExtban::RegisteredMatcher("REGISTEREDBAN", "BAN", 'R')); + ModeManager::AddChannelMode(new UnrealExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'a')); continue; case 'e': - ModeManager::AddChannelMode(new UnrealExtBan("EXCEPT", 'e')); + ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e')); continue; case 'I': - ModeManager::AddChannelMode(new UnrealExtBan("INVITEOVERRIDE", 'I')); + ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I')); continue; default: ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t])); -- cgit From 0afd666f22f1f6a593c2cb9b63de60e4ce4e7113 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 29 Apr 2014 22:55:10 +0200 Subject: InspIRCd 2.0: Recognize GLOBOPS in CAPAB CAPABILITIES --- modules/protocol/inspircd20.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/protocol') diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 1e439da30..07c25972c 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -702,6 +702,8 @@ struct IRCDMessageCapab : Message::Capab ModeManager::RebuildStatusModes(); } + else if (capab == "GLOBOPS=1") + Servers::Capab.insert("GLOBOPS"); } } else if (params[0].equals_cs("END")) -- cgit From 6b6bc819998d137d2f53d7806f767a711a079a81 Mon Sep 17 00:00:00 2001 From: Michael Wobst Date: Tue, 13 May 2014 18:00:10 +0200 Subject: Update ircd-hybrid protocol module --- modules/protocol/hybrid.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 84f7db001..7c2c14098 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -1,7 +1,7 @@ /* ircd-hybrid-8 protocol module * * (C) 2003-2014 Anope Team - * (C) 2012-2013 by the Hybrid Development Team + * (C) 2012-2014 ircd-hybrid development team * * Please read COPYING and README for further details. * @@ -40,10 +40,11 @@ class HybridProto : public IRCDProto { DefaultPseudoclientModes = "+oi"; CanSVSNick = true; + CanSVSHold = true; + CanSVSJoin = true; CanSNLine = true; CanSQLine = true; CanSZLine = true; - CanSVSHold = true; CanCertFP = true; CanSetVHost = true; RequiresID = true; @@ -174,9 +175,9 @@ class HybridProto : public IRCDProto void SendServer(const Server *server) anope_override { if (server == Me) - UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); + UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " :" << server->GetDescription(); else - UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); + UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " :" << server->GetDescription(); } void SendConnect() anope_override @@ -254,6 +255,19 @@ class HybridProto : public IRCDProto UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick << " " << when; } + 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 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; + else + UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; + } + void SendSVSHold(const Anope::string &nick, time_t t) anope_override { XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for registered user"); -- cgit From 63b02b8c97e73d5a1fc7005e9693a954179ded0d Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 13 May 2014 22:57:53 -0400 Subject: Sanitize nuh masks more to prevent the other side from rewriting them, which screws with our internal tracking of them --- modules/protocol/bahamut.cpp | 2 +- modules/protocol/inspircd12.cpp | 2 +- modules/protocol/inspircd20.cpp | 13 +++++++------ modules/protocol/unreal.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 72c3ee8f9..206bca250 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -16,7 +16,7 @@ class ChannelModeFlood : public ChannelModeParam public: ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { try { diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 0cf3e991d..8b17d4140 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -28,7 +28,7 @@ class ChannelModeFlood : public ChannelModeParam public: ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { try { diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 07c25972c..b27249234 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -239,7 +239,7 @@ class ColonDelimitedParamMode : public ChannelModeParam public: ColonDelimitedParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { return IsValid(value, false); } @@ -288,7 +288,7 @@ class SimpleNumberParamMode : public ChannelModeParam public: SimpleNumberParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { if (value.empty()) return false; // empty param is never valid @@ -313,11 +313,12 @@ class ChannelModeFlood : public ColonDelimitedParamMode public: ChannelModeFlood(char modeChar) : ColonDelimitedParamMode("FLOOD", modeChar) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { // The parameter of this mode is a bit different, it may begin with a '*', // ignore it if that's the case - return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(value[0] == '*' ? value.substr(1) : value))); + Anope::string v = value[0] == '*' ? value.substr(1) : value; + return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(v))); } }; @@ -326,7 +327,7 @@ class ChannelModeHistory : public ColonDelimitedParamMode public: ChannelModeHistory(char modeChar) : ColonDelimitedParamMode("HISTORY", modeChar) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { return (ColonDelimitedParamMode::IsValid(value, true)); } @@ -337,7 +338,7 @@ class ChannelModeRedirect : public ChannelModeParam public: ChannelModeRedirect(char modeChar) : ChannelModeParam("REDIRECT", modeChar, true) { } - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { // The parameter of this mode is a channel, and channel names start with '#' return ((!value.empty()) && (value[0] == '#')); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index f444947f6..fd7cb8e81 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -547,7 +547,7 @@ class ChannelModeFlood : public ChannelModeParam ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { } /* Borrowed part of this check from UnrealIRCd */ - bool IsValid(const Anope::string &value) const anope_override + bool IsValid(Anope::string &value) const anope_override { if (value.empty()) return false; -- cgit From f627a3bacd0d058e94260dac1555790cafd9a926 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 21 May 2014 08:50:40 -0400 Subject: Core prep for p10 stuff --- modules/protocol/bahamut.cpp | 2 +- modules/protocol/inspircd12.cpp | 2 +- modules/protocol/ngircd.cpp | 2 +- modules/protocol/plexus.cpp | 2 +- modules/protocol/unreal.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 206bca250..a8252c8c5 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -175,7 +175,7 @@ class BahamutIRCdProto : public IRCDProto if (uc != NULL) uc->status.Clear(); - BotInfo *setter = BotInfo::Find(user->nick); + BotInfo *setter = BotInfo::Find(user->GetUID()); for (size_t i = 0; i < cs.Modes().length(); ++i) c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 8b17d4140..5fb226d99 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -269,7 +269,7 @@ class InspIRCd12Proto : public IRCDProto if (uc != NULL) uc->status.Clear(); - BotInfo *setter = BotInfo::Find(user->nick); + BotInfo *setter = BotInfo::Find(user->GetUID()); for (size_t i = 0; i < cs.Modes().length(); ++i) c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 81ba28a6a..86ced45ed 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -101,7 +101,7 @@ class ngIRCdProto : public IRCDProto if (uc != NULL) uc->status.Clear(); - BotInfo *setter = BotInfo::Find(user->nick); + BotInfo *setter = BotInfo::Find(user->GetUID()); for (size_t i = 0; i < cs.Modes().length(); ++i) c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 04d90be7e..e65699f1c 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -67,7 +67,7 @@ class PlexusProto : public IRCDProto if (uc != NULL) uc->status.Clear(); - BotInfo *setter = BotInfo::Find(user->nick); + BotInfo *setter = BotInfo::Find(user->GetUID()); for (size_t i = 0; i < cs.Modes().length(); ++i) c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index fd7cb8e81..304da6788 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -167,7 +167,7 @@ class UnrealIRCdProto : public IRCDProto if (uc != NULL) uc->status.Clear(); - BotInfo *setter = BotInfo::Find(user->nick); + BotInfo *setter = BotInfo::Find(user->GetUID()); for (size_t i = 0; i < cs.Modes().length(); ++i) c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); -- cgit From 6620f9e9bd5182336264befe10cf19941ad4c40f Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 May 2014 15:12:33 -0400 Subject: Don't allow setting -y on inspircd, secureops etc will try to enforce this --- modules/protocol/inspircd20.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/protocol') diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index b27249234..eb2941ced 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -955,6 +955,15 @@ class ProtoInspIRCd20 : public Module return EVENT_CONTINUE; } + + EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override + { + if ((setter.GetUser() && setter.GetUser()->server == Me) || setter.GetServer() == Me || !setter.GetServer()) + if (mode->name == "OPERPREFIX") + c->SetMode(c->ci->WhoSends(), mode, param, false); + + return EVENT_CONTINUE; + } }; MODULE_INIT(ProtoInspIRCd20) -- cgit From ab27b792b051f61336c2243bef2750f4abb53cfc Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 9 Jun 2014 17:18:21 -0400 Subject: Track SVSKILL on unreal --- modules/protocol/unreal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/protocol') diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 304da6788..4aa340f08 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -1170,7 +1170,7 @@ class ProtoUnreal : public Module Message::Invite message_invite; Message::Join message_join; Message::Kick message_kick; - Message::Kill message_kill; + Message::Kill message_kill, message_svskill; Message::MOTD message_motd; Message::Notice message_notice; Message::Part message_part; @@ -1246,7 +1246,7 @@ class ProtoUnreal : public Module ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), ircd_proto(this), message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), - message_kill(this), message_motd(this), message_notice(this), message_part(this), message_ping(this), + message_kill(this), message_svskill(this, "SVSKILL"), message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this), message_whois(this), -- cgit