From a43051132a938aba5e532273c13fc1fdbd7962a5 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Mon, 20 Apr 2015 21:56:32 +0200 Subject: degesch: log nick changes --- degesch.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/degesch.c b/degesch.c index dc80fb1..6ddfc6e 100644 --- a/degesch.c +++ b/degesch.c @@ -271,6 +271,7 @@ enum buffer_line_type BUFFER_LINE_JOIN, ///< JOIN BUFFER_LINE_PART, ///< PART BUFFER_LINE_KICK, ///< KICK + BUFFER_LINE_NICK, ///< NICK BUFFER_LINE_QUIT, ///< QUIT BUFFER_LINE_STATUS, ///< Whatever status messages BUFFER_LINE_ERROR ///< Whatever error messages @@ -929,6 +930,13 @@ buffer_line_display (struct app_context *ctx, struct buffer_line *line) str_append_printf (&text, "<-- You have kicked %s (%s)", object, reason); break; + case BUFFER_LINE_NICK: + if (who) + str_append_printf (&text, "<-- %s is now known as %s", + nick, object); + else + str_append_printf (&text, "<-- You are now known as %s", object); + break; case BUFFER_LINE_QUIT: if (who) str_append_printf (&text, "<-- %s (%s) has quit (%s)", @@ -1860,7 +1868,8 @@ irc_handle_nick (struct app_context *ctx, const struct irc_message *msg) struct buffer *buffer; while ((buffer = str_map_iter_next (&iter))) { - // TODO: log a "You are now known as" message + buffer_send (ctx, buffer, BUFFER_LINE_NICK, 0, + NULL, NULL, "%s", new_nickname); } } else @@ -1870,7 +1879,8 @@ irc_handle_nick (struct app_context *ctx, const struct irc_message *msg) str_map_find (&ctx->irc_buffer_map, user->nickname); if (buffer) { - // TODO: log a message in the buffer + buffer_send (ctx, buffer, BUFFER_LINE_NICK, 0, + msg->prefix, NULL, "%s", new_nickname); // TODO: rename the buffer, and if it collides, merge them } @@ -1879,7 +1889,8 @@ irc_handle_nick (struct app_context *ctx, const struct irc_message *msg) { buffer = str_map_find (&ctx->irc_buffer_map, iter->channel->name); hard_assert (buffer != NULL); - // TODO: log a message in the buffer + buffer_send (ctx, buffer, BUFFER_LINE_NICK, 0, + msg->prefix, NULL, "%s", new_nickname); } } -- cgit v1.2.3-70-g09d2