1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:16:40 +02:00

Remove some messages during startup about scripts and plugins loaded

It is still possible to see messages by changing debug level for "core" or
plugins (perl, python, ruby, lua, tcl).
This commit is contained in:
Sebastien Helleu
2009-03-18 15:11:18 +01:00
parent 763f030ae8
commit a938ef736a
33 changed files with 530 additions and 200 deletions
+9 -9
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -81,8 +81,8 @@ msgstr "Chyba: domovský adresář (%s) není adresářem\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nemohu vytvořit adresář \"%s\"\n"
#, c-format
msgid "%sWelcome to %s%s%s, %s"
#, fuzzy, c-format
msgid "Welcome to %s%s%s, %s"
msgstr "%sVítejte do %s%s%s, %s"
msgid "compiled on"
@@ -2191,8 +2191,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" odebrán\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s chybí argument pro volbu \"%s\"\n"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" nenalezen\n"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2202,10 +2202,6 @@ msgstr "%s%s: špatný typ znakové sady (očekáváno decode nebo encode)"
msgid "%s%s: invalid charset: \"%s\""
msgstr "Nemůžu zapsat log soubor \"%s\"\n"
#, fuzzy, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" nenalezen\n"
#, fuzzy, c-format
msgid "%s%s: error creating configuration file"
msgstr "říct serveru, aby znovu načetl svůj konfigurační soubor"
@@ -4597,6 +4593,10 @@ msgstr "notify: debug: nastavit notifikaci pro buffer %s na %d (%s)"
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nedostatek paměti pro infobar zprávu\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s chybí argument pro volbu \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s neznámá klávesová funkce \"%s\"\n"
+8 -8
View File
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -88,7 +88,7 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s kann das Verzeichnis \"%s\" nicht anlegen\n"
#, fuzzy, c-format
msgid "%sWelcome to %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr "%sWillkommen in %s%s%s, %s\n"
msgid "compiled on"
@@ -2205,8 +2205,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" entfernt\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s fehlende Argumente für die \"--dir\"-Option\n"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s Plugin \"%s\" nicht gefunden\n"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2216,10 +2216,6 @@ msgstr ""
msgid "%s%s: invalid charset: \"%s\""
msgstr "Kann das Logfile nicht schreiben\n"
#, fuzzy, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s Plugin \"%s\" nicht gefunden\n"
#, fuzzy, c-format
msgid "%s%s: error creating configuration file"
msgstr "den Server dazu bringen, seine Konfigurationsdatei neu zu laden"
@@ -4547,6 +4543,10 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s fehlende Argumente für die \"--dir\"-Option\n"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s unbekannte Tasten-Funktion \"%s\"\n"
+8 -8
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -85,7 +85,7 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s no es posible crear el directorio \"%s\"\n"
#, fuzzy, c-format
msgid "%sWelcome to %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr "%sBienvenido a %s%s%s, %s\n"
msgid "compiled on"
@@ -2179,8 +2179,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "Alias \"%s\" eliminado\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s falta un argumento para la opción --dir\n"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" no encontrado\n"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2190,10 +2190,6 @@ msgstr ""
msgid "%s%s: invalid charset: \"%s\""
msgstr "No es posible escribir un fichero de log para un búfer\n"
#, fuzzy, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" no encontrado\n"
#, fuzzy, c-format
msgid "%s%s: error creating configuration file"
msgstr "pedir al servidor que recargue su archivo de configuración"
@@ -4539,6 +4535,10 @@ msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
"No hay suficiente memoria para el mensaje de la barra de información\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s falta un argumento para la opción --dir\n"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s opción desconocida para el comando \"%s\"\n"
+10 -10
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"PO-Revision-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-03-17 15:38+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -84,8 +84,8 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erreur: impossible de créer le répertoire \"%s\"\n"
#, c-format
msgid "%sWelcome to %s%s%s, %s"
msgstr "%sBienvenue dans %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr "Bienvenue dans %s%s%s, %s"
msgid "compiled on"
msgstr "compilé le"
@@ -2298,8 +2298,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "%s: %s, \"%s\": supprimé"
#, c-format
msgid "%s%s: missing parameters"
msgstr "%s%s: paramètres manquants"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s: terminal: %s, interne: %s"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2309,10 +2309,6 @@ msgstr "%s%s: mauvais type de charset (decode ou encode attendu)"
msgid "%s%s: invalid charset: \"%s\""
msgstr "%s%s: charset invalide: \"%s\""
#, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s: terminal: %s, interne: %s"
#, c-format
msgid "%s%s: error creating configuration file"
msgstr "%s%s: erreur de création du fichier de configuration"
@@ -4749,6 +4745,10 @@ msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
"%s%s: impossible de positionner le niveau de notification \"%s\" => \"%s\""
#, c-format
msgid "%s%s: missing parameters"
msgstr "%s%s: paramètres manquants"
#, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s%s: niveau de notification inconnu \"%s\""
+8 -8
View File
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -89,7 +89,7 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nem sikerült a \"%s\" könyvtárat létrehozni\n"
#, fuzzy, c-format
msgid "%sWelcome to %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr "%sÜdvözöli a %s%s%s, %s\n"
msgid "compiled on"
@@ -2214,8 +2214,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "A \"%s\" aliasz eltávolítva\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s a \"%s\" modul nem található\n"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2225,10 +2225,6 @@ msgstr ""
msgid "%s%s: invalid charset: \"%s\""
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
#, fuzzy, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s a \"%s\" modul nem található\n"
#, fuzzy, c-format
msgid "%s%s: error creating configuration file"
msgstr "szerver konfigurációs fájljának újraolvastatása"
@@ -4607,6 +4603,10 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s ismeretlen billentyűparancs \"%s\"\n"
+8 -8
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: 2009-01-03 00:42+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -85,7 +85,7 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s не могу создать директорию \"%s\"\n"
#, fuzzy, c-format
msgid "%sWelcome to %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr "%sДобро пожаловать в %s%s%s, %s\n"
msgid "compiled on"
@@ -2218,8 +2218,8 @@ msgid "%s: %s, \"%s\": removed"
msgstr "Сокращение \"%s\" удалено\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s нет аргумента для параметра \"%s\"\n"
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" не найден\n"
#, c-format
msgid "%s%s: wrong charset type (decode or encode expected)"
@@ -2229,10 +2229,6 @@ msgstr ""
msgid "%s%s: invalid charset: \"%s\""
msgstr "Не могу записать лог-файл \"%s\"\n"
#, fuzzy, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr "%s plugin \"%s\" не найден\n"
#, fuzzy, c-format
msgid "%s%s: error creating configuration file"
msgstr "перезагрузить конфигурационный файл сервера"
@@ -4583,6 +4579,10 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
#, fuzzy, c-format
msgid "%s%s: missing parameters"
msgstr "%s нет аргумента для параметра \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr "%s неизвестная функция клавиши \"%s\"\n"
+7 -7
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2009-03-15 12:35+0100\n"
"POT-Creation-Date: 2009-03-17 15:38+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -67,7 +67,7 @@ msgid "Error: cannot create directory \"%s\"\n"
msgstr ""
#, c-format
msgid "%sWelcome to %s%s%s, %s"
msgid "Welcome to %s%s%s, %s"
msgstr ""
msgid "compiled on"
@@ -1890,7 +1890,7 @@ msgid "%s: %s, \"%s\": removed"
msgstr ""
#, c-format
msgid "%s%s: missing parameters"
msgid "%s: terminal: %s, internal: %s"
msgstr ""
#, c-format
@@ -1901,10 +1901,6 @@ msgstr ""
msgid "%s%s: invalid charset: \"%s\""
msgstr ""
#, c-format
msgid "%s: terminal: %s, internal: %s"
msgstr ""
#, c-format
msgid "%s%s: error creating configuration file"
msgstr ""
@@ -3945,6 +3941,10 @@ msgstr ""
msgid "%s%s: unable to set notify level \"%s\" => \"%s\""
msgstr ""
#, c-format
msgid "%s%s: missing parameters"
msgstr ""
#, c-format
msgid "%s%s: unknown notify level \"%s\""
msgstr ""
+18 -17
View File
@@ -10,7 +10,7 @@
* ## ##
* ## By FlashCode <flashcode@flashtux.org> ##
* ## ##
* ## http://weechat.flashtux.org ##
* ## http://weechat.flashtux.org/ ##
* ## ##
* ##########################################################################
*
@@ -299,11 +299,11 @@ weechat_welcome_message ()
if (CONFIG_BOOLEAN(config_startup_display_logo))
{
gui_chat_printf (NULL,
"%s ___ __ ______________ _____ \n"
"%s __ | / /___________ ____/__ /_______ __ /_\n"
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ ",
"%s ___ __ ______________ _____ \n"
"%s __ | / /___________ ____/__ /_______ __ /_\n"
"%s __ | /| / /_ _ \\ _ \\ / __ __ \\ __ `/ __/\n"
"%s __ |/ |/ / / __/ __/ /___ _ / / / /_/ // /_ \n"
"%s ____/|__/ \\___/\\___/\\____/ /_/ /_/\\__,_/ \\__/ ",
GUI_COLOR(GUI_COLOR_CHAT_NICK),
GUI_COLOR(GUI_COLOR_CHAT_NICK),
GUI_COLOR(GUI_COLOR_CHAT_NICK),
@@ -313,9 +313,7 @@ weechat_welcome_message ()
if (CONFIG_STRING(config_startup_weechat_slogan)
&& CONFIG_STRING(config_startup_weechat_slogan)[0])
{
gui_chat_printf (NULL, _("%sWelcome to %s%s%s, %s"),
(CONFIG_BOOLEAN(config_startup_display_logo)) ?
" " : "",
gui_chat_printf (NULL, _("Welcome to %s%s%s, %s"),
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
PACKAGE_NAME,
GUI_NO_COLOR,
@@ -323,21 +321,24 @@ weechat_welcome_message ()
}
if (CONFIG_BOOLEAN(config_startup_display_version))
{
gui_chat_printf (NULL, "%s%s%s%s, %s %s %s",
(CONFIG_BOOLEAN(config_startup_display_logo)) ?
" " : "",
gui_chat_printf (NULL, "%sWeeChat %s %s[%s%s %s %s%s]",
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
PACKAGE_STRING,
GUI_NO_COLOR,
_("compiled on"), __DATE__, __TIME__);
PACKAGE_VERSION,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
_("compiled on"),
__DATE__,
__TIME__,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
}
if (CONFIG_BOOLEAN(config_startup_display_logo) ||
(CONFIG_STRING(config_startup_weechat_slogan)
&& CONFIG_STRING(config_startup_weechat_slogan)[0]) ||
CONFIG_BOOLEAN(config_startup_display_version))
{
gui_chat_printf (NULL,
"%s-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-",
GUI_COLOR(GUI_COLOR_CHAT_NICK));
"- - - - - - - - - - - - - - - - - - - - - - - - - - - -");
}
}
/*
+2 -2
View File
@@ -78,7 +78,7 @@ gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string)
ptr_history = buffer->last_history->prev_history;
if (buffer->ptr_history == buffer->last_history)
buffer->ptr_history = ptr_history;
buffer->last_history->prev_history->next_history = NULL;
((buffer->last_history)->prev_history)->next_history = NULL;
if (buffer->last_history->text)
free (buffer->last_history->text);
free (buffer->last_history);
@@ -128,7 +128,7 @@ gui_history_global_add (const char *string)
ptr_history = last_history_global->prev_history;
if (history_global_ptr == last_history_global)
history_global_ptr = ptr_history;
last_history_global->prev_history->next_history = NULL;
(last_history_global->prev_history)->next_history = NULL;
if (last_history_global->text)
free (last_history_global->text);
free (last_history_global);
+1 -1
View File
@@ -238,7 +238,7 @@ gui_hotlist_add_hotlist (struct t_gui_hotlist **hotlist,
new_hotlist->prev_hotlist = pos_hotlist->prev_hotlist;
new_hotlist->next_hotlist = pos_hotlist;
if (pos_hotlist->prev_hotlist)
pos_hotlist->prev_hotlist->next_hotlist = new_hotlist;
(pos_hotlist->prev_hotlist)->next_hotlist = new_hotlist;
else
*hotlist = new_hotlist;
pos_hotlist->prev_hotlist = new_hotlist;
+1
View File
@@ -267,6 +267,7 @@ gui_keyboard_insert_sorted (struct t_gui_key **keys, struct t_gui_key **last_key
}
else
{
/* first key in list */
key->prev_key = NULL;
key->next_key = NULL;
*keys = key;
+2 -2
View File
@@ -95,7 +95,7 @@ gui_nicklist_insert_group_sorted (struct t_gui_nick_group **groups,
group->prev_group = pos_group->prev_group;
group->next_group = pos_group;
if (pos_group->prev_group)
pos_group->prev_group->next_group = group;
(pos_group->prev_group)->next_group = group;
else
*groups = group;
pos_group->prev_group = group;
@@ -243,7 +243,7 @@ gui_nicklist_insert_nick_sorted (struct t_gui_nick_group *group,
nick->prev_nick = pos_nick->prev_nick;
nick->next_nick = pos_nick;
if (pos_nick->prev_nick)
pos_nick->prev_nick->next_nick = nick;
(pos_nick->prev_nick)->next_nick = nick;
else
group->nicks = nick;
pos_nick->prev_nick = nick;
+16 -7
View File
@@ -380,6 +380,18 @@ charset_set (struct t_config_section *section, const char *type,
}
}
/*
* charset_display_charsets: display charsets
*/
void
charset_display_charsets ()
{
weechat_printf (NULL,
_("%s: terminal: %s, internal: %s"),
CHARSET_PLUGIN_NAME, charset_terminal, charset_internal);
}
/*
* charset_command_cb: callback for /charset command
*/
@@ -398,10 +410,8 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (argc < 2)
{
weechat_printf (NULL,
_("%s%s: missing parameters"),
weechat_prefix ("error"), CHARSET_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
charset_display_charsets ();
return WEECHAT_RC_OK;
}
ptr_section = NULL;
@@ -504,9 +514,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
charset_internal = weechat_info_get ("charset_internal", "");
/* display message */
weechat_printf (NULL,
_("%s: terminal: %s, internal: %s"),
CHARSET_PLUGIN_NAME, charset_terminal, charset_internal);
if (weechat_charset_plugin->debug >= 1)
charset_display_charsets ();
if (!charset_config_init ())
{
+11 -3
View File
@@ -42,6 +42,7 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_fifo_plugin = NULL;
#define weechat_plugin weechat_fifo_plugin
int fifo_quiet = 0;
int fifo_fd = -1;
struct t_hook *fifo_fd_hook = NULL;
char *fifo_filename;
@@ -95,9 +96,12 @@ fifo_create ()
if ((fifo_fd = open (fifo_filename,
O_RDONLY | O_NONBLOCK)) != -1)
{
weechat_printf (NULL,
_("%s: pipe opened"),
FIFO_PLUGIN_NAME),
if ((weechat_fifo_plugin->debug >= 1) || !fifo_quiet)
{
weechat_printf (NULL,
_("%s: pipe opened"),
FIFO_PLUGIN_NAME);
}
rc = 1;
}
else
@@ -366,6 +370,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
fifo_quiet = 1;
if (fifo_create ())
fifo_fd_hook = weechat_hook_fd (fifo_fd, 1, 0, 0,
&fifo_read, NULL);
@@ -374,6 +380,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
fifo_info_init ();
fifo_quiet = 0;
return WEECHAT_RC_OK;
}
+119 -13
View File
@@ -55,6 +55,7 @@
#include "plugin-config.h"
int plugin_quiet = 0;
struct t_weechat_plugin *weechat_plugins = NULL;
struct t_weechat_plugin *last_weechat_plugin = NULL;
@@ -125,6 +126,67 @@ plugin_get_name (struct t_weechat_plugin *plugin)
return (plugin) ? plugin->name : plugin_core;
}
/*
* plugin_find_pos: find position for a plugin (for sorting plugins list)
*/
struct t_weechat_plugin *
plugin_find_pos (struct t_weechat_plugin *plugin)
{
struct t_weechat_plugin *ptr_plugin;
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
if (string_strcasecmp (plugin->name, ptr_plugin->name) < 0)
return ptr_plugin;
}
return NULL;
}
/*
* plugin_insert_sorted: insert a plugin in list, keeping sort on name
*/
void
plugin_insert_sorted (struct t_weechat_plugin *plugin)
{
struct t_weechat_plugin *pos_plugin;
if (weechat_plugins)
{
pos_plugin = plugin_find_pos (plugin);
if (pos_plugin)
{
/* insert plugin into the list (before plugin found) */
plugin->prev_plugin = pos_plugin->prev_plugin;
plugin->next_plugin = pos_plugin;
if (pos_plugin->prev_plugin)
(pos_plugin->prev_plugin)->next_plugin = plugin;
else
weechat_plugins = plugin;
pos_plugin->prev_plugin = plugin;
}
else
{
/* add plugin to the end */
plugin->prev_plugin = last_weechat_plugin;
plugin->next_plugin = NULL;
last_weechat_plugin->next_plugin = plugin;
last_weechat_plugin = plugin;
}
}
else
{
/* first plugin in list */
plugin->prev_plugin = NULL;
plugin->next_plugin = NULL;
weechat_plugins = plugin;
last_weechat_plugin = plugin;
}
}
/*
* plugin_load: load a WeeChat plugin (a dynamic library)
* return: pointer to new WeeChat plugin, NULL if error
@@ -518,15 +580,8 @@ plugin_load (const char *filename)
new_plugin->upgrade_read = &upgrade_file_read;
new_plugin->upgrade_close = &upgrade_file_close;
/* add new plugin to list */
new_plugin->prev_plugin = last_weechat_plugin;
new_plugin->next_plugin = NULL;
if (weechat_plugins)
last_weechat_plugin->next_plugin = new_plugin;
else
weechat_plugins = new_plugin;
last_weechat_plugin = new_plugin;
plugin_insert_sorted (new_plugin);
/* associate orphan buffers with this plugin (if asked during upgrade
process) */
gui_buffer_set_plugin_for_upgrade (name, new_plugin);
@@ -591,9 +646,12 @@ plugin_load (const char *filename)
return NULL;
}
gui_chat_printf (NULL,
_("Plugin \"%s\" loaded"),
name);
if ((weechat_debug_core >= 1) || !plugin_quiet)
{
gui_chat_printf (NULL,
_("Plugin \"%s\" loaded"),
name);
}
free (full_name);
@@ -825,7 +883,7 @@ plugin_unload_all ()
{
while (weechat_plugins)
{
plugin_unload (last_weechat_plugin);
plugin_unload (weechat_plugins);
}
}
@@ -859,6 +917,49 @@ plugin_reload_name (const char *name)
}
}
/*
* plugin_display_short_list: print list of plugins on one line
*/
void
plugin_display_short_list ()
{
const char *plugins_loaded;
char *buf;
int length;
struct t_weechat_plugin *ptr_plugin;
if (weechat_plugins)
{
plugins_loaded = _("Plugins loaded:");
length = strlen (plugins_loaded) + 1;
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
length += strlen (ptr_plugin->name) + 2;
}
length++;
buf = malloc (length);
if (buf)
{
strcpy (buf, plugins_loaded);
strcat (buf, " ");
for (ptr_plugin = weechat_plugins; ptr_plugin;
ptr_plugin = ptr_plugin->next_plugin)
{
strcat (buf, ptr_plugin->name);
if (ptr_plugin->next_plugin)
strcat (buf, ", ");
}
gui_chat_printf (NULL, "%s", buf);
free (buf);
}
}
}
/*
* plugin_init: init plugin support
*/
@@ -878,7 +979,12 @@ plugin_init (int auto_load, int argc, char *argv[])
/* auto-load plugins if asked */
if (auto_load)
{
plugin_quiet = 1;
plugin_auto_load ();
plugin_display_short_list ();
plugin_quiet = 0;
}
/* discard command arguments for future plugins */
plugin_argc = 0;
+8 -5
View File
@@ -107,7 +107,7 @@ weechat_lua_api_register (lua_State *L)
/* register script */
lua_current_script = script_add (weechat_lua_plugin,
&lua_scripts,
&lua_scripts, &last_lua_script,
(lua_current_script_filename) ?
lua_current_script_filename : "",
name,
@@ -119,10 +119,13 @@ weechat_lua_api_register (lua_State *L)
charset);
if (lua_current_script)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
LUA_PLUGIN_NAME, name, version, description);
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
LUA_PLUGIN_NAME, name, version, description);
}
}
else
{
+21 -10
View File
@@ -42,7 +42,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_lua_plugin;
int lua_quiet = 0;
struct t_plugin_script *lua_scripts = NULL;
struct t_plugin_script *last_lua_script = NULL;
struct t_plugin_script *lua_current_script = NULL;
const char *lua_current_script_filename = NULL;
lua_State *lua_current_interpreter = NULL;
@@ -95,7 +97,8 @@ weechat_lua_exec (struct t_plugin_script *script,
if (argv[6])
{
argc = 7;
lua_pushstring (lua_current_interpreter, argv[6]);
lua_pushstring (lua_current_interpreter,
argv[6]);
}
}
}
@@ -160,9 +163,12 @@ weechat_lua_load (const char *filename)
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
LUA_PLUGIN_NAME, filename);
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
LUA_PLUGIN_NAME, filename);
}
lua_current_script = NULL;
@@ -233,7 +239,7 @@ weechat_lua_load (const char *filename)
fclose (fp);
/* if script was registered, removing from list */
if (lua_current_script)
script_remove (weechat_lua_plugin, &lua_scripts,
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script,
lua_current_script);
return 0;
}
@@ -298,7 +304,7 @@ weechat_lua_unload (struct t_plugin_script *script)
lua_current_script = (lua_current_script->prev_script) ?
lua_current_script->prev_script : lua_current_script->next_script;
script_remove (weechat_lua_plugin, &lua_scripts, script);
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, script);
lua_close (script->interpreter);
}
@@ -448,8 +454,8 @@ weechat_lua_completion_cb (void *data, const char *completion_item,
*/
int
weechat_lua_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_lua_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -467,8 +473,8 @@ weechat_lua_debug_dump_cb (void *data, const char *signal, const char *type_data
*/
int
weechat_lua_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_lua_buffer_closed_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -494,12 +500,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_lua_plugin = plugin;
lua_quiet = 1;
script_init (weechat_lua_plugin,
&weechat_lua_command_cb,
&weechat_lua_completion_cb,
&weechat_lua_debug_dump_cb,
&weechat_lua_buffer_closed_cb,
&weechat_lua_load_cb);
lua_quiet = 0;
script_display_short_list (weechat_lua_plugin,
lua_scripts);
/* init ok */
return WEECHAT_RC_OK;
+2
View File
@@ -25,7 +25,9 @@
extern struct t_weechat_plugin *weechat_lua_plugin;
extern int lua_quiet;
extern struct t_plugin_script *lua_scripts;
extern struct t_plugin_script *last_lua_script;
extern struct t_plugin_script *lua_current_script;
extern const char *lua_current_script_filename;
extern lua_State *lua_current_interpreter;
+8 -5
View File
@@ -104,17 +104,20 @@ static XS (XS_weechat_api_register)
/* register script */
perl_current_script = script_add (weechat_perl_plugin,
&perl_scripts,
&perl_scripts, &last_perl_script,
(perl_current_script_filename) ?
perl_current_script_filename : "",
name, author, version, license,
description, shutdown_func, charset);
if (perl_current_script)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
PERL_PLUGIN_NAME, name, version, description);
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
PERL_PLUGIN_NAME, name, version, description);
}
}
else
{
+21 -9
View File
@@ -40,7 +40,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_perl_plugin = NULL;
int perl_quiet = 0;
struct t_plugin_script *perl_scripts = NULL;
struct t_plugin_script *last_perl_script = NULL;
struct t_plugin_script *perl_current_script = NULL;
const char *perl_current_script_filename = NULL;
@@ -259,9 +261,12 @@ weechat_perl_load (const char *filename)
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PERL_PLUGIN_NAME, filename);
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PERL_PLUGIN_NAME, filename);
}
perl_current_script = NULL;
@@ -354,7 +359,8 @@ weechat_perl_load (const char *filename)
#endif
if (perl_current_script && (perl_current_script != &temp_script))
{
script_remove (weechat_perl_plugin, &perl_scripts,
script_remove (weechat_perl_plugin,
&perl_scripts, &last_perl_script,
perl_current_script);
}
@@ -436,7 +442,8 @@ weechat_perl_unload (struct t_plugin_script *script)
perl_current_script = (perl_current_script->prev_script) ?
perl_current_script->prev_script : perl_current_script->next_script;
script_remove (weechat_perl_plugin, &perl_scripts, script);
script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script,
script);
#ifdef MULTIPLICITY
perl_destruct (interpreter);
@@ -592,8 +599,8 @@ weechat_perl_completion_cb (void *data, const char *completion_item,
*/
int
weechat_perl_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_perl_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -611,8 +618,8 @@ weechat_perl_debug_dump_cb (void *data, const char *signal, const char *type_dat
*/
int
weechat_perl_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_perl_buffer_closed_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -669,12 +676,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
eval_pv (perl_weechat_code, TRUE);
#endif
perl_quiet = 1;
script_init (weechat_perl_plugin,
&weechat_perl_command_cb,
&weechat_perl_completion_cb,
&weechat_perl_debug_dump_cb,
&weechat_perl_buffer_closed_cb,
&weechat_perl_load_cb);
perl_quiet = 0;
script_display_short_list (weechat_perl_plugin,
perl_scripts);
/* init ok */
return WEECHAT_RC_OK;
+2
View File
@@ -25,7 +25,9 @@
extern struct t_weechat_plugin *weechat_perl_plugin;
extern int perl_quiet;
extern struct t_plugin_script *perl_scripts;
extern struct t_plugin_script *last_perl_script;
extern struct t_plugin_script *perl_current_script;
extern const char *perl_current_script_filename;
@@ -95,17 +95,20 @@ weechat_python_api_register (PyObject *self, PyObject *args)
/* register script */
python_current_script = script_add (weechat_python_plugin,
&python_scripts,
&python_scripts, &last_python_script,
(python_current_script_filename) ?
python_current_script_filename : "",
name, author, version, license,
description, shutdown_func, charset);
if (python_current_script)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
PYTHON_PLUGIN_NAME, name, version, description);
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
PYTHON_PLUGIN_NAME, name, version, description);
}
}
else
{
+39 -20
View File
@@ -38,7 +38,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_python_plugin = NULL;
int python_quiet;
struct t_plugin_script *python_scripts = NULL;
struct t_plugin_script *last_python_script = NULL;
struct t_plugin_script *python_current_script = NULL;
const char *python_current_script_filename = NULL;
PyThreadState *python_mainThreadState = NULL;
@@ -94,21 +96,25 @@ weechat_python_exec (struct t_plugin_script *script,
{
if (argv[6])
{
rc = PyObject_CallFunction (evFunc, "sssssss", argv[0],
argv[1], argv[2], argv[3],
argv[4], argv[5], argv[6]);
rc = PyObject_CallFunction (evFunc, "sssssss",
argv[0], argv[1],
argv[2], argv[3],
argv[4], argv[5],
argv[6]);
}
else
{
rc = PyObject_CallFunction (evFunc, "ssssss", argv[0],
argv[1], argv[2], argv[3],
rc = PyObject_CallFunction (evFunc, "ssssss",
argv[0], argv[1],
argv[2], argv[3],
argv[4], argv[5]);
}
}
else
{
rc = PyObject_CallFunction (evFunc, "sssss", argv[0],
argv[1], argv[2], argv[3],
rc = PyObject_CallFunction (evFunc, "sssss",
argv[0], argv[1],
argv[2], argv[3],
argv[4]);
}
}
@@ -283,9 +289,12 @@ weechat_python_load (const char *filename)
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PYTHON_PLUGIN_NAME, filename);
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
PYTHON_PLUGIN_NAME, filename);
}
python_current_script = NULL;
@@ -389,7 +398,8 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyString_FromString(WEECHAT_HOOK_SIGNAL_INT));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_POINTER", PyString_FromString(WEECHAT_HOOK_SIGNAL_POINTER));
weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs);
weechat_outputs = Py_InitModule("weechatOutputs",
weechat_python_output_funcs);
if (weechat_outputs == NULL)
{
weechat_printf (NULL,
@@ -426,11 +436,14 @@ weechat_python_load (const char *filename)
PyErr_Print ();
Py_EndInterpreter (python_current_interpreter);
/* PyEval_ReleaseLock (); */
/* if script was registered, removing from list */
if (python_current_script != NULL)
script_remove (weechat_python_plugin, &python_scripts,
python_current_script);
{
script_remove (weechat_python_plugin,
&python_scripts, &last_python_script,
python_current_script);
}
return 0;
}
@@ -501,7 +514,8 @@ weechat_python_unload (struct t_plugin_script *script)
python_current_script = (python_current_script->prev_script) ?
python_current_script->prev_script : python_current_script->next_script;
script_remove (weechat_python_plugin, &python_scripts, script);
script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
script);
PyThreadState_Swap (interpreter);
Py_EndInterpreter (interpreter);
@@ -653,8 +667,8 @@ weechat_python_completion_cb (void *data, const char *completion_item,
*/
int
weechat_python_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_python_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -672,8 +686,8 @@ weechat_python_debug_dump_cb (void *data, const char *signal, const char *type_d
*/
int
weechat_python_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_python_buffer_closed_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -725,13 +739,18 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
python_quiet = 1;
script_init (weechat_python_plugin,
&weechat_python_command_cb,
&weechat_python_completion_cb,
&weechat_python_debug_dump_cb,
&weechat_python_buffer_closed_cb,
&weechat_python_load_cb);
python_quiet = 0;
script_display_short_list (weechat_python_plugin,
python_scripts);
/* init ok */
return WEECHAT_RC_OK;
@@ -25,7 +25,9 @@
extern struct t_weechat_plugin *weechat_python_plugin;
extern int python_quiet;
extern struct t_plugin_script *python_scripts;
extern struct t_plugin_script *last_python_script;
extern struct t_plugin_script *python_current_script;
extern const char *python_current_script_filename;
+8 -5
View File
@@ -111,7 +111,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
/* register script */
ruby_current_script = script_add (weechat_ruby_plugin,
&ruby_scripts,
&ruby_scripts, &last_ruby_script,
(ruby_current_script_filename) ?
ruby_current_script_filename : "",
c_name, c_author, c_version, c_license,
@@ -120,10 +120,13 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
if (ruby_current_script)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
RUBY_PLUGIN_NAME, c_name, c_version, c_description);
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
RUBY_PLUGIN_NAME, c_name, c_version, c_description);
}
}
else
{
+29 -13
View File
@@ -41,7 +41,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_ruby_plugin = NULL;
int ruby_quiet = 0;
struct t_plugin_script *ruby_scripts = NULL;
struct t_plugin_script *last_ruby_script = NULL;
struct t_plugin_script *ruby_current_script = NULL;
const char *ruby_current_script_filename = NULL;
@@ -340,9 +342,12 @@ weechat_ruby_load (const char *filename)
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
RUBY_PLUGIN_NAME, filename);
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
RUBY_PLUGIN_NAME, filename);
}
ruby_current_script = NULL;
@@ -429,7 +434,8 @@ weechat_ruby_load (const char *filename)
if (ruby_current_script != NULL)
{
script_remove (weechat_ruby_plugin, &ruby_scripts,
script_remove (weechat_ruby_plugin,
&ruby_scripts, &last_ruby_script,
ruby_current_script);
}
@@ -495,7 +501,8 @@ weechat_ruby_unload (struct t_plugin_script *script)
ruby_current_script = (ruby_current_script->prev_script) ?
ruby_current_script->prev_script : ruby_current_script->next_script;
script_remove (weechat_ruby_plugin, &ruby_scripts, script);
script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script,
script);
if (interpreter)
rb_gc_unregister_address (interpreter);
@@ -646,8 +653,8 @@ weechat_ruby_completion_cb (void *data, const char *completion_item,
*/
int
weechat_ruby_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_ruby_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -665,8 +672,8 @@ weechat_ruby_debug_dump_cb (void *data, const char *signal, const char *type_dat
*/
int
weechat_ruby_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_ruby_buffer_closed_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -750,10 +757,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* redirect stdin and stdout */
ruby_mWeechatOutputs = rb_define_module("WeechatOutputs");
rb_define_singleton_method(ruby_mWeechatOutputs, "write", weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "puts", weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "p", weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "flush", weechat_ruby_output_flush, 0);
rb_define_singleton_method(ruby_mWeechatOutputs, "write",
weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "puts",
weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "p",
weechat_ruby_output, 1);
rb_define_singleton_method(ruby_mWeechatOutputs, "flush",
weechat_ruby_output_flush, 0);
rb_eval_string_protect(weechat_ruby_code, &ruby_error);
if (ruby_error)
@@ -770,12 +781,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_ERROR;
}
ruby_quiet = 1;
script_init (weechat_ruby_plugin,
&weechat_ruby_command_cb,
&weechat_ruby_completion_cb,
&weechat_ruby_debug_dump_cb,
&weechat_ruby_buffer_closed_cb,
&weechat_ruby_load_cb);
ruby_quiet = 0;
script_display_short_list (weechat_ruby_plugin,
ruby_scripts);
/* init ok */
return WEECHAT_RC_OK;
+2
View File
@@ -25,7 +25,9 @@
extern struct t_weechat_plugin *weechat_ruby_plugin;
extern int ruby_quiet;
extern struct t_plugin_script *ruby_scripts;
extern struct t_plugin_script *last_ruby_script;
extern struct t_plugin_script *ruby_current_script;
extern const char *ruby_current_script_filename;
+2 -2
View File
@@ -90,10 +90,10 @@ script_callback_remove (struct t_plugin_script *script,
{
/* remove callback from list */
if (script_callback->prev_callback)
script_callback->prev_callback->next_callback =
(script_callback->prev_callback)->next_callback =
script_callback->next_callback;
if (script_callback->next_callback)
script_callback->next_callback->prev_callback =
(script_callback->next_callback)->prev_callback =
script_callback->prev_callback;
if (script->callbacks == script_callback)
script->callbacks = script_callback->next_callback;
+118 -10
View File
@@ -342,6 +342,71 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
return strdup (filename);
}
/*
* script_find_pos: find position for a script (for sorting scripts list)
*/
struct t_plugin_script *
script_find_pos (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
struct t_plugin_script *script)
{
struct t_plugin_script *ptr_script;
for (ptr_script = scripts; ptr_script; ptr_script = ptr_script->next_script)
{
if (weechat_strcasecmp (script->name, ptr_script->name) < 0)
return ptr_script;
}
return NULL;
}
/*
* script_insert_sorted: insert a script in list, keeping sort on name
*/
void
script_insert_sorted (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
struct t_plugin_script *script)
{
struct t_plugin_script *pos_script;
if (*scripts)
{
pos_script = script_find_pos (weechat_plugin, *scripts, script);
if (pos_script)
{
/* insert script into the list (before script found) */
script->prev_script = pos_script->prev_script;
script->next_script = pos_script;
if (pos_script->prev_script)
(pos_script->prev_script)->next_script = script;
else
*scripts = script;
pos_script->prev_script = script;
}
else
{
/* add script to the end */
script->prev_script = *last_script;
script->next_script = NULL;
(*last_script)->next_script = script;
*last_script = script;
}
}
else
{
/* first script in list */
script->prev_script = NULL;
script->next_script = NULL;
*scripts = script;
*last_script = script;
}
}
/*
* script_add: add a script to list of scripts
*/
@@ -349,6 +414,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *
script_add (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
const char *filename, const char *name, const char *author, const char *version,
const char *license, const char *description, const char *shutdown_func,
const char *charset)
@@ -388,15 +454,9 @@ script_add (struct t_weechat_plugin *weechat_plugin,
new_script->shutdown_func = (shutdown_func) ?
strdup (shutdown_func) : NULL;
new_script->charset = (charset) ? strdup (charset) : NULL;
new_script->callbacks = NULL;
/* add new script to list */
if (*scripts)
(*scripts)->prev_script = new_script;
new_script->prev_script = NULL;
new_script->next_script = *scripts;
*scripts = new_script;
script_insert_sorted (weechat_plugin, scripts, last_script, new_script);
return new_script;
}
@@ -443,6 +503,7 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
void
script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
struct t_plugin_script *script)
{
struct t_script_callback *ptr_script_callback, *next_script_callback;
@@ -456,7 +517,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
weechat_unhook (ptr_script_callback->hook);
}
}
ptr_script_callback = script->callbacks;
while (ptr_script_callback)
{
@@ -516,10 +577,12 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
/* remove script from list */
if (script->prev_script)
(script->prev_script)->next_script = script->next_script;
else
*scripts = script->next_script;
if (script->next_script)
(script->next_script)->prev_script = script->prev_script;
if (*scripts == script)
*scripts = script->next_script;
if (*last_script == script)
*last_script = script->prev_script;
/* free script */
free (script);
@@ -591,6 +654,51 @@ script_display_list (struct t_weechat_plugin *weechat_plugin,
weechat_printf (NULL, _(" (none)"));
}
/*
* script_display_short_list: print list of scripts on one line
*/
void
script_display_short_list (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts)
{
const char *scripts_loaded;
char *buf;
int length;
struct t_plugin_script *ptr_script;
if (scripts)
{
/* TRANSLATORS: %s is language (for example "perl") */
scripts_loaded = _("%s scripts loaded:");
length = strlen (scripts_loaded) + strlen (weechat_plugin->name) + 1;
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
length += strlen (ptr_script->name) + 2;
}
length++;
buf = malloc (length);
if (buf)
{
snprintf (buf, length, scripts_loaded, weechat_plugin->name);
strcat (buf, " ");
for (ptr_script = scripts; ptr_script;
ptr_script = ptr_script->next_script)
{
strcat (buf, ptr_script->name);
if (ptr_script->next_script)
strcat (buf, ", ");
}
weechat_printf (NULL, "%s", buf);
free (buf);
}
}
}
/*
* script_print_log: print script infos in log (usually for crash dump)
*/
+4
View File
@@ -85,6 +85,7 @@ extern char *script_search_full_name (struct t_weechat_plugin *weechat_plugin,
const char *filename);
extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
const char *filename, const char *name,
const char *author, const char *version,
const char *license, const char *description,
@@ -93,6 +94,7 @@ extern void script_remove_buffer_callbacks (struct t_plugin_script *scripts,
struct t_gui_buffer *buffer);
extern void script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
struct t_plugin_script *script);
extern void script_completion (struct t_weechat_plugin *weechat_plugin,
struct t_gui_completion *completion,
@@ -100,6 +102,8 @@ extern void script_completion (struct t_weechat_plugin *weechat_plugin,
extern void script_display_list (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
const char *name, int full);
extern void script_display_short_list (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts);
extern void script_print_log (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts);
+8 -5
View File
@@ -198,17 +198,20 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
/* register script */
tcl_current_script = script_add (weechat_tcl_plugin,
&tcl_scripts,
&tcl_scripts, &last_tcl_script,
(tcl_current_script_filename) ?
tcl_current_script_filename : "",
name, author, version, license,
description, shutdown_func, charset);
if (tcl_current_script)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
TCL_PLUGIN_NAME, name, version, description);
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
TCL_PLUGIN_NAME, name, version, description);
}
tcl_current_script->interpreter = (void *)interp;
}
else
+18 -8
View File
@@ -43,7 +43,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_tcl_plugin = NULL;
int tcl_quiet = 0;
struct t_plugin_script *tcl_scripts = NULL;
struct t_plugin_script *last_tcl_script = NULL;
struct t_plugin_script *tcl_current_script = NULL;
const char *tcl_current_script_filename = NULL;
@@ -155,9 +157,12 @@ weechat_tcl_load (const char *filename)
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
TCL_PLUGIN_NAME, filename);
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
TCL_PLUGIN_NAME, filename);
}
tcl_current_script = NULL;
@@ -239,7 +244,7 @@ weechat_tcl_unload (struct t_plugin_script *script)
tcl_current_script = (tcl_current_script->prev_script) ?
tcl_current_script->prev_script : tcl_current_script->next_script;
script_remove (weechat_tcl_plugin, &tcl_scripts, script);
script_remove (weechat_tcl_plugin, &tcl_scripts, &last_tcl_script, script);
Tcl_DeleteInterp(interp);
}
@@ -389,8 +394,8 @@ weechat_tcl_completion_cb (void *data, const char *completion_item,
*/
int
weechat_tcl_debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_tcl_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -408,8 +413,8 @@ weechat_tcl_debug_dump_cb (void *data, const char *signal, const char *type_data
*/
int
weechat_tcl_buffer_closed_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
weechat_tcl_buffer_closed_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@@ -435,12 +440,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_tcl_plugin = plugin;
tcl_quiet = 1;
script_init (weechat_tcl_plugin,
weechat_tcl_command_cb,
weechat_tcl_completion_cb,
weechat_tcl_debug_dump_cb,
weechat_tcl_buffer_closed_cb,
weechat_tcl_load_cb);
tcl_quiet = 0;
script_display_short_list (weechat_tcl_plugin,
tcl_scripts);
/* init ok */
return WEECHAT_RC_OK;
+2
View File
@@ -25,7 +25,9 @@
extern struct t_weechat_plugin *weechat_tcl_plugin;
extern int tcl_quiet;
extern struct t_plugin_script *tcl_scripts;
extern struct t_plugin_script *last_tcl_script;
extern struct t_plugin_script *tcl_current_script;
extern const char *tcl_current_script_filename;