kike: send NICK notification back to ourselves
Also cleanup.
This commit is contained in:
parent
776c334128
commit
809fd4ab74
14
kike.c
14
kike.c
|
@ -668,18 +668,15 @@ irc_send_to_roommates (struct client *c, const char *message)
|
|||
if (chan->modes & IRC_CHAN_MODE_QUIET
|
||||
|| !channel_get_user (chan, c))
|
||||
continue;
|
||||
|
||||
// When we're unregistering, the str_map_find() will return zero,
|
||||
// which will prevent sending the QUIT message to ourselves.
|
||||
for (struct channel_user *iter = chan->users; iter; iter = iter->next)
|
||||
str_map_set (&targets, iter->c->nickname,
|
||||
str_map_find (&c->ctx->users, iter->c->nickname));
|
||||
str_map_set (&targets, iter->c->nickname, iter->c);
|
||||
}
|
||||
|
||||
str_map_iter_init (&iter, &targets);
|
||||
struct client *target;
|
||||
while ((target = str_map_iter_next (&iter)))
|
||||
client_send (target, "%s", message);
|
||||
if (target != c)
|
||||
client_send (target, "%s", message);
|
||||
}
|
||||
|
||||
// --- Clients (continued) -----------------------------------------------------
|
||||
|
@ -740,9 +737,6 @@ client_unregister (struct client *c, const char *reason)
|
|||
if (!c->registered)
|
||||
return;
|
||||
|
||||
// Make the user effectively non-existent
|
||||
str_map_set (&c->ctx->users, c->nickname, NULL);
|
||||
|
||||
char *message = xstrdup_printf (":%s!%s@%s QUIT :%s",
|
||||
c->nickname, c->username, c->hostname, reason);
|
||||
irc_send_to_roommates (c, message);
|
||||
|
@ -761,6 +755,7 @@ client_unregister (struct client *c, const char *reason)
|
|||
irc_channel_destroy_if_empty (c->ctx, chan);
|
||||
}
|
||||
|
||||
str_map_set (&c->ctx->users, c->nickname, NULL);
|
||||
free (c->nickname);
|
||||
c->nickname = NULL;
|
||||
c->registered = false;
|
||||
|
@ -1055,6 +1050,7 @@ irc_handle_nick (const struct irc_message *msg, struct client *c)
|
|||
char *message = xstrdup_printf (":%s!%s@%s NICK :%s",
|
||||
c->nickname, c->username, c->hostname, nickname);
|
||||
irc_send_to_roommates (c, message);
|
||||
client_send (c, "%s", message);
|
||||
free (message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue