]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove unneeded ProtocolInterface::Introduce
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 2 Sep 2009 00:44:40 +0000 (00:44 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 2 Sep 2009 00:44:40 +0000 (00:44 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11600 e03df62e-2008-0410-955e-edbf42e46eb7

include/protocol.h
src/modules/m_spanningtree/main.cpp
src/modules/m_spanningtree/main.h
src/modules/m_spanningtree/protocolinterface.cpp
src/modules/m_spanningtree/protocolinterface.h
src/modules/m_spanningtree/uid.cpp
src/users.cpp

index 49288fd3b0eefbf18fcbfb80c6b50e6356126ff9..fdfb89aab1a125e443d630b1798e49d668a7ac9e 100644 (file)
@@ -135,11 +135,6 @@ class ProtocolInterface : public Extensible
         * XXX: document me properly, this is shit.
         */
        virtual void GetServerList(ProtoServerList &sl) { }
-
-       /** Send information about a user connection to linked servers.
-        * @param u The user to send information about.
-        */
-       virtual void Introduce(User* u) { }
 };
 
 #endif
index 7f2164f622426a6f48eb0f9bd6fae26b4dc9ca40..c402b145a7afd76955f76bc5da68878d722502c7 100644 (file)
@@ -52,7 +52,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
                I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, I_OnUnloadModule, I_OnUserQuit,
                I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash, I_OnOper,
                I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats, I_OnEvent, I_OnSetAway,
-               I_OnPostCommand
+               I_OnPostCommand, I_OnUserConnect
        };
        ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
 
@@ -60,10 +60,8 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
        ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance);
        loopCall = false;
 
-       for (std::vector<User*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++)
-       {
-               ServerInstance->PI->Introduce(*i);
-       }
+       // update our local user count
+       Utils->TreeRoot->SetUserCount(ServerInstance->Users->local_users.size());
 }
 
 void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
@@ -579,6 +577,27 @@ void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
        DoConnectTimeout(curtime);
 }
 
+void ModuleSpanningTree::OnUserConnect(User* user)
+{
+       if (user->quitting)
+               return;
+
+       parameterlist params;
+       params.push_back(user->uuid);
+       params.push_back(ConvToStr(user->age));
+       params.push_back(user->nick);
+       params.push_back(user->host);
+       params.push_back(user->dhost);
+       params.push_back(user->ident);
+       params.push_back(user->GetIPString());
+       params.push_back(ConvToStr(user->signon));
+       params.push_back("+"+std::string(user->FormatModes(true)));
+       params.push_back(":"+std::string(user->fullname));
+       Utils->DoOneToMany(ServerInstance->Config->GetSID(), "UID", params);
+
+       Utils->TreeRoot->SetUserCount(1); // increment by 1
+}
+
 void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created)
 {
        // Only do this for local users
index 3d6e3375dce833fe5a5f633c1696df236e4e3575..15d59701d373673f70dbdab2bf7e11eddae85704 100644 (file)
@@ -160,6 +160,7 @@ class ModuleSpanningTree : public Module
        virtual int OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
        virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
        virtual void OnGetServerDescription(const std::string &servername,std::string &description);
+       virtual void OnUserConnect(User* source);
        virtual void OnUserInvite(User* source,User* dest,Channel* channel, time_t);
        virtual void OnPostLocalTopicChange(User* user, Channel* chan, const std::string &topic);
        virtual void OnWallops(User* user, const std::string &text);
index 1e5ae7ade8e8536d4bf88eed729c495a325c4b14..989e8b3e41a9c5de4db1f996255a1661eb67f2a4 100644 (file)
@@ -176,30 +176,3 @@ void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::stri
                }
        }
 }
-
-void SpanningTreeProtocolInterface::Introduce(User* user)
-{
-       if (user->quitting)
-               return;
-       if (IS_LOCAL(user))
-       {
-               parameterlist params;
-               params.push_back(user->uuid);
-               params.push_back(ConvToStr(user->age));
-               params.push_back(user->nick);
-               params.push_back(user->host);
-               params.push_back(user->dhost);
-               params.push_back(user->ident);
-               params.push_back(user->GetIPString());
-               params.push_back(ConvToStr(user->signon));
-               params.push_back("+"+std::string(user->FormatModes(true)));
-               params.push_back(":"+std::string(user->fullname));
-               Utils->DoOneToMany(ServerInstance->Config->GetSID(), "UID", params);
-       }
-
-       TreeServer* SourceServer = Utils->FindServer(user->server);
-       if (SourceServer)
-       {
-               SourceServer->SetUserCount(1); // increment by 1
-       }
-}
index de0afcef7fba66bc2bd3d6a90d9581a44460b254..84da6d8cf082819b2095f21a3a14b46fbb0552ff 100644 (file)
@@ -25,7 +25,6 @@ class SpanningTreeProtocolInterface : public ProtocolInterface
        virtual void SendUserPrivmsg(User* target, const std::string &text);
        virtual void SendUserNotice(User* target, const std::string &text);
        virtual void GetServerList(ProtoServerList &sl);
-       virtual void Introduce(User* u);
 };
 
 #endif
index 7146f4c0180c165cb6f2bf25e6100fe49db32b01..b7c13b5f85403208343c9f3ae71082192b7e38d0 100644 (file)
@@ -160,6 +160,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist &params)
        _new->SetClientIP(params[6].c_str());
 
        ServerInstance->Users->AddGlobalClone(_new);
+       remoteserver->SetUserCount(1); // increment by 1
 
        bool dosend = true;
 
@@ -172,7 +173,6 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist &params)
        params[params.size() - 1] = ":" + params[params.size() - 1];
        Utils->DoOneToAllButSender(source, "UID", params, source);
 
-       ServerInstance->PI->Introduce(_new);
        FOREACH_MOD_I(ServerInstance,I_OnPostConnect,OnPostConnect(_new));
 
        return true;
index 6be64fe1df81e082ae6c642a9252bf05817149eb..6087f4d1cd579f03739758fc4071eb2f18ad96c0 100644 (file)
@@ -985,8 +985,6 @@ void User::FullConnect()
 
        this->registered = REG_ALL;
 
-       ServerInstance->PI->Introduce(this);
-
        FOREACH_MOD(I_OnPostConnect,OnPostConnect(this));
 
        ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d: %s!%s@%s [%s] [%s]",