summaryrefslogtreecommitdiff
path: root/src/modules/m_callerid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_callerid.cpp')
-rw-r--r--src/modules/m_callerid.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 6d7d8413f..d3df1948b 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -222,13 +222,13 @@ public:
delete myumode;
throw new ModuleException("Could not add usermode and command!");
}
- Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage };
- ServerInstance->Modules->Attach(eventlist, this, 6);
+ Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnCleanup };
+ ServerInstance->Modules->Attach(eventlist, this, 7);
}
~ModuleCallerID()
{
- delete mycommand;
+ delete myumode;
}
Version GetVersion()
@@ -279,6 +279,14 @@ public:
return 0;
}
+ void OnCleanup(int type, void* item)
+ {
+ if (type != TYPE_USER) return;
+ User* u = (User*)item;
+ /* Cleanup only happens on unload (before dtor), so keep this O(n) instead of O(n^2) which deferring to OnUserQuit would do. */
+ RemoveData(u);
+ }
+
int OnUserPreNick(User* user, const std::string& newnick)
{
if (!tracknick)