summaryrefslogtreecommitdiff
path: root/src/plugins/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/python')
-rw-r--r--src/plugins/python/weechat-python-api.c62
-rw-r--r--src/plugins/python/weechat.pyi24
2 files changed, 85 insertions, 1 deletions
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>`_
::