diff options
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/charybdis.cpp | 19 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 5 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 18 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 24 |
4 files changed, 43 insertions, 23 deletions
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index cc9f8a58b..7d34da8d2 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -10,6 +10,7 @@ */ #include "module.h" +#include "modules/cs_mode.h" static bool sasl = true; static Anope::string UplinkSID; @@ -435,19 +436,24 @@ class ProtoCharybdis : public Module void OnChannelSync(Channel *c) anope_override { - if (use_server_side_mlock && c->ci && Servers::Capab.count("MLOCK") > 0) + if (!c->ci) + return; + + ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); + if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK") > 0) { - Anope::string modes = c->ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; } } EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } @@ -456,10 +462,11 @@ class ProtoCharybdis : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 3a2eb2d8a..876d387d1 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -947,7 +947,7 @@ struct IRCDMessageMetadata : IRCDMessage User *u = User::Find(params[0]); if (!u) return; - u->Extend("SSL"); + u->Extend<bool>("ssl"); Anope::string data = params[2].c_str(); size_t pos1 = data.find(' ') + 1; size_t pos2 = data.find(' ', pos1); @@ -1271,6 +1271,7 @@ struct IRCDMessageEncap : IRCDMessage class ProtoInspIRCd : public Module { InspIRCd12Proto ircd_proto; + ExtensibleItem<bool> ssl; /* Core message handlers */ Message::Away message_away; @@ -1311,7 +1312,7 @@ class ProtoInspIRCd : public Module public: ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), - ircd_proto(this), + ircd_proto(this), ssl(this, "ssl"), message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_topic(this), diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 73f573e5b..c251b93b8 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -10,6 +10,7 @@ */ #include "module.h" +#include "modules/cs_mode.h" static unsigned int spanningtree_proto_ver = 0; @@ -137,7 +138,7 @@ class InspIRCdExtBan : public ChannelModeList { Anope::string real_mask = mask.substr(2); - if (Anope::Match(u->fingerprint, real_mask)) + if (!u->fingerprint.empty() && Anope::Match(u->fingerprint, real_mask)) return true; } @@ -759,9 +760,10 @@ class ProtoInspIRCd : public Module void OnChanRegistered(ChannelInfo *ci) anope_override { - if (use_server_side_mlock && ci->c && !ci->GetMLockAsString(false).empty()) + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); + if (use_server_side_mlock && ci->c && modelocks && !modelocks->GetMLockAsString(false).empty()) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); SendChannelMetadata(ci->c, "mlock", modes); } @@ -783,10 +785,11 @@ class ProtoInspIRCd : public Module EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) + if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; SendChannelMetadata(ci->c, "mlock", modes); } @@ -795,10 +798,11 @@ class ProtoInspIRCd : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) + if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM)) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); SendChannelMetadata(ci->c, "mlock", modes); } diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 5e6534409..856a4aeb4 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -10,6 +10,7 @@ */ #include "module.h" +#include "modules/cs_mode.h" static bool sasl = true; @@ -1226,18 +1227,23 @@ class ProtoUnreal : public Module void OnChannelSync(Channel *c) anope_override { - if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && c->ci) + if (!c->ci) + return; + + ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); + if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks) { - Anope::string modes = c->ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; } } void OnChanRegistered(ChannelInfo *ci) anope_override { - if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); + if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK")) return; - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } @@ -1250,10 +1256,11 @@ class ProtoUnreal : public Module EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } @@ -1262,10 +1269,11 @@ class ProtoUnreal : public Module EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) anope_override { + ModeLocks *modelocks = ci->GetExt<ModeLocks>("modelocks"); ChannelMode *cm = ModeManager::FindChannelModeByName(lock->name); - if (use_server_side_mlock && cm && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) + if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) { - Anope::string modes = ci->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); + Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; } |