mirror of
https://github.com/moparisthebest/hexchat
synced 2024-11-22 09:12:22 -05:00
Handle lists in MONITOR replies
This commit is contained in:
parent
46c32952b0
commit
77c1edbe13
@ -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)
|
||||
{
|
||||
|
@ -47,6 +47,11 @@ void notify_set_online (server * serv, char *nick,
|
||||
const message_tags_data *tags_data);
|
||||
void notify_set_offline (server * serv, char *nick, int quiet,
|
||||
const message_tags_data *tags_data);
|
||||
/* the MONITOR stuff */
|
||||
void notify_set_online_list (server * serv, char *users,
|
||||
const message_tags_data *tags_data);
|
||||
void notify_set_offline_list (server * serv, char *users, int quiet,
|
||||
const message_tags_data *tags_data);
|
||||
void notify_send_watches (server * serv);
|
||||
|
||||
/* the general stuff */
|
||||
|
@ -466,8 +466,6 @@ process_numeric (session * sess, int n,
|
||||
/* show whois is the server tab */
|
||||
session *whois_sess = serv->server_session;
|
||||
|
||||
char *ex;
|
||||
|
||||
/* unless this setting is on */
|
||||
if (prefs.hex_irc_whois_front)
|
||||
whois_sess = serv->front_session;
|
||||
@ -942,17 +940,11 @@ process_numeric (session * sess, int n,
|
||||
break;
|
||||
|
||||
case 730: /* RPL_MONONLINE */
|
||||
ex = strchr (word[4], '!'); /* only send the nick */
|
||||
if (ex)
|
||||
ex[0] = 0;
|
||||
notify_set_online (serv, word[4] + 1, tags_data);
|
||||
notify_set_online_list (serv, word[4] + 1, tags_data);
|
||||
break;
|
||||
|
||||
case 731: /* RPL_MONOFFLINE */
|
||||
ex = strchr (word[4], '!'); /* only send the nick */
|
||||
if (ex)
|
||||
ex[0] = 0;
|
||||
notify_set_offline (serv, word[4] + 1, FALSE, tags_data);
|
||||
notify_set_offline_list (serv, word[4] + 1, FALSE, tags_data);
|
||||
break;
|
||||
|
||||
case 900: /* successful SASL 'logged in as ' */
|
||||
|
Loading…
Reference in New Issue
Block a user