summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-13 17:04:17 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-13 17:04:17 +0000
commit97c0e6b4c4e304a1c4e764fc06a7e2663a41743d (patch)
treee8ed104d85a573545a94c3ddc9eda144c05c7bbc /src/modules/m_spanningtree
parenta889336d194abc7df7a98102e3d0e56f0e125edc (diff)
Use Utils->ServerUser instead of ServerInstance->FakeClient in m_spanningtree
This makes it possible to determine which server initiated a mode change, instead of having only a flag saying that some server did. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11379 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp6
-rw-r--r--src/modules/m_spanningtree/fmode.cpp14
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
3 files changed, 7 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index b9bd79f18..28a922c0f 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -123,7 +123,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
modelist.push_back(params[idx]);
}
- this->ServerInstance->SendMode(modelist, this->ServerInstance->FakeClient);
+ this->ServerInstance->SendMode(modelist, Utils->ServerUser);
}
/* Now, process every 'modes,nick' pair */
@@ -188,7 +188,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
while (modestack.GetStackedLine(stackresult))
{
mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
- ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
+ ServerInstance->SendMode(mode_junk, Utils->ServerUser);
mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
}
}
@@ -225,7 +225,7 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string>
while (stack.GetStackedLine(stackresult))
{
mode_junk.insert(mode_junk.end(), stackresult.begin(), stackresult.end());
- ServerInstance->SendMode(mode_junk, ServerInstance->FakeClient);
+ ServerInstance->SendMode(mode_junk, Utils->ServerUser);
mode_junk.erase(mode_junk.begin() + 1, mode_junk.end());
}
}
diff --git a/src/modules/m_spanningtree/fmode.cpp b/src/modules/m_spanningtree/fmode.cpp
index 24047226d..2d9c37339 100644
--- a/src/modules/m_spanningtree/fmode.cpp
+++ b/src/modules/m_spanningtree/fmode.cpp
@@ -31,7 +31,6 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p
return true;
}
- bool smode = false;
std::string sourceserv;
/* Are we dealing with an FMODE from a user, or from a server? */
@@ -44,8 +43,7 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p
else
{
/* FMODE from a server, use a fake user to receive mode feedback */
- who = this->ServerInstance->FakeClient;
- smode = true; /* Setting this flag tells us it is a server mode*/
+ who = Utils->ServerUser;
sourceserv = source; /* Set sourceserv to the actual source string */
}
std::vector<std::string> modelist;
@@ -99,14 +97,8 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p
*/
if (TS <= ourTS)
{
- if (smode)
- {
- this->ServerInstance->SendMode(modelist, who);
- }
- else
- {
- this->ServerInstance->CallCommandHandler("MODE", modelist, who);
- }
+ ServerInstance->Modes->Process(modelist, who, (who == Utils->ServerUser));
+
/* HOT POTATO! PASS IT ON! */
Utils->DoOneToAllButSender(source,"FMODE",params,sourceserv);
}
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 68b5a7840..6f5bd6f3e 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -299,9 +299,7 @@ bool TreeSocket::ProcessLine(std::string &line)
TreeServer *ServerSource = Utils->FindServer(prefix);
if (ServerSource)
{
- // ServerSource->GetName().c_str() may become invalid before it is used
- Utils->ServerUser->nick = ServerSource->GetName().c_str();
- Utils->ServerUser->server = Utils->ServerUser->nick.c_str();
+ Utils->ServerUser->SetFakeServer(ServerSource->GetName());
Utils->ServerUser->uuid = ServerSource->GetID();
}