summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h15
-rw-r--r--src/modules.cpp1
-rw-r--r--src/usermanager.cpp4
3 files changed, 15 insertions, 5 deletions
diff --git a/include/modules.h b/include/modules.h
index de418a785..ebb3c63b4 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -216,7 +216,7 @@ enum Implementation
I_OnSendSnotice, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper,
I_OnUserPreInvite, I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNick,
I_OnUserPostMessage, I_OnUserMessageBlocked, I_OnMode,
- I_OnDecodeMetaData, I_OnAcceptConnection, I_OnUserInit,
+ I_OnDecodeMetaData, I_OnAcceptConnection, I_OnUserInit, I_OnUserPostInit,
I_OnChangeHost, I_OnChangeRealName, I_OnAddLine, I_OnDelLine, I_OnExpireLine,
I_OnUserPostNick, I_OnPreMode, I_On005Numeric, I_OnKill, I_OnLoadModule,
I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite,
@@ -722,11 +722,20 @@ class CoreExport Module : public classbase, public usecountbase
*/
virtual void OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, bool loop);
- /** Called when a user is first connecting, prior to starting DNS lookups, checking initial
- * connect class, or accepting any commands.
+ /** Called after a user object is initialised and added to the user list.
+ * When this is called the user has not their I/O hooks checked or had their initial
+ * connect class assigned and may not yet have a serialiser. You probably want to use
+ * the OnUserPostInit or OnUserSetIP hooks instead of this one.
+ * @param user The connecting user.
*/
virtual void OnUserInit(LocalUser* user);
+ /** Called after a user object has had their I/O hooks checked, their initial connection
+ * class assigned, and had a serialiser set.
+ * @param user The connecting user.
+ */
+ virtual void OnUserPostInit(LocalUser* user);
+
/** Called to check if a user who is connecting can now be allowed to register
* If any modules return false for this function, the user is held in the waiting
* state until all modules return true. For example a module which implements ident
diff --git a/src/modules.cpp b/src/modules.cpp
index 66f424dcb..690ff0feb 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -102,6 +102,7 @@ void Module::OnBackgroundTimer(time_t) { DetachEvent(I_OnBackgroundTimer); }
ModResult Module::OnPreCommand(std::string&, CommandBase::Params&, LocalUser*, bool) { DetachEvent(I_OnPreCommand); return MOD_RES_PASSTHRU; }
void Module::OnPostCommand(Command*, const CommandBase::Params&, LocalUser*, CmdResult, bool) { DetachEvent(I_OnPostCommand); }
void Module::OnUserInit(LocalUser*) { DetachEvent(I_OnUserInit); }
+void Module::OnUserPostInit(LocalUser*) { DetachEvent(I_OnUserPostInit); }
ModResult Module::OnCheckReady(LocalUser*) { DetachEvent(I_OnCheckReady); return MOD_RES_PASSTHRU; }
ModResult Module::OnUserRegister(LocalUser*) { DetachEvent(I_OnUserRegister); return MOD_RES_PASSTHRU; }
ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { DetachEvent(I_OnUserPreKick); return MOD_RES_PASSTHRU; }
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 40e0096a2..fafeffb42 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -210,8 +210,8 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
New->WriteNotice("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.");
FOREACH_MOD(OnSetUserIP, (New));
- if (New->quitting)
- return;
+ if (!New->quitting)
+ FOREACH_MOD(OnUserPostInit, (New));
}
void UserManager::QuitUser(User* user, const std::string& quitreason, const std::string* operreason)