mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 09:43:13 +02:00
Replaced /builtin command by /command, and can now be used to launch commands with same name from different plugins
This commit is contained in:
@@ -128,7 +128,7 @@ gui_action_return (char *args)
|
||||
gui_current_window->buffer->ptr_history = NULL;
|
||||
gui_input_optimize_size (gui_current_window->buffer);
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
input_data (gui_current_window->buffer, command, 0);
|
||||
input_data (gui_current_window->buffer, command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,6 +580,57 @@ gui_completion_list_add_plugin (struct t_gui_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_list_add_plugin_commands: add plugin commands to completion
|
||||
* list (plugin name is previous
|
||||
* argument)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_completion_list_add_plugin_commands (struct t_gui_completion *completion)
|
||||
{
|
||||
char *pos_space, *plugin_name;
|
||||
struct t_weechat_plugin *ptr_plugin;
|
||||
struct t_hook *ptr_hook;
|
||||
|
||||
if (completion->args)
|
||||
{
|
||||
pos_space = strchr (completion->args, ' ');
|
||||
if (pos_space)
|
||||
plugin_name = string_strndup (completion->args,
|
||||
pos_space - completion->args);
|
||||
else
|
||||
plugin_name = strdup (completion->args);
|
||||
|
||||
if (plugin_name)
|
||||
{
|
||||
ptr_plugin = NULL;
|
||||
if (string_strcasecmp (plugin_name, "weechat") != 0)
|
||||
{
|
||||
/* plugin name is different from "weechat", then search it in
|
||||
plugin list */
|
||||
ptr_plugin = plugin_search (plugin_name);
|
||||
if (!ptr_plugin)
|
||||
return;
|
||||
}
|
||||
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
|
||||
ptr_hook = ptr_hook->next_hook)
|
||||
{
|
||||
if (!ptr_hook->deleted
|
||||
&& (ptr_hook->plugin == ptr_plugin)
|
||||
&& HOOK_COMMAND(ptr_hook, command)
|
||||
&& HOOK_COMMAND(ptr_hook, command)[0])
|
||||
{
|
||||
gui_completion_list_add (completion,
|
||||
HOOK_COMMAND(ptr_hook, command),
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
}
|
||||
free (plugin_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_list_add_option_value: add option value to completion list
|
||||
*/
|
||||
@@ -817,6 +868,9 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
|
||||
case 'p': /* plugin name */
|
||||
gui_completion_list_add_plugin (completion);
|
||||
break;
|
||||
case 'P': /* plugin commands */
|
||||
gui_completion_list_add_plugin_commands (completion);
|
||||
break;
|
||||
case 'r': /* bar names */
|
||||
gui_completion_list_add_bars_names (completion);
|
||||
break;
|
||||
|
||||
@@ -641,7 +641,7 @@ gui_keyboard_pressed (char *key_str)
|
||||
for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++)
|
||||
{
|
||||
input_data (gui_current_window->buffer,
|
||||
*ptr_cmd, 0);
|
||||
*ptr_cmd);
|
||||
}
|
||||
string_free_splitted_command (commands);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user