kike: add support for IRCv3.2 server-time

This commit is contained in:
2016-01-31 20:06:45 +01:00
parent 2ec6258ff3
commit 10a264ec3d
4 changed files with 40 additions and 3 deletions

View File

@@ -3144,6 +3144,7 @@ log_formatter (struct app_context *ctx,
// Move the formatter inside
struct buffer_line *line = buffer_line_new (f);
line->flags = flags;
// TODO: allow providing custom time (IRCv3.2 server-time)
line->when = time (NULL);
buffer_pop_excess_lines (ctx, buffer);
@@ -5474,6 +5475,7 @@ irc_handle_cap (struct server *s, const struct irc_message *msg)
const char *cap = v.vector[i];
if (!strcasecmp_ascii (cap, "multi-prefix")
|| !strcasecmp_ascii (cap, "invite-notify")
|| !strcasecmp_ascii (cap, "server-time")
|| !strcasecmp_ascii (cap, "echo-message"))
str_vector_add (&chosen, cap);
}
@@ -6827,6 +6829,9 @@ irc_process_numeric (struct server *s,
static void
irc_process_message (const struct irc_message *msg, struct server *s)
{
// TODO: make use of IRCv3.2 server-time (with fallback to unixtime_msec())
// -> change all calls to log_{server,nick,outcoming,ctcp}*() to take
// an extra argument specifying time
struct irc_handler key = { .name = msg->command };
struct irc_handler *handler = bsearch (&key, g_irc_handlers,
N_ELEMENTS (g_irc_handlers), sizeof key, irc_handler_cmp_by_name);