kike: send NICK notification back to ourselves
Also cleanup.
This commit is contained in:
parent
776c334128
commit
809fd4ab74
12
kike.c
12
kike.c
@ -668,17 +668,14 @@ irc_send_to_roommates (struct client *c, const char *message)
|
|||||||
if (chan->modes & IRC_CHAN_MODE_QUIET
|
if (chan->modes & IRC_CHAN_MODE_QUIET
|
||||||
|| !channel_get_user (chan, c))
|
|| !channel_get_user (chan, c))
|
||||||
continue;
|
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)
|
for (struct channel_user *iter = chan->users; iter; iter = iter->next)
|
||||||
str_map_set (&targets, iter->c->nickname,
|
str_map_set (&targets, iter->c->nickname, iter->c);
|
||||||
str_map_find (&c->ctx->users, iter->c->nickname));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
str_map_iter_init (&iter, &targets);
|
str_map_iter_init (&iter, &targets);
|
||||||
struct client *target;
|
struct client *target;
|
||||||
while ((target = str_map_iter_next (&iter)))
|
while ((target = str_map_iter_next (&iter)))
|
||||||
|
if (target != c)
|
||||||
client_send (target, "%s", message);
|
client_send (target, "%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,9 +737,6 @@ client_unregister (struct client *c, const char *reason)
|
|||||||
if (!c->registered)
|
if (!c->registered)
|
||||||
return;
|
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",
|
char *message = xstrdup_printf (":%s!%s@%s QUIT :%s",
|
||||||
c->nickname, c->username, c->hostname, reason);
|
c->nickname, c->username, c->hostname, reason);
|
||||||
irc_send_to_roommates (c, message);
|
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);
|
irc_channel_destroy_if_empty (c->ctx, chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str_map_set (&c->ctx->users, c->nickname, NULL);
|
||||||
free (c->nickname);
|
free (c->nickname);
|
||||||
c->nickname = NULL;
|
c->nickname = NULL;
|
||||||
c->registered = false;
|
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",
|
char *message = xstrdup_printf (":%s!%s@%s NICK :%s",
|
||||||
c->nickname, c->username, c->hostname, nickname);
|
c->nickname, c->username, c->hostname, nickname);
|
||||||
irc_send_to_roommates (c, message);
|
irc_send_to_roommates (c, message);
|
||||||
|
client_send (c, "%s", message);
|
||||||
free (message);
|
free (message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user