summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/fakeuser.h5
-rw-r--r--src/inspircd.cpp1
-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
-rw-r--r--src/users.cpp6
6 files changed, 17 insertions, 19 deletions
diff --git a/include/fakeuser.h b/include/fakeuser.h
index afb267c52..efdb5bd3d 100644
--- a/include/fakeuser.h
+++ b/include/fakeuser.h
@@ -24,8 +24,9 @@ class CoreExport FakeUser : public User
SetFd(FD_FAKEUSER_NUMBER);
}
- virtual const std::string GetFullHost() { return server; }
- virtual const std::string GetFullRealHost() { return server; }
+ virtual const std::string GetFullHost() { return nick; }
+ virtual const std::string GetFullRealHost() { return nick; }
+ void SetFakeServer(std::string name);
};
#endif
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 3d24c7cd2..a2a634a64 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -610,6 +610,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
/* set up fake client again this time with the correct uid */
this->FakeClient = new FakeUser(this, "!");
+ this->FakeClient->SetFakeServer(Config->ServerName);
// Get XLine to do it's thing.
this->XLines->CheckELines();
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();
}
diff --git a/src/users.cpp b/src/users.cpp
index 9574dd415..9c295caad 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -2045,6 +2045,12 @@ void User::DecreasePenalty(int decrease)
this->Penalty -= decrease;
}
+void FakeUser::SetFakeServer(std::string name)
+{
+ this->nick = name;
+ this->server = nick.c_str();
+}
+
VisData::VisData()
{
}