degesch: log the channel topic after joining
This commit is contained in:
parent
458ac8b7c4
commit
5e4f94c38c
23
degesch.c
23
degesch.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue