diff options
-rw-r--r-- | src/channels.cpp | 45 | ||||
-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 |
4 files changed, 18 insertions, 94 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index a6ed3406d..0532a70e2 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -595,52 +595,11 @@ long Channel::PartUser(User *user, std::string &reason) long Channel::ServerKickUser(User* user, const char* reason, const char* servername) { - bool silent = false; - - if (!user || !reason) - return this->GetUserCounter(); - - if (IS_LOCAL(user)) - { - if (!this->HasUser(user)) - { - /* Not on channel */ - return this->GetUserCounter(); - } - } - if (servername == NULL || *ServerInstance->Config->HideWhoisServer) servername = ServerInstance->Config->ServerName; - FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent)); - - UCListIter i = user->chans.find(this); - if (i != user->chans.end()) - { - if (!silent) - this->WriteChannelWithServ(servername, "KICK %s %s :%s", this->name.c_str(), user->nick.c_str(), reason); - - user->chans.erase(i); - this->RemoveAllPrefixes(user); - } - - if (!this->DelUser(user)) - { - chan_hash::iterator iter = ServerInstance->chanlist->find(this->name); - /* kill the record */ - if (iter != ServerInstance->chanlist->end()) - { - int MOD_RESULT = 0; - FOREACH_RESULT_I(ServerInstance,I_OnChannelPreDelete, OnChannelPreDelete(this)); - if (MOD_RESULT == 1) - return 1; // delete halted by module - FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); - ServerInstance->chanlist->erase(iter); - } - return 0; - } - - return this->GetUserCounter(); + ServerInstance->FakeClient->server = servername; + return this->KickUser(ServerInstance->FakeClient, user, reason); } long Channel::KickUser(User *src, User *user, const char* reason) 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; |