- if (!strcasecmp(i->c_str(),nick))
- {
- sl->erase(i);
- WriteServ(user->fd,"950 %s %s :Removed %s!*@* from silence list",user->nick, user->nick,nick);
- // we have modified the vector from within a loop, we must now bail out
- return;
- }
- }
- }
- if (!sl->size())
+ irc::string listitem = i->first.c_str();
+ if (listitem == mask && i->second == pattern)
+ {
+ sl->erase(i);
+ user->WriteNumeric(950, "%s %s :Removed %s %s from silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), DecompPattern(pattern).c_str());
+ if (!sl->size())
+ {
+ delete sl;
+ user->Shrink("silence_list");
+ }
+ return CMD_SUCCESS;
+ }
+ }
+ }
+ user->WriteNumeric(952, "%s %s :%s %s does not exist on your silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), DecompPattern(pattern).c_str());
+ }
+ else if (action == '+')
+ {
+ // fetch the user's current silence list
+ silencelist* sl;
+ user->GetExt("silence_list", sl);
+ // what, they dont have one??? WE'RE ALL GONNA DIE! ...no, we just create an empty one.
+ if (!sl)
+ {
+ sl = new silencelist;
+ user->Extend("silence_list", sl);
+ }
+ if (sl->size() > maxsilence)
+ {
+ user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick.c_str(), user->nick.c_str());
+ return CMD_FAILURE;
+ }
+ for (silencelist::iterator n = sl->begin(); n != sl->end(); n++)
+ {
+ irc::string listitem = n->first.c_str();
+ if (listitem == mask && n->second == pattern)
+ {
+ user->WriteNumeric(952, "%s %s :%s %s is already on your silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), DecompPattern(pattern).c_str());
+ return CMD_FAILURE;
+ }
+ }
+ if (((pattern & SILENCE_EXCLUDE) > 0))