summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/main.cpp29
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp27
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h1
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
5 files changed, 26 insertions, 34 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 7f2164f62..c402b145a 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -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
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 3d6e3375d..15d59701d 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -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);
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 1e5ae7ade..989e8b3e4 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -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
- }
-}
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index de0afcef7..84da6d8cf 100644
--- a/src/modules/m_spanningtree/protocolinterface.h
+++ b/src/modules/m_spanningtree/protocolinterface.h
@@ -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
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 7146f4c01..b7c13b5f8 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -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;