- for (int x = 0; x < pcnt; x++)
- {
- const char *nick = parameters[x];
- if (!strcasecmp(nick,"C"))
- {
- // watch clear
- watchlist* wl;
- if (user->GetExt("watchlist", wl))
- {
- delete wl;
- user->Shrink("watchlist");
- }
- }
- else if (!strcasecmp(nick,"L"))
- {
- watchlist* wl;
- if (user->GetExt("watchlist", wl))
- {
- for (watchlist::iterator q = wl->begin(); q != wl->end(); q++)
- {
- if (!q->second.empty())
- user->WriteServ("604 %s %s %s :is online", user->nick, q->first.c_str(), q->second.c_str());
- }
- }
- user->WriteServ("607 %s :End of WATCH list",user->nick);
- }
- else if (!strcasecmp(nick,"S"))
- {
- watchlist* wl;
- int you_have = 0;
- int youre_on = 0;
- std::string list;
-
- if (user->GetExt("watchlist", wl))
- {
- for (watchlist::iterator q = wl->begin(); q != wl->end(); q++)
- if (!q->second.empty())
- list.append(q->first.c_str()).append(" ");
- you_have = wl->size();
- }
-
- watchentries::iterator x = whos_watching_me.find(user->nick);
- if (x != whos_watching_me.end())
- youre_on = x->second.size();
-
- user->WriteServ("603 %s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on);
- if (!list.empty())
- user->WriteServ("606 %s :%s",user->nick, list.c_str());
- user->WriteServ("607 %s :End of WATCH S",user->nick);
- }
- else if (nick[0] == '-')
- {
- nick++;
- return remove_watch(user, nick);
- }
- else if (nick[0] == '+')
- {
- nick++;
- return add_watch(user, nick);
- }
- }