]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_operprefix Fix force joined opers not being given the operprefix mode
authorAttila Molnar <attilamolnar@hush.com>
Mon, 19 Jan 2015 16:43:58 +0000 (17:43 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 19 Jan 2015 16:43:58 +0000 (17:43 +0100)
src/modules/m_operprefix.cpp

index 62ddb6c67b160d187214431d4372f440d332750f..9f1f6cc5e8f3f25863a940abde3513d133767d46 100644 (file)
@@ -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;