aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-07 00:41:59 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-07 01:23:52 +0200
commit6d16dbb16d4d575a63f30bd1288b616e48598813 (patch)
tree833163b92bbb70d313820925be3610f95392e069
parent6d720e7a1ad9b107ac9567ce6ca90850a3a8aca6 (diff)
downloadxK-6d16dbb16d4d575a63f30bd1288b616e48598813.tar.gz
xK-6d16dbb16d4d575a63f30bd1288b616e48598813.tar.xz
xK-6d16dbb16d4d575a63f30bd1288b616e48598813.zip
degesch: process RPL_TOPICWHOTIME
-rw-r--r--degesch.c31
-rw-r--r--kike-replies1
2 files changed, 32 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index 789ab55..8b71d59 100644
--- a/degesch.c
+++ b/degesch.c
@@ -4876,6 +4876,35 @@ irc_handle_rpl_creationtime (struct server *s, const struct irc_message *msg)
}
static void
+irc_handle_rpl_topicwhotime (struct server *s, const struct irc_message *msg)
+{
+ if (msg->params.len < 4)
+ return;
+
+ const char *channel_name = msg->params.vector[1];
+ const char *who = msg->params.vector[2];
+ const char *change_time = msg->params.vector[3];
+
+ unsigned long changed;
+ if (!xstrtoul (&changed, change_time, 10))
+ return;
+
+ 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));
+
+ // Topic set by x (y@z) on ...
+ if (buffer)
+ {
+ // FIXME: logging
+ char *x = make_time_string (changed);
+ buffer_send_status (s->ctx, buffer, "Topic set by %s on %s", who, x);
+ free (x);
+ }
+}
+
+static void
irc_handle_isupport_prefix (struct server *s, char *value)
{
char *modes = value;
@@ -5068,6 +5097,8 @@ irc_process_numeric (struct server *s,
irc_handle_rpl_channelmodeis (s, msg); buffer = NULL; break;
case IRC_RPL_CREATIONTIME:
irc_handle_rpl_creationtime (s, msg); buffer = NULL; break;
+ case IRC_RPL_TOPICWHOTIME:
+ irc_handle_rpl_topicwhotime (s, msg); buffer = NULL; break;
case IRC_ERR_NICKNAMEINUSE:
// TODO: if (state == IRC_CONNECTED), use a different nick;
diff --git a/kike-replies b/kike-replies
index d5c4b75..decc880 100644
--- a/kike-replies
+++ b/kike-replies
@@ -27,6 +27,7 @@
329 IRC_RPL_CREATIONTIME "%s %lld"
331 IRC_RPL_NOTOPIC "%s :No topic is set"
332 IRC_RPL_TOPIC "%s :%s"
+333 IRC_RPL_TOPICWHOTIME "%s %s %lld"
346 IRC_RPL_INVITELIST "%s %s"
347 IRC_RPL_ENDOFINVITELIST "%s :End of channel invite list"
348 IRC_RPL_EXCEPTLIST "%s %s"