summaryrefslogtreecommitdiff
path: root/kike.c
diff options
context:
space:
mode:
Diffstat (limited to 'kike.c')
-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);