summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/guile/weechat-guile-api.c50
-rw-r--r--src/plugins/irc/irc-command.c11
-rw-r--r--src/plugins/irc/irc-config.c3
-rw-r--r--src/plugins/irc/irc-ctcp.c38
-rw-r--r--src/plugins/irc/irc-input.c3
-rw-r--r--src/plugins/irc/irc-input.h1
-rw-r--r--src/plugins/irc/irc-protocol.c574
-rw-r--r--src/plugins/irc/irc-protocol.h2
-rw-r--r--src/plugins/irc/irc-raw.c37
-rw-r--r--src/plugins/irc/irc-raw.h2
-rw-r--r--src/plugins/irc/irc-upgrade.c1
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp83
-rw-r--r--src/plugins/logger/logger-buffer.c38
-rw-r--r--src/plugins/logger/logger-config.c3
-rw-r--r--src/plugins/logger/logger.c24
-rw-r--r--src/plugins/logger/logger.h3
-rw-r--r--src/plugins/lua/weechat-lua-api.c61
-rw-r--r--src/plugins/perl/weechat-perl-api.c56
-rw-r--r--src/plugins/php/weechat-php-api.c73
-rw-r--r--src/plugins/php/weechat-php-api.h2
-rw-r--r--src/plugins/php/weechat-php.c2
-rw-r--r--src/plugins/php/weechat-php.stub.php2
-rw-r--r--src/plugins/php/weechat-php_arginfo.h17
-rw-r--r--src/plugins/php/weechat-php_legacy_arginfo.h46
-rw-r--r--src/plugins/plugin-script-api.c58
-rw-r--r--src/plugins/plugin-script-api.h14
-rw-r--r--src/plugins/plugin.c5
-rw-r--r--src/plugins/python/weechat-python-api.c62
-rw-r--r--src/plugins/python/weechat.pyi24
-rw-r--r--src/plugins/relay/weechat/relay-weechat-protocol.c10
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c82
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c73
-rw-r--r--src/plugins/trigger/trigger-callback.c32
-rw-r--r--src/plugins/trigger/trigger-callback.h8
-rw-r--r--src/plugins/weechat-plugin.h56
35 files changed, 1201 insertions, 355 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index ff2c051cb..6f48f548a 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -2005,6 +2005,28 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
}
SCM
+weechat_guile_api_print_datetime_tags (SCM buffer, SCM date, SCM date_usec,
+ SCM tags, SCM message)
+{
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (!scm_is_string (buffer) || !scm_is_integer (date)
+ || !scm_is_integer (date_usec) || !scm_is_string (tags)
+ || !scm_is_string (message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ plugin_script_api_printf_datetime_tags (
+ weechat_guile_plugin,
+ guile_current_script,
+ API_STR2PTR(API_SCM_TO_STRING(buffer)),
+ (time_t)scm_to_long (date),
+ scm_to_int (date_usec),
+ API_SCM_TO_STRING(tags),
+ "%s", API_SCM_TO_STRING(message));
+
+ API_RETURN_OK;
+}
+
+SCM
weechat_guile_api_print_y (SCM buffer, SCM y, SCM message)
{
API_INIT_FUNC(1, "print_y", API_RETURN_ERROR);
@@ -2043,6 +2065,29 @@ weechat_guile_api_print_y_date_tags (SCM buffer, SCM y, SCM date, SCM tags,
}
SCM
+weechat_guile_api_print_y_datetime_tags (SCM buffer, SCM y, SCM date,
+ SCM date_usec, SCM tags, SCM message)
+{
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (!scm_is_string (buffer) || !scm_is_integer (y)
+ || !scm_is_integer (date) || !scm_is_integer (date_usec)
+ || !scm_is_string (tags) || !scm_is_string (message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ plugin_script_api_printf_y_datetime_tags (
+ weechat_guile_plugin,
+ guile_current_script,
+ API_STR2PTR(API_SCM_TO_STRING(buffer)),
+ scm_to_int (y),
+ (time_t)scm_to_long (date),
+ scm_to_int (date_usec),
+ API_SCM_TO_STRING(tags),
+ "%s", API_SCM_TO_STRING(message));
+
+ API_RETURN_OK;
+}
+
+SCM
weechat_guile_api_log_print (SCM message)
{
API_INIT_FUNC(1, "log_print", API_RETURN_ERROR);
@@ -2743,7 +2788,7 @@ weechat_guile_api_hook_line (SCM buffer_type, SCM buffer_name, SCM tags,
int
weechat_guile_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2756,6 +2801,7 @@ weechat_guile_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -5353,8 +5399,10 @@ weechat_guile_api_module_init (void *data)
API_DEF_FUNC(color, 1);
API_DEF_FUNC(print, 2);
API_DEF_FUNC(print_date_tags, 4);
+ API_DEF_FUNC(print_datetime_tags, 5);
API_DEF_FUNC(print_y, 3);
API_DEF_FUNC(print_y_date_tags, 5);
+ API_DEF_FUNC(print_y_datetime_tags, 6);
API_DEF_FUNC(log_print, 1);
API_DEF_FUNC(hook_command, 7);
API_DEF_FUNC(hook_completion, 4);
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 61d977332..b08fe0bb0 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -388,6 +388,7 @@ irc_command_me_channel_message (struct t_irc_server *server,
irc_input_user_message_display (
server,
0, /* date */
+ 0, /* date_usec */
channel_name,
NULL, /* address */
"privmsg",
@@ -1974,6 +1975,7 @@ IRC_COMMAND_CALLBACK(ctcp)
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
ctcp_target,
NULL, /* address */
"privmsg",
@@ -3841,6 +3843,7 @@ IRC_COMMAND_CALLBACK(msg)
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
ptr_channel->name,
NULL, /* address */
"privmsg",
@@ -3864,6 +3867,7 @@ IRC_COMMAND_CALLBACK(msg)
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
targets[i],
NULL, /* address */
"privmsg",
@@ -4065,6 +4069,7 @@ IRC_COMMAND_CALLBACK(notice)
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
argv[arg_target],
NULL, /* address */
"notice",
@@ -4595,6 +4600,7 @@ IRC_COMMAND_CALLBACK(query)
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
ptr_channel->name,
NULL, /* address */
"privmsg",
@@ -7799,8 +7805,9 @@ irc_command_init ()
"condition \"xxx\", using following variables: output of function "
"irc_message_parse (like nick, command, channel, text, etc., see "
"function info_get_hashtable in plugin API reference for the list "
- "of all variables), date (format: \"yyyy-mm-dd hh:mm:ss\"), server, "
- "recv, sent, modified, redirected"),
+ "of all variables), date (format: \"%FT%T.%f\", see function "
+ "util_strftimeval in Plugin API reference), server, recv, sent, "
+ "modified, redirected"),
"",
N_("Examples:"),
AI(" /server listfull"),
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ad12fe87b..8c2995cdd 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -3114,7 +3114,8 @@ irc_config_init ()
irc_config_file, irc_config_section_look,
"ctcp_time_format", "string",
N_("time format used in answer to message CTCP TIME (see man "
- "strftime for date/time specifiers)"),
+ "strftime for date/time specifiers, extra specifiers are supported, "
+ "see function util_strftimeval in Plugin API reference)"),
NULL, 0, 0, "%a, %d %b %Y %T %z", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_account_message = weechat_config_new_option (
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index 3e8b94416..59a1910f7 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -185,11 +185,12 @@ irc_ctcp_display_request (struct t_irc_protocol_ctxt *ctxt,
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "irc_ctcp"),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
@@ -252,10 +253,11 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt,
difftime = ((sec2 * 1000000) + usec2) -
((sec1 * 1000000) + usec1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->nick, NULL, "ctcp", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "irc_ctcp"),
/* TRANSLATORS: %.3fs is a float number + "s" ("seconds") */
_("%sCTCP reply from %s%s%s: %s%s%s %.3fs"),
@@ -272,10 +274,11 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt,
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->nick, NULL, "ctcp", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "irc_ctcp"),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
@@ -291,10 +294,11 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt,
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->nick, NULL, "ctcp", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
@@ -545,8 +549,7 @@ irc_ctcp_eval_reply (struct t_irc_server *server, const char *format)
struct t_hashtable *extra_vars;
char *info, *info_version, *info_version_git, *username, *realname;
char buf[4096], *value;
- time_t now;
- struct tm *local_time;
+ struct timeval tv_now;
struct utsname *buf_uname;
if (!server || !format)
@@ -661,13 +664,12 @@ irc_ctcp_eval_reply (struct t_irc_server *server, const char *format)
* ${time}: local date/time of user, example:
* Sat, 08 Jul 2023 21:11:19 +0200
*/
- now = time (NULL);
- local_time = localtime (&now);
+ gettimeofday (&tv_now, NULL);
setlocale (LC_ALL, "C");
- if (strftime (buf, sizeof (buf),
- weechat_config_string (irc_config_look_ctcp_time_format),
- local_time) == 0)
- buf[0] = '\0';
+ weechat_util_strftimeval (
+ buf, sizeof (buf),
+ weechat_config_string (irc_config_look_ctcp_time_format),
+ &tv_now);
setlocale (LC_ALL, "");
weechat_hashtable_set (extra_vars, "time", buf);
@@ -1389,9 +1391,10 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
ctxt->params[0][0]))
{
/* STATUSMSG action */
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me) ?
@@ -1414,9 +1417,10 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
else
{
/* standard action */
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me) ?
@@ -1456,9 +1460,10 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, ctxt->address);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me) ?
@@ -1535,11 +1540,12 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
{
if (weechat_config_boolean (irc_config_look_display_ctcp_unknown))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "irc_ctcp"),
_("%sUnknown CTCP requested by %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index 72820cc8a..a3f87445c 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -64,6 +64,7 @@
void
irc_input_user_message_display (struct t_irc_server *server,
time_t date,
+ int date_usec,
const char *target,
const char *address,
const char *command,
@@ -86,6 +87,7 @@ irc_input_user_message_display (struct t_irc_server *server,
memset (&ctxt, 0, sizeof (ctxt));
ctxt.server = server;
ctxt.date = date;
+ ctxt.date_usec = date_usec;
ctxt.address = (char *)address;
ctxt.command = (char *)command;
@@ -317,6 +319,7 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
irc_input_user_message_display (
ptr_server,
0, /* date */
+ 0, /* date_usec */
ptr_channel->name,
NULL, /* address */
"privmsg",
diff --git a/src/plugins/irc/irc-input.h b/src/plugins/irc/irc-input.h
index a01c404da..2c5faa782 100644
--- a/src/plugins/irc/irc-input.h
+++ b/src/plugins/irc/irc-input.h
@@ -26,6 +26,7 @@ struct t_gui_buffer;
extern void irc_input_user_message_display (struct t_irc_server *server,
time_t date,
+ int date_usec,
const char *target,
const char *address,
const char *command,
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 2a42d5115..b646d9a9e 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -373,63 +373,105 @@ irc_protocol_nick_address (struct t_irc_server *server,
}
/*
- * Parses date/time received in a "time" tag.
- *
- * Returns value of time (timestamp), 0 if error.
+ * Parses date/time received in a "time" tag and sets *date to the date/time
+ * and *date_usec to the microseconds of date (value is set to 0 for both in
+ * case of error).
*/
-time_t
-irc_protocol_parse_time (const char *time)
+void
+irc_protocol_parse_time (const char *time, time_t *date, int *date_usec)
{
- time_t time_value, time_msg, time_gm, time_local;
+ time_t time_msg, time_gm, time_local;
struct tm tm_date, tm_date_gm, tm_date_local;
+ char *time2, *pos, *pos2, *pos_msec, *error, str_msec[16];
long value;
- char *time2, *pos, *error;
+ int length;
+
+ if (!date || !date_usec)
+ return;
+
+ *date = 0;
+ *date_usec = 0;
if (!time || !time[0])
- return 0;
+ return;
- time_value = 0;
+ time2 = strdup (time);
+ if (!time2)
+ return;
+
+ pos_msec = NULL;
- if (strchr (time, '-'))
+ if (strchr (time2, '-'))
{
/* date is with ISO 8601 format: "2012-11-24T07:41:02.018Z" */
/* initialize structure, because strptime does not do it */
memset (&tm_date, 0, sizeof (struct tm));
- if (strptime (time, "%Y-%m-%dT%H:%M:%S", &tm_date))
- {
- if (tm_date.tm_year > 0)
+ pos = strptime (time2, "%Y-%m-%dT%H:%M:%S", &tm_date);
+ if (pos && (tm_date.tm_year > 0))
+ {
+ time_msg = mktime (&tm_date);
+ gmtime_r (&time_msg, &tm_date_gm);
+ localtime_r (&time_msg, &tm_date_local);
+ time_gm = mktime (&tm_date_gm);
+ time_local = mktime (&tm_date_local);
+ *date = mktime (&tm_date_local) + (time_local - time_gm);
+ if (pos[0] == '.')
{
- time_msg = mktime (&tm_date);
- gmtime_r (&time_msg, &tm_date_gm);
- localtime_r (&time_msg, &tm_date_local);
- time_gm = mktime (&tm_date_gm);
- time_local = mktime (&tm_date_local);
- time_value = mktime (&tm_date_local) + (time_local - time_gm);
+ pos++;
+ pos2 = strchr (pos, 'Z');
+ if (pos2)
+ pos2[0] = '\0';
+ pos_msec = pos;
}
}
}
else
{
- /* date is with timestamp format: "1353403519.478" */
- time2 = strdup (time);
- if (time2)
+ /* date is with timestamp format: "1353403519.478" or "1353403519,478" */
+ pos = strchr (time2, '.');
+ if (pos)
+ {
+ pos[0] = '\0';
+ }
+ else
{
- pos = strchr (time2, '.');
- if (pos)
- pos[0] = '\0';
pos = strchr (time2, ',');
if (pos)
pos[0] = '\0';
- error = NULL;
- value = strtol (time2, &error, 10);
- if (error && !error[0] && (value >= 0))
- time_value = (int)value;
- free (time2);
}
+ error = NULL;
+ value = strtol (time2, &error, 10);
+ if (error && !error[0] && (value >= 0))
+ *date = (int)value;
+ if (pos && pos[1])
+ pos_msec = pos + 1;
}
- return time_value;
+ if (pos_msec)
+ {
+ length = strlen (pos_msec);
+ if (length > 6)
+ length = 6;
+ memcpy (str_msec, pos_msec, length);
+ str_msec[length] = '\0';
+ while (strlen (str_msec) < 6)
+ {
+ strcat (str_msec, "0");
+ }
+ error = NULL;
+ value = strtol (str_msec, &error, 10);
+ if (error && !error[0])
+ {
+ if (value < 0)
+ value = 0;
+ else if (value > 999999)
+ value = 999999;
+ *date_usec = (int)value;
+ }
+ }
+
+ free (time2);
}
/*
@@ -476,9 +518,10 @@ irc_protocol_print_error_warning_msg (struct t_irc_protocol_ctxt *ctxt,
str_context = (ctxt->num_params > 2) ?
irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 2) : NULL;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s%s%s[%s%s%s]%s %s",
(prefix) ? prefix : "",
@@ -544,10 +587,11 @@ IRC_PROTOCOL_CALLBACK(account)
&& (irc_server_strcasecmp (ctxt->server,
ptr_channel->name, ctxt->nick) == 0))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
(pos_account) ? _("%s%s%s%s has identified as %s") : _("%s%s%s%s has unidentified"),
weechat_prefix ("network"),
@@ -572,10 +616,11 @@ IRC_PROTOCOL_CALLBACK(account)
&& weechat_config_boolean (irc_config_look_smart_filter_account)
&& !ptr_nick_speaking);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(smart_filter) ? "irc_smart_filter" : NULL),
@@ -1108,8 +1153,11 @@ IRC_PROTOCOL_CALLBACK(cap)
weechat_hashtable_map_string (ctxt->server->cap_ls,
irc_protocol_cap_print_cb,
str_caps);
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, server supports: %s"),
weechat_prefix ("network"),
IRC_PLUGIN_NAME,
@@ -1194,8 +1242,11 @@ IRC_PROTOCOL_CALLBACK(cap)
weechat_hashtable_map_string (ctxt->server->cap_list,
irc_protocol_cap_print_cb,
str_caps);
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, currently enabled: %s"),
weechat_prefix ("network"),
IRC_PLUGIN_NAME,
@@ -1259,24 +1310,33 @@ IRC_PROTOCOL_CALLBACK(cap)
}
if (*str_caps_enabled[0] && *str_caps_disabled[0])
{
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, enabled: %s, disabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_enabled, *str_caps_disabled);
}
else if (*str_caps_enabled[0])
{
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, enabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_enabled);
}
else if (*str_caps_disabled[0])
{
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, disabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_disabled);
@@ -1319,8 +1379,11 @@ IRC_PROTOCOL_CALLBACK(cap)
return WEECHAT_RC_OK;
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, refused: %s"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, str_params);
if (str_params)
@@ -1335,8 +1398,11 @@ IRC_PROTOCOL_CALLBACK(cap)
return WEECHAT_RC_OK;
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, now available: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, str_params);
if (str_params)
@@ -1387,8 +1453,11 @@ IRC_PROTOCOL_CALLBACK(cap)
return WEECHAT_RC_OK;
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
- ctxt->server->buffer, ctxt->date, "irc_cap,log3",
+ weechat_printf_datetime_tags (
+ ctxt->server->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ "irc_cap,log3",
_("%s%s: client capability, removed: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, str_params);
if (str_params)
@@ -1469,10 +1538,11 @@ IRC_PROTOCOL_CALLBACK(chghost)
{
snprintf (str_tags, sizeof (str_tags),
"new_host_%s", str_host);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%s%s%s%s (%s%s%s)%s has changed host to %s%s"),
weechat_prefix ("network"),
@@ -1505,10 +1575,11 @@ IRC_PROTOCOL_CALLBACK(chghost)
str_host,
(smart_filter) ? "," : "",
(smart_filter) ? "irc_smart_filter" : "");
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%s%s%s%s (%s%s%s)%s has changed host to %s%s"),
weechat_prefix ("network"),
@@ -1548,9 +1619,10 @@ IRC_PROTOCOL_CALLBACK(error)
str_error = irc_protocol_string_params (ctxt->params, 0, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("error"),
@@ -1645,13 +1717,14 @@ IRC_PROTOCOL_CALLBACK(generic_error)
str_error = irc_protocol_string_params (ctxt->params, arg_error, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, pos_nick, ctxt->command,
((strcmp (ctxt->command, "401") == 0)
|| (strcmp (ctxt->command, "402") == 0)) ? "whois" : NULL,
ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s",
weechat_prefix ("network"),
@@ -1708,9 +1781,10 @@ IRC_PROTOCOL_CALLBACK(invite)
if (irc_server_strcasecmp (ctxt->server, ctxt->params[0], ctxt->server->nick) == 0)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->nick, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "notify_highlight"),
_("%sYou have been invited to %s%s%s by %s%s%s"),
weechat_prefix ("network"),
@@ -1725,9 +1799,10 @@ IRC_PROTOCOL_CALLBACK(invite)
{
/* CAP invite-notify */
/* imitate numeric 341 output */
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->nick, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has invited %s%s%s to %s%s%s"),
weechat_prefix ("network"),
@@ -1875,10 +1950,11 @@ IRC_PROTOCOL_CALLBACK(join)
&& !ptr_nick_speaking);
/* display the join */
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt,
(smart_filter) ? "irc_smart_filter" : NULL),
_("%s%s%s%s%s%s%s%s%s%s%s%s has joined %s%s%s"),
@@ -1974,10 +2050,11 @@ IRC_PROTOCOL_CALLBACK(kick)
if (pos_comment)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has kicked %s%s%s %s(%s%s%s)"),
weechat_prefix ("quit"),
@@ -1994,10 +2071,11 @@ IRC_PROTOCOL_CALLBACK(kick)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has kicked %s%s%s"),
weechat_prefix ("quit"),
@@ -2094,10 +2172,11 @@ IRC_PROTOCOL_CALLBACK(kill)
if (pos_comment)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%sYou were killed by %s%s%s %s(%s%s%s)"),
weechat_prefix ("quit"),
@@ -2112,10 +2191,11 @@ IRC_PROTOCOL_CALLBACK(kill)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%sYou were killed by %s%s%s"),
weechat_prefix ("quit"),
@@ -2170,9 +2250,10 @@ IRC_PROTOCOL_CALLBACK(knock_reply)
str_message = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[0], ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s: %s",
weechat_prefix ("network"),
@@ -2222,10 +2303,11 @@ IRC_PROTOCOL_CALLBACK(mode)
ptr_nick = irc_nick_search (ctxt->server, ptr_channel, ctxt->nick);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer;
modes_args = irc_mode_get_arguments (msg_modes_args);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(smart_filter && !ctxt->nick_is_me) ? "irc_smart_filter" : NULL),
@@ -2247,9 +2329,10 @@ IRC_PROTOCOL_CALLBACK(mode)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sUser mode %s[%s%s%s]%s by %s%s"),
weechat_prefix ("network"),
@@ -2308,9 +2391,10 @@ IRC_PROTOCOL_CALLBACK(nick)
"irc_nick1_%s,irc_nick2_%s",
ctxt->nick,
ctxt->params[0]);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ctxt->server->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%sYou are now known as %s%s%s"),
weechat_prefix ("network"),
@@ -2371,9 +2455,10 @@ IRC_PROTOCOL_CALLBACK(nick)
"irc_nick1_%s,irc_nick2_%s",
ctxt->nick,
ctxt->params[0]);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%s%s%s%s is now known as %s%s%s"),
weechat_prefix ("network"),
@@ -2412,16 +2497,17 @@ IRC_PROTOCOL_CALLBACK(nick)
"irc_nick1_%s,irc_nick2_%s",
ctxt->nick,
ctxt->params[0]);
- weechat_printf_date_tags (ptr_channel->buffer,
- ctxt->date,
- irc_protocol_tags (
- ctxt, str_tags),
- _("%sYou are now known as "
- "%s%s%s"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_NICK_SELF,
- ctxt->params[0],
- IRC_COLOR_RESET);
+ weechat_printf_datetime_tags (
+ ptr_channel->buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ irc_protocol_tags (
+ ctxt, str_tags),
+ _("%sYou are now known as %s%s%s"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_NICK_SELF,
+ ctxt->params[0],
+ IRC_COLOR_RESET);
/* enable hotlist */
weechat_buffer_set (NULL, "hotlist", "+");
@@ -2442,9 +2528,10 @@ IRC_PROTOCOL_CALLBACK(nick)
(smart_filter) ? "irc_smart_filter," : "",
ctxt->nick,
ctxt->params[0]);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%s%s%s%s is now known as %s%s%s"),
weechat_prefix ("network"),
@@ -2640,9 +2727,10 @@ IRC_PROTOCOL_CALLBACK(notice)
"notify_message" :
weechat_config_string (irc_config_look_notice_welcome_tags));
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
(ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
"%s%s%s%s%s(%s%s%s%s)%s%s%s%s%s: %s",
weechat_prefix ("network"),
@@ -2719,9 +2807,10 @@ IRC_PROTOCOL_CALLBACK(notice)
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, ctxt->address);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "notify_private"),
"%s%s%s%s: %s",
weechat_prefix ("network"),
@@ -2746,9 +2835,10 @@ IRC_PROTOCOL_CALLBACK(notice)
*/
if (ctxt->nick && ctxt->nick_is_me)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(notify_private) ? "notify_private" : NULL),
@@ -2773,9 +2863,10 @@ IRC_PROTOCOL_CALLBACK(notice)
NULL,
ctxt->nick,
(display_host) ? ctxt->address : NULL);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(notify_private) ? "notify_private" : NULL),
@@ -2840,10 +2931,11 @@ IRC_PROTOCOL_CALLBACK(part)
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
if (str_comment && str_comment[0])
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me
@@ -2873,10 +2965,11 @@ IRC_PROTOCOL_CALLBACK(part)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me
@@ -3012,9 +3105,10 @@ IRC_PROTOCOL_CALLBACK(pong)
{
str_params = (ctxt->num_params > 1) ?
irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1) : NULL;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"PONG%s%s",
(str_params) ? ": " : "",
@@ -3063,6 +3157,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_protocol_ctxt *ctxt,
irc_input_user_message_display (
ctxt->server,
ctxt->date,
+ ctxt->date_usec,
target,
ctxt->address,
"privmsg",
@@ -3167,9 +3262,10 @@ IRC_PROTOCOL_CALLBACK(privmsg)
if (status_msg)
{
/* message to channel ops/voiced (to "@#channel" or "+#channel") */
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me) ?
@@ -3213,9 +3309,10 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
if (str_color)
free (str_color);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_channel->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
"%s%s",
irc_nick_as_prefix (ctxt->server, ptr_nick,
@@ -3351,6 +3448,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
irc_input_user_message_display (
ctxt->server,
ctxt->date,
+ ctxt->date_usec,
remote_nick,
ctxt->address,
"privmsg",
@@ -3360,9 +3458,10 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
(ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
"%s%s",
irc_nick_as_prefix (
@@ -3444,10 +3543,11 @@ IRC_PROTOCOL_CALLBACK(quit)
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
if (str_quit_msg && str_quit_msg[0])
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me
@@ -3476,10 +3576,11 @@ IRC_PROTOCOL_CALLBACK(quit)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(ctxt->nick_is_me
@@ -3559,10 +3660,11 @@ IRC_PROTOCOL_CALLBACK(setname)
&& (irc_server_strcasecmp (ctxt->server,
ptr_channel->name, ctxt->nick) == 0))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has changed real name to %s\"%s%s%s\"%s"),
weechat_prefix ("network"),
@@ -3590,10 +3692,11 @@ IRC_PROTOCOL_CALLBACK(setname)
&& weechat_config_boolean (irc_config_look_smart_filter_setname)
&& !ptr_nick_speaking);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (
ctxt,
(smart_filter) ? "irc_smart_filter" : NULL),
@@ -3621,9 +3724,10 @@ IRC_PROTOCOL_CALLBACK(setname)
if (!ctxt->ignore_remove && ctxt->nick_is_me)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%sYour real name has been set to %s\"%s%s%s\"%s"),
weechat_prefix ("network"),
@@ -3724,9 +3828,10 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
str_params = irc_protocol_string_params (ctxt->params, arg_text, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s",
weechat_prefix ("network"),
@@ -3759,9 +3864,10 @@ IRC_PROTOCOL_CALLBACK(numeric)
if (str_params)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -3822,10 +3928,11 @@ IRC_PROTOCOL_CALLBACK(topic)
old_topic_color = irc_color_decode (
ptr_channel->topic,
weechat_config_boolean (irc_config_network_colors_receive));
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has changed topic for %s%s%s from \"%s%s%s\" to "
"\"%s%s%s\""),
@@ -3847,10 +3954,11 @@ IRC_PROTOCOL_CALLBACK(topic)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has changed topic for %s%s%s to \"%s%s%s\""),
weechat_prefix ("network"),
@@ -3875,10 +3983,11 @@ IRC_PROTOCOL_CALLBACK(topic)
old_topic_color = irc_color_decode (
ptr_channel->topic,
weechat_config_boolean (irc_config_network_colors_receive));
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has unset topic for %s%s%s (old topic: "
"\"%s%s%s\")"),
@@ -3897,10 +4006,11 @@ IRC_PROTOCOL_CALLBACK(topic)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s%s%s has unset topic for %s%s%s"),
weechat_prefix ("network"),
@@ -3953,9 +4063,10 @@ IRC_PROTOCOL_CALLBACK(wallops)
str_message = irc_protocol_string_params (ctxt->params, 0, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->nick, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "notify_private"),
_("%sWallops from %s: %s"),
weechat_prefix ("network"),
@@ -4262,9 +4373,10 @@ IRC_PROTOCOL_CALLBACK(008)
str_params = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[0], ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sServer notice mask for %s%s%s: %s"),
weechat_prefix ("network"),
@@ -4294,9 +4406,10 @@ IRC_PROTOCOL_CALLBACK(221)
str_modes = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[0], ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sUser mode for %s%s%s is %s[%s%s%s]"),
weechat_prefix ("network"),
@@ -4350,10 +4463,11 @@ IRC_PROTOCOL_CALLBACK(301)
|| (strcmp (ptr_channel->away_message, str_away_msg) != 0))
{
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s]%s is away: %s"),
weechat_prefix ("network"),
@@ -4391,9 +4505,10 @@ IRC_PROTOCOL_CALLBACK(303)
str_nicks = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sUsers online: %s%s"),
weechat_prefix ("network"),
@@ -4422,10 +4537,11 @@ IRC_PROTOCOL_CALLBACK(305)
if (ctxt->num_params > 1)
{
str_away_msg = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "unaway", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -4458,10 +4574,11 @@ IRC_PROTOCOL_CALLBACK(306)
if (ctxt->num_params > 1)
{
str_away_msg = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "away", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -4497,10 +4614,11 @@ IRC_PROTOCOL_CALLBACK(whois_nick_msg)
if (ctxt->num_params >= 3)
{
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s",
weechat_prefix ("network"),
@@ -4541,10 +4659,11 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg)
if (ctxt->num_params >= 3)
{
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whowas", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s",
weechat_prefix ("network"),
@@ -4589,10 +4708,11 @@ IRC_PROTOCOL_CALLBACK(311)
else
{
str_realname = irc_protocol_string_params (ctxt->params, 5, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] (%s%s@%s%s)%s: %s",
weechat_prefix ("network"),
@@ -4633,10 +4753,11 @@ IRC_PROTOCOL_CALLBACK(312)
else
{
str_server = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s(%s%s%s)",
weechat_prefix ("network"),
@@ -4677,10 +4798,11 @@ IRC_PROTOCOL_CALLBACK(314)
else
{
str_realname = irc_protocol_string_params (ctxt->params, 5, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whowas", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] (%s%s@%s%s)%s was %s"),
weechat_prefix ("network"),
@@ -4723,10 +4845,11 @@ IRC_PROTOCOL_CALLBACK(315)
else
{
str_text = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "who", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s %s",
weechat_prefix ("network"),
@@ -4771,9 +4894,10 @@ IRC_PROTOCOL_CALLBACK(317)
if (day > 0)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s]%s idle: %s%d %s%s, %s%02d %s%s %s%02d %s%s %s%02d "
"%s%s, signon at: %s%s"),
@@ -4804,9 +4928,10 @@ IRC_PROTOCOL_CALLBACK(317)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s]%s idle: %s%02d %s%s %s%02d %s%s %s%02d %s%s, "
"signon at: %s%s"),
@@ -4850,10 +4975,11 @@ IRC_PROTOCOL_CALLBACK(321)
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "list", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s",
weechat_prefix ("network"),
@@ -4884,10 +5010,11 @@ IRC_PROTOCOL_CALLBACK(322)
(regexec (ctxt->server->cmd_list_regexp, ctxt->params[1], 0, NULL, 0) == 0))
{
str_topic = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "list", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s(%s%s%s)%s%s%s",
weechat_prefix ("network"),
@@ -4922,9 +5049,10 @@ IRC_PROTOCOL_CALLBACK(323)
str_params = irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, "list", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -4969,11 +5097,12 @@ IRC_PROTOCOL_CALLBACK(324)
|| (weechat_hashtable_has_key (ptr_channel->join_msg_received, ctxt->command)
|| weechat_hashtable_has_key (irc_config_hashtable_display_join_message, ctxt->command)))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL,
(ptr_channel) ? ptr_channel->buffer : NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sMode %s%s %s[%s%s%s]"),
weechat_prefix ("network"),
@@ -5024,9 +5153,10 @@ IRC_PROTOCOL_CALLBACK(327)
if (str_realname && str_realname[0])
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s %s(%s%s%s)",
weechat_prefix ("network"),
@@ -5044,9 +5174,10 @@ IRC_PROTOCOL_CALLBACK(327)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s",
weechat_prefix ("network"),
@@ -5084,10 +5215,11 @@ IRC_PROTOCOL_CALLBACK(328)
if (ptr_channel)
{
str_url = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sURL for %s%s%s: %s"),
weechat_prefix ("network"),
@@ -5125,10 +5257,11 @@ IRC_PROTOCOL_CALLBACK(329)
if (weechat_hashtable_has_key (ptr_channel->join_msg_received, ctxt->command)
|| weechat_hashtable_has_key (irc_config_hashtable_display_join_message, ctxt->command))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "created on" is a date */
_("%sChannel created on %s"),
@@ -5138,9 +5271,10 @@ IRC_PROTOCOL_CALLBACK(329)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "created on" is a date */
_("%sChannel %s%s%s created on %s"),
@@ -5178,10 +5312,11 @@ IRC_PROTOCOL_CALLBACK(330_343)
if (ctxt->num_params >= 4)
{
str_text = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s%s",
weechat_prefix ("network"),
@@ -5202,10 +5337,11 @@ IRC_PROTOCOL_CALLBACK(330_343)
irc_channel_search (ctxt->server, ctxt->params[1]) : NULL;
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer;
str_text = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s",
weechat_prefix ("network"),
@@ -5238,10 +5374,11 @@ IRC_PROTOCOL_CALLBACK(331)
ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]);
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sNo topic set for channel %s%s"),
weechat_prefix ("network"),
@@ -5299,10 +5436,11 @@ IRC_PROTOCOL_CALLBACK(332)
|| (weechat_hashtable_has_key (ptr_channel->join_msg_received, ctxt->command))
|| weechat_hashtable_has_key (irc_config_hashtable_display_join_message, ctxt->command))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sTopic for %s%s%s is \"%s%s%s\""),
weechat_prefix ("network"),
@@ -5364,10 +5502,11 @@ IRC_PROTOCOL_CALLBACK(333)
{
if (topic_nick)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"),
@@ -5385,10 +5524,11 @@ IRC_PROTOCOL_CALLBACK(333)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%sTopic set on %s"),
@@ -5401,10 +5541,11 @@ IRC_PROTOCOL_CALLBACK(333)
{
if (topic_nick)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%sTopic for %s%s%s set by %s%s%s%s%s%s%s%s%s on %s"),
@@ -5425,10 +5566,11 @@ IRC_PROTOCOL_CALLBACK(333)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%sTopic for %s%s%s set on %s"),
@@ -5469,10 +5611,11 @@ IRC_PROTOCOL_CALLBACK(338)
else
{
str_text = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s %s %s%s",
weechat_prefix ("network"),
@@ -5507,9 +5650,10 @@ IRC_PROTOCOL_CALLBACK(341)
snprintf (str_tags, sizeof (str_tags), "nick_%s", ctxt->params[0]);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[0], ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
_("%s%s%s%s has invited %s%s%s to %s%s%s"),
weechat_prefix ("network"),
@@ -5546,9 +5690,10 @@ IRC_PROTOCOL_CALLBACK(344)
{
/* channel reop (IRCnet) */
str_host = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, "reop", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sChannel reop %s%s%s: %s%s"),
weechat_prefix ("network"),
@@ -5569,10 +5714,11 @@ IRC_PROTOCOL_CALLBACK(344)
ctxt->params,
(ctxt->num_params >= 4) ? 3 : 2,
ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s%s%s%s",
weechat_prefix ("network"),
@@ -5613,9 +5759,10 @@ IRC_PROTOCOL_CALLBACK(345)
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, "reop", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s: %s",
weechat_prefix ("network"),
@@ -5683,10 +5830,11 @@ IRC_PROTOCOL_CALLBACK(346)
datetime = (time_t)(atol (ctxt->params[4]));
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "invitelist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%s%s[%s%s%s] %s%s%s%s invited by %s on %s"),
@@ -5706,10 +5854,11 @@ IRC_PROTOCOL_CALLBACK(346)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "invitelist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s invited by %s"),
weechat_prefix ("network"),
@@ -5728,10 +5877,11 @@ IRC_PROTOCOL_CALLBACK(346)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], NULL, 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "invitelist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s invited"),
weechat_prefix ("network"),
@@ -5783,10 +5933,11 @@ IRC_PROTOCOL_CALLBACK(347)
}
ptr_modelist->state = IRC_MODELIST_STATE_RECEIVED;
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "invitelist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s%s%s",
weechat_prefix ("network"),
@@ -5856,10 +6007,11 @@ IRC_PROTOCOL_CALLBACK(348)
datetime = (time_t)(atol (ctxt->params[4]));
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "exceptionlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%s%s[%s%s%s]%s%s exception %s%s%s by %s on %s"),
@@ -5880,10 +6032,11 @@ IRC_PROTOCOL_CALLBACK(348)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "exceptionlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s]%s%s exception %s%s%s by %s"),
weechat_prefix ("network"),
@@ -5903,10 +6056,11 @@ IRC_PROTOCOL_CALLBACK(348)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], NULL, 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "exceptionlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s]%s%s exception %s%s"),
weechat_prefix ("network"),
@@ -5958,10 +6112,11 @@ IRC_PROTOCOL_CALLBACK(349)
}
ptr_modelist->state = IRC_MODELIST_STATE_RECEIVED;
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "exceptionlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s%s%s",
weechat_prefix ("network"),
@@ -6013,10 +6168,11 @@ IRC_PROTOCOL_CALLBACK(350)
IRC_COLOR_CHAT_DELIMITERS);
}
str_params = irc_protocol_string_params (ctxt->params, 4, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, ctxt->params[1], ctxt->command, "whois", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s%s",
weechat_prefix ("network"),
@@ -6060,9 +6216,10 @@ IRC_PROTOCOL_CALLBACK(351)
if (ctxt->num_params > 3)
{
str_params = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s %s (%s)",
weechat_prefix ("network"),
@@ -6074,9 +6231,10 @@ IRC_PROTOCOL_CALLBACK(351)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s %s",
weechat_prefix ("network"),
@@ -6165,10 +6323,11 @@ IRC_PROTOCOL_CALLBACK(352)
/* display output of who (manual who from user) */
if (!ptr_channel || (ptr_channel->checking_whox <= 0))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "who", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s(%s%s@%s%s)%s %s%s%s%s%s(%s%s%s)",
weechat_prefix ("network"),
@@ -6337,10 +6496,11 @@ IRC_PROTOCOL_CALLBACK(353)
if (!ptr_channel && str_nicks)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "names", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sNicks %s%s%s: %s[%s%s%s]"),
weechat_prefix ("network"),
@@ -6391,10 +6551,11 @@ IRC_PROTOCOL_CALLBACK(354)
if (!ptr_channel || (ptr_channel->checking_whox <= 0))
{
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "who", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s%s%s",
weechat_prefix ("network"),
@@ -6462,10 +6623,11 @@ IRC_PROTOCOL_CALLBACK(354)
/* display output of who (manual who from user) */
if (!ptr_channel || (ptr_channel->checking_whox <= 0))
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "who", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s] %s%s %s[%s%s%s] (%s%s@%s%s)%s %s %s %s(%s%s%s)",
weechat_prefix ("network"),
@@ -6755,10 +6917,11 @@ IRC_PROTOCOL_CALLBACK(366)
{
str_filter[0] = '\0';
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "names", ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sNicks %s%s%s%s: %s[%s%s]"),
weechat_prefix ("network"),
@@ -6781,10 +6944,11 @@ IRC_PROTOCOL_CALLBACK(366)
ptr_channel);
if (string)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "names", ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%sChannel %s%s%s: %s%d%s %s %s(%s%s)"),
weechat_prefix ("network"),
@@ -6820,10 +6984,11 @@ IRC_PROTOCOL_CALLBACK(366)
else
{
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "names", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s%s%s: %s",
weechat_prefix ("network"),
@@ -6901,10 +7066,11 @@ IRC_PROTOCOL_CALLBACK(367)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3],
datetime);
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "banlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%s%s[%s%s%s] %s%s%s%s banned by %s on %s"),
@@ -6924,10 +7090,11 @@ IRC_PROTOCOL_CALLBACK(367)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "banlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s banned by %s"),
weechat_prefix ("network"),
@@ -6946,10 +7113,11 @@ IRC_PROTOCOL_CALLBACK(367)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], NULL, 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "banlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s banned"),
weechat_prefix ("network"),
@@ -7004,10 +7172,11 @@ IRC_PROTOCOL_CALLBACK(368)
ptr_modelist->state = IRC_MODELIST_STATE_RECEIVED;
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "banlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s%s%s",
weechat_prefix ("network"),
@@ -7050,8 +7219,11 @@ IRC_PROTOCOL_CALLBACK(432)
alternate_nick = irc_server_get_alternate_nick (ctxt->server);
if (!alternate_nick)
{
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: all declared nicknames are already in use or "
"invalid, closing connection with server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
@@ -7059,8 +7231,11 @@ IRC_PROTOCOL_CALLBACK(432)
return WEECHAT_RC_OK;
}
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: nickname \"%s\" is invalid, trying nickname \"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
ctxt->server->nick, alternate_nick);
@@ -7100,8 +7275,11 @@ IRC_PROTOCOL_CALLBACK(433)
alternate_nick = irc_server_get_alternate_nick (ctxt->server);
if (!alternate_nick)
{
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: all declared nicknames are already in use, closing "
"connection with server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
@@ -7109,8 +7287,11 @@ IRC_PROTOCOL_CALLBACK(433)
return WEECHAT_RC_OK;
}
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: nickname \"%s\" is already in use, trying nickname "
"\"%s\""),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
@@ -7157,8 +7338,11 @@ IRC_PROTOCOL_CALLBACK(437)
alternate_nick = irc_server_get_alternate_nick (ctxt->server);
if (!alternate_nick)
{
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: all declared nicknames are already in use or "
"invalid, closing connection with server"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
@@ -7166,8 +7350,11 @@ IRC_PROTOCOL_CALLBACK(437)
return WEECHAT_RC_OK;
}
- weechat_printf_date_tags (
- ptr_buffer, ctxt->date, NULL,
+ weechat_printf_datetime_tags (
+ ptr_buffer,
+ ctxt->date,
+ ctxt->date_usec,
+ NULL,
_("%s%s: nickname \"%s\" is unavailable, trying nickname "
"\"%s\""),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
@@ -7206,9 +7393,10 @@ IRC_PROTOCOL_CALLBACK(438)
if (ctxt->num_params >= 3)
{
str_params = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s (%s => %s)",
weechat_prefix ("network"),
@@ -7220,9 +7408,10 @@ IRC_PROTOCOL_CALLBACK(438)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
ptr_buffer,
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s %s",
weechat_prefix ("network"),
@@ -7366,9 +7555,10 @@ IRC_PROTOCOL_CALLBACK(help)
str_message = irc_protocol_string_params (ctxt->params, 2, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->nick, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, "notify_private"),
"%s%s",
weechat_prefix ("network"),
@@ -7414,10 +7604,11 @@ IRC_PROTOCOL_CALLBACK(710)
str_message = irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, NULL, ptr_channel->buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, str_tags),
"%s%s %s",
weechat_prefix ("network"),
@@ -7486,10 +7677,11 @@ IRC_PROTOCOL_CALLBACK(728)
irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4],
datetime);
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "quietlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
/* TRANSLATORS: "%s" after "on" is a date */
_("%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"),
@@ -7509,10 +7701,11 @@ IRC_PROTOCOL_CALLBACK(728)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4], 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "quietlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s quieted by %s"),
weechat_prefix ("network"),
@@ -7531,10 +7724,11 @@ IRC_PROTOCOL_CALLBACK(728)
{
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[3], NULL, 0);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "quietlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
_("%s%s[%s%s%s] %s%s%s%s quieted"),
weechat_prefix ("network"),
@@ -7589,10 +7783,11 @@ IRC_PROTOCOL_CALLBACK(729)
ptr_modelist->state = IRC_MODELIST_STATE_RECEIVED;
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "quietlist", ptr_buffer),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s[%s%s%s]%s%s%s",
weechat_prefix ("network"),
@@ -7742,10 +7937,11 @@ IRC_PROTOCOL_CALLBACK(732)
str_nicks = (ctxt->num_params > 1) ?
irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1) : NULL;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "monitor", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -7773,10 +7969,11 @@ IRC_PROTOCOL_CALLBACK(733)
str_params = (ctxt->num_params > 1) ?
irc_protocol_string_params (ctxt->params, 1, ctxt->num_params - 1) : NULL;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "monitor", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -7804,10 +8001,11 @@ IRC_PROTOCOL_CALLBACK(734)
str_params = (ctxt->num_params > 3) ?
irc_protocol_string_params (ctxt->params, 3, ctxt->num_params - 1) : NULL;
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (
ctxt->server, NULL, ctxt->command, "monitor", NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s (%s)",
weechat_prefix ("error"),
@@ -7841,9 +8039,10 @@ IRC_PROTOCOL_CALLBACK(900)
if (pos_nick_host)
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s %s(%s%s%s)",
weechat_prefix ("network"),
@@ -7855,9 +8054,10 @@ IRC_PROTOCOL_CALLBACK(900)
}
else
{
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -7883,9 +8083,10 @@ IRC_PROTOCOL_CALLBACK(901)
{
IRC_PROTOCOL_MIN_PARAMS(3);
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL, NULL),
ctxt->date,
+ ctxt->date_usec,
irc_protocol_tags (ctxt, NULL),
"%s%s",
weechat_prefix ("network"),
@@ -8175,6 +8376,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
ctxt.server = server;
ctxt.date = 0;
+ ctxt.date_usec = 0;
ctxt.irc_message = NULL;
ctxt.tags = NULL;
ctxt.nick = NULL;
@@ -8207,8 +8409,10 @@ irc_protocol_recv_command (struct t_irc_server *server,
if (ctxt.tags)
{
irc_tag_parse (tags, ctxt.tags, NULL);
- ctxt.date = irc_protocol_parse_time (
- weechat_hashtable_get (ctxt.tags, "time"));
+ irc_protocol_parse_time (
+ weechat_hashtable_get (ctxt.tags, "time"),
+ &(ctxt.date),
+ &(ctxt.date_usec));
}
free (tags);
}
diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h
index f287f29ed..93b6efd71 100644
--- a/src/plugins/irc/irc-protocol.h
+++ b/src/plugins/irc/irc-protocol.h
@@ -63,6 +63,7 @@ struct t_irc_protocol_ctxt
{
struct t_irc_server *server; /* IRC server */
time_t date; /* message date */
+ int date_usec; /* microseconds of date */
char *irc_message; /* whole raw IRC message */
struct t_hashtable *tags; /* IRC tags */
char *nick; /* nick of sender */
@@ -88,7 +89,6 @@ struct t_irc_protocol_msg
extern const char *irc_protocol_tags (struct t_irc_protocol_ctxt *ctxt,
const char *extra_tags);
-extern time_t irc_protocol_parse_time (const char *time);
extern void irc_protocol_recv_command (struct t_irc_server *server,
const char *irc_message,
const char *msg_command,
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 43918cd10..9313213af 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
+#include <sys/time.h>
#include "../weechat-plugin.h"
#include "irc.h"
@@ -80,7 +81,7 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message,
int match;
char *command, *result, str_date[128];
struct t_hashtable *hashtable;
- struct tm *date_tmp;
+ struct timeval tv;
if (!filter || !filter[0])
return 1;
@@ -92,12 +93,10 @@ irc_raw_message_match_filter (struct t_irc_raw_message *raw_message,
raw_message->message);
if (hashtable)
{
- date_tmp = localtime (&(raw_message->date));
- if (strftime (str_date, sizeof (str_date),
- "%Y-%m-%d %H:%M:%S", date_tmp) == 0)
- {
- str_date[0] = '\0';
- }
+ tv.tv_sec = raw_message->date;
+ tv.tv_usec = raw_message->date_usec;
+ weechat_util_strftimeval (str_date, sizeof (str_date),
+ "%FT%T.%f", &tv);
weechat_hashtable_set (hashtable, "date", str_date);
weechat_hashtable_set (hashtable,
"server", raw_message->server->name);
@@ -301,9 +300,11 @@ irc_raw_message_print (struct t_irc_raw_message *raw_message)
(raw_message->server) ? (raw_message->server)->name : "");
}
- weechat_printf_date_tags (
+ weechat_printf_datetime_tags (
irc_raw_buffer,
- raw_message->date, NULL,
+ raw_message->date,
+ raw_message->date_usec,
+ NULL,
"%s\t%s",
prefix,
(buf2) ? buf2 : ((buf) ? buf : raw_message->message));
@@ -532,7 +533,8 @@ irc_raw_message_remove_old ()
*/
struct t_irc_raw_message *
-irc_raw_message_add_to_list (time_t date, struct t_irc_server *server,
+irc_raw_message_add_to_list (time_t date, int date_usec,
+ struct t_irc_server *server,
int flags, const char *message)
{
struct t_irc_raw_message *new_raw_message;
@@ -546,6 +548,7 @@ irc_raw_message_add_to_list (time_t date, struct t_irc_server *server,
if (new_raw_message)
{
new_raw_message->date = date;
+ new_raw_message->date_usec = date_usec;
new_raw_message->server = server;
new_raw_message->flags = flags;
new_raw_message->message = strdup (message);
@@ -574,7 +577,7 @@ irc_raw_print (struct t_irc_server *server, int flags,
const char *message)
{
struct t_irc_raw_message *new_raw_message;
- time_t now;
+ struct timeval tv_now;
if (!message)
return;
@@ -583,10 +586,9 @@ irc_raw_print (struct t_irc_server *server, int flags,
if (!irc_raw_buffer && (weechat_irc_plugin->debug >= 1))
irc_raw_open (0);
- now = time (NULL);
-
- new_raw_message = irc_raw_message_add_to_list (now, server, flags,
- message);
+ gettimeofday (&tv_now, NULL);
+ new_raw_message = irc_raw_message_add_to_list (
+ tv_now.tv_sec, tv_now.tv_usec, server, flags, message);
if (new_raw_message)
{
if (irc_raw_buffer)
@@ -598,7 +600,8 @@ irc_raw_print (struct t_irc_server *server, int flags,
if (weechat_irc_plugin->debug >= 2)
{
new_raw_message = irc_raw_message_add_to_list (
- now,
+ tv_now.tv_sec,
+ tv_now.tv_usec,
server,
flags | IRC_RAW_FLAG_BINARY,
message);
@@ -635,6 +638,8 @@ irc_raw_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_time (ptr_item, "date", raw_message->date))
return 0;
+ if (!weechat_infolist_new_var_integer (ptr_item, "date_usec", raw_message->date_usec))
+ return 0;
if (!weechat_infolist_new_var_string (ptr_item, "server", raw_message->server->name))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "flags", raw_message->flags))
diff --git a/src/plugins/irc/irc-raw.h b/src/plugins/irc/irc-raw.h
index b846e7b96..ddbcca723 100644
--- a/src/plugins/irc/irc-raw.h
+++ b/src/plugins/irc/irc-raw.h
@@ -41,6 +41,7 @@ struct t_irc_server;
struct t_irc_raw_message
{
time_t date; /* date/time of message */
+ int date_usec; /* microseconds of date */
struct t_irc_server *server; /* server */
int flags; /* flags */
char *message; /* message */
@@ -59,6 +60,7 @@ extern void irc_raw_open (int switch_to_buffer);
extern void irc_raw_set_filter (const char *filter);
extern void irc_raw_filter_options (const char *filter);
extern struct t_irc_raw_message *irc_raw_message_add_to_list (time_t date,
+ int date_usec,
struct t_irc_server *server,
int flags,
const char *message);
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 8745477d1..43745f947 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -969,6 +969,7 @@ irc_upgrade_read_cb (const void *pointer, void *data,
{
irc_raw_message_add_to_list (
weechat_infolist_time (infolist, "date"),
+ weechat_infolist_integer (infolist, "date_usec"),
ptr_server,
weechat_infolist_integer (infolist, "flags"),
weechat_infolist_string (infolist, "message"));
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 0475672e3..483303938 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -1903,6 +1903,31 @@ API_FUNC(print_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_datetime_tags)
+{
+ long date;
+ int date_usec;
+
+ API_INIT_FUNC(1, "print_datetime_tags", "sniss", API_RETURN_ERROR);
+
+ v8::String::Utf8Value buffer(args[0]);
+ date = args[1]->IntegerValue();
+ date_usec = args[2]->IntegerValue();
+ v8::String::Utf8Value tags(args[3]);
+ v8::String::Utf8Value message(args[4]);
+
+ plugin_script_api_printf_datetime_tags (
+ weechat_js_plugin,
+ js_current_script,
+ (struct t_gui_buffer *)API_STR2PTR(*buffer),
+ (time_t)date,
+ date_usec,
+ *tags,
+ "%s", *message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(print_y)
{
int y;
@@ -1913,11 +1938,12 @@ API_FUNC(print_y)
y = args[1]->IntegerValue();
v8::String::Utf8Value message(args[2]);
- plugin_script_api_printf_y (weechat_js_plugin,
- js_current_script,
- (struct t_gui_buffer *)API_STR2PTR(*buffer),
- y,
- "%s", *message);
+ plugin_script_api_printf_y (
+ weechat_js_plugin,
+ js_current_script,
+ (struct t_gui_buffer *)API_STR2PTR(*buffer),
+ y,
+ "%s", *message);
API_RETURN_OK;
}
@@ -1935,13 +1961,41 @@ API_FUNC(print_y_date_tags)
v8::String::Utf8Value tags(args[3]);
v8::String::Utf8Value message(args[4]);
- plugin_script_api_printf_y_date_tags (weechat_js_plugin,
- js_current_script,
- (struct t_gui_buffer *)API_STR2PTR(*buffer),
- y,
- (time_t)date,
- *tags,
- "%s", *message);
+ plugin_script_api_printf_y_date_tags (
+ weechat_js_plugin,
+ js_current_script,
+ (struct t_gui_buffer *)API_STR2PTR(*buffer),
+ y,
+ (time_t)date,
+ *tags,
+ "%s", *message);
+
+ API_RETURN_OK;
+}
+
+API_FUNC(print_y_datetime_tags)
+{
+ int y, date_usec;
+ long date;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", "siniss", API_RETURN_ERROR);
+
+ v8::String::Utf8Value buffer(args[0]);
+ y = args[1]->IntegerValue();
+ date = args[2]->IntegerValue();
+ date_usec = args[3]->IntegerValue();
+ v8::String::Utf8Value tags(args[4]);
+ v8::String::Utf8Value message(args[5]);
+
+ plugin_script_api_printf_y_datetime_tags (
+ weechat_js_plugin,
+ js_current_script,
+ (struct t_gui_buffer *)API_STR2PTR(*buffer),
+ y,
+ (time_t)date,
+ date_usec,
+ *tags,
+ "%s", *message);
API_RETURN_OK;
}
@@ -2667,7 +2721,7 @@ API_FUNC(hook_line)
int
weechat_js_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2680,6 +2734,7 @@ weechat_js_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -5297,8 +5352,10 @@ WeechatJsV8::loadLibs()
API_DEF_FUNC(color);
API_DEF_FUNC(print);
API_DEF_FUNC(print_date_tags);
+ API_DEF_FUNC(print_datetime_tags);
API_DEF_FUNC(print_y);
API_DEF_FUNC(print_y_date_tags);
+ API_DEF_FUNC(print_y_datetime_tags);
API_DEF_FUNC(log_print);
API_DEF_FUNC(hook_command);
API_DEF_FUNC(hook_completion);
diff --git a/src/plugins/logger/logger-buffer.c b/src/plugins/logger/logger-buffer.c
index dcbd8b7e3..5ad85acd1 100644
--- a/src/plugins/logger/logger-buffer.c
+++ b/src/plugins/logger/logger-buffer.c
@@ -27,6 +27,8 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include <time.h>
+#include <sys/time.h>
#include <sys/stat.h>
#include "../weechat-plugin.h"
@@ -236,8 +238,7 @@ logger_buffer_create_log_file (struct t_logger_buffer *logger_buffer)
{
char *charset, *message, buf_time[256], buf_beginning[1024];
int log_level, rc;
- time_t seconds;
- struct tm *date_tmp;
+ struct timeval tv_now;
struct stat statbuf;
if (logger_buffer->log_file)
@@ -311,16 +312,11 @@ logger_buffer_create_log_file (struct t_logger_buffer *logger_buffer)
if (weechat_config_boolean (logger_config_file_info_lines)
&& logger_buffer->write_start_info_line)
{
- buf_time[0] = '\0';
- seconds = time (NULL);
- date_tmp = localtime (&seconds);
- if (date_tmp)
- {
- if (strftime (buf_time, sizeof (buf_time) - 1,
- weechat_config_string (logger_config_file_time_format),
- date_tmp) == 0)
- buf_time[0] = '\0';
- }
+ gettimeofday (&tv_now, NULL);
+ weechat_util_strftimeval (
+ buf_time, sizeof (buf_time),
+ weechat_config_string (logger_config_file_time_format),
+ &tv_now);
snprintf (buf_beginning, sizeof (buf_beginning),
_("%s\t**** Beginning of log ****"),
buf_time);
@@ -663,8 +659,7 @@ logger_buffer_write_line (struct t_logger_buffer *logger_buffer,
void
logger_buffer_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
{
- time_t seconds;
- struct tm *date_tmp;
+ struct timeval tv_now;
char buf_time[256];
if (!logger_buffer)
@@ -674,16 +669,11 @@ logger_buffer_stop (struct t_logger_buffer *logger_buffer, int write_info_line)
{
if (write_info_line && weechat_config_boolean (logger_config_file_info_lines))
{
- buf_time[0] = '\0';
- seconds = time (NULL);
- date_tmp = localtime (&seconds);
- if (date_tmp)
- {
- if (strftime (buf_time, sizeof (buf_time) - 1,
- weechat_config_string (logger_config_file_time_format),
- date_tmp) == 0)
- buf_time[0] = '\0';
- }
+ gettimeofday (&tv_now, NULL);
+ weechat_util_strftimeval (
+ buf_time, sizeof (buf_time),
+ weechat_config_string (logger_config_file_time_format),
+ &tv_now);
logger_buffer_write_line (logger_buffer,
_("%s\t**** End of log ****"),
buf_time);
diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c
index 0a5810234..5ab376721 100644
--- a/src/plugins/logger/logger-config.c
+++ b/src/plugins/logger/logger-config.c
@@ -716,7 +716,8 @@ logger_config_init ()
logger_config_file, logger_config_section_file,
"time_format", "string",
N_("timestamp used in log files (see man strftime for date/time "
- "specifiers)"),
+ "specifiers, extra specifiers are supported, see function "
+ "util_strftimeval in Plugin API reference)"),
NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index 6489ef1ec..bc3121ea8 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <ctype.h>
#include <time.h>
+#include <sys/time.h>
#include "../weechat-plugin.h"
#include "logger.h"
@@ -150,7 +151,7 @@ logger_get_file_path ()
seconds = time (NULL);
date_tmp = localtime (&seconds);
path2[0] = '\0';
- if (strftime (path2, length - 1, path, date_tmp) == 0)
+ if (strftime (path2, length, path, date_tmp) == 0)
path2[0] = '\0';
if (weechat_logger_plugin->debug)
@@ -378,7 +379,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
seconds = time (NULL);
date_tmp = localtime (&seconds);
mask2[0] = '\0';
- if (strftime (mask2, length - 1, mask, date_tmp) == 0)
+ if (strftime (mask2, length, mask, date_tmp) == 0)
mask2[0] = '\0';
/*
@@ -695,13 +696,13 @@ logger_get_line_tag_info (int tags_count, const char **tags,
int
logger_print_cb (const void *pointer, void *data,
- struct t_gui_buffer *buffer, time_t date,
+ struct t_gui_buffer *buffer, time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
struct t_logger_buffer *ptr_logger_buffer;
- struct tm *date_tmp;
+ struct timeval tv;
char buf_time[256], *prefix_ansi, *message_ansi;
const char *ptr_prefix, *ptr_message;
int line_log_level, prefix_is_nick, color_lines;
@@ -740,15 +741,12 @@ logger_print_cb (const void *pointer, void *data,
ptr_prefix = prefix;
ptr_message = message;
}
- buf_time[0] = '\0';
- date_tmp = localtime (&date);
- if (date_tmp)
- {
- if (strftime (buf_time, sizeof (buf_time) - 1,
- weechat_config_string (logger_config_file_time_format),
- date_tmp) == 0)
- buf_time[0] = '\0';
- }
+ tv.tv_sec = date;
+ tv.tv_usec = date_usec;
+ weechat_util_strftimeval (
+ buf_time, sizeof (buf_time),
+ weechat_config_string (logger_config_file_time_format),
+ &tv);
logger_buffer_write_line (
ptr_logger_buffer,
diff --git a/src/plugins/logger/logger.h b/src/plugins/logger/logger.h
index 2b94acab4..c2d9ac5d7 100644
--- a/src/plugins/logger/logger.h
+++ b/src/plugins/logger/logger.h
@@ -41,7 +41,8 @@ extern char *logger_build_option_name (struct t_gui_buffer *buffer);
extern int logger_get_level_for_buffer (struct t_gui_buffer *buffer);
extern char *logger_get_filename (struct t_gui_buffer *buffer);
extern int logger_print_cb (const void *pointer, void *data,
- struct t_gui_buffer *buffer, time_t date,
+ struct t_gui_buffer *buffer,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message);
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 749ce5acf..b67bd82b2 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -2107,6 +2107,33 @@ API_FUNC(print_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_datetime_tags)
+{
+ const char *buffer, *tags, *message;
+ long date;
+ int date_usec;
+
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (lua_gettop (L) < 5)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = lua_tostring (L, -5);
+ date = lua_tonumber (L, -4);
+ date_usec = lua_tonumber (L, -3);
+ tags = lua_tostring (L, -2);
+ message = lua_tostring (L, -1);
+
+ plugin_script_api_printf_datetime_tags (weechat_lua_plugin,
+ lua_current_script,
+ API_STR2PTR(buffer),
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(print_y)
{
const char *buffer, *message;
@@ -2156,6 +2183,35 @@ API_FUNC(print_y_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_y_datetime_tags)
+{
+ const char *buffer, *tags, *message;
+ int y, date_usec;
+ long date;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (lua_gettop (L) < 6)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = lua_tostring (L, -6);
+ y = lua_tonumber (L, -5);
+ date = lua_tonumber (L, -4);
+ date_usec = lua_tonumber (L, -3);
+ tags = lua_tostring (L, -2);
+ message = lua_tostring (L, -1);
+
+ plugin_script_api_printf_y_datetime_tags (weechat_lua_plugin,
+ lua_current_script,
+ API_STR2PTR(buffer),
+ y,
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(log_print)
{
const char *message;
@@ -2891,7 +2947,7 @@ API_FUNC(hook_line)
int
weechat_lua_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2904,6 +2960,7 @@ weechat_lua_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -5662,8 +5719,10 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(color),
API_DEF_FUNC(print),
API_DEF_FUNC(print_date_tags),
+ API_DEF_FUNC(print_datetime_tags),
API_DEF_FUNC(print_y),
API_DEF_FUNC(print_y_date_tags),
+ API_DEF_FUNC(print_y_datetime_tags),
API_DEF_FUNC(log_print),
API_DEF_FUNC(hook_command),
API_DEF_FUNC(hook_completion),
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 0e28070eb..6d89d68a6 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -2015,6 +2015,30 @@ API_FUNC(print_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_datetime_tags)
+{
+ char *buffer, *tags, *message;
+ dXSARGS;
+
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (items < 5)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = SvPV_nolen (ST (0));
+ tags = SvPV_nolen (ST (3));
+ message = SvPV_nolen (ST (4));
+
+ plugin_script_api_printf_datetime_tags (weechat_perl_plugin,
+ perl_current_script,
+ API_STR2PTR(buffer),
+ (time_t)(SvIV (ST (1))), /* date */
+ SvIV (ST (2)), /* date_usec */
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(print_y)
{
char *buffer, *message;
@@ -2030,7 +2054,7 @@ API_FUNC(print_y)
plugin_script_api_printf_y (weechat_perl_plugin,
perl_current_script,
API_STR2PTR(buffer),
- SvIV (ST (1)),
+ SvIV (ST (1)), /* y */
"%s", message);
API_RETURN_OK;
@@ -2060,6 +2084,31 @@ API_FUNC(print_y_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_y_datetime_tags)
+{
+ char *buffer, *tags, *message;
+ dXSARGS;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (items < 5)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = SvPV_nolen (ST (0));
+ tags = SvPV_nolen (ST (4));
+ message = SvPV_nolen (ST (5));
+
+ plugin_script_api_printf_y_datetime_tags (weechat_perl_plugin,
+ perl_current_script,
+ API_STR2PTR(buffer),
+ SvIV (ST (1)), /* y */
+ (time_t)(SvIV (ST (2))), /* date */
+ SvIV (ST (3)), /* date_usec */
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(log_print)
{
dXSARGS;
@@ -2777,7 +2826,7 @@ API_FUNC(hook_line)
int
weechat_perl_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2790,6 +2839,7 @@ weechat_perl_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -5606,8 +5656,10 @@ weechat_perl_api_init (pTHX)
API_DEF_FUNC(color);
API_DEF_FUNC(print);
API_DEF_FUNC(print_date_tags);
+ API_DEF_FUNC(print_datetime_tags);
API_DEF_FUNC(print_y);
API_DEF_FUNC(print_y_date_tags);
+ API_DEF_FUNC(print_y_datetime_tags);
API_DEF_FUNC(log_print);
API_DEF_FUNC(hook_command);
API_DEF_FUNC(hook_completion);
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c
index fbd1ce5db..b23c86bf9 100644
--- a/src/plugins/php/weechat-php-api.c
+++ b/src/plugins/php/weechat-php-api.c
@@ -2183,6 +2183,38 @@ API_FUNC(print_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_datetime_tags)
+{
+ zend_string *z_buffer, *z_tags, *z_message;
+ zend_long z_date, z_date_usec;
+ struct t_gui_buffer *buffer;
+ time_t date;
+ int date_usec;
+ char *tags, *message;
+
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (zend_parse_parameters (ZEND_NUM_ARGS(), "SllSS", &z_buffer, &z_date,
+ &z_date_usec, &z_tags, &z_message) == FAILURE)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = (struct t_gui_buffer *)API_STR2PTR(ZSTR_VAL(z_buffer));
+ date = (time_t)z_date;
+ date_usec = (int)z_date_usec;
+ tags = ZSTR_VAL(z_tags);
+ message = ZSTR_VAL(z_message);
+
+ plugin_script_api_printf_datetime_tags (weechat_php_plugin,
+ php_current_script,
+ buffer,
+ date,
+ date_usec,
+ (const char *)tags,
+ "%s",
+ message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(print_y)
{
zend_string *z_buffer, *z_message;
@@ -2242,6 +2274,41 @@ API_FUNC(print_y_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_y_datetime_tags)
+{
+ zend_string *z_buffer, *z_tags, *z_message;
+ zend_long z_y, z_date, z_date_usec;
+ struct t_gui_buffer *buffer;
+ int y, date_usec;
+ time_t date;
+ char *tags, *message;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (zend_parse_parameters (ZEND_NUM_ARGS(), "SlllSS", &z_buffer, &z_y,
+ &z_date, &z_date_usec, &z_tags,
+ &z_message) == FAILURE)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = (struct t_gui_buffer *)API_STR2PTR(ZSTR_VAL(z_buffer));
+ y = (int)z_y;
+ date = (time_t)z_date;
+ date_usec = (int)z_date_usec;
+ tags = ZSTR_VAL(z_tags);
+ message = ZSTR_VAL(z_message);
+
+ plugin_script_api_printf_y_datetime_tags (weechat_php_plugin,
+ php_current_script,
+ buffer,
+ y,
+ date,
+ date_usec,
+ (const char *)tags,
+ "%s",
+ message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(log_print)
{
zend_string *z_message;
@@ -2871,7 +2938,8 @@ API_FUNC(hook_line)
static int
weechat_php_api_hook_print_cb (const void *pointer, void *data,
- struct t_gui_buffer *buffer, time_t date,
+ struct t_gui_buffer *buffer,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2879,6 +2947,9 @@ weechat_php_api_hook_print_cb (const void *pointer, void *data,
int rc;
void *func_argv[9];
+ /* make C compiler happy */
+ (void) date_usec;
+
func_argv[1] = (char *)API_PTR2STR(buffer);
func_argv[2] = &date;
func_argv[3] = &tags_count;
diff --git a/src/plugins/php/weechat-php-api.h b/src/plugins/php/weechat-php-api.h
index d223b6f56..0d0057705 100644
--- a/src/plugins/php/weechat-php-api.h
+++ b/src/plugins/php/weechat-php-api.h
@@ -129,8 +129,10 @@ PHP_FUNCTION(weechat_prefix);
PHP_FUNCTION(weechat_color);
PHP_FUNCTION(weechat_print);
PHP_FUNCTION(weechat_print_date_tags);
+PHP_FUNCTION(weechat_print_datetime_tags);
PHP_FUNCTION(weechat_print_y);
PHP_FUNCTION(weechat_print_y_date_tags);
+PHP_FUNCTION(weechat_print_y_datetime_tags);
PHP_FUNCTION(weechat_log_print);
PHP_FUNCTION(weechat_hook_command);
PHP_FUNCTION(weechat_hook_completion);
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 8a5534916..e97abaf03 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -187,8 +187,10 @@ const zend_function_entry weechat_functions[] = {
PHP_FE(weechat_color, arginfo_weechat_color)
PHP_FE(weechat_print, arginfo_weechat_print)
PHP_FE(weechat_print_date_tags, arginfo_weechat_print_date_tags)
+ PHP_FE(weechat_print_datetime_tags, arginfo_weechat_print_datetime_tags)
PHP_FE(weechat_print_y, arginfo_weechat_print_y)
PHP_FE(weechat_print_y_date_tags, arginfo_weechat_print_y_date_tags)
+ PHP_FE(weechat_print_y_datetime_tags, arginfo_weechat_print_y_datetime_tags)
PHP_FE(weechat_log_print, arginfo_weechat_log_print)
PHP_FE(weechat_hook_command, arginfo_weechat_hook_command)
PHP_FE(weechat_hook_completion, arginfo_weechat_hook_completion)
diff --git a/src/plugins/php/weechat-php.stub.php b/src/plugins/php/weechat-php.stub.php
index 9343075af..3fa47053b 100644
--- a/src/plugins/php/weechat-php.stub.php
+++ b/src/plugins/php/weechat-php.stub.php
@@ -95,8 +95,10 @@ function weechat_prefix(string $p0): string {}
function weechat_color(string $p0): string {}
function weechat_print(string $p0, string $p1): int {}
function weechat_print_date_tags(string $p0, int $p1, string $p2, string $p3): int {}
+function weechat_print_datetime_tags(string $p0, int $p1, int $p2, string $p3, string $p4): int {}
function weechat_print_y(string $p0, int $p1, string $p2): int {}
function weechat_print_y_date_tags(string $p0, int $p1, int $p2, string $p3, string $p4): int {}
+function weechat_print_y_datetime_tags(string $p0, int $p1, int $p2, int $p3, string $p4, string $p5): int {}
function weechat_log_print(string $p0): int {}
function weechat_hook_command(string $p0, string $p1, string $p2, string $p3, string $p4, mixed $p5, string $p6): string {}
function weechat_hook_completion(string $p0, string $p1, mixed $p2, string $p3): string {}
diff --git a/src/plugins/php/weechat-php_arginfo.h b/src/plugins/php/weechat-php_arginfo.h
index e2b345a3e..250d2ea5f 100644
--- a/src/plugins/php/weechat-php_arginfo.h
+++ b/src/plugins/php/weechat-php_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 614392b6be26030a5d7b12437562aec08ad7052c */
+ * Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_register, 0, 7, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
@@ -239,18 +239,29 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_print_date_tags, 0, 4, I
ZEND_ARG_TYPE_INFO(0, p3, IS_STRING, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_print_datetime_tags, 0, 5, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, p1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, p2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, p3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, p4, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_print_y, 0, 3, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, p1, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p2, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_print_y_date_tags, 0, 5, IS_LONG, 0)
+#define arginfo_weechat_print_y_date_tags arginfo_weechat_print_datetime_tags
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_print_y_datetime_tags, 0, 6, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, p1, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p2, IS_LONG, 0)
- ZEND_ARG_TYPE_INFO(0, p3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, p3, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, p4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, p5, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_weechat_log_print arginfo_weechat_charset_set
diff --git a/src/plugins/php/weechat-php_legacy_arginfo.h b/src/plugins/php/weechat-php_legacy_arginfo.h
index de2cb031e..2622d66b0 100644
--- a/src/plugins/php/weechat-php_legacy_arginfo.h
+++ b/src/plugins/php/weechat-php_legacy_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 614392b6be26030a5d7b12437562aec08ad7052c */
+ * Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7)
ZEND_ARG_INFO(0, p0)
@@ -192,14 +192,25 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_print_date_tags arginfo_weechat_string_eval_expression
+ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_print_datetime_tags, 0, 0, 5)
+ ZEND_ARG_INFO(0, p0)
+ ZEND_ARG_INFO(0, p1)
+ ZEND_ARG_INFO(0, p2)
+ ZEND_ARG_INFO(0, p3)
+ ZEND_ARG_INFO(0, p4)
+ZEND_END_ARG_INFO()
+
#define arginfo_weechat_print_y arginfo_weechat_ngettext
-ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_print_y_date_tags, 0, 0, 5)
+#define arginfo_weechat_print_y_date_tags arginfo_weechat_print_datetime_tags
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_print_y_datetime_tags, 0, 0, 6)
ZEND_ARG_INFO(0, p0)
ZEND_ARG_INFO(0, p1)
ZEND_ARG_INFO(0, p2)
ZEND_ARG_INFO(0, p3)
ZEND_ARG_INFO(0, p4)
+ ZEND_ARG_INFO(0, p5)
ZEND_END_ARG_INFO()
#define arginfo_weechat_log_print arginfo_weechat_plugin_get_name
@@ -214,28 +225,21 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_hook_command_run arginfo_weechat_ngettext
-#define arginfo_weechat_hook_timer arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hook_timer arginfo_weechat_print_datetime_tags
-ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_hook_fd, 0, 0, 6)
- ZEND_ARG_INFO(0, p0)
- ZEND_ARG_INFO(0, p1)
- ZEND_ARG_INFO(0, p2)
- ZEND_ARG_INFO(0, p3)
- ZEND_ARG_INFO(0, p4)
- ZEND_ARG_INFO(0, p5)
-ZEND_END_ARG_INFO()
+#define arginfo_weechat_hook_fd arginfo_weechat_print_y_datetime_tags
#define arginfo_weechat_hook_process arginfo_weechat_string_eval_expression
-#define arginfo_weechat_hook_process_hashtable arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hook_process_hashtable arginfo_weechat_print_datetime_tags
-#define arginfo_weechat_hook_url arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hook_url arginfo_weechat_print_datetime_tags
#define arginfo_weechat_hook_connect arginfo_weechat_list_new
-#define arginfo_weechat_hook_line arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hook_line arginfo_weechat_print_datetime_tags
-#define arginfo_weechat_hook_print arginfo_weechat_hook_fd
+#define arginfo_weechat_hook_print arginfo_weechat_print_y_datetime_tags
#define arginfo_weechat_hook_signal arginfo_weechat_ngettext
@@ -251,11 +255,11 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_hook_modifier_exec arginfo_weechat_ngettext
-#define arginfo_weechat_hook_info arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hook_info arginfo_weechat_print_datetime_tags
#define arginfo_weechat_hook_info_hashtable arginfo_weechat_register
-#define arginfo_weechat_hook_infolist arginfo_weechat_hook_fd
+#define arginfo_weechat_hook_infolist arginfo_weechat_print_y_datetime_tags
#define arginfo_weechat_hook_focus arginfo_weechat_ngettext
@@ -265,9 +269,9 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_unhook_all arginfo_weechat_plugin_get_name
-#define arginfo_weechat_buffer_new arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_buffer_new arginfo_weechat_print_datetime_tags
-#define arginfo_weechat_buffer_new_props arginfo_weechat_hook_fd
+#define arginfo_weechat_buffer_new_props arginfo_weechat_print_y_datetime_tags
#define arginfo_weechat_buffer_search arginfo_weechat_iconv_to_internal
@@ -307,7 +311,7 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_window_set_title arginfo_weechat_plugin_get_name
-#define arginfo_weechat_nicklist_add_group arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_nicklist_add_group arginfo_weechat_print_datetime_tags
#define arginfo_weechat_nicklist_search_group arginfo_weechat_ngettext
@@ -441,7 +445,7 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_hdata_hashtable arginfo_weechat_ngettext
-#define arginfo_weechat_hdata_compare arginfo_weechat_print_y_date_tags
+#define arginfo_weechat_hdata_compare arginfo_weechat_print_datetime_tags
#define arginfo_weechat_hdata_update arginfo_weechat_ngettext
diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c
index 85ee30430..5a3e39bc5 100644
--- a/src/plugins/plugin-script-api.c
+++ b/src/plugins/plugin-script-api.c
@@ -391,6 +391,34 @@ plugin_script_api_printf_date_tags (struct t_weechat_plugin *weechat_plugin,
}
/*
+ * Prints a message, with optional date/time (with microseconds) and tags.
+ */
+
+void
+plugin_script_api_printf_datetime_tags (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ struct t_gui_buffer *buffer,
+ time_t date, int date_usec,
+ const char *tags,
+ const char *format, ...)
+{
+ char *buf2;
+
+ weechat_va_format (format);
+ if (!vbuffer)
+ return;
+
+ buf2 = (script && script->charset && script->charset[0]) ?
+ weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
+ weechat_printf_datetime_tags (buffer, date, date_usec, tags,
+ "%s", (buf2) ? buf2 : vbuffer);
+ if (buf2)
+ free (buf2);
+
+ free (vbuffer);
+}
+
+/*
* Prints a message on a buffer with free content.
*/
@@ -443,6 +471,35 @@ plugin_script_api_printf_y_date_tags (struct t_weechat_plugin *weechat_plugin,
}
/*
+ * Prints a message on a buffer with free content, with optional date/time
+ * (with microseconds) and tags.
+ */
+
+void
+plugin_script_api_printf_y_datetime_tags (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ struct t_gui_buffer *buffer, int y,
+ time_t date, int date_usec,
+ const char *tags,
+ const char *format, ...)
+{
+ char *buf2;
+
+ weechat_va_format (format);
+ if (!vbuffer)
+ return;
+
+ buf2 = (script && script->charset && script->charset[0]) ?
+ weechat_iconv_to_internal (script->charset, vbuffer) : NULL;
+ weechat_printf_y_datetime_tags (buffer, y, date, date_usec, tags,
+ "%s", (buf2) ? buf2 : vbuffer);
+ if (buf2)
+ free (buf2);
+
+ free (vbuffer);
+}
+
+/*
* Prints a message in WeeChat log file.
*/
@@ -857,6 +914,7 @@ plugin_script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
void *data,
struct t_gui_buffer *buffer,
time_t date,
+ int date_usec,
int tags_count,
const char **tags,
int displayed, int highlight,
diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h
index a69b3435a..dae298193 100644
--- a/src/plugins/plugin-script-api.h
+++ b/src/plugins/plugin-script-api.h
@@ -126,6 +126,12 @@ extern void plugin_script_api_printf_date_tags (struct t_weechat_plugin *weechat
struct t_gui_buffer *buffer,
time_t date, const char *tags,
const char *format, ...);
+extern void plugin_script_api_printf_datetime_tags (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ struct t_gui_buffer *buffer,
+ time_t date, int date_usec,
+ const char *tags,
+ const char *format, ...);
extern void plugin_script_api_printf_y (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
@@ -136,6 +142,13 @@ extern void plugin_script_api_printf_y_date_tags (struct t_weechat_plugin *weech
int y, time_t date,
const char *tags,
const char *format, ...);
+extern void plugin_script_api_printf_y_datetime_tags (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ struct t_gui_buffer *buffer,
+ int y,
+ time_t date, int date_usec,
+ const char *tags,
+ const char *format, ...);
extern void plugin_script_api_log_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *format, ...);
@@ -256,6 +269,7 @@ extern struct t_hook *plugin_script_api_hook_print (struct t_weechat_plugin *wee
void *data,
struct t_gui_buffer *buffer,
time_t date,
+ int date_usec,
int tags_count,
const char **tags,
int displayed,
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index e496d547a..aa9a87856 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -694,6 +694,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
new_plugin->util_timeval_diff = &util_timeval_diff;
new_plugin->util_timeval_add = &util_timeval_add;
new_plugin->util_get_time_string = &util_get_time_string;
+ new_plugin->util_strftimeval = &util_strftimeval;
new_plugin->util_version_number = &util_version_number;
new_plugin->list_new = &weelist_new;
@@ -789,8 +790,8 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
new_plugin->prefix = &plugin_api_prefix;
new_plugin->color = &plugin_api_color;
- new_plugin->printf_date_tags = &gui_chat_printf_date_tags;
- new_plugin->printf_y_date_tags = &gui_chat_printf_y_date_tags;
+ new_plugin->printf_datetime_tags = &gui_chat_printf_datetime_tags;
+ new_plugin->printf_y_datetime_tags = &gui_chat_printf_y_datetime_tags;
new_plugin->log_printf = &log_printf;
new_plugin->hook_command = &hook_command;
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index 15c1a41ee..b08b178b8 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -2012,6 +2012,33 @@ API_FUNC(prnt_date_tags)
API_RETURN_OK;
}
+API_FUNC(prnt_datetime_tags)
+{
+ char *buffer, *tags, *message;
+ long date;
+ int date_usec;
+
+ API_INIT_FUNC(1, "prnt_datetime_tags", API_RETURN_ERROR);
+ buffer = NULL;
+ date = 0;
+ date_usec = 0;
+ tags = NULL;
+ message = NULL;
+ if (!PyArg_ParseTuple (args, "sliss", &buffer, &date, &date_usec, &tags,
+ &message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ plugin_script_api_printf_datetime_tags (weechat_python_plugin,
+ python_current_script,
+ API_STR2PTR(buffer),
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(prnt_y)
{
char *buffer, *message;
@@ -2059,6 +2086,36 @@ API_FUNC(prnt_y_date_tags)
API_RETURN_OK;
}
+API_FUNC(prnt_y_datetime_tags)
+{
+ char *buffer, *tags, *message;
+ int y;
+ long date;
+ int date_usec;
+
+ API_INIT_FUNC(1, "prnt_y_datetime_tags", API_RETURN_ERROR);
+ buffer = NULL;
+ y = 0;
+ date = 0;
+ date_usec = 0;
+ tags = NULL;
+ message = NULL;
+ if (!PyArg_ParseTuple (args, "siliss", &buffer, &y, &date, &date_usec,
+ &tags, &message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ plugin_script_api_printf_y_datetime_tags (weechat_python_plugin,
+ python_current_script,
+ API_STR2PTR(buffer),
+ y,
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(log_print)
{
char *message;
@@ -2797,7 +2854,7 @@ API_FUNC(hook_line)
int
weechat_python_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -2810,6 +2867,7 @@ weechat_python_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -5527,8 +5585,10 @@ PyMethodDef weechat_python_funcs[] =
API_DEF_FUNC(color),
API_DEF_FUNC(prnt),
API_DEF_FUNC(prnt_date_tags),
+ API_DEF_FUNC(prnt_datetime_tags),
API_DEF_FUNC(prnt_y),
API_DEF_FUNC(prnt_y_date_tags),
+ API_DEF_FUNC(prnt_y_datetime_tags),
API_DEF_FUNC(log_print),
API_DEF_FUNC(hook_command),
API_DEF_FUNC(hook_completion),
diff --git a/src/plugins/python/weechat.pyi b/src/plugins/python/weechat.pyi
index db2b5ceae..8bb4ad8e4 100644
--- a/src/plugins/python/weechat.pyi
+++ b/src/plugins/python/weechat.pyi
@@ -1156,6 +1156,20 @@ def prnt_date_tags(buffer: str, date: int, tags: str, message: str) -> int:
...
+def prnt_datetime_tags(buffer: str, date: int, date_usec: int, tags: str, message: str) -> int:
+ """`prnt_datetime_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_datetime_tags>`_
+ ::
+
+ # example
+ now = time.time()
+ time_sec = int(now)
+ time_usec = int((now * 1000000) % 1000000)
+ weechat.prnt_datetime_tags("", time_sec - 120, time_usec, "notify_message",
+ "Message 2 minutes ago, with a tag 'notify_message'")
+ """
+ ...
+
+
def prnt_y(buffer: str, y: int, message: str) -> int:
"""`prnt_y in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_y>`_
::
@@ -1176,6 +1190,16 @@ def prnt_y_date_tags(buffer: str, y: int, date: int, tags: str, message: str) ->
...
+def prnt_y_datetime_tags(buffer: str, y: int, date: int, date_usec: int, tags: str, message: str) -> int:
+ """`prnt_y_datetime_tags in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_prnt_y_datetime_tags>`_
+ ::
+
+ # example
+ weechat.prnt_y_datetime_tags("", 2, 0, 0, "my_tag", "My message on third line with a tag")
+ """
+ ...
+
+
def log_print(message: str) -> int:
"""`log_print in WeeChat plugin API reference <https://weechat.org/doc/weechat/api/#_log_print>`_
::
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c
index 4966f19ae..d5bdd83dc 100644
--- a/src/plugins/relay/weechat/relay-weechat-protocol.c
+++ b/src/plugins/relay/weechat/relay-weechat-protocol.c
@@ -1143,11 +1143,11 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data,
snprintf (cmd_hdata, sizeof (cmd_hdata),
"line_data:0x%lx",
(unsigned long)ptr_line_data);
- relay_weechat_msg_add_hdata (msg, cmd_hdata,
- "buffer,date,date_printed,"
- "displayed,notify_level,"
- "highlight,tags_array,prefix,"
- "message");
+ relay_weechat_msg_add_hdata (
+ msg, cmd_hdata,
+ "buffer,date,date_usec,date_printed,date_usec_printed,"
+ "displayed,notify_level,highlight,tags_array,"
+ "prefix,message");
relay_weechat_msg_send (ptr_client, msg);
relay_weechat_msg_free (msg);
}
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 9716dc5be..0dc20e24a 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -2487,6 +2487,43 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
}
static VALUE
+weechat_ruby_api_print_datetime_tags (VALUE class, VALUE buffer, VALUE date,
+ VALUE date_usec, VALUE tags,
+ VALUE message)
+{
+ char *c_buffer, *c_tags, *c_message;
+ time_t c_date;
+ int c_date_usec;
+
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (NIL_P (buffer) || NIL_P (date) || NIL_P (date_usec) || NIL_P (tags)
+ || NIL_P (message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ Check_Type (buffer, T_STRING);
+ CHECK_INTEGER(date);
+ CHECK_INTEGER(date_usec);
+ Check_Type (tags, T_STRING);
+ Check_Type (message, T_STRING);
+
+ c_buffer = StringValuePtr (buffer);
+ c_date = NUM2ULONG (date);
+ c_date_usec = NUM2INT (date_usec);
+ c_tags = StringValuePtr (tags);
+ c_message = StringValuePtr (message);
+
+ plugin_script_api_printf_datetime_tags (weechat_ruby_plugin,
+ ruby_current_script,
+ API_STR2PTR(c_buffer),
+ c_date,
+ c_date_usec,
+ c_tags,
+ "%s", c_message);
+
+ API_RETURN_OK;
+}
+
+static VALUE
weechat_ruby_api_print_y (VALUE class, VALUE buffer, VALUE y, VALUE message)
{
char *c_buffer, *c_message;
@@ -2550,6 +2587,46 @@ weechat_ruby_api_print_y_date_tags (VALUE class, VALUE buffer, VALUE y,
}
static VALUE
+weechat_ruby_api_print_y_datetime_tags (VALUE class, VALUE buffer, VALUE y,
+ VALUE date, VALUE date_usec, VALUE tags,
+ VALUE message)
+{
+ char *c_buffer, *c_tags, *c_message;
+ int c_y, c_date_usec;
+ time_t c_date;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (NIL_P (buffer) || NIL_P (y) || NIL_P (date) || NIL_P (date_usec)
+ || NIL_P (tags) || NIL_P (message))
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ Check_Type (buffer, T_STRING);
+ CHECK_INTEGER(y);
+ CHECK_INTEGER(date);
+ CHECK_INTEGER(date_usec);
+ Check_Type (tags, T_STRING);
+ Check_Type (message, T_STRING);
+
+ c_buffer = StringValuePtr (buffer);
+ c_y = NUM2INT (y);
+ c_date = NUM2ULONG (date);
+ c_date_usec = NUM2INT (date_usec);
+ c_tags = StringValuePtr (tags);
+ c_message = StringValuePtr (message);
+
+ plugin_script_api_printf_y_datetime_tags (weechat_ruby_plugin,
+ ruby_current_script,
+ API_STR2PTR(c_buffer),
+ c_y,
+ c_date,
+ c_date_usec,
+ c_tags,
+ "%s", c_message);
+
+ API_RETURN_OK;
+}
+
+static VALUE
weechat_ruby_api_log_print (VALUE class, VALUE message)
{
char *c_message;
@@ -3400,7 +3477,7 @@ weechat_ruby_api_hook_line (VALUE class, VALUE buffer_type, VALUE buffer_name,
int
weechat_ruby_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -3413,6 +3490,7 @@ weechat_ruby_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -6838,8 +6916,10 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(color, 1);
API_DEF_FUNC(print, 2);
API_DEF_FUNC(print_date_tags, 4);
+ API_DEF_FUNC(print_datetime_tags, 5);
API_DEF_FUNC(print_y, 3);
API_DEF_FUNC(print_y_date_tags, 5);
+ API_DEF_FUNC(print_y_datetime_tags, 6);
API_DEF_FUNC(log_print, 1);
API_DEF_FUNC(hook_command, 7);
API_DEF_FUNC(hook_completion, 4);
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 9414ad27b..88438a64a 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -2277,6 +2277,38 @@ API_FUNC(print_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_datetime_tags)
+{
+ Tcl_Obj *objp;
+ char *buffer, *tags, *message;
+ int i, date_usec;
+ long date;
+
+ API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
+ if (objc < 6)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ if (Tcl_GetLongFromObj (interp, objv[2], &date) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ if (Tcl_GetIntFromObj (interp, objv[3], &date_usec) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = Tcl_GetStringFromObj (objv[1], &i);
+ tags = Tcl_GetStringFromObj (objv[4], &i);
+ message = Tcl_GetStringFromObj (objv[5], &i);
+
+ plugin_script_api_printf_datetime_tags (weechat_tcl_plugin,
+ tcl_current_script,
+ API_STR2PTR(buffer),
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(print_y)
{
Tcl_Obj *objp;
@@ -2334,6 +2366,42 @@ API_FUNC(print_y_date_tags)
API_RETURN_OK;
}
+API_FUNC(print_y_datetime_tags)
+{
+ Tcl_Obj *objp;
+ char *buffer, *tags, *message;
+ int i, y, date_usec;
+ long date;
+
+ API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
+ if (objc < 7)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ if (Tcl_GetIntFromObj (interp, objv[2], &y) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ if (Tcl_GetLongFromObj (interp, objv[3], &date) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ if (Tcl_GetIntFromObj (interp, objv[4], &date_usec) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_ERROR);
+
+ buffer = Tcl_GetStringFromObj (objv[1], &i);
+ tags = Tcl_GetStringFromObj (objv[5], &i);
+ message = Tcl_GetStringFromObj (objv[6], &i);
+
+ plugin_script_api_printf_y_datetime_tags (weechat_tcl_plugin,
+ tcl_current_script,
+ API_STR2PTR(buffer),
+ y,
+ (time_t)date,
+ date_usec,
+ tags,
+ "%s", message);
+
+ API_RETURN_OK;
+}
+
API_FUNC(log_print)
{
Tcl_Obj *objp;
@@ -3097,7 +3165,7 @@ API_FUNC(hook_line)
int
weechat_tcl_api_hook_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date,
+ time_t date, int date_usec,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -3110,6 +3178,7 @@ weechat_tcl_api_hook_print_cb (const void *pointer, void *data,
int *rc, ret;
/* make C compiler happy */
+ (void) date_usec;
(void) tags_count;
script = (struct t_plugin_script *)pointer;
@@ -6118,8 +6187,10 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
API_DEF_FUNC(color);
API_DEF_FUNC(print);
API_DEF_FUNC(print_date_tags);
+ API_DEF_FUNC(print_datetime_tags);
API_DEF_FUNC(print_y);
API_DEF_FUNC(print_y_date_tags);
+ API_DEF_FUNC(print_y_datetime_tags);
API_DEF_FUNC(log_print);
API_DEF_FUNC(hook_command);
API_DEF_FUNC(hook_completion);
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index d9f307688..389f87cbd 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -1143,13 +1143,14 @@ end:
int
trigger_callback_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date, int tags_count, const char **tags,
+ time_t date, int date_usec,
+ int tags_count, const char **tags,
int displayed, int highlight, const char *prefix,
const char *message)
{
char *str_tags, *str_tags2, str_temp[128], *str_no_color;
int length;
- struct tm *date_tmp;
+ struct timeval tv;
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
@@ -1166,14 +1167,10 @@ trigger_callback_print_cb (const void *pointer, void *data,
/* add data in hashtables used for conditions/replace/command */
trigger_callback_set_common_vars (trigger, ctx.extra_vars);
weechat_hashtable_set (ctx.pointers, "buffer", buffer);
- date_tmp = localtime (&date);
- if (date_tmp)
- {
- if (strftime (str_temp, sizeof (str_temp),
- "%Y-%m-%d %H:%M:%S", date_tmp) == 0)
- str_temp[0] = '\0';
- weechat_hashtable_set (ctx.extra_vars, "tg_date", str_temp);
- }
+ tv.tv_sec = date;
+ tv.tv_usec = date_usec;
+ weechat_util_strftimeval (str_temp, sizeof (str_temp), "%FT%T.%f", &tv);
+ weechat_hashtable_set (ctx.extra_vars, "tg_date", str_temp);
snprintf (str_temp, sizeof (str_temp), "%d", displayed);
weechat_hashtable_set (ctx.extra_vars, "tg_displayed", str_temp);
snprintf (str_temp, sizeof (str_temp), "%d", highlight);
@@ -1313,8 +1310,7 @@ trigger_callback_timer_cb (const void *pointer, void *data,
{
char str_temp[128];
int i;
- time_t date;
- struct tm *date_tmp;
+ struct timeval tv_now;
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
@@ -1337,15 +1333,9 @@ trigger_callback_timer_cb (const void *pointer, void *data,
trigger_callback_set_common_vars (trigger, ctx.extra_vars);
snprintf (str_temp, sizeof (str_temp), "%d", remaining_calls);
weechat_hashtable_set (ctx.extra_vars, "tg_remaining_calls", str_temp);
- date = time (NULL);
- date_tmp = localtime (&date);
- if (date_tmp)
- {
- if (strftime (str_temp, sizeof (str_temp),
- "%Y-%m-%d %H:%M:%S", date_tmp) == 0)
- str_temp[0] = '\0';
- weechat_hashtable_set (ctx.extra_vars, "tg_date", str_temp);
- }
+ gettimeofday (&tv_now, NULL);
+ weechat_util_strftimeval (str_temp, sizeof (str_temp), "%FT%T.%f", &tv_now);
+ weechat_hashtable_set (ctx.extra_vars, "tg_date", str_temp);
/* execute the trigger (conditions, regex, command) */
if (!trigger_callback_execute (trigger, &ctx))
diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h
index b04eb1633..ad2d7cd7b 100644
--- a/src/plugins/trigger/trigger-callback.h
+++ b/src/plugins/trigger/trigger-callback.h
@@ -122,10 +122,10 @@ extern struct t_hashtable *trigger_callback_line_cb (const void *pointer, void
struct t_hashtable *line);
extern int trigger_callback_print_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- time_t date, int tags_count,
- const char **tags, int displayed,
- int highlight, const char *prefix,
- const char *message);
+ time_t date, int date_usec,
+ int tags_count, const char **tags,
+ int displayed, int highlight,
+ const char *prefix, const char *message);
extern int trigger_callback_command_cb (const void *pointer,
void *data,
struct t_gui_buffer *buffer,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index e7a1c10f9..0d09416c8 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -68,7 +68,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
-#define WEECHAT_PLUGIN_API_VERSION "20231017-01"
+#define WEECHAT_PLUGIN_API_VERSION "20231226-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -240,8 +240,8 @@ struct timeval;
#define WEECHAT_COMMAND_MIN_ARGS(__min_args, __option) \
if (argc < __min_args) \
{ \
- weechat_printf_date_tags ( \
- NULL, 0, "no_filter", \
+ weechat_printf_datetime_tags ( \
+ NULL, 0, 0, "no_filter", \
_("%sToo few arguments for command \"%s%s%s\" " \
"(help on command: /help %s)"), \
weechat_prefix ("error"), \
@@ -255,8 +255,8 @@ struct timeval;
/* macro to return error in callback of hook_command */
#define WEECHAT_COMMAND_ERROR \
{ \
- weechat_printf_date_tags ( \
- NULL, 0, "no_filter", \
+ weechat_printf_datetime_tags ( \
+ NULL, 0, 0, "no_filter", \
_("%sError with command \"%s\" " \
"(help on command: /help %s)"), \
weechat_prefix ("error"), \
@@ -437,6 +437,8 @@ struct t_weechat_plugin
long long (*util_timeval_diff) (struct timeval *tv1, struct timeval *tv2);
void (*util_timeval_add) (struct timeval *tv, long long interval);
const char *(*util_get_time_string) (const time_t *date);
+ int (*util_strftimeval) (char *string, int max, const char *format,
+ struct timeval *tv);
int (*util_version_number) (const char *version);
/* sorted lists */
@@ -695,11 +697,13 @@ struct t_weechat_plugin
/* display */
const char *(*prefix) (const char *prefix);
const char *(*color) (const char *color_name);
- void (*printf_date_tags) (struct t_gui_buffer *buffer, time_t date,
- const char *tags, const char *message, ...);
- void (*printf_y_date_tags) (struct t_gui_buffer *buffer, int y,
- time_t date, const char *tags,
- const char *message, ...);
+ void (*printf_datetime_tags) (struct t_gui_buffer *buffer,
+ time_t date, int date_usec,
+ const char *tags, const char *message, ...);
+ void (*printf_y_datetime_tags) (struct t_gui_buffer *buffer, int y,
+ time_t date, int date_usec,
+ const char *tags,
+ const char *message, ...);
void (*log_printf) (const char *message, ...);
/* hooks */
@@ -814,6 +818,7 @@ struct t_weechat_plugin
void *data,
struct t_gui_buffer *buffer,
time_t date,
+ int date_usec,
int tags_count,
const char **tags,
int displayed,
@@ -1492,6 +1497,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->util_timeval_add)(__time, __interval)
#define weechat_util_get_time_string(__date) \
(weechat_plugin->util_get_time_string)(__date)
+#define weechat_util_strftimeval(__string, __max, __format, __tv) \
+ (weechat_plugin->util_strftimeval)(__string, __max, __format, __tv)
#define weechat_util_version_number(__version) \
(weechat_plugin->util_version_number)(__version)
@@ -1790,19 +1797,32 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_color(__color_name) \
(weechat_plugin->color)(__color_name)
#define weechat_printf(__buffer, __message, __argz...) \
- (weechat_plugin->printf_date_tags)(__buffer, 0, NULL, __message, \
- ##__argz)
+ (weechat_plugin->printf_datetime_tags)(__buffer, 0, 0, NULL, \
+ __message, ##__argz)
#define weechat_printf_date_tags(__buffer, __date, __tags, __message, \
__argz...) \
- (weechat_plugin->printf_date_tags)(__buffer, __date, __tags, \
- __message, ##__argz)
+ (weechat_plugin->printf_datetime_tags)(__buffer, __date, 0, __tags, \
+ __message, ##__argz)
+
+#define weechat_printf_datetime_tags(__buffer, __date, __date_usec, \
+ __tags, __message, __argz...) \
+ (weechat_plugin->printf_datetime_tags)(__buffer, __date, \
+ __date_usec, __tags, \
+ __message, ##__argz)
#define weechat_printf_y(__buffer, __y, __message, __argz...) \
- (weechat_plugin->printf_y_date_tags)(__buffer, __y, 0, NULL, \
- __message, ##__argz)
+ (weechat_plugin->printf_y_datetime_tags)(__buffer, __y, 0, 0, NULL, \
+ __message, ##__argz)
#define weechat_printf_y_date_tags(__buffer, __y, __date, __tags, \
__message, __argz...) \
- (weechat_plugin->printf_y_date_tags)(__buffer, __y, __date, __tags, \
- __message, ##__argz)
+ (weechat_plugin->printf_y_datetime_tags)(__buffer, __y, __date, 0, \
+ __tags, __message, \
+ ##__argz)
+#define weechat_printf_y_datetime_tags(__buffer, __y, __date, \
+ __date_usec, __tags, \
+ __message, __argz...) \
+ (weechat_plugin->printf_y_datetime_tags)(__buffer, __y, __date, \
+ __date_usec, __tags, \
+ __message, ##__argz)
#define weechat_log_printf(__message, __argz...) \
(weechat_plugin->log_printf)(__message, ##__argz)