kike: implement RPL_TOPICWHOTIME

This one was also trivial.
This commit is contained in:
Přemysl Eric Janouch 2015-06-07 00:58:00 +02:00
parent fc09c392c9
commit 8282b7bd45
1 changed files with 10 additions and 0 deletions

10
kike.c
View File

@ -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);