mirror of
https://github.com/weechat/weechat.git
synced 2026-06-21 18:36:39 +02:00
script: add option script.look.quiet_actions (no messages when installing/removing/loading/unloading scripts on script buffer)
This commit is contained in:
@@ -825,9 +825,12 @@ weechat_python_unload_name (const char *name)
|
||||
if (ptr_script)
|
||||
{
|
||||
weechat_python_unload (ptr_script);
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: script \"%s\" unloaded"),
|
||||
PYTHON_PLUGIN_NAME, name);
|
||||
if (!python_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: script \"%s\" unloaded"),
|
||||
PYTHON_PLUGIN_NAME, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -867,9 +870,12 @@ weechat_python_reload_name (const char *name)
|
||||
if (filename)
|
||||
{
|
||||
weechat_python_unload (ptr_script);
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: script \"%s\" unloaded"),
|
||||
PYTHON_PLUGIN_NAME, name);
|
||||
if (!python_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: script \"%s\" unloaded"),
|
||||
PYTHON_PLUGIN_NAME, name);
|
||||
}
|
||||
weechat_python_load (filename);
|
||||
free (filename);
|
||||
}
|
||||
@@ -890,7 +896,7 @@ int
|
||||
weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
int argc, char **argv, char **argv_eol)
|
||||
{
|
||||
char *path_script;
|
||||
char *ptr_name, *path_script;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -939,24 +945,40 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
plugin_script_display_list (weechat_python_plugin, python_scripts,
|
||||
argv_eol[2], 1);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
else if ((weechat_strcasecmp (argv[1], "load") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "unload") == 0))
|
||||
{
|
||||
/* load Python script */
|
||||
path_script = plugin_script_search_path (weechat_python_plugin,
|
||||
argv_eol[2]);
|
||||
weechat_python_load ((path_script) ? path_script : argv_eol[2]);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
/* reload one Python script */
|
||||
weechat_python_reload_name (argv_eol[2]);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
/* unload Python script */
|
||||
weechat_python_unload_name (argv_eol[2]);
|
||||
ptr_name = argv_eol[2];
|
||||
if (strncmp (ptr_name, "-q ", 3) == 0)
|
||||
{
|
||||
python_quiet = 1;
|
||||
ptr_name += 3;
|
||||
while (ptr_name[0] == ' ')
|
||||
{
|
||||
ptr_name++;
|
||||
}
|
||||
}
|
||||
if (weechat_strcasecmp (argv[1], "load") == 0)
|
||||
{
|
||||
/* load Python script */
|
||||
path_script = plugin_script_search_path (weechat_python_plugin,
|
||||
ptr_name);
|
||||
weechat_python_load ((path_script) ? path_script : ptr_name);
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
{
|
||||
/* reload one Python script */
|
||||
weechat_python_reload_name (ptr_name);
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
{
|
||||
/* unload Python script */
|
||||
weechat_python_unload_name (ptr_name);
|
||||
}
|
||||
python_quiet = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1123,6 +1145,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&weechat_python_load,
|
||||
&python_quiet,
|
||||
&python_action_install_list);
|
||||
}
|
||||
else if (data == &python_action_remove_list)
|
||||
@@ -1130,6 +1153,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
|
||||
plugin_script_action_remove (weechat_python_plugin,
|
||||
python_scripts,
|
||||
&weechat_python_unload,
|
||||
&python_quiet,
|
||||
&python_action_remove_list);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user