summaryrefslogtreecommitdiff
path: root/src/modules/m_operprefix.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-01-19 17:43:58 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-01-19 17:43:58 +0100
commit17b4151bff2edcec3f3524cc60e536407c70cec6 (patch)
tree255a68a6cb9ed960c9152dbb1bb32f001b804c91 /src/modules/m_operprefix.cpp
parent2653fbaa28c9b7b41e03abd4893ea623a6276d21 (diff)
m_operprefix Fix force joined opers not being given the operprefix mode
Diffstat (limited to 'src/modules/m_operprefix.cpp')
-rw-r--r--src/modules/m_operprefix.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index 62ddb6c67..9f1f6cc5e 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -85,7 +85,7 @@ class ModuleOperPrefixMode : public Module
{
ServerInstance->Modules->AddService(opm);
- Implementation eventlist[] = { I_OnUserPreJoin, I_OnPostOper, I_OnLoadModule, I_OnUnloadModule };
+ Implementation eventlist[] = { I_OnUserPreJoin, I_OnPostOper, I_OnLoadModule, I_OnUnloadModule, I_OnPostJoin };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
/* To give clients a chance to learn about the new prefix we don't give +y to opers
@@ -110,6 +110,22 @@ class ModuleOperPrefixMode : public Module
return MOD_RES_PASSTHRU;
}
+ void OnPostJoin(Membership* memb)
+ {
+ if ((!IS_LOCAL(memb->user)) || (!IS_OPER(memb->user)) || (((mw_added) && (memb->user->IsModeSet('H')))))
+ return;
+
+ if (memb->hasMode(opm.GetModeChar()))
+ return;
+
+ // The user was force joined and OnUserPreJoin() did not run. Set the operprefix now.
+ std::vector<std::string> modechange;
+ modechange.push_back(memb->chan->name);
+ modechange.push_back("+y");
+ modechange.push_back(memb->user->nick);
+ ServerInstance->SendGlobalMode(modechange, ServerInstance->FakeClient);
+ }
+
void SetOperPrefix(User* user, bool add)
{
std::vector<std::string> modechange;