From 06149e3f2b56258e76e9c5d5e7f5997a05bdd7f0 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 13 Dec 2006 22:48:55 +0000 Subject: 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 --- src/modules/m_watch.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') 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; + } } } -- cgit v1.2.3