diff options
author | TingPing <tingping@tingping.se> | 2013-08-20 00:24:11 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-08-20 00:24:20 -0400 |
commit | 77c1edbe13e1d4a2697e184a01d174004dd9e25b (patch) | |
tree | cef2bff93cd6d0b5af8aa173aafdfa8951c1688b /src/common/notify.c | |
parent | 46c32952b06452a219424ed3e5a6c1da92691a49 (diff) |
Handle lists in MONITOR replies
Diffstat (limited to 'src/common/notify.c')
-rw-r--r-- | src/common/notify.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/common/notify.c b/src/common/notify.c index 944d826c..f1439140 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -284,6 +284,70 @@ notify_set_online (server * serv, char *nick, notify_announce_online (serv, servnot, nick, tags_data); } +/* monitor can send lists for numeric 730/731 */ + +void +notify_set_offline_list (server * serv, char *users, int quiet, + const message_tags_data *tags_data) +{ + struct notify_per_server *servnot; + char nick[NICKLEN]; + char *token, *chr; + int pos; + + token = strtok (users, ","); + while (token != NULL) + { + chr = strchr (token, '!'); + if (!chr) + goto end; + + pos = chr - token; + if (pos + 1 >= sizeof(nick)) + goto end; + + memset (nick, 0, sizeof(nick)); + strncpy (nick, token, pos); + + servnot = notify_find (serv, nick); + if (servnot) + notify_announce_offline (serv, servnot, nick, quiet, tags_data); +end: + token = strtok (NULL, ","); + } +} + +void +notify_set_online_list (server * serv, char *users, + const message_tags_data *tags_data) +{ + struct notify_per_server *servnot; + char nick[NICKLEN]; + char *token, *chr; + int pos; + + token = strtok (users, ","); + while (token != NULL) + { + chr = strchr (token, '!'); + if (!chr) + goto end; + + pos = chr - token; + if (pos + 1 >= sizeof(nick)) + goto end; + + memset (nick, 0, sizeof(nick)); + strncpy (nick, token, pos); + + servnot = notify_find (serv, nick); + if (servnot) + notify_announce_online (serv, servnot, nick, tags_data); +end: + token = strtok (NULL, ","); + } +} + static void notify_watch (server * serv, char *nick, int add) { |