diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-26 18:37:21 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-26 19:44:37 +0100 |
commit | 9fb3d3f14c17f8307f04907d5f57034410dc7010 (patch) | |
tree | 239415921e803382adf1abb9a334456c5d96711b /doc/it | |
parent | 57f80a4c1fac3d5b3c194206c900b1066f9a565e (diff) | |
download | weechat-9fb3d3f14c17f8307f04907d5f57034410dc7010.zip |
core: store microseconds in buffer lines (closes #649)
Diffstat (limited to 'doc/it')
-rw-r--r-- | doc/it/weechat_plugin_api.it.adoc | 232 | ||||
-rw-r--r-- | doc/it/weechat_scripting.it.adoc | 4 | ||||
-rw-r--r-- | doc/it/weechat_user.it.adoc | 10 |
3 files changed, 235 insertions, 11 deletions
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index f6016d4b0..0646e16f2 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -4913,6 +4913,48 @@ weechat_printf (NULL, "date: %s", [NOTE] Questa funzione non è disponibile nelle API per lo scripting. +// TRANSLATION MISSING +==== util_strftimeval + +_WeeChat ≥ 4.2.0._ + +Format date and time like function `strftime` in C library, using `struct timeval` +as input, and supporting extra specifiers for microseconds. + +Prototype: + +[source,c] +---- +int weechat_util_strftimeval (char *string, int max, const char *format, struct timeval *tv); +---- + +Arguments: + +* _string_: buffer where the formatted string is stored +* _max_: string size +* _format_: format, the same as _strftime_ function, with these extra specifiers: +** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits + (for example `%.3` for milliseconds) +** `%f`: alias of `%.6` + +Return value: + +* number of bytes put in _string_ (value returned from _strftime_ function) + +C example: + +[source,c] +---- +char time[256]; +struct timeval tv; +gettimeofday (&tv, NULL); +weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv); +/* result: 2023-12-26T18:10:04.460509 */ +---- + +[NOTE] +Questa funzione non è disponibile nelle API per lo scripting. + ==== util_version_number _WeeChat ≥ 0.3.9._ @@ -9611,13 +9653,13 @@ void weechat_printf (struct t_gui_buffer *buffer, const char *message, ...); ---- // TRANSLATION MISSING -This function is a shortcut for function printf_date_tags. These two calls give -exactly same result: +This function is a shortcut for function printf_datetime_tags. + +These two calls give exactly same result: [source,c] ---- weechat_printf (buffer, "message"); -weechat_printf_date_tags (buffer, 0, NULL, "message"); +weechat_printf_datetime_tags (buffer, 0, 0, NULL, "message"); ---- Argomenti: @@ -9683,6 +9725,16 @@ void weechat_printf_date_tags (struct t_gui_buffer *buffer, time_t date, const char *tags, const char *message, ...); ---- +// TRANSLATION MISSING +This function is a shortcut for function printf_datetime_tags. + +These two calls give exactly same result: + +[source,c] +---- +weechat_printf_date_tags (buffer, 0, NULL, "message"); +weechat_printf_datetime_tags (buffer, 0, 0, NULL, "message"); +---- + Argomenti: * _buffer_: puntatore al buffer, se NULL il messaggio viene visualizzato @@ -9720,6 +9772,67 @@ weechat.prnt_date_tags("", time - 120, "notify_message", [NOTE] La funzione è chiamata "print_date_tags" negli script ("prnt_date_tags" in Python). +==== printf_datetime_tags + +_WeeChat ≥ 4.2.0._ + +// TRANSLATION MISSING +Display a message on a buffer, using a custom date/time (with microseconds) +and tags. + +Prototipo: + +[source,c] +---- +void weechat_printf_datetime_tags (struct t_gui_buffer *buffer, time_t date, + int date_usec, const char *tags, const char *message, ...); +---- + +Argomenti: + +* _buffer_: puntatore al buffer, se NULL il messaggio viene visualizzato + sul buffer di WeeChat +* _date_: data per il messaggio (0 indica data/ora corrente) +// TRANSLATION MISSING +* _date_usec_: microseconds of date (between 0 and 999999) +// TRANSLATION MISSING +* _tags_: lista di tag separati da virgole (NULL means no tags) +* _message_: messaggio da visualizzare + +// TRANSLATION MISSING +See the link:weechat_user.it.html#lines_tags[WeeChat user's guide / Lines tags ^↗^^] +for a list of commonly used tags in WeeChat. + +Esempio in C: + +[source,c] +---- +struct timeval tv_now; + +gettimeofday (&tv_now, NULL); +weechat_printf_datetime_tags (NULL, tv_now.tv_sec - 120, tv_now.tv_usec, + "notify_message", + "Messaggio 2 minuti fa, con tag 'notify_message'"); +---- + +Script (Python): + +[source,python] +---- +# prototipo +def prnt_datetime_tags(buffer: str, date: int, date_usec: int, tags: str, message: str) -> int: ... + +# esempio +now = time.time() +time_sec = int(now) +time_usec = int((now * 1000000) % 1000000) +weechat.prnt_datetime_tags("", time_sec - 120, time_usec, "notify_message", + "Messaggio 2 minuti fa, con tag 'notify_message'") +---- + +[NOTE] +La funzione è chiamata "print_datetime_tags" negli script ("prnt_datetime_tags" in Python). + ==== printf_y Visualizza un messaggio sulla riga di un buffer con contenuto libero. @@ -9728,8 +9841,17 @@ Prototipo: [source,c] ---- -void weechat_printf_y (struct t_gui_buffer *buffer, int y, - const char *message, ...); +void weechat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...); +---- + +// TRANSLATION MISSING +This function is a shortcut for function printf_y_datetime_tags. + +These two calls give exactly same result: + +[source,c] +---- +weechat_printf_y (buffer, 0, "message"); +weechat_printf_y_datetime_tags (buffer, 0, 0, 0, NULL, "message"); ---- Argomenti: @@ -9779,6 +9901,16 @@ void weechat_printf_y_date_tags (struct t_gui_buffer *buffer, int y, time_t date const char *tags, const char *message, ...); ---- +// TRANSLATION MISSING +This function is a shortcut for function printf_y_datetime_tags. + +These two calls give exactly same result: + +[source,c] +---- +weechat_printf_y_date_tags (buffer, 0, 0, NULL, "message"); +weechat_printf_y_datetime_tags (buffer, 0, 0, 0, NULL, "message"); +---- + Argomenti: * _buffer_: puntatore al buffer @@ -9813,6 +9945,58 @@ weechat.prnt_y_date_tags("", 2, 0, "my_tag", "My message on third line with a ta [NOTE] La funzione è chiamata "print_y_date_tags" negli script ("prnt_y_date_tags in Python). +==== printf_y_datetime_tags + +_WeeChat ≥ 4.2.0._ + +// TRANSLATION MISSING +Display a message on a line of a buffer with free content, using a custom +date/time (with microseconds) and tags. + +Prototipo: + +[source,c] +---- +void weechat_printf_y_datetime_tags (struct t_gui_buffer *buffer, int y, time_t date, + int date_usec, const char *tags, const char *message, ...); +---- + +Argomenti: + +* _buffer_: puntatore al buffer +// TRANSLATION MISSING +* _y_: numero di riga (la prima riga è 0); a negative value adds a line after + last line displayed: absolute value of _y_ is the number of lines after last + line (for example -1 is immediately after last line, -2 is 2 lines after last + line) +* _date_: data per il messaggio (0 indica data/ora corrente) +// TRANSLATION MISSING +* _date_usec_: microseconds of date (between 0 and 999999) +// TRANSLATION MISSING +* _tags_: lista di tag separati da virgole (NULL means no tags) +* _message_: messaggio da visualizzare + +Esempio in C: + +[source,c] +---- +weechat_printf_y_datetime_tags (buffer, 2, 0, 0, "my_tag", "My message on third line with a tag"); +---- + +Script (Python): + +[source,python] +---- +# prototipo +def prnt_y_datetime_tags(buffer: str, y: int, date: int, date_usec: int, tags: str, message: str) -> int: ... + +# esempio +weechat.prnt_y_datetime_tags("", 2, 0, 0, "my_tag", "My message on third line with a tag") +---- + +[NOTE] +La funzione è chiamata "print_y_datetime_tags" negli script ("prnt_y_datetime_tags in Python). + ==== log_printf Scrive un messaggio nel file di log di WeeChat (weechat.log). @@ -11218,7 +11402,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "", // TRANSLATION MISSING ==== hook_line -_WeeChat ≥ 2.3, updated in 3.7._ +_WeeChat ≥ 2.3, updated in 4.2.0._ Hook a line to be printed in a buffer. @@ -11317,11 +11501,21 @@ Line data sent to the callback is a hashtable, with following values | N/A ("0"). | `+1533792000+` +| date_usec +| Microseconds of line date (between 0 and 999999). +| N/A ("0"). +| `+123456+` + | date_printed | Date when line was displayed (timestamp). | N/A ("0"). | `+1533792012+` +| date_usec_printed +| Microseconds of date when line was displayed (between 0 and 999999). +| N/A ("0"). +| `+654321+` + | str_time | Date for display (possible color codes inside). | N/A (empty string). @@ -11408,11 +11602,22 @@ in this hashtable): | The date is set to this value. + The value of `+str_time+` is updated accordingly. +| date_usec +| Integer ("0" to "999999"). +| N/A. +| The microseconds of line date is set to this value. + + The value of `+str_time+` is updated accordingly. + | date_printed | Timestamp. | N/A. | The printed date is set to this timestamp (not displayed). +| date_usec_printed +| Integer ("0" to "999999"). +| N/A. +| The microseconds of printed date is set to this value. + | str_time | String. | N/A. @@ -11494,7 +11699,7 @@ hook = weechat.hook_line("", "", "irc_join", "my_line_cb", "") ==== hook_print // TRANSLATION MISSING -_Updated in 0.4.3, 1.0, 1.5._ +_Updated in 0.4.3, 1.0, 1.5, 4.2.0._ // TRANSLATION MISSING Hook su un messaggio stampato. It is called when a line has been added in @@ -11516,6 +11721,7 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer, void *data, struct t_gui_buffer *buffer, time_t date, + int date_usec, int tags_count, const char **tags, int displayed, @@ -11549,6 +11755,8 @@ Argomenti: ** _void *data_: puntatore ** _struct t_gui_buffer *buffer_: puntatore al buffer ** _time_t date_: data +// TRANSLATION MISSING +** _int date_usec_: microseconds of date ** _int tags_count_: numero di tag per riga ** _const char **tags_: array con tag per riga ** _int displayed_: 1 se la riga è visualizzata, 0 se filtrata (nascosta) @@ -11581,7 +11789,7 @@ Esempio in C: ---- int my_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) { @@ -13891,9 +14099,17 @@ Contenuto della tabella hash inviata alla callback (tasti e valori sono di tipo | _chat_line_date | Riga con data/ora. | "1313237175" | "0" +// TRANSLATION MISSING +| _chat_line_date_usec | Microseconds of line date/time. +| "123456" | "0" + | _chat_line_date_printed | Riga con data/ora ^(4)^. | "1313237175" | "0" +// TRANSLATION MISSING +| _chat_line_date_usec_printed | Microseconds of line printed date/time ^(4)^. +| "123456" | "0" + | _chat_line_time | Ora visualizzata. | "14:06:15" | "" diff --git a/doc/it/weechat_scripting.it.adoc b/doc/it/weechat_scripting.it.adoc index 4f9cb47e8..7670bf0d9 100644 --- a/doc/it/weechat_scripting.it.adoc +++ b/doc/it/weechat_scripting.it.adoc @@ -682,9 +682,13 @@ Elenco di funzioni nelle API per gli script: // TRANSLATION MISSING print_date_tags (for python: prnt_date_tags) + // TRANSLATION MISSING + print_datetime_tags (for python: prnt_datetime_tags) + +// TRANSLATION MISSING print_y (for python: prnt_y) + // TRANSLATION MISSING print_y_date_tags (for python: prnt_y_date_tags) + +// TRANSLATION MISSING + print_y_datetime_tags (for python: prnt_y_datetime_tags) + log_print | hook diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index c7abe8066..ea06ec017 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -5575,7 +5575,7 @@ type: | signal | tg_signal_data | | hsignal | | | modifier | tg_string | tg_string -| line | message | buffer, buffer_name, y, date, date_printed, str_time, tags, notify_level, highlight, prefix, message +| line | message | buffer, buffer_name, y, date, date_usec, date_printed, date_usec_printed, str_time, tags, notify_level, highlight, prefix, message | print | tg_message | | command | tg_argv_eol1 | | command_run | tg_command | @@ -5734,7 +5734,9 @@ The "line" callback sets following variables in hashtable: | buffer_type | string | Buffer type ("formatted" or "free"). | y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content. | date | string | Line date (timestamp). +| date_usec | string | Microseconds of line date. | date_printed | string | Date when line was displayed (timestamp). +| date_usec_printed | string | Microseconds of date when line was displayed. | str_time | string | Date for display. It may contain color codes. | tags | string | Tags of message (with comma added at beginning/end of string). | displayed | string | "1" if displayed, "0" if line filtered. @@ -5773,7 +5775,8 @@ The "print" callback sets following variables in hashtable: |=== | Variable | Type | Description | buffer | pointer | Buffer. -| tg_date | string | Message date/time (format: `YYYY-MM-DD hh:mm:ss`). +// TRANSLATION MISSING +| tg_date | string | Message date/time (format: `%FT%T.%f`, see link:weechat_plugin_api.it.html#_util_strftimeval[WeeChat plugin API reference / util_strftimeval ^↗^^]). | tg_displayed | string | "1" if displayed, "0" if line filtered. | tg_highlight | string | "1" if highlight, otherwise "0". | tg_prefix | string | Prefix. @@ -5838,7 +5841,8 @@ The "timer" callback sets following variables in hashtable: |=== | Variable | Type | Description | tg_remaining_calls | string | Number of remaining calls. -| tg_date | string | Current date/time (format: `YYYY-MM-DD hh:mm:ss`). +// TRANSLATION MISSING +| tg_date | string | Current date/time (format: `%FT%T.%f`, see link:weechat_plugin_api.it.html#_util_strftimeval[WeeChat plugin API reference / util_strftimeval ^↗^^]). |=== [[trigger_data_config]] |