summaryrefslogtreecommitdiff
path: root/src/plugins/javascript/weechat-js-api.cpp
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-04-07 13:20:58 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-04-07 13:20:58 +0200
commit6de98179bc87df4f2da38e36d64a03a1c0f9f623 (patch)
treeac3505c42a0297cf32fa966fc67f86a7825d8520 /src/plugins/javascript/weechat-js-api.cpp
parentea365cccbffb245285b33e5beeebac06743f7056 (diff)
downloadweechat-6de98179bc87df4f2da38e36d64a03a1c0f9f623.zip
api: add function string_format_size in scripting API
Diffstat (limited to 'src/plugins/javascript/weechat-js-api.cpp')
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 0fd5c5f3d..67c09d016 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -74,6 +74,7 @@ extern "C"
{ \
if (((js_args[num] == 's') && (!args[num]->IsString())) \
|| ((js_args[num] == 'i') && (!args[num]->IsInt32())) \
+ || ((js_args[num] == 'n') && (!args[num]->IsNumber())) \
|| ((js_args[num] == 'h') && (!args[num]->IsObject()))) \
{ \
WEECHAT_SCRIPT_MSG_WRONG_ARGS(JS_CURRENT_SCRIPT_NAME, \
@@ -344,6 +345,20 @@ API_FUNC(string_mask_to_regex)
API_RETURN_STRING_FREE(result);
}
+API_FUNC(string_format_size)
+{
+ unsigned long long size;
+ char *result;
+
+ API_INIT_FUNC(1, "string_format_size", "n", API_RETURN_EMPTY);
+
+ size = args[0]->IntegerValue();
+
+ result = weechat_string_format_size (size);
+
+ API_RETURN_STRING_FREE(result);
+}
+
API_FUNC(string_remove_color)
{
char *result;
@@ -4808,6 +4823,7 @@ WeechatJsV8::loadLibs()
API_DEF_FUNC(string_has_highlight);
API_DEF_FUNC(string_has_highlight_regex);
API_DEF_FUNC(string_mask_to_regex);
+ API_DEF_FUNC(string_format_size);
API_DEF_FUNC(string_remove_color);
API_DEF_FUNC(string_is_command_char);
API_DEF_FUNC(string_input_for_buffer);