diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-01 14:18:07 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-06-01 14:18:07 +0000 |
commit | ada434820d2d81d8e4bcf633ebcbfef20606b51c (patch) | |
tree | 945c80ec070f872cd32cb8a8706079b28ce88cbc /src/modules/m_spanningtree | |
parent | 0620c97abdf473ad536027c3b60efee517013fa1 (diff) |
Add ProtocolInterface::Introduce() to prevent confusion over event ordering, and allow for more flexible protocol use
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9827 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 31 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 1 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.h | 1 |
4 files changed, 28 insertions, 29 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 585af8fe4..b91d76836 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -50,19 +50,19 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) { I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange, I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, - I_OnUserJoin, I_OnChangeHost, I_OnChangeName, I_OnUserPart, I_OnPostConnect, + I_OnUserJoin, I_OnChangeHost, I_OnChangeName, I_OnUserPart, I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnPostCommand }; - ServerInstance->Modules->Attach(eventlist, this, 28); + ServerInstance->Modules->Attach(eventlist, this, 27); delete ServerInstance->PI; ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance); for (std::vector<User*>::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); i++) { - this->OnPostConnect((*i)); + ServerInstance->PI->Introduce(*i); } } @@ -622,31 +622,6 @@ void ModuleSpanningTree::OnUserPart(User* user, Channel* channel, const std::str } } -void ModuleSpanningTree::OnPostConnect(User* user) -{ - if (IS_LOCAL(user)) - { - std::deque<std::string> 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("+"+std::string(user->FormatModes())); - params.push_back(user->GetIPString()); - params.push_back(ConvToStr(user->signon)); - 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 - } -} - void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { if ((IS_LOCAL(user)) && (user->registered == REG_ALL)) diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index a302c1f4f..fa3a33b02 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -161,7 +161,6 @@ class ModuleSpanningTree : public Module virtual void OnChangeHost(User* user, const std::string &newhost); virtual void OnChangeName(User* user, const std::string &gecos); virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent); - virtual void OnPostConnect(User* user); virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); virtual void OnUserPostNick(User* user, const std::string &oldnick); virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent); diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index e586c7017..850a27c22 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -172,3 +172,27 @@ void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::stri } } +void SpanningTreeProtocolInterface::Introduce(User* user) +{ + if (IS_LOCAL(user)) + { + std::deque<std::string> 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("+"+std::string(user->FormatModes())); + params.push_back(user->GetIPString()); + params.push_back(ConvToStr(user->signon)); + 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 b43e88c67..1b8c6ec56 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -25,6 +25,7 @@ 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 |