summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-02 23:42:04 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-02 23:42:04 +0200
commit5e4f94c38c2078655a3e314d49926d6b05830ea1 (patch)
tree99272fdf81d81f1850b46fbd6a4fb2756e4da05f /degesch.c
parent458ac8b7c4dde49ddde3dfa4335fb717e2d2f5e0 (diff)
downloadxK-5e4f94c38c2078655a3e314d49926d6b05830ea1.tar.gz
xK-5e4f94c38c2078655a3e314d49926d6b05830ea1.tar.xz
xK-5e4f94c38c2078655a3e314d49926d6b05830ea1.zip
degesch: log the channel topic after joining
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index ee5540f..ffac775 100644
--- a/degesch.c
+++ b/degesch.c
@@ -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;