* 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
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));
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)
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
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);
}
}
}
-
-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
- }
-}
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
_new->SetClientIP(params[6].c_str());
ServerInstance->Users->AddGlobalClone(_new);
+ remoteserver->SetUserCount(1); // increment by 1
bool dosend = true;
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;
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]",