string_getter(cl, nick_reg);
/* string_getter(cl, pass_reg); */
string_getter(cl, ctcp_version);
+ string_getter(cl, ctcp_time);
string_getter(cl, peername);
integer_getter(cl, peerport);
/* buf/bufLen/wbuf/wbufLen */
if (!client->ctcp_version)
abort();
}
+ if (!strncmp(args[1], "\1TIME ", 6)) {
+ args[1] += 6;
+ char *p = strchr(args[1], '\1');
+ if (p)
+ *p = '\0';
+ free(client->ctcp_time);
+ time_t current = get_time();
+ char buf[20];
+ strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", gmtime(¤t));
+ client->ctcp_time = malloc(strlen(args[1])+sizeof(" (received on UTC)")+sizeof(buf));
+ if (!client->ctcp_time)
+ abort();
+ sprintf(client->ctcp_time, "%s (received on %s UTC)", args[1], buf);
+ }
return 0;
}
(command[0] == 'P' ? msg_privmsg : msg_notice)(client, args[0], args[1]);
if (client == cl || client->umode & UMODE_OPER)
rpl_whoisactually(client, cl), sendbuf(client);
if (cl->ctcp_version && client->umode & UMODE_OPER)
- rpl_whoisspecial(client, cl, "Version: ", cl->ctcp_version), sendbuf(client);
+ rpl_whoisspecial(client, cl, "CTCP VERSION: ", cl->ctcp_version), sendbuf(client);
+ if (cl->ctcp_time && client->umode & UMODE_OPER)
+ rpl_whoisspecial(client, cl, "CTCP TIME: ", cl->ctcp_time), sendbuf(client);
rpl_whoismodes(client, cl), sendbuf(client);
if (cl->umode & UMODE_BOT)
rpl_whoisbot(client, cl), sendbuf(client);