]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add ProtocolInterface::Introduce() to prevent confusion over event ordering, and...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 1 Jun 2008 14:18:07 +0000 (14:18 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 1 Jun 2008 14:18:07 +0000 (14:18 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9827 e03df62e-2008-0410-955e-edbf42e46eb7

include/protocol.h
src/modules/m_conn_join.cpp
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/users.cpp

index 44013a1cac271ca8d6f92163b5d8544c6df89996..87d4ea384bb23c469ece668544276087c7aaaba3 100644 (file)
@@ -17,6 +17,7 @@
 #include "hashcomp.h"
 
 class InspIRCd;
+class User;
 
 typedef std::deque<std::string> parameterlist;
 
@@ -74,6 +75,8 @@ class ProtocolInterface : public Extensible
        virtual void SendUserNotice(User* target, const std::string &text) { }
 
        virtual void GetServerList(ProtoServerList &sl) { }
+
+       virtual void Introduce(User* u) { }
 };
 
 #endif
index 046176b0c69f9c4830c7ffd926423d54214572a0..606794d10818c687c96c19863f05ef841ff591d6 100644 (file)
@@ -46,8 +46,8 @@ class ModuleConnJoin : public Module
                        : Module(Me)
                {
                        OnRehash(NULL, "");
-               Implementation eventlist[] = { I_OnPostConnect, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+                       Implementation eventlist[] = { I_OnPostConnect, I_OnRehash };
+                       ServerInstance->Modules->Attach(eventlist, this, 2);
                }
 
                void Prioritize()
index 585af8fe4b2e3fac4ecd1ec384cbcf7fa9e95f4a..b91d76836edaef9ebabb006ecb800f9681dcdcd1 100644 (file)
@@ -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))
index a302c1f4fa8e109d3af7aea727dd1cf633f064de..fa3a33b026c6c6ee7c5a45a7178314919f995a8b 100644 (file)
@@ -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);
index e586c7017160c7d5761d6abdbad63f08f90f510e..850a27c22de970605089162caea1168e6a2bf5fa 100644 (file)
@@ -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
+       }
+}
index b43e88c67f19c5e5aaf49906068e9247ada7263d..1b8c6ec56621e23a690511951facb57a7847aed8 100644 (file)
@@ -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
index c892c51f50231e1d1ccc93c8bd4c73d6816ba2e1..143313af20e7fd457522aafbf146f1aa88e3f3c9 100644 (file)
@@ -959,6 +959,8 @@ 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]", this->GetPort(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str());