diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-08-30 13:01:10 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-08-30 13:01:10 +0200 |
commit | 1031f333332cf1b09db4fd632f141143ee637c34 (patch) | |
tree | 3f2b3c08e9a743f19725da45f3879aa2bf54bfbf /src/modules/m_spanningtree | |
parent | 7432fea968127b606fc029ae462e91d3f30df8a4 (diff) | |
parent | d54eec6dd8d44cba3c1e935f72089dbe675e0820 (diff) |
Merge insp20
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 32 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 3 |
3 files changed, 37 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 93320757c..0fb446877 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -124,12 +124,36 @@ CmdResult CommandFJoin::Handle(User* srcuser, std::vector<std::string>& params) /* First up, apply their channel modes if they won the TS war */ if (apply_other_sides_modes) { + // Need to use a modestacker here due to maxmodes + irc::modestacker stack(true); + 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; + } + + stack.Push(*i, modeparam); + } + std::vector<std::string> modelist; - modelist.push_back(channel); - /* Remember, params[params.size() - 1] is userlist, and we don't want to apply *that* */ - modelist.insert(modelist.end(), params.begin()+2, params.end()-1); - ServerInstance->Modes->Process(modelist, srcuser, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE); + // Mode parser needs to know what channel to act on. + modelist.push_back(params[0]); + + while (stack.GetStackedLine(modelist)) + { + ServerInstance->Modes->Process(modelist, srcuser, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE); + modelist.erase(modelist.begin() + 1, modelist.end()); + } } irc::modestacker modestack(true); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 98f9a304b..9ece3c03d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -669,6 +669,13 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod) sock->Close(); } } + + for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i) + { + TreeSocket* sock = i->first; + if (sock->GetIOHook() && sock->GetIOHook()->creator == mod) + sock->Close(); + } } // note: the protocol does not allow direct umode +o except diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 9e6f41852..164bed1ca 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -50,6 +50,7 @@ class SpanningTreeUtilities : public classbase public: typedef std::set<TreeSocket*> TreeSocketSet; + typedef std::map<TreeSocket*, std::pair<std::string, int> > TimeoutList; /** Creator module */ @@ -91,7 +92,7 @@ class SpanningTreeUtilities : public classbase server_hash sidlist; /** List of all outgoing sockets and their timeouts */ - std::map<TreeSocket*, std::pair<std::string, int> > timeoutlist; + TimeoutList timeoutlist; /** Holds the data from the <link> tags in the conf */ std::vector<reference<Link> > LinkBlocks; |