]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/fjoin.cpp
Link m_ldap against libldap_r
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / fjoin.cpp
index cb1126ac7420bd9a6e26973e61912685fc1d7b40..bfe3592d2ae03599df8039fc5364bc83ec9dfe18 100644 (file)
@@ -116,24 +116,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params)
        Modes::ChangeList modechangelist;
        if (apply_other_sides_modes)
        {
-               std::vector<std::string>::const_iterator paramit = params.begin() + 3;
-               const std::vector<std::string>::const_iterator lastparamit = ((params.size() > 3) ? (params.end() - 1) : params.end());
-               for (std::string::const_iterator i = params[2].begin(); i != params[2].end(); ++i)
-               {
-                       ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL);
-                       if (!mh)
-                               continue;
-
-                       std::string modeparam;
-                       if ((paramit != lastparamit) && (mh->GetNumParams(true)))
-                       {
-                               modeparam = *paramit;
-                               ++paramit;
-                       }
-
-                       modechangelist.push_add(mh, modeparam);
-               }
-
+               ServerInstance->Modes.ModeParamsToChangeList(srcuser, MODETYPE_CHANNEL, params, modechangelist, 2, params.size() - 1);
                ServerInstance->Modes->Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
                // Reuse for prefix modes
                modechangelist.clear();
@@ -209,7 +192,7 @@ void CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeServer* sour
 
 void CommandFJoin::RemoveStatus(Channel* c)
 {
-       irc::modestacker stack(false);
+       Modes::ChangeList changelist;
 
        const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
        for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i)
@@ -220,22 +203,10 @@ void CommandFJoin::RemoveStatus(Channel* c)
                 * rather than applied immediately. Module unloads require this to be done immediately,
                 * for this function we require tidyness instead. Fixes bug #493
                 */
-               mh->RemoveMode(c, stack);
+               mh->RemoveMode(c, changelist);
        }
 
-       ApplyModeStack(ServerInstance->FakeClient, c, stack);
-}
-
-void CommandFJoin::ApplyModeStack(User* srcuser, Channel* c, irc::modestacker& stack)
-{
-       parameterlist stackresult;
-       stackresult.push_back(c->name);
-
-       while (stack.GetStackedLine(stackresult))
-       {
-               ServerInstance->Modes->Process(stackresult, srcuser, ModeParser::MODE_LOCALONLY);
-               stackresult.erase(stackresult.begin() + 1, stackresult.end());
-       }
+       ServerInstance->Modes->Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY);
 }
 
 void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)