summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+ }
}
}