]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/main.cpp
Remove unneeded ProtocolInterface::Introduce
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / main.cpp
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