summaryrefslogtreecommitdiff
path: root/src/plugins/javascript/weechat-js-api.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-12-26 18:37:21 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-12-26 19:44:37 +0100
commit9fb3d3f14c17f8307f04907d5f57034410dc7010 (patch)
tree239415921e803382adf1abb9a334456c5d96711b /src/plugins/javascript/weechat-js-api.cpp
parent57f80a4c1fac3d5b3c194206c900b1066f9a565e (diff)
downloadweechat-9fb3d3f14c17f8307f04907d5f57034410dc7010.zip
core: store microseconds in buffer lines (closes #649)
Diffstat (limited to 'src/plugins/javascript/weechat-js-api.cpp')
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp83
1 files changed, 70 insertions, 13 deletions
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);