diff --git a/src/modules/watch.c b/src/modules/watch.c index 23c54edf0..371a0cb04 100644 --- a/src/modules/watch.c +++ b/src/modules/watch.c @@ -388,6 +388,22 @@ int watch_notification(Client *client, Watch *watch, Link *lp, int event) (IsUser(client) ? client->user->username : ""), (IsUser(client) ? (IsHidden(client) ? client->user->virthost : client->user->realhost) : ""), (long long)watch->lasttime); + /* For watch away notification, a user who is away could change their nick, + * and that nick could be on someones watch list. In such a case we + * should not only send RPL_LOGON but also a RPL_GONEAWAY. + */ + if ((lp->flags & WATCH_FLAG_AWAYNOTIFY) && IsUser(client) && client->user->away) + { + /* This is possible if the user is nick changing, + * they come online, and then we send RPL_GONEAWAY + */ + sendnumeric(lp->value.client, RPL_GONEAWAY, + client->name, + (IsUser(client) ? client->user->username : ""), + (IsUser(client) ? (IsHidden(client) ? client->user->virthost : client->user->realhost) : ""), + (long long)client->user->away_since, + client->user->away); + } } } else