Fixed completion of redefined commands removed by plugins (bug #19176)
This commit is contained in:
parent
f1fdc469c4
commit
018b440004
@ -5,6 +5,7 @@ ChangeLog - 2007-03-01
|
||||
|
||||
|
||||
Version 0.2.4 (under dev!):
|
||||
* fixed completion of redefined commands removed by plugins (bug #19176)
|
||||
* fixed memory leaks in perl and python plugins (bug #19163)
|
||||
* added "call" option to /key command, added new key function "insert" to
|
||||
insert text on command line (task #6468)
|
||||
|
@ -275,6 +275,45 @@ command_index_free ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* command_used_by_weechat: return 1 if command is used by weechat
|
||||
* (weechat command, IRC command or alias)
|
||||
*/
|
||||
|
||||
int
|
||||
command_used_by_weechat (char *command)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
int i;
|
||||
|
||||
/* look for alias */
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_alias->alias_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for WeeChat command */
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (weechat_commands[i].command_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for IRC command */
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if ((ascii_strcasecmp (irc_commands[i].command_name, command) == 0) &&
|
||||
((irc_commands[i].cmd_function_args) ||
|
||||
(irc_commands[i].cmd_function_1arg)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* no command/alias found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* if only_builtin == 1, then try only WeeChat/IRC commands
|
||||
|
@ -53,6 +53,7 @@ extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern int command_used_by_weechat (char *);
|
||||
extern char **split_multi_command (char *, char);
|
||||
extern void free_multi_command (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, t_irc_channel *, char *, int);
|
||||
|
@ -752,7 +752,8 @@ plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
(handler->next_handler)->prev_handler = handler->prev_handler;
|
||||
|
||||
/* remove command from WeeChat command list, if command handler */
|
||||
if (handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
if ((handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
&& (!command_used_by_weechat (handler->command)))
|
||||
weelist_remove (&index_commands, &last_index_command,
|
||||
weelist_search (index_commands, handler->command));
|
||||
|
||||
|
@ -5,6 +5,7 @@ ChangeLog - 2007-03-01
|
||||
|
||||
|
||||
Version 0.2.4 (under dev!):
|
||||
* fixed completion of redefined commands removed by plugins (bug #19176)
|
||||
* fixed memory leaks in perl and python plugins (bug #19163)
|
||||
* added "call" option to /key command, added new key function "insert" to
|
||||
insert text on command line (task #6468)
|
||||
|
@ -275,6 +275,45 @@ command_index_free ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* command_used_by_weechat: return 1 if command is used by weechat
|
||||
* (weechat command, IRC command or alias)
|
||||
*/
|
||||
|
||||
int
|
||||
command_used_by_weechat (char *command)
|
||||
{
|
||||
t_weechat_alias *ptr_alias;
|
||||
int i;
|
||||
|
||||
/* look for alias */
|
||||
for (ptr_alias = weechat_alias; ptr_alias;
|
||||
ptr_alias = ptr_alias->next_alias)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_alias->alias_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for WeeChat command */
|
||||
for (i = 0; weechat_commands[i].command_name; i++)
|
||||
{
|
||||
if (ascii_strcasecmp (weechat_commands[i].command_name, command) == 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* look for IRC command */
|
||||
for (i = 0; irc_commands[i].command_name; i++)
|
||||
{
|
||||
if ((ascii_strcasecmp (irc_commands[i].command_name, command) == 0) &&
|
||||
((irc_commands[i].cmd_function_args) ||
|
||||
(irc_commands[i].cmd_function_1arg)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* no command/alias found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* exec_weechat_command: executes a command (WeeChat internal or IRC)
|
||||
* if only_builtin == 1, then try only WeeChat/IRC commands
|
||||
|
@ -53,6 +53,7 @@ extern t_weelist *last_index_command;
|
||||
|
||||
extern void command_index_build ();
|
||||
extern void command_index_free ();
|
||||
extern int command_used_by_weechat (char *);
|
||||
extern char **split_multi_command (char *, char);
|
||||
extern void free_multi_command (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, t_irc_channel *, char *, int);
|
||||
|
@ -752,7 +752,8 @@ plugin_handler_remove (t_weechat_plugin *plugin,
|
||||
(handler->next_handler)->prev_handler = handler->prev_handler;
|
||||
|
||||
/* remove command from WeeChat command list, if command handler */
|
||||
if (handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
if ((handler->type == PLUGIN_HANDLER_COMMAND)
|
||||
&& (!command_used_by_weechat (handler->command)))
|
||||
weelist_remove (&index_commands, &last_index_command,
|
||||
weelist_search (index_commands, handler->command));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user