From b454920c81cdb33914b008b716f2d5db7144ba56 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Mon, 29 Aug 2022 15:04:37 +0200 Subject: xC: deal with conflicts when renaming buffers --- NEWS | 2 ++ xC.c | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 207ec9b..e521b33 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Unreleased * xC: made it show WALLOPS messages, as PRIVMSG for the server buffer + * xC: various bugfixes + * xD: implemented WALLOPS, choosing to make it target even non-operators diff --git a/xC.c b/xC.c index 5b8dda2..fe32773 100644 --- a/xC.c +++ b/xC.c @@ -7155,7 +7155,7 @@ irc_handle_nick (struct server *s, const struct irc_message *msg) str_map_set (&s->irc_buffer_map, user->nickname, NULL); str_map_set (&s->irc_buffer_map, new_nickname, pm_buffer); - char *x = xstrdup_printf ("%s.%s", s->name, new_nickname); + char *x = irc_make_buffer_name (s, new_nickname); buffer_rename (s->ctx, pm_buffer, x); free (x); } @@ -8768,18 +8768,14 @@ server_rename (struct app_context *ctx, struct server *s, const char *new_name) struct buffer *buffer; while ((buffer = str_map_iter_next (&iter))) { - // TODO: creation of buffer names should be centralized -> replace - // calls to buffer_rename() and manual setting of buffer names - // with something like buffer_autorename() -- just mind the mess - // in irc_handle_nick(), which can hopefully be simplified char *x = NULL; switch (buffer->type) { case BUFFER_PM: - x = xstrdup_printf ("%s.%s", s->name, buffer->user->nickname); + x = irc_make_buffer_name (s, buffer->user->nickname); break; case BUFFER_CHANNEL: - x = xstrdup_printf ("%s.%s", s->name, buffer->channel->name); + x = irc_make_buffer_name (s, buffer->channel->name); break; default: hard_assert (!"unexpected type of server-related buffer"); -- cgit v1.2.3-70-g09d2