]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Call the OnUserInit hook from earlier in UserManager::AddUser.
authorPeter Powell <petpow@saberuk.com>
Sun, 20 Jan 2019 09:52:38 +0000 (09:52 +0000)
committerPeter Powell <petpow@saberuk.com>
Sun, 20 Jan 2019 09:52:38 +0000 (09:52 +0000)
This fixes messages being lost when sending them to a user who has
only just connected to the server.

src/usermanager.cpp
src/users.cpp

index a70a00085029bda15ef96e8850b6fe2025b1765b..053a308cbb164b6ea9d36e0c83d0259a4c252843 100644 (file)
@@ -76,6 +76,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
        this->clientlist[New->nick] = New;
        this->AddClone(New);
        this->local_users.push_front(New);
+       FOREACH_MOD(OnUserInit, (New));
 
        if (!SocketEngine::AddFd(eh, FD_WANT_FAST_READ | FD_WANT_EDGE_WRITE))
        {
@@ -162,8 +163,6 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
        FOREACH_MOD(OnSetUserIP, (New));
        if (New->quitting)
                return;
-
-       FOREACH_MOD(OnUserInit, (New));
 }
 
 void UserManager::QuitUser(User* user, const std::string& quitreason, const std::string* operreason)
index a0b9c9d031aa4ce2e0e3a18850511d6ec0969055..eb87824fcf1f22d7ba543f49edc6d61931c1d9f7 100644 (file)
@@ -804,7 +804,11 @@ void LocalUser::Write(const ClientProtocol::SerializedMessage& text)
 void LocalUser::Send(ClientProtocol::Event& protoev)
 {
        if (!serializer)
+       {
+               ServerInstance->Logs->Log("USERS", LOG_DEBUG, "BUG: LocalUser::Send() called on %s who does not have a serializer!",
+                       GetFullRealHost().c_str());
                return;
+       }
 
        // In the most common case a static LocalUser field, sendmsglist, is passed to the event to be
        // populated. The list is cleared before returning.