diff options
-rw-r--r-- | degesch.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -4518,6 +4518,27 @@ irc_handle_rpl_endofnames (struct server *s, const struct irc_message *msg) } 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) { char *modes = 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; |