diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-02-26 07:33:12 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-12 20:37:11 +0100 |
commit | 9e0dd1815278e189b6fd84046fc78e883cf85704 (patch) | |
tree | a7d8c6ed636ca02227cd140889d2bcc45aa2676e /src/plugins/relay | |
parent | c85b57b8b399b980c5d6725fc33bef83d9727bfb (diff) | |
download | weechat-9e0dd1815278e189b6fd84046fc78e883cf85704.zip |
api: add function "hdata_longlong" (issue #2081)
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-msg.c | 25 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-msg.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c index 4dde883a5..a1e373bdb 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.c +++ b/src/plugins/relay/weechat/relay-weechat-msg.c @@ -176,6 +176,23 @@ relay_weechat_msg_add_long (struct t_relay_weechat_msg *msg, long value) } /* + * Adds a long long integer to a message. + */ + +void +relay_weechat_msg_add_longlong (struct t_relay_weechat_msg *msg, + long long value) +{ + char str_longlong[128]; + unsigned char length; + + snprintf (str_longlong, sizeof (str_longlong), "%lld", value); + length = strlen (str_longlong); + relay_weechat_msg_add_bytes (msg, &length, 1); + relay_weechat_msg_add_bytes (msg, str_longlong, length); +} + +/* * Adds length + string to a message. */ @@ -434,6 +451,7 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg, relay_weechat_msg_add_type (msg, RELAY_WEECHAT_MSG_OBJ_INT); break; case WEECHAT_HDATA_LONG: + case WEECHAT_HDATA_LONGLONG: relay_weechat_msg_add_type (msg, RELAY_WEECHAT_MSG_OBJ_LONG); break; case WEECHAT_HDATA_STRING: @@ -480,6 +498,12 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg, pointer, name)); break; + case WEECHAT_HDATA_LONGLONG: + relay_weechat_msg_add_longlong (msg, + weechat_hdata_longlong (hdata, + pointer, + name)); + break; case WEECHAT_HDATA_STRING: case WEECHAT_HDATA_SHARED_STRING: relay_weechat_msg_add_string (msg, @@ -694,6 +718,7 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, strcat (keys_types, RELAY_WEECHAT_MSG_OBJ_INT); break; case WEECHAT_HDATA_LONG: + case WEECHAT_HDATA_LONGLONG: strcat (keys_types, RELAY_WEECHAT_MSG_OBJ_LONG); break; case WEECHAT_HDATA_STRING: diff --git a/src/plugins/relay/weechat/relay-weechat-msg.h b/src/plugins/relay/weechat/relay-weechat-msg.h index 554007549..2596f625f 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.h +++ b/src/plugins/relay/weechat/relay-weechat-msg.h @@ -62,6 +62,8 @@ extern void relay_weechat_msg_add_int (struct t_relay_weechat_msg *msg, int value); extern void relay_weechat_msg_add_long (struct t_relay_weechat_msg *msg, long value); +extern void relay_weechat_msg_add_longlong (struct t_relay_weechat_msg *msg, + long long value); extern void relay_weechat_msg_add_string (struct t_relay_weechat_msg *msg, const char *string); extern void relay_weechat_msg_add_buffer (struct t_relay_weechat_msg *msg, |