From 8282b7bd4560949a2f8152dff621429248305683 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 7 Jun 2015 00:58:00 +0200 Subject: kike: implement RPL_TOPICWHOTIME This one was also trivial. --- kike.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kike.c b/kike.c index 5c3dfd9..7a2d6e5 100644 --- a/kike.c +++ b/kike.c @@ -407,6 +407,8 @@ struct channel time_t created; ///< Creation time char *topic; ///< Channel topic + char *topic_who; ///< Who set the topic + time_t topic_time; ///< When the topic was set struct channel_user *users; ///< Channel users @@ -435,6 +437,7 @@ channel_delete (struct channel *self) free (self->name); free (self->key); free (self->topic); + free (self->topic_who); struct channel_user *link, *tmp; for (link = self->users; link; link = tmp) @@ -2095,7 +2098,11 @@ irc_send_rpl_topic (struct client *c, struct channel *chan) if (!*chan->topic) irc_send_reply (c, IRC_RPL_NOTOPIC, chan->name); else + { irc_send_reply (c, IRC_RPL_TOPIC, chan->name, chan->topic); + irc_send_reply (c, IRC_RPL_TOPICWHOTIME, + chan->name, chan->topic_who, (long long) chan->topic_time); + } } static void @@ -2124,7 +2131,10 @@ irc_handle_topic (const struct irc_message *msg, struct client *c) RETURN_WITH_REPLY (c, IRC_ERR_CHANOPRIVSNEEDED, target); free (chan->topic); + free (chan->topic_who); chan->topic = xstrdup (msg->params.vector[1]); + chan->topic_who = xstrdup (msg->prefix); + chan->topic_time = time (NULL); char *message = xstrdup_printf (":%s!%s@%s TOPIC %s :%s", c->nickname, c->username, c->hostname, target, chan->topic); -- cgit v1.2.3-70-g09d2