degesch: log the channel topic after joining

This commit is contained in:
Přemysl Eric Janouch 2015-06-02 23:42:04 +02:00
parent 458ac8b7c4
commit 5e4f94c38c
1 changed files with 23 additions and 0 deletions

View File

@ -4517,6 +4517,27 @@ irc_handle_rpl_endofnames (struct server *s, const struct irc_message *msg)
irc_process_names (s, channel);
}
static void
irc_handle_rpl_topic (struct server *s, const struct irc_message *msg)
{
if (msg->params.len < 3)
return;
const char *channel_name = msg->params.vector[1];
const char *topic = msg->params.vector[2];
struct channel *channel = str_map_find (&s->irc_channels, channel_name);
struct buffer *buffer = str_map_find (&s->irc_buffer_map, channel_name);
hard_assert ((channel && buffer) ||
(channel && !buffer) || (!channel && !buffer));
if (buffer)
{
// FIXME: logging
buffer_send_status (s->ctx, buffer, "The topic is: %s", topic);
}
}
static void
irc_handle_isupport_prefix (struct server *s, char *value)
{
@ -4682,6 +4703,8 @@ irc_process_numeric (struct server *s,
irc_handle_rpl_namreply (s, msg); buffer = NULL; break;
case IRC_RPL_ENDOFNAMES:
irc_handle_rpl_endofnames (s, msg); buffer = NULL; break;
case IRC_RPL_TOPIC:
irc_handle_rpl_topic (s, msg); buffer = NULL; break;
case IRC_ERR_NICKNAMEINUSE:
// TODO: if (state == IRC_CONNECTED), use a different nick;