aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-07 00:58:00 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-07 01:23:52 +0200
commit8282b7bd4560949a2f8152dff621429248305683 (patch)
tree5f5123ff908aa71b0f59b00ca5d1a323f8a0577f
parentfc09c392c9bceb9750888d1455d8246ba01ee7a8 (diff)
downloadxK-8282b7bd4560949a2f8152dff621429248305683.tar.gz
xK-8282b7bd4560949a2f8152dff621429248305683.tar.xz
xK-8282b7bd4560949a2f8152dff621429248305683.zip
kike: implement RPL_TOPICWHOTIME
This one was also trivial.
-rw-r--r--kike.c10
1 files changed, 10 insertions, 0 deletions
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);