+ // removing an item from the list
+ nick++;
+ irc::string n1 = nick;
+ for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
+ {
+ if (q->watcher == user)
+ {
+ irc::string n2 = q->target.c_str();
+ userrec* a = Srv->FindNick(q->target);
+ if (a)
+ {
+ WriteServ(user->fd,"602 %s %s %s %s %lu :stopped watching",user->nick,a->nick,a->ident,a->dhost,a->age);
+ }
+ else
+ {
+ WriteServ(user->fd,"602 %s %s * * 0 :stopped watching",user->nick,q->target.c_str());
+ }
+ if (n1 == n2)
+ {
+ watches.erase(q);
+ break;
+ }
+ }
+ }
+ }
+ else if (nick[0] == '+')
+ {
+ nick++;
+ irc::string n1 = nick;
+ bool exists = false;
+ for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
+ {
+ if (q->watcher == user)
+ {
+ irc::string n2 = q->target.c_str();
+ if (n1 == n2)
+ {
+ // already on watch list
+ exists = true;
+ }
+ }
+ }
+ if (!exists)
+ {
+ watchentry w;
+ w.watcher = user;
+ w.target = nick;
+ watches.push_back(w);
+ log(DEBUG,"*** Added %s to watchlist of %s",nick,user->nick);
+ }
+ userrec* a = Srv->FindNick(nick);
+ if (a)
+ {
+ WriteServ(user->fd,"604 %s %s %s %s %lu :is online",user->nick,a->nick,a->ident,a->dhost,a->age);
+ }
+ else
+ {
+ WriteServ(user->fd,"605 %s %s * * 0 :is offline",user->nick,nick);
+ }