summaryrefslogtreecommitdiff
path: root/modules/protocol/charybdis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol/charybdis.cpp')
-rw-r--r--modules/protocol/charybdis.cpp19
1 files changed, 13 insertions, 6 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;
}