1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

api: run hook_print callback also on empty messages

This commit is contained in:
Sébastien Helleu
2022-07-02 21:10:48 +02:00
parent 749bc26926
commit 1c7b431bc8
5 changed files with 17 additions and 7 deletions
+1
View File
@@ -33,6 +33,7 @@ New features::
Bug fixes::
* core: fix bad window size on startup with some terminals like https://github.com/kovidgoyal/kitty[kitty] (issue #1769)
* api: run hook_print callback also on empty messages
* buflist: fix memory leak when reading config and changing option buflist.look.sort
* irc: remove channel from autojoin option when manually closing a buffer with `/buffer close` or `/close`
* irc: fix add of channel to autojoin option when joining a channel with a buffer still opened
+9
View File
@@ -20,6 +20,15 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
[[v3.6]]
== Version 3.6 (under dev)
[[v3.6_hook_print_empty_messages]]
=== Hook print on empty messages
The "hook_print" callback is now called even when an empty message is displayed
(with or without prefix).
This was a bug, but is mentioned here just in case some scripts callbacks
would be surprised to be called with such empty messages.
[[v3.6_trigger_beep]]
=== Default trigger "beep"
+1 -1
View File
@@ -126,7 +126,7 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
if (!weechat_hooks[HOOK_TYPE_PRINT])
return;
if (!line->data->message || !line->data->message[0])
if (!line->data->message)
return;
prefix_no_color = (line->data->prefix) ?
+2 -2
View File
@@ -140,7 +140,7 @@ test_print_cb (const void *pointer, void *data, struct t_gui_buffer *buffer,
"%s: \"%s%s%s\"",
buffer_full_name,
(prefix && prefix[0]) ? prefix : "",
(prefix && prefix[0]) ? " " : "",
(prefix && prefix[0] && message && message[0]) ? " " : "",
(message && message[0]) ? message : "");
arraylist_add (recorded_messages, strdup (str_recorded));
}
@@ -150,7 +150,7 @@ test_print_cb (const void *pointer, void *data, struct t_gui_buffer *buffer,
{
printf ("%s%s%s\n", /* with color: "\33[34m%s%s%s\33[0m\n" */
(prefix && prefix[0]) ? prefix : "",
(prefix && prefix[0]) ? " " : "",
(prefix && prefix[0] && message && message[0]) ? " " : "",
(message && message[0]) ? message : "");
}
+4 -4
View File
@@ -2048,7 +2048,7 @@ TEST(IrcProtocolWithServer, 001_empty)
CHECK_ERROR_PARAMS("001", 0, 1);
RECV(":server 001 alice");
CHECK_NO_MSG;
CHECK_SRV("--");
LONGS_EQUAL(1, ptr_server->is_connected);
STRCMP_EQUAL("alice", ptr_server->nick);
}
@@ -2693,7 +2693,7 @@ TEST(IrcProtocolWithServer, 323)
CHECK_ERROR_PARAMS("323", 0, 1);
RECV(":server 323 alice");
CHECK_NO_MSG;
CHECK_SRV("--");
RECV(":server 323 alice end");
CHECK_SRV("-- end");
RECV(":server 323 alice :End of /LIST");
@@ -3999,7 +3999,7 @@ TEST(IrcProtocolWithServer, 732)
CHECK_ERROR_PARAMS("732", 0, 1);
RECV(":server 732 alice");
CHECK_NO_MSG;
CHECK_SRV("--");
RECV(":server 732 alice :nick1!user1@host1,nick2!user2@host2");
CHECK_SRV("-- nick1!user1@host1,nick2!user2@host2");
}
@@ -4018,7 +4018,7 @@ TEST(IrcProtocolWithServer, 733)
CHECK_ERROR_PARAMS("733", 0, 1);
RECV(":server 733 alice");
CHECK_NO_MSG;
CHECK_SRV("--");
RECV(":server 733 alice end");
CHECK_SRV("-- end");
RECV(":server 733 alice :End of MONITOR list");