1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

core: display an error message if the buffer is not found with command /buffer listvar

This commit is contained in:
Sébastien Helleu
2025-11-09 18:15:00 +01:00
parent af41184889
commit c9d4dd48a0
+22 -20
View File
@@ -1286,28 +1286,30 @@ COMMAND_CALLBACK(buffer)
ptr_buffer = gui_buffer_search_by_id_number_name (argv[2]);
else
ptr_buffer = buffer;
if (ptr_buffer)
if (!ptr_buffer)
{
if (ptr_buffer->local_variables
&& (ptr_buffer->local_variables->items_count > 0))
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL,
_("Local variables for buffer \"%s\":"),
ptr_buffer->name);
hashtable_map (ptr_buffer->local_variables,
&command_buffer_display_localvar, NULL);
}
else
{
gui_chat_printf (NULL,
_("No local variable defined for buffer "
"\"%s\""),
ptr_buffer->name);
}
gui_chat_printf (NULL,
_("%sBuffer \"%s\" not found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[2]);
return WEECHAT_RC_ERROR;
}
if (ptr_buffer->local_variables
&& (ptr_buffer->local_variables->items_count > 0))
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL,
_("Local variables for buffer \"%s\":"),
ptr_buffer->name);
hashtable_map (ptr_buffer->local_variables,
&command_buffer_display_localvar, NULL);
}
else
{
gui_chat_printf (NULL,
_("No local variable defined for buffer \"%s\""),
ptr_buffer->name);
}
return WEECHAT_RC_OK;
}