diff options
Diffstat (limited to 'src')
-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 == '+') |