+ // removing an item from the list
+ nick++;
+ // fetch their silence list
+ silencelist* sl;
+ user->GetExt("silence_list", sl);
+ // does it contain any entries and does it exist?
+ if (sl)
+ {
+ if (sl->size())
+ {
+ for (silencelist::iterator i = sl->begin(); i != sl->end(); i++)
+ {
+ // search through for the item
+ irc::string listitem = i->c_str();
+ irc::string target = nick;
+ if (listitem == target)
+ {
+ 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())
+ {
+ // 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 (nick[0] == '+')
+ {
+ nick++;
+ // 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(std::string("silence_list"), sl);
+ }
+ // add the nick to it -- silence only takes nicks for some reason even though its list shows masks
+ for (silencelist::iterator n = sl->begin(); n != sl->end(); n++)
+ {
+ irc::string listitem = n->c_str();
+ irc::string target = nick;
+ if (listitem == target)
+ {
+ WriteServ(user->fd,"952 %s %s :%s is already on your silence list",user->nick, user->nick,nick);
+ return;
+ }
+ }
+ sl->push_back(std::string(nick));
+ WriteServ(user->fd,"951 %s %s :Added %s!*@* to silence list",user->nick, user->nick,nick);
+ return;