diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-22 10:18:54 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-22 10:18:54 +0000 |
commit | 9eadffd061f3586247a42f470a957142d6173889 (patch) | |
tree | 189b7e83bfc12f8ba0bd095991e446144a7ac75d | |
parent | ef8b0808954066cfe37f8c51330d76db31577b86 (diff) |
Fix memory consumption of m_slence, users silence lists arent deleted till they quit, they should be deleted when they empty their list to save ram
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6823 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_silence.cpp | 21 | ||||
-rw-r--r-- | src/modules/m_silence_ext.cpp | 25 |
2 files changed, 19 insertions, 27 deletions
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 5c8e5fdef..9aa891129 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -79,22 +79,19 @@ class cmd_silence : public command_t // does it contain any entries and does it exist? if (sl) { - if (sl->size()) + silencelist::iterator i = sl->find(mask.c_str()); + if (i != sl->end()) { - silencelist::iterator i = sl->find(mask.c_str()); - if (i != sl->end()) + sl->erase(i); + user->WriteServ("950 %s %s :Removed %s from silence list",user->nick, user->nick, mask.c_str()); + if (!sl->size()) { - sl->erase(i); - user->WriteServ("950 %s %s :Removed %s from silence list",user->nick, user->nick, mask.c_str()); + // tidy up -- if a user's list is empty, theres no use having it + // hanging around in the user record. + DELETE(sl); + user->Shrink("silence_list"); } } - else - { - // tidy up -- if a user's list is empty, theres no use having it - // hanging around in the user record. - DELETE(sl); - user->Shrink("silence_list"); - } } } else if (action == '+') diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp index ba76abc29..8b40c90bb 100644 --- a/src/modules/m_silence_ext.cpp +++ b/src/modules/m_silence_ext.cpp @@ -117,27 +117,22 @@ class cmd_silence : public command_t // does it contain any entries and does it exist? if (sl) { - if (sl->size()) + for (silencelist::iterator i = sl->begin(); i != sl->end(); i++) { - for (silencelist::iterator i = sl->begin(); i != sl->end(); i++) + // search through for the item + irc::string listitem = i->first.c_str(); + if (listitem == mask && i->second == pattern) { - // search through for the item - irc::string listitem = i->first.c_str(); - if (listitem == mask && i->second == pattern) + sl->erase(i); + user->WriteServ("950 %s %s :Removed %s %s from silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); + if (!sl->size()) { - sl->erase(i); - user->WriteServ("950 %s %s :Removed %s %s from silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); - break; + DELETE(sl); + user->Shrink("silence_list"); } + break; } } - else - { - // tidy up -- if a user's list is empty, theres no use having it - // hanging around in the user record. - DELETE(sl); - user->Shrink("silence_list"); - } } } else if (action == '+') |