degesch: log nick changes

This commit is contained in:
Přemysl Eric Janouch 2015-04-20 21:56:32 +02:00
parent b8bfcfde7c
commit a43051132a
1 changed files with 14 additions and 3 deletions

View File

@ -271,6 +271,7 @@ enum buffer_line_type
BUFFER_LINE_JOIN, ///< JOIN BUFFER_LINE_JOIN, ///< JOIN
BUFFER_LINE_PART, ///< PART BUFFER_LINE_PART, ///< PART
BUFFER_LINE_KICK, ///< KICK BUFFER_LINE_KICK, ///< KICK
BUFFER_LINE_NICK, ///< NICK
BUFFER_LINE_QUIT, ///< QUIT BUFFER_LINE_QUIT, ///< QUIT
BUFFER_LINE_STATUS, ///< Whatever status messages BUFFER_LINE_STATUS, ///< Whatever status messages
BUFFER_LINE_ERROR ///< Whatever error 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)", str_append_printf (&text, "<-- You have kicked %s (%s)",
object, reason); object, reason);
break; 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: case BUFFER_LINE_QUIT:
if (who) if (who)
str_append_printf (&text, "<-- %s (%s) has quit (%s)", 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; struct buffer *buffer;
while ((buffer = str_map_iter_next (&iter))) 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 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); str_map_find (&ctx->irc_buffer_map, user->nickname);
if (buffer) 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 // 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); buffer = str_map_find (&ctx->irc_buffer_map, iter->channel->name);
hard_assert (buffer != NULL); 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);
} }
} }