diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-13 05:27:46 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-13 05:27:46 +0000 |
commit | 23a98c8fe1f255fe5f20c26c726da817d2796c9a (patch) | |
tree | f5b4d0dd6eafb1d583fc17d3dde8c23d348d8fda /src/modules | |
parent | 6dd331262aa8f989657891e27b8891ee6a00016c (diff) |
Use a FakeUser source for server-sourced commands in spanningtree
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11376 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 62 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 3 |
3 files changed, 16 insertions, 51 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index e873c96de..9f99a7416 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -297,6 +297,11 @@ bool TreeSocket::ProcessLine(std::string &line) /* Find the server that this command originated from, used in the handlers below */ TreeServer *ServerSource = Utils->FindServer(prefix); + if (ServerSource) + { + Utils->ServerUser->server = ServerSource->GetName().c_str(); + Utils->ServerUser->uid = ServerSource->GetID(); + } /* Find the link we just got this from so we don't bounce it back incorrectly */ std::string sourceserv = this->myhost; @@ -428,34 +433,6 @@ bool TreeSocket::ProcessLine(std::string &line) { return this->Time(prefix,params); } - else if ((command == "KICK") && (Utils->IsServer(prefix))) - { - if (params.size() == 3) - { - TreeServer* pf = Utils->FindServer(prefix); - if (pf) - { - irc::commasepstream nicks(params[1]); - std::string nick; - Channel* chan = this->ServerInstance->FindChan(params[0]); - if (chan) - { - while (nicks.GetToken(nick)) - { - User* user = this->ServerInstance->FindNick(nick); - if (user) - { - if (!chan->ServerKickUser(user, params[2].c_str(), pf->GetName().c_str())) - /* Yikes, the channels gone! */ - delete chan; - } - } - } - } - } - - return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params); - } else if (command == "SVSJOIN") { return this->ServiceJoin(prefix,params); @@ -528,27 +505,6 @@ bool TreeSocket::ProcessLine(std::string &line) { return this->Encap(prefix, params); } - else if (command == "MODE" && !this->ServerInstance->FindUUID(prefix)) // XXX we should check for no such serv? - { - // Server-prefix MODE. - std::vector<std::string> modelist(params.begin(), params.end()); - - /* We don't support this for channel mode changes any more! */ - if (params.size() >= 1) - { - if (ServerInstance->FindChan(params[0])) - { - this->SendError("Protocol violation by '"+(ServerSource ? ServerSource->GetName().c_str() : prefix)+"'! MODE for channel mode changes is not supported by the InspIRCd 1.2 protocol. You must use FMODE to preserve channel timestamps."); - return false; - } - } - - // Insert into the parser - this->ServerInstance->SendMode(modelist, this->ServerInstance->FakeClient); - - // Pass out to the network - return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params); - } else { /* @@ -557,7 +513,11 @@ bool TreeSocket::ProcessLine(std::string &line) */ User* who = this->ServerInstance->FindUUID(prefix); - if (!who) + if (ServerSource) + { + who = Utils->ServerUser; + } + else if (!who) { /* this looks ugly because command is an irc::string * It is important that we dont close the link here, unknown prefix can occur @@ -600,7 +560,7 @@ bool TreeSocket::ProcessLine(std::string &line) } } - // its a user + // it's a user std::vector<std::string> strparams(params.begin(), params.end()); switch (this->ServerInstance->CallCommandHandler(command.c_str(), strparams, who)) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index c97728694..23dd6084e 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -154,6 +154,7 @@ SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningT ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); + this->ServerUser = new FakeUser(ServerInstance); this->ReadConfiguration(true); } @@ -176,6 +177,7 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } } delete TreeRoot; + delete ServerUser; ServerInstance->BufferedSocketCull(); } diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 2fd3a6e19..7f95ad8c8 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -97,6 +97,9 @@ class SpanningTreeUtilities : public classbase /** This variable represents the root of the server tree */ TreeServer *TreeRoot; + /** Represents the server whose command we are processing + */ + FakeUser *ServerUser; /** IPs allowed to link to us */ std::vector<std::string> ValidIPs; |