summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h96
-rw-r--r--src/coremods/core_xline/core_xline.cpp10
-rw-r--r--src/modules.cpp1
-rw-r--r--src/users.cpp1
4 files changed, 91 insertions, 17 deletions
diff --git a/include/modules.h b/include/modules.h
index a5e4440dc..a6450547c 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -233,23 +233,78 @@ enum Priority { PRIORITY_FIRST, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER }
*/
enum Implementation
{
- I_OnUserConnect, I_OnUserPreQuit, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart,
- 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_OnShutdown,
- 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,
- I_OnRawMode, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckChannelBan, I_OnExtBanCheck,
- I_OnPreChangeHost, I_OnPreTopicChange, I_OnConnectionFail,
- I_OnPostTopicChange, I_OnPostConnect, I_OnPostDeoper,
- I_OnPreChangeRealName, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete,
- I_OnPostOper, I_OnPostCommand, I_OnCommandBlocked, I_OnPostJoin,
- I_OnBuildNeighborList, I_OnGarbageCollect, I_OnSetConnectClass,
- I_OnUserMessage, I_OnPassCompare, I_OnNumeric,
- I_OnPreRehash, I_OnModuleRehash, I_OnChangeIdent, I_OnSetUserIP,
- I_OnServiceAdd, I_OnServiceDel, I_OnUserWrite,
+ I_On005Numeric,
+ I_OnAcceptConnection,
+ I_OnAddLine,
+ I_OnBackgroundTimer,
+ I_OnBuildNeighborList,
+ I_OnChangeHost,
+ I_OnChangeRealHost,
+ I_OnChangeIdent,
+ I_OnChangeRealName,
+ I_OnChannelDelete,
+ I_OnChannelPreDelete,
+ I_OnCheckBan,
+ I_OnCheckChannelBan,
+ I_OnCheckInvite,
+ I_OnCheckKey,
+ I_OnCheckLimit,
+ I_OnCheckReady,
+ I_OnCommandBlocked,
+ I_OnConnectionFail,
+ I_OnDecodeMetaData,
+ I_OnDelLine,
+ I_OnExpireLine,
+ I_OnExtBanCheck,
+ I_OnGarbageCollect,
+ I_OnKill,
+ I_OnLoadModule,
+ I_OnMode,
+ I_OnModuleRehash,
+ I_OnNumeric,
+ I_OnOper,
+ I_OnPassCompare,
+ I_OnPostCommand,
+ I_OnPostConnect,
+ I_OnPostDeoper,
+ I_OnPostJoin,
+ I_OnPostOper,
+ I_OnPostTopicChange,
+ I_OnPreChangeHost,
+ I_OnPreChangeRealName,
+ I_OnPreCommand,
+ I_OnPreMode,
+ I_OnPreRehash,
+ I_OnPreTopicChange,
+ I_OnRawMode,
+ I_OnSendSnotice,
+ I_OnServiceAdd,
+ I_OnServiceDel,
+ I_OnSetConnectClass,
+ I_OnSetUserIP,
+ I_OnShutdown,
+ I_OnUnloadModule,
+ I_OnUserConnect,
+ I_OnUserDisconnect,
+ I_OnUserInit,
+ I_OnUserInvite,
+ I_OnUserJoin,
+ I_OnUserKick,
+ I_OnUserMessage,
+ I_OnUserMessageBlocked,
+ I_OnUserPart,
+ I_OnUserPostInit,
+ I_OnUserPostMessage,
+ I_OnUserPostNick,
+ I_OnUserPreInvite,
+ I_OnUserPreJoin,
+ I_OnUserPreKick,
+ I_OnUserPreMessage,
+ I_OnUserPreNick,
+ I_OnUserPreQuit,
+ I_OnUserQuit,
+ I_OnUserRegister,
+ I_OnUserWrite,
I_END
};
@@ -598,6 +653,13 @@ class CoreExport Module : public classbase, public usecountbase
*/
virtual void OnChangeHost(User* user, const std::string &newhost);
+ /** Called whenever a user's real hostname is changed.
+ * This event triggers after the host has been set.
+ * @param user The user whos host is being changed
+ * @param newhost The new hostname being set
+ */
+ virtual void OnChangeRealHost(User* user, const std::string& newhost);
+
/** Called whenever a user's real name is changed.
* This event triggers after the name has been set.
* @param user The user who's real name is being changed
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index 568b7d269..7a53f8566 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -77,6 +77,16 @@ class CoreModXLine : public Module
user->CheckLines(true);
}
+ void OnChangeRealHost(User* user, const std::string& newhost) CXX11_OVERRIDE
+ {
+ LocalUser* luser = IS_LOCAL(user);
+ if (!luser || luser->quitting)
+ return;
+
+ luser->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ luser->CheckLines(false);
+ }
+
ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE
{
// Check Q-lines (for local nick changes only, remote servers have our Q-lines to enforce themselves)
diff --git a/src/modules.cpp b/src/modules.cpp
index 6c7929b1f..27431e3fb 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -132,6 +132,7 @@ void Module::OnUserInvite(User*, User*, Channel*, time_t, unsigned int, CUList&
void Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); }
void Module::OnDecodeMetaData(Extensible*, const std::string&, const std::string&) { DetachEvent(I_OnDecodeMetaData); }
void Module::OnChangeHost(User*, const std::string&) { DetachEvent(I_OnChangeHost); }
+void Module::OnChangeRealHost(User*, const std::string&) { DetachEvent(I_OnChangeRealHost); }
void Module::OnChangeRealName(User*, const std::string&) { DetachEvent(I_OnChangeRealName); }
void Module::OnChangeIdent(User*, const std::string&) { DetachEvent(I_OnChangeIdent); }
void Module::OnAddLine(User*, XLine*) { DetachEvent(I_OnAddLine); }
diff --git a/src/users.cpp b/src/users.cpp
index df21dbeee..8270e2d0e 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1075,6 +1075,7 @@ void User::ChangeRealHost(const std::string& host, bool resetdisplay)
if (!changehost)
return;
+ FOREACH_MOD(OnChangeHost, (this, host));
realhost = host;
this->InvalidateCache();
}