summaryrefslogtreecommitdiff
path: root/src/modules/m_watch.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-13 22:48:55 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-13 22:48:55 +0000
commit06149e3f2b56258e76e9c5d5e7f5997a05bdd7f0 (patch)
treed4dd9081187e16e6c999356053e00fd1b7f9ebe5 /src/modules/m_watch.cpp
parent9c2f93089bbac577f69d7af67c707d32317f012a (diff)
Fix m_watch to properly use OnCleanup, and to delete pointer on quit
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5984 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_watch.cpp')
-rw-r--r--src/modules/m_watch.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 622adec3d..0b46fff13 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -312,7 +312,7 @@ class Modulewatch : public Module
void Implements(char* List)
{
- List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1;
+ List[I_OnCleanup] = List[I_OnUserQuit] = List[I_OnPostConnect] = List[I_OnUserPostNick] = List[I_On005Numeric] = 1;
}
virtual void OnUserQuit(userrec* user, const std::string &reason)
@@ -351,6 +351,24 @@ class Modulewatch : public Module
whos_watching_me.erase(user->nick);
}
}
+
+ /* User's quitting, we're done with this. */
+ delete wl;
+ }
+ }
+
+ virtual void OnCleanup(int target_type, void* item)
+ {
+ if (target_type == TYPE_USER)
+ {
+ watchlist* wl;
+ userrec* user = (userrec*)item;
+
+ if (user->GetExt("watchlist", wl))
+ {
+ user->Shrink("watchlist");
+ delete wl;
+ }
}
}