mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 00:25:43 +02:00
script: add control of autoload (enable/disable/toggle) (task #12393)
New option script.scripts.autoload, new options autoload/noautoload/toggleautoload for command /script, new action "A" (meta-A) on script buffer (toggle autoload).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.4.1-dev, 2013-02-23
|
||||
v0.4.1-dev, 2013-02-25
|
||||
|
||||
|
||||
This document lists all changes for each version.
|
||||
@@ -54,6 +54,9 @@ Version 0.4.1 (under dev!)
|
||||
* rmodifier: rename default rmodifier "nickserv" to "command_auth" (with new
|
||||
modifier "irc_command_auth"), add default rmodifier "message_auth" (modifier
|
||||
"irc_message_auth")
|
||||
* script: add option script.scripts.autoload, add options "autoload",
|
||||
"noautoload" and "toggleautoload" for command /script, add action "A" (meta-A)
|
||||
on script buffer (toggle autoload) (task #12393)
|
||||
* scripts: do not allow empty script name in function "register"
|
||||
|
||||
Version 0.4.0 (2013-01-20)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -168,6 +168,11 @@
|
||||
** Typ: boolesch
|
||||
** Werte: on, off (Standardwert: `on`)
|
||||
|
||||
* [[option_script.scripts.autoload]] *script.scripts.autoload*
|
||||
** Beschreibung: `autoload scripts installed (make a link in "autoload" directory to script in parent directory`
|
||||
** Typ: boolesch
|
||||
** Werte: on, off (Standardwert: `on`)
|
||||
|
||||
* [[option_script.scripts.cache_expire]] *script.scripts.cache_expire*
|
||||
** Beschreibung: `Ablaufdatum des lokalen Caches, in Minuten (-1 = ohne Ablaufdatum, 0 = umgehend)`
|
||||
** Typ: integer
|
||||
|
||||
@@ -5,25 +5,29 @@
|
||||
search <text>
|
||||
show <script>
|
||||
load|unload|reload <script> [<script>...]
|
||||
autoload|noautoload|toggleautoload <script> [<script>...]
|
||||
install|remove|installremove|hold [-q] <script> [<script>...]
|
||||
upgrade
|
||||
update
|
||||
|
||||
list: list loaded scripts (all languages)
|
||||
-o: send list of loaded scripts to buffer
|
||||
-i: copy list of loaded scripts in command line (for sending to buffer)
|
||||
search: search scripts by tags or text and display result on scripts buffer
|
||||
show: show detailed info about a script
|
||||
load: load script(s)
|
||||
unload: unload script(s)
|
||||
reload: reload script(s)
|
||||
install: install/upgrade script(s)
|
||||
remove: remove script(s)
|
||||
installremove: install or remove script(s), depending on current state
|
||||
hold: hold/unhold script(s) (a script held will not be upgraded any more and cannot be removed)
|
||||
-q: quiet mode: do not display messages
|
||||
upgrade: upgrade all installed scripts which are obsolete (new version available)
|
||||
update: update local scripts cache
|
||||
list: list loaded scripts (all languages)
|
||||
-o: send list of loaded scripts to buffer
|
||||
-i: copy list of loaded scripts in command line (for sending to buffer)
|
||||
search: search scripts by tags or text and display result on scripts buffer
|
||||
show: show detailed info about a script
|
||||
load: load script(s)
|
||||
unload: unload script(s)
|
||||
reload: reload script(s)
|
||||
autoload: autoload the script
|
||||
noautoload: do not autoload the script
|
||||
toggleautoload: toggle autoload
|
||||
install: install/upgrade script(s)
|
||||
remove: remove script(s)
|
||||
installremove: install or remove script(s), depending on current state
|
||||
hold: hold/unhold script(s) (a script held will not be upgraded any more and cannot be removed)
|
||||
-q: quiet mode: do not display messages
|
||||
upgrade: upgrade all installed scripts which are obsolete (new version available)
|
||||
update: update local scripts cache
|
||||
|
||||
Without argument, this command opens a buffer with list of scripts.
|
||||
|
||||
|
||||
@@ -168,6 +168,11 @@
|
||||
** type: boolean
|
||||
** values: on, off (default value: `on`)
|
||||
|
||||
* [[option_script.scripts.autoload]] *script.scripts.autoload*
|
||||
** description: `autoload scripts installed (make a link in "autoload" directory to script in parent directory`
|
||||
** type: boolean
|
||||
** values: on, off (default value: `on`)
|
||||
|
||||
* [[option_script.scripts.cache_expire]] *script.scripts.cache_expire*
|
||||
** description: `local cache expiration time, in minutes (-1 = never expires, 0 = always expire)`
|
||||
** type: integer
|
||||
|
||||
@@ -5,25 +5,29 @@
|
||||
search <texte>
|
||||
show <script>
|
||||
load|unload|reload <script> [<script>...]
|
||||
autoload|noautoload|toggleautoload <script> [<script>...]
|
||||
install|remove|installremove|hold [-q] <script> [<script>...]
|
||||
upgrade
|
||||
update
|
||||
|
||||
list: lister les scripts chargés (tous les langages)
|
||||
-o: envoyer la liste des scripts chargés au tampon
|
||||
-i: copier la liste des scripts chargés dans la ligne de commande (pour envoi au tampon)
|
||||
search: chercher des scripts par étiquettes ou texte et afficher le résultat sur le tampon des scripts
|
||||
show: afficher des infos détaillées sur le script
|
||||
load: charger un ou plusieurs scripts
|
||||
unload: décharger un ou plusieurs scripts
|
||||
reload: recharger un ou plusieurs scripts
|
||||
install: installer/mettre à jour un ou plusieurs scripts
|
||||
remove: supprimer un ou plusieurs scripts
|
||||
installremove: installer ou supprimer un ou plusieurs scripts, selon l'état courant
|
||||
hold: figer/défiger un ou plusieurs scripts (un script figé ne sera plus mis à jour et ne peut pas être supprimé)
|
||||
-q: mode silencieux: ne pas afficher de messages
|
||||
upgrade: mettre à jour les scripts obsolètes (avec nouvelle version disponible)
|
||||
update: mettre à jour le cache local des scripts
|
||||
list: lister les scripts chargés (tous les langages)
|
||||
-o: envoyer la liste des scripts chargés au tampon
|
||||
-i: copier la liste des scripts chargés dans la ligne de commande (pour envoi au tampon)
|
||||
search: chercher des scripts par étiquettes ou texte et afficher le résultat sur le tampon des scripts
|
||||
show: afficher des infos détaillées sur le script
|
||||
load: charger un ou plusieurs scripts
|
||||
unload: décharger un ou plusieurs scripts
|
||||
reload: recharger un ou plusieurs scripts
|
||||
autoload: charger automatiquement un ou plusieurs scripts
|
||||
noautoload: ne pas charger automatiquement un ou plusieurs scripts
|
||||
toggleautoload: activer/désactiver le chargement automatique
|
||||
install: installer/mettre à jour un ou plusieurs scripts
|
||||
remove: supprimer un ou plusieurs scripts
|
||||
installremove: installer ou supprimer un ou plusieurs scripts, selon l'état courant
|
||||
hold: figer/défiger un ou plusieurs scripts (un script figé ne sera plus mis à jour et ne peut pas être supprimé)
|
||||
-q: mode silencieux: ne pas afficher de messages
|
||||
upgrade: mettre à jour les scripts obsolètes (avec nouvelle version disponible)
|
||||
update: mettre à jour le cache local des scripts
|
||||
|
||||
Sans paramètre, cette commande ouvre un tampon avec la liste des scripts.
|
||||
|
||||
|
||||
@@ -168,6 +168,11 @@
|
||||
** type: booléen
|
||||
** valeurs: on, off (valeur par défaut: `on`)
|
||||
|
||||
* [[option_script.scripts.autoload]] *script.scripts.autoload*
|
||||
** description: `charger automatiquement les scripts installés (faire un lien dans le répertoire "autoload" vers le script dans le répertoire parent)`
|
||||
** type: booléen
|
||||
** valeurs: on, off (valeur par défaut: `on`)
|
||||
|
||||
* [[option_script.scripts.cache_expire]] *script.scripts.cache_expire*
|
||||
** description: `temps d'expiration du cache local, en minutes (-1 = n'expire jamais, 0 = expire toujours)`
|
||||
** type: entier
|
||||
|
||||
@@ -5,25 +5,29 @@
|
||||
search <text>
|
||||
show <script>
|
||||
load|unload|reload <script> [<script>...]
|
||||
autoload|noautoload|toggleautoload <script> [<script>...]
|
||||
install|remove|installremove|hold [-q] <script> [<script>...]
|
||||
upgrade
|
||||
update
|
||||
|
||||
list: list loaded scripts (all languages)
|
||||
-o: send list of loaded scripts to buffer
|
||||
-i: copy list of loaded scripts in command line (for sending to buffer)
|
||||
search: search scripts by tags or text and display result on scripts buffer
|
||||
show: show detailed info about a script
|
||||
load: load script(s)
|
||||
unload: unload script(s)
|
||||
reload: reload script(s)
|
||||
install: install/upgrade script(s)
|
||||
remove: remove script(s)
|
||||
installremove: install or remove script(s), depending on current state
|
||||
hold: hold/unhold script(s) (a script held will not be upgraded any more and cannot be removed)
|
||||
-q: quiet mode: do not display messages
|
||||
upgrade: upgrade all installed scripts which are obsolete (new version available)
|
||||
update: update local scripts cache
|
||||
list: list loaded scripts (all languages)
|
||||
-o: send list of loaded scripts to buffer
|
||||
-i: copy list of loaded scripts in command line (for sending to buffer)
|
||||
search: search scripts by tags or text and display result on scripts buffer
|
||||
show: show detailed info about a script
|
||||
load: load script(s)
|
||||
unload: unload script(s)
|
||||
reload: reload script(s)
|
||||
autoload: autoload the script
|
||||
noautoload: do not autoload the script
|
||||
toggleautoload: toggle autoload
|
||||
install: install/upgrade script(s)
|
||||
remove: remove script(s)
|
||||
installremove: install or remove script(s), depending on current state
|
||||
hold: hold/unhold script(s) (a script held will not be upgraded any more and cannot be removed)
|
||||
-q: quiet mode: do not display messages
|
||||
upgrade: upgrade all installed scripts which are obsolete (new version available)
|
||||
update: update local scripts cache
|
||||
|
||||
Without argument, this command opens a buffer with list of scripts.
|
||||
|
||||
|
||||
@@ -168,6 +168,11 @@
|
||||
** tipo: bool
|
||||
** valori: on, off (valore predefinito: `on`)
|
||||
|
||||
* [[option_script.scripts.autoload]] *script.scripts.autoload*
|
||||
** descrizione: `autoload scripts installed (make a link in "autoload" directory to script in parent directory`
|
||||
** tipo: bool
|
||||
** valori: on, off (valore predefinito: `on`)
|
||||
|
||||
* [[option_script.scripts.cache_expire]] *script.scripts.cache_expire*
|
||||
** descrizione: `local cache expiration time, in minutes (-1 = never expires, 0 = always expire)`
|
||||
** tipo: intero
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -168,6 +168,11 @@
|
||||
** タイプ: ブール
|
||||
** 値: on, off (デフォルト値: `on`)
|
||||
|
||||
* [[option_script.scripts.autoload]] *script.scripts.autoload*
|
||||
** 説明: `autoload scripts installed (make a link in "autoload" directory to script in parent directory`
|
||||
** タイプ: ブール
|
||||
** 値: on, off (デフォルト値: `on`)
|
||||
|
||||
* [[option_script.scripts.cache_expire]] *script.scripts.cache_expire*
|
||||
** 説明: `ローカルキャッシュが無効になる時間、分単位 (-1 = 再取得しない、0 = 常に再取得)`
|
||||
** タイプ: 整数
|
||||
|
||||
+47
-26
File diff suppressed because it is too large
Load Diff
+43
-26
File diff suppressed because it is too large
Load Diff
@@ -60,7 +60,7 @@ struct t_guile_function
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "guile_install_script" is received, name of string
|
||||
* when signal "guile_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -68,12 +68,20 @@ char *guile_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "guile_remove_script" is received, name of string
|
||||
* when signal "guile_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *guile_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "guile_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *guile_action_autoload_list = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Flushes stdout.
|
||||
@@ -815,6 +823,12 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
|
||||
&guile_quiet,
|
||||
&guile_action_remove_list);
|
||||
}
|
||||
else if (data == &guile_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_guile_plugin,
|
||||
&guile_quiet,
|
||||
&guile_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -850,6 +864,14 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_guile_timer_action_cb,
|
||||
&guile_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "guile_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&guile_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_guile_timer_action_cb,
|
||||
&guile_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -971,6 +993,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
free (guile_action_install_list);
|
||||
if (guile_action_remove_list)
|
||||
free (guile_action_remove_list);
|
||||
if (guile_action_autoload_list)
|
||||
free (guile_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ lua_State *lua_current_interpreter = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "lua_install_script" is received, name of string
|
||||
* when signal "lua_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -60,12 +60,20 @@ char *lua_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "lua_remove_script" is received, name of string
|
||||
* when signal "lua_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *lua_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "lua_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *lua_action_autoload_list = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Callback called for each key/value in a hashtable.
|
||||
@@ -769,6 +777,12 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
|
||||
&lua_quiet,
|
||||
&lua_action_remove_list);
|
||||
}
|
||||
else if (data == &lua_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_lua_plugin,
|
||||
&lua_quiet,
|
||||
&lua_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -804,6 +818,14 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_lua_timer_action_cb,
|
||||
&lua_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "lua_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&lua_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_lua_timer_action_cb,
|
||||
&lua_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -852,5 +874,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
plugin_script_end (plugin, &lua_scripts, &weechat_lua_unload_all);
|
||||
lua_quiet = 0;
|
||||
|
||||
/* free some data */
|
||||
if (lua_action_install_list)
|
||||
free (lua_action_install_list);
|
||||
if (lua_action_remove_list)
|
||||
free (lua_action_remove_list);
|
||||
if (lua_action_autoload_list)
|
||||
free (lua_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ int perl_quit_or_upgrade = 0;
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "perl_install_script" is received, name of string
|
||||
* when signal "perl_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -58,12 +58,20 @@ char *perl_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "perl_remove_script" is received, name of string
|
||||
* when signal "perl_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *perl_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "perl_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *perl_action_autoload_list = NULL;
|
||||
|
||||
#ifdef NO_PERL_MULTIPLICITY
|
||||
#undef MULTIPLICITY
|
||||
#endif
|
||||
@@ -850,6 +858,12 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
|
||||
&perl_quiet,
|
||||
&perl_action_remove_list);
|
||||
}
|
||||
else if (data == &perl_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_perl_plugin,
|
||||
&perl_quiet,
|
||||
&perl_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -885,6 +899,14 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_perl_timer_action_cb,
|
||||
&perl_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "perl_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&perl_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_perl_timer_action_cb,
|
||||
&perl_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1003,5 +1025,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
PERL_SYS_TERM ();
|
||||
#endif
|
||||
|
||||
/* free some data */
|
||||
if (perl_action_install_list)
|
||||
free (perl_action_install_list);
|
||||
if (perl_action_remove_list)
|
||||
free (perl_action_remove_list);
|
||||
if (perl_action_autoload_list)
|
||||
free (perl_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
+152
-36
File diff suppressed because it is too large
Load Diff
@@ -145,6 +145,9 @@ extern void plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin
|
||||
void (*script_unload)(struct t_plugin_script *script),
|
||||
int *quiet,
|
||||
char **list);
|
||||
extern void plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
|
||||
int *quiet,
|
||||
char **list);
|
||||
extern void plugin_script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full);
|
||||
|
||||
@@ -86,7 +86,7 @@ static struct PyModuleDef moduleDefOutputs = {
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "python_install_script" is received, name of string
|
||||
* when signal "python_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -94,12 +94,20 @@ char *python_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "python_remove_script" is received, name of string
|
||||
* when signal "python_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *python_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "python_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *python_action_autoload_list = NULL;
|
||||
|
||||
char python_buffer_output[128];
|
||||
|
||||
|
||||
@@ -1167,13 +1175,20 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
|
||||
&python_quiet,
|
||||
&python_action_remove_list);
|
||||
}
|
||||
else if (data == &python_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_python_plugin,
|
||||
&python_quiet,
|
||||
&python_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback called when a script action is asked (install/remove a script).
|
||||
* Callback called when a script action is asked (install/remove/autoload a
|
||||
* script).
|
||||
*/
|
||||
|
||||
int
|
||||
@@ -1202,6 +1217,14 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_python_timer_action_cb,
|
||||
&python_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "python_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&python_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_python_timer_action_cb,
|
||||
&python_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1314,6 +1337,8 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
free (python_action_install_list);
|
||||
if (python_action_remove_list)
|
||||
free (python_action_remove_list);
|
||||
if (python_action_autoload_list)
|
||||
free (python_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ const char *ruby_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "ruby_install_script" is received, name of string
|
||||
* when signal "ruby_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -79,12 +79,20 @@ char *ruby_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "ruby_remove_script" is received, name of string
|
||||
* when signal "ruby_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *ruby_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "ruby_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *ruby_action_autoload_list = NULL;
|
||||
|
||||
VALUE ruby_mWeechat, ruby_mWeechatOutputs;
|
||||
|
||||
#define MOD_NAME_PREFIX "WeechatRubyModule"
|
||||
@@ -987,6 +995,12 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
|
||||
&ruby_quiet,
|
||||
&ruby_action_remove_list);
|
||||
}
|
||||
else if (data == &ruby_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_ruby_plugin,
|
||||
&ruby_quiet,
|
||||
&ruby_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1022,6 +1036,14 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "ruby_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&ruby_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_ruby_timer_action_cb,
|
||||
&ruby_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -1175,5 +1197,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
*/
|
||||
/*ruby_cleanup (0);*/
|
||||
|
||||
/* free some data */
|
||||
if (ruby_action_install_list)
|
||||
free (ruby_action_install_list);
|
||||
if (ruby_action_remove_list)
|
||||
free (ruby_action_remove_list);
|
||||
if (ruby_action_autoload_list)
|
||||
free (ruby_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -510,9 +510,9 @@ script_buffer_refresh (int clear)
|
||||
snprintf (str_title, sizeof (str_title),
|
||||
_("%d/%d scripts (filter: %s) | Sort: %s | "
|
||||
"Alt+key/input: i=install r=remove l=load L=reload "
|
||||
"u=unload h=(un)hold v=view script | Input: q=close "
|
||||
"$=refresh s:x,y=sort words=filter *=reset filter | "
|
||||
"Mouse: left=select right=install/remove"),
|
||||
"u=unload A=autoload h=(un)hold v=view script | "
|
||||
"Input: q=close $=refresh s:x,y=sort words=filter "
|
||||
"*=reset filter | Mouse: left=select right=install/remove"),
|
||||
script_repo_count_displayed,
|
||||
script_repo_count,
|
||||
(script_repo_filter) ? script_repo_filter : "*",
|
||||
@@ -706,15 +706,16 @@ int
|
||||
script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
|
||||
const char *input_data)
|
||||
{
|
||||
char *actions[][2] = { { "l", "load" },
|
||||
{ "u", "unload" },
|
||||
{ "L", "reload" },
|
||||
{ "i", "install" },
|
||||
{ "r", "remove" },
|
||||
{ "h", "hold" },
|
||||
{ "v", "show" },
|
||||
{ "d", "showdiff" },
|
||||
{ NULL, NULL } };
|
||||
char *actions[][2] = { { "A", "toggleautoload" },
|
||||
{ "l", "load" },
|
||||
{ "u", "unload" },
|
||||
{ "L", "reload" },
|
||||
{ "i", "install" },
|
||||
{ "r", "remove" },
|
||||
{ "h", "hold" },
|
||||
{ "v", "show" },
|
||||
{ "d", "showdiff" },
|
||||
{ NULL, NULL } };
|
||||
char str_command[64];
|
||||
int i;
|
||||
|
||||
@@ -814,15 +815,16 @@ script_buffer_set_callbacks ()
|
||||
void
|
||||
script_buffer_set_keys ()
|
||||
{
|
||||
char *keys[][2] = { { "meta-l", "load" },
|
||||
{ "meta-u", "unload" },
|
||||
{ "meta-L", "reload" },
|
||||
{ "meta-i", "install" },
|
||||
{ "meta-r", "remove" },
|
||||
{ "meta-h", "hold" },
|
||||
{ "meta-v", "show" },
|
||||
{ "meta-d", "showdiff" },
|
||||
{ NULL, NULL } };
|
||||
char *keys[][2] = { { "meta-A", "toggleautoload" },
|
||||
{ "meta-l", "load" },
|
||||
{ "meta-u", "unload" },
|
||||
{ "meta-L", "reload" },
|
||||
{ "meta-i", "install" },
|
||||
{ "meta-r", "remove" },
|
||||
{ "meta-h", "hold" },
|
||||
{ "meta-v", "show" },
|
||||
{ "meta-d", "showdiff" },
|
||||
{ NULL, NULL } };
|
||||
char str_key[64], str_command[64];
|
||||
int i;
|
||||
|
||||
|
||||
@@ -169,7 +169,10 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if ((weechat_strcasecmp (argv[1], "load") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "unload") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "reload") == 0))
|
||||
|| (weechat_strcasecmp (argv[1], "reload") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "autoload") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "noautoload") == 0)
|
||||
|| (weechat_strcasecmp (argv[1], "toggleautoload") == 0))
|
||||
{
|
||||
script_command_action (buffer,
|
||||
argv[1],
|
||||
@@ -264,29 +267,33 @@ script_command_init ()
|
||||
N_("WeeChat scripts manager"),
|
||||
N_("list [-o|-i] || search <text> || show <script>"
|
||||
" || load|unload|reload <script> [<script>...]"
|
||||
" || autoload|noautoload|toggleautoload <script> [<script>...]"
|
||||
" || install|remove|installremove|hold [-q] <script> [<script>...]"
|
||||
" || upgrade || update"),
|
||||
N_(" list: list loaded scripts (all languages)\n"
|
||||
" -o: send list of loaded scripts to buffer\n"
|
||||
" -i: copy list of loaded scripts in "
|
||||
N_(" list: list loaded scripts (all languages)\n"
|
||||
" -o: send list of loaded scripts to buffer\n"
|
||||
" -i: copy list of loaded scripts in "
|
||||
"command line (for sending to buffer)\n"
|
||||
" search: search scripts by tags or text and "
|
||||
" search: search scripts by tags or text and "
|
||||
"display result on scripts buffer\n"
|
||||
" show: show detailed info about a script\n"
|
||||
" load: load script(s)\n"
|
||||
" unload: unload script(s)\n"
|
||||
" reload: reload script(s)\n"
|
||||
" install: install/upgrade script(s)\n"
|
||||
" remove: remove script(s)\n"
|
||||
"installremove: install or remove script(s), "
|
||||
" show: show detailed info about a script\n"
|
||||
" load: load script(s)\n"
|
||||
" unload: unload script(s)\n"
|
||||
" reload: reload script(s)\n"
|
||||
" autoload: autoload the script\n"
|
||||
" noautoload: do not autoload the script\n"
|
||||
"toggleautoload: toggle autoload\n"
|
||||
" install: install/upgrade script(s)\n"
|
||||
" remove: remove script(s)\n"
|
||||
" installremove: install or remove script(s), "
|
||||
"depending on current state\n"
|
||||
" hold: hold/unhold script(s) (a script held "
|
||||
" hold: hold/unhold script(s) (a script held "
|
||||
"will not be upgraded any more and cannot be "
|
||||
"removed)\n"
|
||||
" -q: quiet mode: do not display messages\n"
|
||||
" upgrade: upgrade all installed scripts which "
|
||||
" -q: quiet mode: do not display messages\n"
|
||||
" upgrade: upgrade all installed scripts which "
|
||||
"are obsolete (new version available)\n"
|
||||
" update: update local scripts cache\n\n"
|
||||
" update: update local scripts cache\n\n"
|
||||
"Without argument, this command opens a buffer "
|
||||
"with list of scripts.\n\n"
|
||||
"On script buffer, the possible status for each "
|
||||
@@ -338,6 +345,9 @@ script_command_init ()
|
||||
" || reload %(python_script)|%(perl_script)|"
|
||||
"%(ruby_script)|%(tcl_script)|%(lua_script)|"
|
||||
"%(guile_script)|%*"
|
||||
" || autoload %(script_scripts_installed)|%*"
|
||||
" || noautoload %(script_scripts_installed)|%*"
|
||||
" || toggleautoload %(script_scripts_installed)|%*"
|
||||
" || install %(script_scripts)|%*"
|
||||
" || remove %(script_scripts_installed)|%*"
|
||||
" || installremove %(script_scripts)|%*"
|
||||
|
||||
@@ -80,6 +80,7 @@ struct t_config_option *script_config_color_text_bg_selected;
|
||||
|
||||
/* script config, scripts section */
|
||||
|
||||
struct t_config_option *script_config_scripts_autoload;
|
||||
struct t_config_option *script_config_scripts_cache_expire;
|
||||
struct t_config_option *script_config_scripts_dir;
|
||||
struct t_config_option *script_config_scripts_hold;
|
||||
@@ -670,6 +671,13 @@ script_config_init ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
script_config_scripts_autoload = weechat_config_new_option (
|
||||
script_config_file, ptr_section,
|
||||
"autoload", "boolean",
|
||||
N_("autoload scripts installed (make a link in \"autoload\" directory "
|
||||
"to script in parent directory"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
script_config_scripts_cache_expire = weechat_config_new_option (
|
||||
script_config_file, ptr_section,
|
||||
"cache_expire", "integer",
|
||||
|
||||
@@ -60,6 +60,7 @@ extern struct t_config_option *script_config_color_text_version_selected;
|
||||
extern struct t_config_option *script_config_color_text_version_loaded_selected;
|
||||
extern struct t_config_option *script_config_color_text_bg_selected;
|
||||
|
||||
extern struct t_config_option *script_config_scripts_autoload;
|
||||
extern struct t_config_option *script_config_scripts_cache_expire;
|
||||
extern struct t_config_option *script_config_scripts_dir;
|
||||
extern struct t_config_option *script_config_scripts_hold;
|
||||
|
||||
@@ -52,7 +52,7 @@ const char *tcl_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
* when signal "tcl_install_script" is received, name of string
|
||||
* when signal "tcl_script_install" is received, name of string
|
||||
* is added to this string, to be installed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
@@ -60,12 +60,20 @@ char *tcl_action_install_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "remove":
|
||||
* when signal "tcl_remove_script" is received, name of string
|
||||
* when signal "tcl_script_remove" is received, name of string
|
||||
* is added to this string, to be removed later by a timer (when nothing is
|
||||
* running in script)
|
||||
*/
|
||||
char *tcl_action_remove_list = NULL;
|
||||
|
||||
/*
|
||||
* string used to execute action "autoload":
|
||||
* when signal "tcl_script_autoload" is received, name of string
|
||||
* is added to this string, to autoload or disable autoload later by a timer
|
||||
* (when nothing is running in script)
|
||||
*/
|
||||
char *tcl_action_autoload_list = NULL;
|
||||
|
||||
Tcl_Interp* cinterp;
|
||||
|
||||
|
||||
@@ -728,6 +736,12 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
|
||||
&tcl_quiet,
|
||||
&tcl_action_remove_list);
|
||||
}
|
||||
else if (data == &tcl_action_autoload_list)
|
||||
{
|
||||
plugin_script_action_autoload (weechat_tcl_plugin,
|
||||
&tcl_quiet,
|
||||
&tcl_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -763,6 +777,14 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
|
||||
&weechat_tcl_timer_action_cb,
|
||||
&tcl_action_remove_list);
|
||||
}
|
||||
else if (strcmp (signal, "tcl_script_autoload") == 0)
|
||||
{
|
||||
plugin_script_action_add (&tcl_action_autoload_list,
|
||||
(const char *)signal_data);
|
||||
weechat_hook_timer (1, 0, 1,
|
||||
&weechat_tcl_timer_action_cb,
|
||||
&tcl_action_autoload_list);
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -811,5 +833,13 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
plugin_script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
|
||||
tcl_quiet = 0;
|
||||
|
||||
/* free some data */
|
||||
if (tcl_action_install_list)
|
||||
free (tcl_action_install_list);
|
||||
if (tcl_action_remove_list)
|
||||
free (tcl_action_remove_list);
|
||||
if (tcl_action_autoload_list)
|
||||
free (tcl_action_autoload_list);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user