From 20e521a9eade796b119b5f7e7bde45541149915c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 12 Jun 2013 18:11:51 +0200 Subject: m_spanningtree FJOIN handler: Merge and take maxmodes into consideration when applying non-prefix modes --- src/modules/m_spanningtree/fjoin.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index c0475613a..ee18c8e87 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -121,19 +121,38 @@ CmdResult CommandFJoin::Handle(const std::vector& params, User *src /* First up, apply their modes if they won the TS war */ if (apply_other_sides_modes) { - unsigned int idx = 2; + // Need to use a modestacker here due to maxmodes + irc::modestacker stack(true); + std::vector::const_iterator paramit = params.begin() + 3; + const std::vector::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 modelist; // Mode parser needs to know what channel to act on. modelist.push_back(params[0]); - /* Remember, params[params.size() - 1] is nicklist, and we don't want to apply *that* */ - for (idx = 2; idx != (params.size() - 1); idx++) + while (stack.GetStackedLine(modelist)) { - modelist.push_back(params[idx]); + ServerInstance->Modes->Process(modelist, srcuser, true); + modelist.erase(modelist.begin() + 1, modelist.end()); } - ServerInstance->SendMode(modelist, srcuser); + ServerInstance->Modes->Process(modelist, srcuser, true); } /* Now, process every 'modes,nick' pair */ -- cgit v1.2.3 From 1be212b865b3cab816cd3cb49b527add3cac6826 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 26 Jul 2013 07:33:45 -0400 Subject: Use server ids when propagating squits --- src/modules/m_spanningtree/treesocket1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 6582ba060..cb2c93548 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -189,9 +189,9 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) if (!Current->GetSocket() || Current->GetSocket()->Introduced()) { parameterlist params; - params.push_back(Current->GetName()); + params.push_back(Current->GetID()); params.push_back(":"+reason); - Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); + Utils->DoOneToAllButSender(Current->GetParent()->GetID(),"SQUIT",params,Current->GetID()); } if (Current->GetParent() == Utils->TreeRoot) -- cgit v1.2.3 From d3b6538f955e824d46141f64fc081ce19fc081ef Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 21 Aug 2013 16:38:33 +0200 Subject: m_spanningtree When an IOHook goes away close all pending connections that use it --- src/modules/m_spanningtree/main.cpp | 7 +++++++ src/modules/m_spanningtree/utils.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 7c93e7d45..ce1792a02 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -815,6 +815,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() == 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 92a03428f..a0543b6bd 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -50,6 +50,8 @@ typedef std::map TreeServerList; class SpanningTreeUtilities : public classbase { public: + typedef std::map > TimeoutList; + /** Creator module */ ModuleSpanningTree* Creator; @@ -90,7 +92,7 @@ class SpanningTreeUtilities : public classbase server_hash sidlist; /** List of all outgoing sockets and their timeouts */ - std::map > timeoutlist; + TimeoutList timeoutlist; /** Holds the data from the tags in the conf */ std::vector > LinkBlocks; -- cgit v1.2.3