1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 02:03:13 +02:00

Added config file functions in plugins API, improved /reload and /save commands (now possible to reload/save some files only), fixed completion bug

This commit is contained in:
Sebastien Helleu
2008-01-27 10:48:29 +01:00
parent ed26a0389c
commit ad41486543
30 changed files with 4687 additions and 4118 deletions
+42 -7
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -332,6 +332,10 @@ msgstr "Možnosti pluginů uloženy\n"
msgid "%sError: failed to reload options from %s"
msgstr "%s selhalo uložení nastavení pluginů\n"
#, fuzzy, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "říct serveru, aby znovu načetl svůj konfigurační soubor"
#, fuzzy, c-format
msgid "%sOptions saved to %s"
msgstr "Možnosti pluginů uloženy\n"
@@ -621,12 +625,27 @@ msgid "quit WeeChat"
msgstr ""
#, fuzzy
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr "Ukládám konfiguraci na disk\n"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
#, fuzzy
msgid "save WeeChat and plugins configuration files to disk"
msgstr "uloží nastavení na disk"
msgid "save configuration files to disk"
msgstr "uložit soubor s nastavením při ukončení"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
msgstr "nastaví konfigurační možnosti"
@@ -1296,6 +1315,10 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
#, fuzzy
msgid "save configuration files when unloading plugins"
msgstr "uložit soubor s nastavením při ukončení"
#, fuzzy, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Ukládám konfiguraci na disk\n"
@@ -4336,6 +4359,21 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s špatné parametry pro příkaz \"%s\"\n"
#~ msgid "[file]"
#~ msgstr "[soubor]"
#, fuzzy
#~ msgid "file: configuration file to reload"
#~ msgstr "uložit soubor s nastavením při ukončení"
#, fuzzy
#~ msgid "save WeeChat and plugins configuration files to disk"
#~ msgstr "uloží nastavení na disk"
#, fuzzy
#~ msgid "file: configuration file to save"
#~ msgstr "uložit soubor s nastavením při ukončení"
#, fuzzy
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "Konfigurační soubor uložen\n"
@@ -5306,9 +5344,6 @@ msgstr "%s špatné parametry pro příkaz \"%s\"\n"
#~ "Pro každý argument, znamená '*' vše.\n"
#~ "Bez arumentů vypíše příkaz /ignore seznam všech definovaných ignorování."
#~ msgid "[file]"
#~ msgstr "[soubor]"
#~ msgid "file: filename for writing config"
#~ msgstr "soubor: jméno souboru pro zapsání"
+42 -7
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -338,6 +338,10 @@ msgstr "Plugin-Optionen gesichert\n"
msgid "%sError: failed to reload options from %s"
msgstr "%s konnte die Plugin-Konfigurationsdatei nicht sichern\n"
#, fuzzy, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "den Server dazu bringen, seine Konfigurationsdatei neu zu laden"
#, fuzzy, c-format
msgid "%sOptions saved to %s"
msgstr "Plugin-Optionen gesichert\n"
@@ -613,12 +617,27 @@ msgid "quit WeeChat"
msgstr ""
#, fuzzy
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr "Konfiguration wird gespeichert\n"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
#, fuzzy
msgid "save WeeChat and plugins configuration files to disk"
msgstr "Konfiguration abspeichern"
msgid "save configuration files to disk"
msgstr "Konfiguration beim Verlassen abspeichern"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
msgstr "Konfigurationsparameter setzen"
@@ -1287,6 +1306,10 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
#, fuzzy
msgid "save configuration files when unloading plugins"
msgstr "Konfiguration beim Verlassen abspeichern"
#, fuzzy, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Konfiguration wird gespeichert\n"
@@ -4332,6 +4355,21 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
#~ msgid "[file]"
#~ msgstr "[Datei]"
#, fuzzy
#~ msgid "file: configuration file to reload"
#~ msgstr "Konfiguration beim Verlassen abspeichern"
#, fuzzy
#~ msgid "save WeeChat and plugins configuration files to disk"
#~ msgstr "Konfiguration abspeichern"
#, fuzzy
#~ msgid "file: configuration file to save"
#~ msgstr "Konfiguration beim Verlassen abspeichern"
#, fuzzy
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "Konfigurationsdatei gesichert\n"
@@ -5310,9 +5348,6 @@ msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
#~ "Bei jedem Argument steht '*' für 'alle'.\n"
#~ "Ohne Argumente listet /ignore alle definierten /ignore-Regeln auf."
#~ msgid "[file]"
#~ msgstr "[Datei]"
#~ msgid "file: filename for writing config"
#~ msgstr "Datei: Name der zu speichernden Konfigurationsdatei"
+41 -6
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -334,6 +334,10 @@ msgstr "opción/opciones de plugin encontrada(s)\n"
msgid "%sError: failed to reload options from %s"
msgstr "%s falló al salvar el archivo de configuración\n"
#, fuzzy, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "pedir al servidor que recargue su archivo de configuración"
#, fuzzy, c-format
msgid "%sOptions saved to %s"
msgstr "opción/opciones de plugin encontrada(s)\n"
@@ -599,13 +603,28 @@ msgid "quit WeeChat"
msgstr ""
#, fuzzy
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr "Guardar configuración a disco\n"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
#, fuzzy
msgid "save WeeChat and plugins configuration files to disk"
msgid "save configuration files to disk"
msgstr "guardar configuración a disco"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
msgstr "poner opciones de configuración"
@@ -1282,6 +1301,10 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
#, fuzzy
msgid "save configuration files when unloading plugins"
msgstr "guardar configuración a disco"
#, fuzzy, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Guardar configuración a disco\n"
@@ -4348,6 +4371,21 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
#~ msgid "[file]"
#~ msgstr "[archivo]"
#, fuzzy
#~ msgid "file: configuration file to reload"
#~ msgstr "guardar configuración a disco"
#, fuzzy
#~ msgid "save WeeChat and plugins configuration files to disk"
#~ msgstr "guardar configuración a disco"
#, fuzzy
#~ msgid "file: configuration file to save"
#~ msgstr "guardar configuración a disco"
#, fuzzy
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "Archivo de configuración guardado\n"
@@ -5336,9 +5374,6 @@ msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
#~ "Para cada argumento, '*' significa todo.\n"
#~ "Sin argumentos, el comando /ignore lista todos los ignores definidos."
#~ msgid "[file]"
#~ msgstr "[archivo]"
#~ msgid "file: filename for writing config"
#~ msgstr "archivo: fichero en el que guardar la configuración"
+39 -45
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: 2008-01-24 16:42+0100\n"
"PO-Revision-Date: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2008-01-27 10:28+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -304,13 +304,17 @@ msgstr "%sOptions rechargées depuis %s"
msgid "%sError: failed to reload options from %s"
msgstr "%sErreur: impossible de recharger les options depuis %s"
#, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "%sFichier de configuration inconnu \"%s\""
#, c-format
msgid "%sOptions saved to %s"
msgstr "%sOptions sauvées dans %s"
msgstr "%sOptions sauvegardées dans %s"
#, c-format
msgid "%sError: failed to save options to %s"
msgstr "%sErreur: impossible de sauver les options dans %s"
msgstr "%sErreur: impossible de sauvegarder les options dans %s"
msgid "(unknown)"
msgstr "(inconnu)"
@@ -590,14 +594,32 @@ msgstr ""
msgid "quit WeeChat"
msgstr "quitter WeeChat"
msgid "reload WeeChat and plugins configuration files from disk"
msgstr ""
"recharger les fichiers de configuration WeeChat et extensions depuis le "
"disque"
msgid "reload configuration files from disk"
msgstr "recharger les fichiers de configuration depuis le disque"
msgid "save WeeChat and plugins configuration files to disk"
msgid "[file [file...]]"
msgstr "[fichier [fichier...]]"
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
"sauvegarder les fichiers de configuration WeeChat et extensions sur disque"
"fichier: fichier de configuration à recharger\n"
"\n"
"Sans paramètre, tous les fichiers (WeeChat et extensions) sont rechargés."
msgid "save configuration files to disk"
msgstr "sauvegarder les fichiers de configuration sur disque"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
"fichier: fichier de configuration à sauvegarder\n"
"\n"
"Sans paramètre, tous les fichiers (WeeChat et extensions) sont sauvegardés."
msgid "set config options"
msgstr "modifier des options de configuration"
@@ -1197,6 +1219,10 @@ msgstr ""
"extension par défaut des extensions (par example \".so\" sous Linux ou \".dll"
"\" sous Microsoft Windows)"
msgid "save configuration files when unloading plugins"
msgstr ""
"sauvegarder les fichiers de configuration lors du déchargement des extensions"
#, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Sauvegarde de la configuration WeeChat sur disque (%s)"
@@ -2526,8 +2552,8 @@ msgstr ""
" nom_serveur: nom du serveur, pour usage interne et affichage\n"
" nom/IP: nom ou adresse IP du serveur\n"
" port: port pour le serveur (nombre entier, 6667 par défaut)\n"
" temp: créer un serveur temporaire (non sauvé dans le fichier de "
"configuration)\n"
" temp: créer un serveur temporaire (non sauvegardé dans le fichier "
"de configuration)\n"
" auto: se connecter automatiquement au serveur quand WeeChat "
"démarre\n"
" noauto: ne pas se connecter au serveur quand WeeChat démarre (par "
@@ -3192,7 +3218,7 @@ msgid "off"
msgstr "désactivé"
msgid " (temporary server, will not be saved)"
msgstr " (serveur temporaire, ne sera pas sauvé)"
msgstr " (serveur temporaire, ne sera pas sauvegardé)"
msgid "(hidden)"
msgstr "(caché)"
@@ -4281,35 +4307,3 @@ msgstr ""
#, c-format
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s%s: paramètres invalides pour la fonction \"%s\""
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "%sFichier de configuration WeeChat rechargé"
#~ msgid "%sError: failed to reload WeeChat configuration file"
#~ msgstr ""
#~ "%sErreur: impossible de recharger le fichier de configuration WeeChat"
#~ msgid "%sWeeChat configuration file saved"
#~ msgstr "%sFichier de configuration WeeChat sauvé"
#~ msgid "%sError: failed to save WeeChat configuration file"
#~ msgstr "%sErreur: impossible de sauver le fichier de configuration WeeChat"
#~ msgid "%s%s: configuration file reloaded"
#~ msgstr "%s%s: fichier de configuration rechargé"
#~ msgid "%s%s: failed to reload configuration file"
#~ msgstr "%s%s: impossible de recharger le fichier de configuration"
#~ msgid "clear buffer(s)"
#~ msgstr "effacer le(s) tampon(s)"
#~ msgid "[-all | number [number ...]]"
#~ msgstr "[-all | numéro [numéro ...]]"
#~ msgid ""
#~ " -all: clear all buffers\n"
#~ "number: clear buffer by number"
#~ msgstr ""
#~ " -all: effacer tous les tampons\n"
#~ "numéro: effacer un tampon par son numéro"
+42 -7
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -337,6 +337,10 @@ msgstr "Modul beállítások elmentve\n"
msgid "%sError: failed to reload options from %s"
msgstr "%s nem sikerült a modul opciókat elmenteni\n"
#, fuzzy, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "szerver konfigurációs fájljának újraolvastatása"
#, fuzzy, c-format
msgid "%sOptions saved to %s"
msgstr "Modul beállítások elmentve\n"
@@ -627,12 +631,27 @@ msgid "quit WeeChat"
msgstr ""
#, fuzzy
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr "Beállítások mentése a lemezre\n"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
#, fuzzy
msgid "save WeeChat and plugins configuration files to disk"
msgstr "beállítások lemezre mentése"
msgid "save configuration files to disk"
msgstr "beállítások mentése kilépéskor"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
msgstr "konfigurációs paraméterek beállítása"
@@ -1300,6 +1319,10 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
#, fuzzy
msgid "save configuration files when unloading plugins"
msgstr "beállítások mentése kilépéskor"
#, fuzzy, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Beállítások mentése a lemezre\n"
@@ -4336,6 +4359,21 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#~ msgid "[file]"
#~ msgstr "[fájl]"
#, fuzzy
#~ msgid "file: configuration file to reload"
#~ msgstr "beállítások mentése kilépéskor"
#, fuzzy
#~ msgid "save WeeChat and plugins configuration files to disk"
#~ msgstr "beállítások lemezre mentése"
#, fuzzy
#~ msgid "file: configuration file to save"
#~ msgstr "beállítások mentése kilépéskor"
#, fuzzy
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "Konfigurációs fájl elmentve\n"
@@ -5301,9 +5339,6 @@ msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#~ "Paraméter megadása nélkül az /ignore parancs listázza a meglévő "
#~ "mellőzéseket."
#~ msgid "[file]"
#~ msgstr "[fájl]"
#~ msgid "file: filename for writing config"
#~ msgstr "fájl: fájlnév a beállítások mentéséhez"
+42 -7
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -334,6 +334,10 @@ msgstr "Настройки pluginов сохранены\n"
msgid "%sError: failed to reload options from %s"
msgstr "%s не могу сохранить конфигурационный файл pluginов\n"
#, fuzzy, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr "перезагрузить конфигурационный файл сервера"
#, fuzzy, c-format
msgid "%sOptions saved to %s"
msgstr "Настройки pluginов сохранены\n"
@@ -624,12 +628,27 @@ msgid "quit WeeChat"
msgstr ""
#, fuzzy
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr "Сохраняю конфигурацию\n"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
#, fuzzy
msgid "save WeeChat and plugins configuration files to disk"
msgstr "сохранить конфигурацию"
msgid "save configuration files to disk"
msgstr "сохранять конфигурационный файл при выходе"
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
msgstr "настроить параметры конфигурации"
@@ -1301,6 +1320,10 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
#, fuzzy
msgid "save configuration files when unloading plugins"
msgstr "сохранять конфигурационный файл при выходе"
#, fuzzy, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr "Сохраняю конфигурацию\n"
@@ -4318,6 +4341,21 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s некорректные аргументы команды \"%s\"\n"
#~ msgid "[file]"
#~ msgstr "[файл]"
#, fuzzy
#~ msgid "file: configuration file to reload"
#~ msgstr "сохранять конфигурационный файл при выходе"
#, fuzzy
#~ msgid "save WeeChat and plugins configuration files to disk"
#~ msgstr "сохранить конфигурацию"
#, fuzzy
#~ msgid "file: configuration file to save"
#~ msgstr "сохранять конфигурационный файл при выходе"
#, fuzzy
#~ msgid "%sWeeChat configuration file reloaded"
#~ msgstr "Конфигурационный файл сохранён\n"
@@ -5306,9 +5344,6 @@ msgstr "%s некорректные аргументы команды \"%s\"\n"
#~ "Для каждого аргумента '*' означает \"все\".\n"
#~ "Команда /ignore без аргументов перечисляет все существующие игнорирования."
#~ msgid "[file]"
#~ msgstr "[файл]"
#~ msgid "file: filename for writing config"
#~ msgstr "файл: конфигурационный файл"
+25 -3
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: 2008-01-24 16:42+0100\n"
"POT-Creation-Date: 2008-01-27 10:27+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"
@@ -285,6 +285,10 @@ msgstr ""
msgid "%sError: failed to reload options from %s"
msgstr ""
#, c-format
msgid "%sUnknown configuration file \"%s\""
msgstr ""
#, c-format
msgid "%sOptions saved to %s"
msgstr ""
@@ -505,10 +509,25 @@ msgstr ""
msgid "quit WeeChat"
msgstr ""
msgid "reload WeeChat and plugins configuration files from disk"
msgid "reload configuration files from disk"
msgstr ""
msgid "save WeeChat and plugins configuration files to disk"
msgid "[file [file...]]"
msgstr ""
msgid ""
"file: configuration file to reload\n"
"\n"
"Without argument, all files (WeeChat and plugins) are reloaded."
msgstr ""
msgid "save configuration files to disk"
msgstr ""
msgid ""
"file: configuration file to save\n"
"\n"
"Without argument, all files (WeeChat and plugins) are saved."
msgstr ""
msgid "set config options"
@@ -1018,6 +1037,9 @@ msgid ""
"\".dll\" under Microsoft Windows)"
msgstr ""
msgid "save configuration files when unloading plugins"
msgstr ""
#, c-format
msgid "Saving WeeChat configuration to disk (%s)"
msgstr ""
+105 -34
View File
@@ -1152,6 +1152,30 @@ command_quit (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
/*
* command_reload_file: reload a configuration file
*/
void
command_reload_file (struct t_config_file *config_file)
{
if ((int) (config_file->callback_reload) (config_file->callback_reload_data,
config_file) == 0)
{
gui_chat_printf (NULL,
_("%sOptions reloaded from %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
config_file->filename);
}
else
{
gui_chat_printf (NULL,
_("%sError: failed to reload options from %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
config_file->filename);
}
}
/*
* command_reload: reload WeeChat and plugins options from disk
*/
@@ -1161,31 +1185,39 @@ command_reload (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_config_file *ptr_config_file;
int i;
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argc;
(void) argv;
(void) argv_eol;
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
if (argc > 1)
{
if (ptr_config_file->callback_reload)
for (i = 1; i < argc; i++)
{
if ((int) (ptr_config_file->callback_reload) (ptr_config_file) == 0)
ptr_config_file = config_file_search (argv[i]);
if (ptr_config_file)
{
gui_chat_printf (NULL, _("%sOptions reloaded from %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
ptr_config_file->filename);
command_reload_file (ptr_config_file);
}
else
{
gui_chat_printf (NULL,
_("%sError: failed to reload options from %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_config_file->filename);
_("%sUnknown configuration file \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
argv[i]);
}
}
}
else
{
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
if (ptr_config_file->callback_reload)
{
command_reload_file (ptr_config_file);
}
}
}
@@ -1193,6 +1225,29 @@ command_reload (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
/*
* command_save_file: save a configuration file
*/
void
command_save_file (struct t_config_file *config_file)
{
if (config_file_write (config_file) == 0)
{
gui_chat_printf (NULL,
_("%sOptions saved to %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
config_file->filename);
}
else
{
gui_chat_printf (NULL,
_("%sError: failed to save options to %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
config_file->filename);
}
}
/*
* command_save: save WeeChat and plugins options to disk
*/
@@ -1202,29 +1257,37 @@ command_save (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_config_file *ptr_config_file;
int i;
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argc;
(void) argv;
(void) argv_eol;
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
if (argc > 1)
{
if (config_file_write (ptr_config_file) == 0)
for (i = 1; i < argc; i++)
{
gui_chat_printf (NULL, _("%sOptions saved to %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
ptr_config_file->filename);
ptr_config_file = config_file_search (argv[i]);
if (ptr_config_file)
{
command_save_file (ptr_config_file);
}
else
{
gui_chat_printf (NULL,
_("%sUnknown configuration file \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
argv[i]);
}
}
else
}
else
{
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
gui_chat_printf (NULL,
_("%sError: failed to save options to %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_config_file->filename);
command_save_file (ptr_config_file);
}
}
@@ -1433,7 +1496,10 @@ command_set (void *data, struct t_gui_buffer *buffer,
gui_chat_prefix[GUI_CHAT_PREFIX_INFO],
_("Option changed: "));
if ((rc == 2) && (ptr_option->callback_change))
(void) (ptr_option->callback_change) ();
{
(void) (ptr_option->callback_change)
(ptr_option->callback_change_data);
}
}
else
{
@@ -1998,15 +2064,20 @@ command_init ()
"%q",
command_quit, NULL);
hook_command (NULL, "reload",
N_("reload WeeChat and plugins configuration files from "
"disk"),
"", "",
NULL,
N_("reload configuration files from disk"),
N_("[file [file...]]"),
N_("file: configuration file to reload\n\n"
"Without argument, all files (WeeChat and plugins) are "
"reloaded."),
"%C|%*",
command_reload, NULL);
hook_command (NULL, "save",
N_("save WeeChat and plugins configuration files to disk"),
"", "",
NULL,
N_("save configuration files to disk"),
N_("[file [file...]]"),
N_("file: configuration file to save\n\n"
"Without argument, all files (WeeChat and plugins) are "
"saved."),
"%C|%*",
command_save, NULL);
hook_command (NULL, "set",
N_("set config options"),
+99 -22
View File
@@ -52,7 +52,10 @@ struct t_config_file *
config_file_search (char *filename)
{
struct t_config_file *ptr_config;
if (!filename)
return NULL;
for (ptr_config = config_files; ptr_config;
ptr_config = ptr_config->next_config)
{
@@ -70,7 +73,9 @@ config_file_search (char *filename)
struct t_config_file *
config_file_new (struct t_weechat_plugin *plugin, char *filename,
int (*callback_reload)(struct t_config_file *config_file))
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_reload_data)
{
struct t_config_file *new_config_file;
@@ -88,6 +93,7 @@ config_file_new (struct t_weechat_plugin *plugin, char *filename,
new_config_file->filename = strdup (filename);
new_config_file->file = NULL;
new_config_file->callback_reload = callback_reload;
new_config_file->callback_reload_data = callback_reload_data;
new_config_file->sections = NULL;
new_config_file->last_section = NULL;
@@ -133,12 +139,18 @@ config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_section *
config_file_new_section (struct t_config_file *config_file, char *name,
void (*callback_read)(struct t_config_file *config_file,
void (*callback_read)(void *data,
struct t_config_file *config_file,
char *option_name, char *value),
void (*callback_write)(struct t_config_file *config_file,
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
void (*callback_write_default)(struct t_config_file *,
char *section_name))
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
void *callback_write_default_data)
{
struct t_config_section *new_section;
@@ -150,8 +162,11 @@ config_file_new_section (struct t_config_file *config_file, char *name,
{
new_section->name = strdup (name);
new_section->callback_read = callback_read;
new_section->callback_read_data = callback_read_data;
new_section->callback_write = callback_write;
new_section->callback_write_data = callback_write_data;
new_section->callback_write_default = callback_write_default;
new_section->callback_write_default_data = callback_write_default_data;
new_section->options = NULL;
new_section->last_option = NULL;
@@ -177,6 +192,9 @@ config_file_search_section (struct t_config_file *config_file,
{
struct t_config_section *ptr_section;
if (!config_file || !section_name)
return NULL;
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
{
@@ -224,17 +242,19 @@ config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
struct t_config_option *
config_file_new_option (struct t_config_section *section, char *name,
config_file_new_option (struct t_config_file *config_file,
struct t_config_section *section, char *name,
char *type, char *description, char *string_values,
int min, int max, char *default_value,
void (*callback_change)())
void (*callback_change)(),
void *callback_change_data)
{
struct t_config_option *new_option;
int var_type, int_value, argc, i, index_value;
long number;
char *error;
if (!section || !name)
if (!config_file || !section || !name)
return NULL;
var_type = -1;
@@ -332,6 +352,7 @@ config_file_new_option (struct t_config_section *section, char *name,
break;
}
new_option->callback_change = callback_change;
new_option->callback_change_data = callback_change_data;
new_option->loaded = 0;
new_option->prev_option = section->last_option;
@@ -430,6 +451,9 @@ config_file_string_boolean_is_valid (char *text)
{
int i;
if (!text)
return 0;
for (i = 0; config_boolean_true[i]; i++)
{
if (string_strcasecmp (text, config_boolean_true[i]) == 0)
@@ -456,6 +480,9 @@ config_file_string_to_boolean (char *text)
{
int i;
if (!text)
return CONFIG_BOOLEAN_FALSE;
for (i = 0; config_boolean_true[i]; i++)
{
if (string_strcasecmp (text, config_boolean_true[i]) == 0)
@@ -495,7 +522,10 @@ config_file_option_set (struct t_config_option *option, char *new_value,
return 1;
*((int *)option->value) = new_value_int;
if (run_callback && option->callback_change)
(void) (option->callback_change) ();
{
(void) (option->callback_change)
(option->callback_change_data);
}
return 2;
case CONFIG_OPTION_INTEGER:
if (!new_value)
@@ -518,7 +548,10 @@ config_file_option_set (struct t_config_option *option, char *new_value,
return 1;
*((int *)option->value) = new_value_int;
if (run_callback && option->callback_change)
(void) (option->callback_change) ();
{
(void) (option->callback_change)
(option->callback_change_data);
}
return 2;
}
else
@@ -531,7 +564,10 @@ config_file_option_set (struct t_config_option *option, char *new_value,
return 1;
*((int *)option->value) = number;
if (run_callback && option->callback_change)
(void) (option->callback_change) ();
{
(void) (option->callback_change)
(option->callback_change_data);
}
return 2;
}
}
@@ -553,7 +589,10 @@ config_file_option_set (struct t_config_option *option, char *new_value,
else
option->value = NULL;
if (run_callback && (rc == 2) && option->callback_change)
(void) (option->callback_change) ();
{
(void) (option->callback_change)
(option->callback_change_data);
}
return rc;
case CONFIG_OPTION_COLOR:
if (!gui_color_assign (&new_value_int, new_value))
@@ -562,7 +601,10 @@ config_file_option_set (struct t_config_option *option, char *new_value,
return 1;
*((int *)option->value) = new_value_int;
if (run_callback && option->callback_change)
(void) (option->callback_change) ();
{
(void) (option->callback_change)
(option->callback_change_data);
}
return 2;
}
@@ -631,6 +673,9 @@ config_file_option_reset (struct t_config_option *option)
int
config_file_option_boolean (struct t_config_option *option)
{
if (!option)
return 0;
if (option->type == CONFIG_OPTION_BOOLEAN)
return CONFIG_BOOLEAN(option);
else
@@ -644,6 +689,9 @@ config_file_option_boolean (struct t_config_option *option)
int
config_file_option_integer (struct t_config_option *option)
{
if (!option)
return 0;
switch (option->type)
{
case CONFIG_OPTION_BOOLEAN:
@@ -667,6 +715,9 @@ config_file_option_integer (struct t_config_option *option)
char *
config_file_option_string (struct t_config_option *option)
{
if (!option)
return NULL;
switch (option->type)
{
case CONFIG_OPTION_STRING:
@@ -688,6 +739,9 @@ config_file_option_string (struct t_config_option *option)
int
config_file_option_color (struct t_config_option *option)
{
if (!option)
return 0;
if (option->type == CONFIG_OPTION_COLOR)
return CONFIG_COLOR(option);
else
@@ -752,7 +806,10 @@ config_file_write_line (struct t_config_file *config_file,
{
char buf[4096];
va_list argptr;
if (!config_file || !option_name)
return;
va_start (argptr, value);
vsnprintf (buf, sizeof (buf) - 1, value, argptr);
va_end (argptr);
@@ -776,7 +833,8 @@ config_file_write_line (struct t_config_file *config_file,
*/
int
config_file_write_internal (struct t_config_file *config_file, int default_options)
config_file_write_internal (struct t_config_file *config_file,
int default_options)
{
int filename_length, rc;
char *filename, *filename2;
@@ -828,12 +886,14 @@ config_file_write_internal (struct t_config_file *config_file, int default_optio
/* call write callback if defined for section */
if (default_options && ptr_section->callback_write_default)
{
(void) (ptr_section->callback_write_default) (config_file,
(void) (ptr_section->callback_write_default) (ptr_section->callback_write_default_data,
config_file,
ptr_section->name);
}
else if (!default_options && ptr_section->callback_write)
{
(void) (ptr_section->callback_write) (config_file,
(void) (ptr_section->callback_write) (ptr_section->callback_write_data,
config_file,
ptr_section->name);
}
else
@@ -959,7 +1019,8 @@ config_file_read (struct t_config_file *config_file)
{
if (ptr_section->callback_read)
{
(void) (ptr_section->callback_read) (config_file,
(void) (ptr_section->callback_read) (ptr_section->callback_read_data,
config_file,
NULL, NULL);
}
}
@@ -1036,7 +1097,8 @@ config_file_read (struct t_config_file *config_file)
if (ptr_section && ptr_section->callback_read)
{
ptr_option = NULL;
(void) (ptr_section->callback_read) (config_file,
(void) (ptr_section->callback_read) (ptr_section->callback_read_data,
config_file,
line, pos);
rc = 1;
}
@@ -1109,7 +1171,10 @@ config_file_reload (struct t_config_file *config_file)
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
int rc;
if (!config_file)
return -1;
/* init "loaded" flag for all options */
for (ptr_section = config_file->sections; ptr_section;
ptr_section = ptr_section->next_section)
@@ -1141,7 +1206,10 @@ config_file_reload (struct t_config_file *config_file)
if (config_file_option_reset (ptr_option) == 2)
{
if (ptr_option->callback_change)
(void) (ptr_option->callback_change) ();
{
(void) (ptr_option->callback_change)
(ptr_option->callback_change_data);
}
}
}
}
@@ -1161,6 +1229,9 @@ config_file_option_free (struct t_config_section *section,
{
struct t_config_option *new_options;
if (!section || !option)
return;
/* remove option */
if (section->last_option == option)
section->last_option = option->prev_option;
@@ -1200,6 +1271,9 @@ config_file_section_free (struct t_config_file *config_file,
{
struct t_config_section *new_sections;
if (!config_file || !section)
return;
/* remove section */
if (config_file->last_section == section)
config_file->last_section = section->prev_section;
@@ -1234,6 +1308,9 @@ config_file_free (struct t_config_file *config_file)
{
struct t_config_file *new_config_files;
if (!config_file)
return;
/* remove config file */
if (last_config_file == config_file)
last_config_file = config_file->prev_config;
+33 -13
View File
@@ -41,7 +41,9 @@ struct t_config_file
char *filename; /* config filename (without path)*/
FILE *file; /* file pointer */
int (*callback_reload) /* callback for reloading file */
(struct t_config_file *config_file);
(void *data,
struct t_config_file *config_file);
void *callback_reload_data; /* data sent to callback */
struct t_config_section *sections; /* config sections */
struct t_config_section *last_section; /* last config section */
struct t_config_file *prev_config; /* link to previous config file */
@@ -52,14 +54,20 @@ struct t_config_section
{
char *name; /* section name */
void (*callback_read) /* called when unknown option */
(struct t_config_file *config_file, /* is read from config file */
char *option_name, char *value);
(void *data, /* is read from config file */
struct t_config_file *config_file,
char *option_name, char *value);
void *callback_read_data; /* data sent to read callback */
void (*callback_write) /* called to write special */
(struct t_config_file *config_file, /* options in config file */
(void *data, /* options in config file */
struct t_config_file *config_file,
char *section_name);
void *callback_write_data; /* data sent to write callback */
void (*callback_write_default) /* called to write default */
(struct t_config_file *config_file, /* options in config file */
(void *data, /* options in config file */
struct t_config_file *config_file,
char *section_name);
void *callback_write_default_data; /* data sent to write def. callb.*/
struct t_config_option *options; /* options in section */
struct t_config_option *last_option; /* last option in section */
struct t_config_section *prev_section; /* link to previous section */
@@ -83,7 +91,8 @@ struct t_config_option
int min, max; /* min and max for value */
void *default_value; /* default value */
void *value; /* value */
void (*callback_change)(); /* called when value is changed */
void (*callback_change)(void *data); /* called when value is changed */
void *callback_change_data; /* data sent to change callback */
int loaded; /* 1 if opt was found in config */
struct t_config_option *prev_option; /* link to previous option */
struct t_config_option *next_option; /* link to next option */
@@ -92,31 +101,42 @@ struct t_config_option
extern struct t_config_file *config_files;
extern struct t_config_file *last_config_file;
extern struct t_config_file *config_file_search (char *filename);
extern struct t_config_file *config_file_new (struct t_weechat_plugin *plugin,
char *filename,
int (*callback_reload)(struct t_config_file *config_file));
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_data);
extern int config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_file *config_file);
extern struct t_config_section *config_file_new_section (struct t_config_file *config_file,
char *name,
void (*callback_read)(struct t_config_file *config_file,
void (*callback_read)(void *data,
struct t_config_file *config_file,
char *option_name,
char *value),
void (*callback_write)(struct t_config_file *config_file,
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
void (*callback_write_default)(struct t_config_file *config_file,
char *section_name));
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
void *callback_write_default_data);
extern struct t_config_section *config_file_search_section (struct t_config_file *config_file,
char *section_name);
extern int config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_section *);
extern struct t_config_option *config_file_new_option (struct t_config_section *section,
extern struct t_config_option *config_file_new_option (struct t_config_file *config_file,
struct t_config_section *section,
char *name, char *type,
char *description,
char *string_values,
int min, int max,
char *default_value,
void (*callback_change)());
void (*callback_change)(void *data),
void *callback_change_data);
extern struct t_config_option *config_file_search_option (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name);
+419 -274
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -164,6 +164,7 @@ extern struct t_config_option *config_proxy_password;
extern struct t_config_option *config_plugins_path;
extern struct t_config_option *config_plugins_autoload;
extern struct t_config_option *config_plugins_extension;
extern struct t_config_option *config_plugins_save_config_on_unload;
extern int config_weechat_init ();
extern int config_weechat_read ();
+24 -3
View File
@@ -278,6 +278,23 @@ gui_completion_list_add_buffers_categories (struct t_gui_completion *completion)
}
}
/*
* gui_completion_list_add_config_files: add config files to completion list
*/
void
gui_completion_list_add_config_files (struct t_gui_completion *completion)
{
struct t_config_file *ptr_config_file;
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
gui_completion_list_add (completion, ptr_config_file->filename,
0, WEECHAT_LIST_POS_SORT);
}
}
/*
* gui_completion_list_add_filename: add filename to completion list
*/
@@ -670,6 +687,9 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
case 'c': /* buffers categories */
gui_completion_list_add_buffers_categories (completion);
break;
case 'C': /* config files */
gui_completion_list_add_config_files (completion);
break;
case 'f': /* filename */
gui_completion_list_add_filename (completion);
break;
@@ -745,7 +765,7 @@ void
gui_completion_build_list (struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
char *template, *pos_template, *pos_space;
char *pos_template, *pos_space;
int repeat_last, i, length;
repeat_last = 0;
@@ -789,10 +809,11 @@ gui_completion_build_list (struct t_gui_completion *completion)
}
if (repeat_last)
{
pos_space = rindex (template, ' ');
pos_space = rindex (HOOK_COMMAND(ptr_hook, completion), ' ');
gui_completion_build_list_template (completion,
(pos_space) ?
pos_space + 1 : template,
pos_space + 1 : HOOK_COMMAND(ptr_hook,
completion),
ptr_hook->plugin);
}
}
+21 -9
View File
@@ -420,9 +420,10 @@ alias_free_all ()
*/
int
alias_config_reload (struct t_config_file *config_file)
alias_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
(void) config_file;
alias_free_all ();
@@ -434,10 +435,11 @@ alias_config_reload (struct t_config_file *config_file)
*/
void
alias_config_read_line (struct t_config_file *config_file, char *option_name,
char *value)
alias_config_read_line (void *data, struct t_config_file *config_file,
char *option_name, char *value)
{
/* make C compiler happy */
(void) data;
(void) config_file;
if (option_name && value)
@@ -460,11 +462,14 @@ alias_config_read_line (struct t_config_file *config_file, char *option_name,
*/
void
alias_config_write_section (struct t_config_file *config_file,
alias_config_write_section (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_alias *ptr_alias;
/* make C compiler happy */
(void) data;
weechat_config_write_line (config_file, section_name, NULL);
for (ptr_alias = alias_list; ptr_alias;
@@ -482,9 +487,13 @@ alias_config_write_section (struct t_config_file *config_file,
*/
void
alias_config_write_default_aliases (struct t_config_file *config_file,
alias_config_write_default_aliases (void *data,
struct t_config_file *config_file,
char *section_name)
{
/* make C compiler happy */
(void) data;
weechat_config_write_line (config_file, section_name, NULL);
weechat_config_write_line (config_file, "SAY", "%s", "\"msg *\"");
@@ -524,14 +533,17 @@ alias_config_init ()
struct t_config_section *ptr_section;
alias_config_file = weechat_config_new (ALIAS_CONFIG_FILENAME,
&alias_config_reload);
&alias_config_reload, NULL);
if (!alias_config_file)
return 0;
ptr_section = weechat_config_new_section (alias_config_file, "alias",
alias_config_read_line,
alias_config_write_section,
alias_config_write_default_aliases);
&alias_config_read_line,
NULL,
&alias_config_write_section,
NULL,
&alias_config_write_default_aliases,
NULL);
if (!ptr_section)
{
weechat_config_free (alias_config_file);
+21 -9
View File
@@ -172,9 +172,10 @@ charset_free_all ()
*/
int
charset_config_reload (struct t_config_file *config_file)
charset_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
(void) config_file;
charset_free_all ();
@@ -186,10 +187,11 @@ charset_config_reload (struct t_config_file *config_file)
*/
void
charset_config_read_line (struct t_config_file *config_file, char *option_name,
char *value)
charset_config_read_line (void *data, struct t_config_file *config_file,
char *option_name, char *value)
{
/* make C compiler happy */
(void) data;
(void) config_file;
if (option_name && value)
@@ -212,11 +214,14 @@ charset_config_read_line (struct t_config_file *config_file, char *option_name,
*/
void
charset_config_write_section (struct t_config_file *config_file,
charset_config_write_section (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_charset *ptr_charset;
/* make C compiler happy */
(void) data;
weechat_config_write_line (config_file, section_name, NULL);
for (ptr_charset = charset_list; ptr_charset;
@@ -234,9 +239,13 @@ charset_config_write_section (struct t_config_file *config_file,
*/
void
charset_config_write_default_charsets (struct t_config_file *config_file,
charset_config_write_default_charsets (void *data,
struct t_config_file *config_file,
char *section_name)
{
/* make C compiler happy */
(void) data;
weechat_config_write_line (config_file, section_name, NULL);
if (charset_terminal && charset_internal
@@ -258,14 +267,17 @@ charset_config_init ()
struct t_config_section *ptr_section;
charset_config_file = weechat_config_new (CHARSET_CONFIG_FILENAME,
&charset_config_reload);
&charset_config_reload, NULL);
if (!charset_config_file)
return 0;
ptr_section = weechat_config_new_section (charset_config_file, "charset",
charset_config_read_line,
charset_config_write_section,
charset_config_write_default_charsets);
&charset_config_read_line,
NULL,
&charset_config_write_section,
NULL,
&charset_config_write_default_charsets,
NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
+191 -121
View File
@@ -212,12 +212,13 @@ irc_config_change_notify_levels ()
*/
int
irc_config_reload (struct t_config_file *config_file)
irc_config_reload (void *data, struct t_config_file *config_file)
{
struct t_irc_server *ptr_server, *next_server;
int rc;
/* make C compiler happy */
(void) data;
(void) config_file;
irc_config_server = NULL;
@@ -270,13 +271,14 @@ irc_config_reload (struct t_config_file *config_file)
*/
void
irc_config_read_server_line (struct t_config_file *config_file,
irc_config_read_server_line (void *data, struct t_config_file *config_file,
char *option_name, char *value)
{
struct t_config_option *ptr_option;
int rc;
/* make C compiler happy */
(void) data;
(void) config_file;
if (option_name && value)
@@ -339,11 +341,14 @@ irc_config_read_server_line (struct t_config_file *config_file,
*/
void
irc_config_write_servers (struct t_config_file *config_file,
irc_config_write_servers (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
(void) data;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
@@ -397,12 +402,15 @@ irc_config_write_servers (struct t_config_file *config_file,
*/
void
irc_config_write_server_default (struct t_config_file *config_file,
irc_config_write_server_default (void *data, struct t_config_file *config_file,
char *section_name)
{
struct passwd *my_passwd;
char *realname, *pos;
/* make C compiler happy */
(void) data;
weechat_config_write_line (config_file, section_name, NULL);
weechat_config_write_line (config_file, "server_name", "%s", "\"freenode\"");
@@ -469,12 +477,14 @@ irc_config_init ()
struct t_config_section *ptr_section;
irc_config_file = weechat_config_new (IRC_CONFIG_FILENAME,
&irc_config_reload);
&irc_config_reload, NULL);
if (!irc_config_file)
return 0;
ptr_section = weechat_config_new_section (irc_config_file, "irc",
NULL, NULL, NULL);
NULL, NULL,
NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -482,93 +492,114 @@ irc_config_init ()
}
irc_config_irc_one_server_buffer = weechat_config_new_option (
ptr_section, "irc_one_server_buffer", "boolean",
irc_config_file, ptr_section,
"irc_one_server_buffer", "boolean",
N_("use same buffer for all servers"),
NULL, 0, 0, "off", &irc_config_change_one_server_buffer);
NULL, 0, 0, "off", &irc_config_change_one_server_buffer, NULL);
irc_config_irc_open_near_server = weechat_config_new_option (
ptr_section, "irc_open_near_server", "boolean",
irc_config_file, ptr_section,
"irc_open_near_server", "boolean",
N_("open new channels/privates near server"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
irc_config_irc_nick_prefix = weechat_config_new_option (
ptr_section, "irc_nick_prefix", "string",
irc_config_file, ptr_section,
"irc_nick_prefix", "string",
N_("text to display before nick in chat window"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_irc_nick_suffix = weechat_config_new_option (
ptr_section, "irc_nick_suffix", "string",
irc_config_file, ptr_section,
"irc_nick_suffix", "string",
N_("text to display after nick in chat window"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_irc_nick_completion_smart = weechat_config_new_option (
ptr_section, "irc_nick_completion_smart", "boolean",
irc_config_file, ptr_section,
"irc_nick_completion_smart", "boolean",
N_("smart completion for nicks (completes with last speakers first)"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_irc_display_away = weechat_config_new_option (
ptr_section, "irc_display_away", "integer",
irc_config_file, ptr_section,
"irc_display_away", "integer",
N_("display message when (un)marking as away"),
"off|local|channel", 0, 0, "local", NULL);
"off|local|channel", 0, 0, "local", NULL, NULL);
irc_config_irc_show_away_once = weechat_config_new_option (
ptr_section, "irc_show_away_once", "boolean",
irc_config_file, ptr_section,
"irc_show_away_once", "boolean",
N_("show remote away message only once in private"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_irc_default_msg_part = weechat_config_new_option (
ptr_section, "irc_default_msg_part", "string",
irc_config_file, ptr_section,
"irc_default_msg_part", "string",
N_("default part message (leaving channel) ('%v' will be replaced by "
"WeeChat version in string)"),
NULL, 0, 0, "WeeChat %v", NULL);
NULL, 0, 0, "WeeChat %v", NULL, NULL);
irc_config_irc_notice_as_pv = weechat_config_new_option (
ptr_section, "irc_notice_as_pv", "boolean",
irc_config_file, ptr_section,
"irc_notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
irc_config_irc_away_check = weechat_config_new_option (
ptr_section, "irc_away_check", "integer",
irc_config_file, ptr_section,
"irc_away_check", "integer",
N_("interval between two checks for away (in minutes, 0 = never "
"check)"),
NULL, 0, INT_MAX, "0", &irc_config_change_away_check);
NULL, 0, INT_MAX, "0", &irc_config_change_away_check, NULL);
irc_config_irc_away_check_max_nicks = weechat_config_new_option (
ptr_section, "irc_away_check_max_nicks", "integer",
irc_config_file, ptr_section,
"irc_away_check_max_nicks", "integer",
N_("do not check away nicks on channels with high number of nicks "
"(0 = unlimited)"),
NULL, 0, INT_MAX, "0", &irc_config_change_away_check);
NULL, 0, INT_MAX, "0", &irc_config_change_away_check, NULL);
irc_config_irc_lag_check = weechat_config_new_option (
ptr_section, "irc_lag_check", "integer",
irc_config_file, ptr_section,
"irc_lag_check", "integer",
N_("interval between two checks for lag (in seconds, 0 = never "
"check)"),
NULL, 0, INT_MAX, "60", NULL);
NULL, 0, INT_MAX, "60", NULL, NULL);
irc_config_irc_lag_min_show = weechat_config_new_option (
ptr_section, "irc_lag_min_show", "integer",
irc_config_file, ptr_section,
"irc_lag_min_show", "integer",
N_("minimum lag to show (in seconds)"),
NULL, 0, INT_MAX, "1", NULL);
NULL, 0, INT_MAX, "1", NULL, NULL);
irc_config_irc_lag_disconnect = weechat_config_new_option (
ptr_section, "irc_lag_disconnect", "integer",
irc_config_file, ptr_section,
"irc_lag_disconnect", "integer",
N_("disconnect after important lag (in minutes, 0 = never "
"disconnect)"),
NULL, 0, INT_MAX, "5", NULL);
NULL, 0, INT_MAX, "5", NULL, NULL);
irc_config_irc_anti_flood = weechat_config_new_option (
ptr_section, "irc_anti_flood", "integer",
irc_config_file, ptr_section,
"irc_anti_flood", "integer",
N_("anti-flood: # seconds between two user messages (0 = no "
"anti-flood)"),
NULL, 0, 5, "2", NULL);
NULL, 0, 5, "2", NULL, NULL);
irc_config_irc_highlight = weechat_config_new_option (
ptr_section, "irc_highlight", "string",
irc_config_file, ptr_section,
"irc_highlight", "string",
N_("comma separated list of words to highlight (case insensitive "
"comparison, words may begin or end with \"*\" for partial match)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_irc_colors_receive = weechat_config_new_option (
ptr_section, "irc_colors_receive", "boolean",
irc_config_file, ptr_section,
"irc_colors_receive", "boolean",
N_("when off, colors codes are ignored in incoming messages"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_irc_colors_send = weechat_config_new_option (
ptr_section, "irc_colors_send", "boolean",
irc_config_file, ptr_section,
"irc_colors_send", "boolean",
N_("allow user to send colors with special codes (^Cb=bold, "
"^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, "
"^Cr=reverse)"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_irc_send_unknown_commands = weechat_config_new_option (
ptr_section, "irc_send_unknown_commands", "boolean",
irc_config_file, ptr_section,
"irc_send_unknown_commands", "boolean",
N_("send unknown commands to IRC server"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "dcc",
NULL, NULL, NULL);
NULL, NULL,
NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -576,62 +607,76 @@ irc_config_init ()
}
irc_config_dcc_auto_accept_files = weechat_config_new_option (
ptr_section, "dcc_auto_accept_files", "boolean",
irc_config_file, ptr_section,
"dcc_auto_accept_files", "boolean",
N_("automatically accept incoming dcc files (use carefully!)"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
irc_config_dcc_auto_accept_chats = weechat_config_new_option (
ptr_section, "dcc_auto_accept_chats", "boolean",
irc_config_file, ptr_section,
"dcc_auto_accept_chats", "boolean",
N_("automatically accept dcc chats (use carefully!)"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
irc_config_dcc_timeout = weechat_config_new_option (
ptr_section, "dcc_timeout", "integer",
irc_config_file, ptr_section,
"dcc_timeout", "integer",
N_("timeout for dcc request (in seconds)"),
NULL, 5, INT_MAX, "300", NULL);
NULL, 5, INT_MAX, "300", NULL, NULL);
irc_config_dcc_blocksize = weechat_config_new_option (
ptr_section, "dcc_blocksize", "integer",
irc_config_file, ptr_section,
"dcc_blocksize", "integer",
N_("block size for dcc packets in bytes"),
NULL, IRC_DCC_MIN_BLOCKSIZE, IRC_DCC_MAX_BLOCKSIZE, "65536",
NULL);
NULL, NULL);
irc_config_dcc_fast_send = weechat_config_new_option (
ptr_section, "dcc_fast_send", "boolean",
irc_config_file, ptr_section,
"dcc_fast_send", "boolean",
N_("does not wait for ACK when sending file"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_dcc_port_range = weechat_config_new_option (
ptr_section, "dcc_port_range", "string",
irc_config_file, ptr_section,
"dcc_port_range", "string",
N_("restricts outgoing dcc to use only ports in the given range "
"(useful for NAT) (syntax: a single port, ie. 5000 or a port "
"range, ie. 5000-5015, empty value means any port)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_dcc_own_ip = weechat_config_new_option (
ptr_section, "dcc_own_ip", "string",
irc_config_file, ptr_section,
"dcc_own_ip", "string",
N_("IP or DNS address used for outgoing dcc "
"(if empty, local interface IP is used)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_dcc_download_path = weechat_config_new_option (
ptr_section, "dcc_download_path", "string",
irc_config_file, ptr_section,
"dcc_download_path", "string",
N_("path for writing incoming files with dcc"),
NULL, 0, 0, "%h/dcc", NULL);
NULL, 0, 0, "%h/dcc", NULL, NULL);
irc_config_dcc_upload_path = weechat_config_new_option (
ptr_section, "dcc_upload_path", "string",
irc_config_file, ptr_section,
"dcc_upload_path", "string",
N_("path for reading files when sending thru dcc (when no path is "
"specified)"),
NULL, 0, 0, "~", NULL);
NULL, 0, 0, "~", NULL, NULL);
irc_config_dcc_convert_spaces = weechat_config_new_option (
ptr_section, "dcc_convert_spaces", "boolean",
irc_config_file, ptr_section,
"dcc_convert_spaces", "boolean",
N_("convert spaces to underscores when sending files"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_dcc_auto_rename = weechat_config_new_option (
ptr_section, "dcc_auto_rename", "boolean",
irc_config_file, ptr_section,
"dcc_auto_rename", "boolean",
N_("rename incoming files if already exists (add '.1', '.2', ...)"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_dcc_auto_resume = weechat_config_new_option (
ptr_section, "dcc_auto_resume", "boolean",
irc_config_file, ptr_section,
"dcc_auto_resume", "boolean",
N_("automatically resume dcc transfer if connection with remote host "
"is loosed"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "log",
NULL, NULL, NULL);
NULL, NULL,
NULL, NULL,
NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -639,26 +684,33 @@ irc_config_init ()
}
irc_config_log_auto_server = weechat_config_new_option (
ptr_section, "log_auto_server", "boolean",
irc_config_file, ptr_section,
"log_auto_server", "boolean",
N_("automatically log server messages"),
NULL, 0, 0, "off", &irc_config_change_log);
NULL, 0, 0, "off", &irc_config_change_log, NULL);
irc_config_log_auto_channel = weechat_config_new_option (
ptr_section, "log_auto_channel", "boolean",
irc_config_file, ptr_section,
"log_auto_channel", "boolean",
N_("automatically log channel chats"),
NULL, 0, 0, "off", &irc_config_change_log);
NULL, 0, 0, "off", &irc_config_change_log, NULL);
irc_config_log_auto_private = weechat_config_new_option (
ptr_section, "log_auto_private", "boolean",
irc_config_file, ptr_section,
"log_auto_private", "boolean",
N_("automatically log private chats"),
NULL, 0, 0, "off", &irc_config_change_log);
NULL, 0, 0, "off", &irc_config_change_log, NULL);
irc_config_log_hide_nickserv_pwd = weechat_config_new_option (
ptr_section, "log_hide_nickserv_pwd", "boolean",
irc_config_file, ptr_section,
"log_hide_nickserv_pwd", "boolean",
N_("hide password displayed by nickserv"),
NULL, 0, 0, "on", &irc_config_change_log);
NULL, 0, 0, "on", &irc_config_change_log, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "server",
irc_config_read_server_line,
irc_config_write_servers,
irc_config_write_server_default);
&irc_config_read_server_line,
NULL,
&irc_config_write_servers,
NULL,
&irc_config_write_server_default,
NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -668,94 +720,112 @@ irc_config_init ()
irc_config_section_server = ptr_section;
irc_config_server_name = weechat_config_new_option (
ptr_section, "server_name", "string",
irc_config_file, ptr_section,
"server_name", "string",
N_("name associated to IRC server (for display only)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_autoconnect = weechat_config_new_option (
ptr_section, "server_autoconnect", "boolean",
irc_config_file, ptr_section,
"server_autoconnect", "boolean",
N_("automatically connect to server when WeeChat is starting"),
NULL, 0, 0, "off", NULL);
NULL, 0, 0, "off", NULL, NULL);
irc_config_server_autoreconnect = weechat_config_new_option (
ptr_section, "server_autoreconnect", "boolean",
irc_config_file, ptr_section,
"server_autoreconnect", "boolean",
N_("automatically reconnect to server when disconnected"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_server_autoreconnect_delay = weechat_config_new_option (
ptr_section, "server_autoreconnect_delay", "integer",
irc_config_file, ptr_section,
"server_autoreconnect_delay", "integer",
N_("delay (in seconds) before trying again to reconnect to server"),
NULL, 0, 65535, "30", NULL);
NULL, 0, 65535, "30", NULL, NULL);
irc_config_server_address = weechat_config_new_option (
ptr_section, "server_address", "string",
irc_config_file, ptr_section,
"server_address", "string",
N_("IP address or hostname of IRC server"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_port = weechat_config_new_option (
ptr_section, "server_port", "integer",
irc_config_file, ptr_section,
"server_port", "integer",
N_("port for connecting to server"),
NULL, 0, 65535, "6667", NULL);
NULL, 0, 65535, "6667", NULL, NULL);
irc_config_server_ipv6 = weechat_config_new_option (
ptr_section, "server_ipv6", "boolean",
irc_config_file, ptr_section,
"server_ipv6", "boolean",
N_("use IPv6 protocol for server communication"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_server_ssl = weechat_config_new_option (
ptr_section, "server_ssl", "boolean",
irc_config_file, ptr_section,
"server_ssl", "boolean",
N_("use SSL for server communication"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_server_password = weechat_config_new_option (
ptr_section, "server_password", "string",
irc_config_file, ptr_section,
"server_password", "string",
N_("password for IRC server"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_nick1 = weechat_config_new_option (
ptr_section, "server_nick1", "string",
irc_config_file, ptr_section,
"server_nick1", "string",
N_("nickname to use on IRC server"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_nick2 = weechat_config_new_option (
ptr_section, "server_nick2", "string",
irc_config_file, ptr_section,
"server_nick2", "string",
N_("alternate nickname to use on IRC server (if nickname is already "
"used)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_nick3 = weechat_config_new_option (
ptr_section, "server_nick3", "string",
irc_config_file, ptr_section, "server_nick3", "string",
N_("2nd alternate nickname to use on IRC server (if alternate "
"nickname is already used)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_username = weechat_config_new_option (
ptr_section, "server_username", "string",
irc_config_file, ptr_section, "server_username", "string",
N_("user name to use on IRC server"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_realname = weechat_config_new_option (
ptr_section, "server_realname", "string",
irc_config_file, ptr_section,
"server_realname", "string",
N_("real name to use on IRC server"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_hostname = weechat_config_new_option (
ptr_section, "server_hostname", "string",
irc_config_file, ptr_section,
"server_hostname", "string",
N_("custom hostname/IP for server (optional, if empty local hostname "
"is used)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_command = weechat_config_new_option (
ptr_section, "server_command", "string",
irc_config_file, ptr_section,
"server_command", "string",
N_("command(s) to run when connected to server (many commands should "
"be separated by ';', use '\\;' for a semicolon, special variables "
"$nick, $channel and $server are replaced by their value)"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_command_delay = weechat_config_new_option (
ptr_section, "server_command_delay", "integer",
irc_config_file, ptr_section,
"server_command_delay", "integer",
N_("delay (in seconds) after command was executed (example: give some "
"time for authentication)"),
NULL, 0, 3600, "0", NULL);
NULL, 0, 3600, "0", NULL, NULL);
irc_config_server_autojoin = weechat_config_new_option (
ptr_section, "server_autojoin", "string",
irc_config_file, ptr_section,
"server_autojoin", "string",
N_("comma separated list of channels to join when connected to server "
"(example: \"#chan1,#chan2,#chan3 key1,key2\")"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
irc_config_server_autorejoin = weechat_config_new_option (
ptr_section, "server_autorejoin", "string",
irc_config_file, ptr_section,
"server_autorejoin", "string",
N_("automatically rejoin channels when kicked"),
NULL, 0, 0, "on", NULL);
NULL, 0, 0, "on", NULL, NULL);
irc_config_server_notify_levels = weechat_config_new_option (
ptr_section, "server_notify_levels", "string",
irc_config_file, ptr_section,
"server_notify_levels", "string",
N_("comma separated list of notify levels for channels of this server "
"(format: #channel:1,..), a channel name '*' is reserved for "
"server default notify level"),
NULL, 0, 0, "", NULL);
NULL, 0, 0, "", NULL, NULL);
return 1;
}
+12 -7
View File
@@ -289,9 +289,10 @@ plugin_config_free_all ()
*/
int
plugin_config_reload (struct t_config_file *config_file)
plugin_config_reload (void *data, struct t_config_file *config_file)
{
/* make C compiler happy */
(void) data;
(void) config_file;
/* remove all plugin options */
@@ -309,12 +310,13 @@ plugin_config_reload (struct t_config_file *config_file)
*/
void
plugin_config_read_option (struct t_config_file *config_file,
plugin_config_read_option (void *data, struct t_config_file *config_file,
char *option_name, char *value)
{
char *value2;
/* make C compiler happy */
(void) data;
(void) config_file;
if (option_name && value)
@@ -332,11 +334,14 @@ plugin_config_read_option (struct t_config_file *config_file,
*/
void
plugin_config_write_options (struct t_config_file *config_file,
plugin_config_write_options (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_config_option *ptr_option;
/* make C compiler happy */
(void) data;
config_file_write_line (config_file, section_name, NULL);
for (ptr_option = plugin_options; ptr_option;
@@ -356,13 +361,13 @@ void
plugin_config_init ()
{
plugin_config = config_file_new (NULL, PLUGIN_CONFIG_FILENAME,
&plugin_config_reload);
&plugin_config_reload, NULL);
if (plugin_config)
{
config_file_new_section (plugin_config, "plugins",
&plugin_config_read_option,
&plugin_config_write_options,
NULL);
&plugin_config_read_option, NULL,
&plugin_config_write_options, NULL,
NULL, NULL);
}
}
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -213,7 +213,8 @@ weechat_lua_load (char *filename)
fclose (fp);
/* if script was registered, removing from list */
if (lua_current_script)
script_remove (weechat_lua_plugin, &lua_scripts, lua_current_script);
script_remove (weechat_lua_plugin, &lua_scripts,
lua_current_script);
return 0;
}
fclose (fp);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -370,8 +370,8 @@ weechat_python_load (char *filename)
/* 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,
python_current_script);
}
return 0;
}
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -376,8 +376,8 @@ weechat_ruby_load (char *filename)
if (ruby_current_script != NULL)
{
script_remove (weechat_ruby_plugin,
&ruby_scripts, ruby_current_script);
script_remove (weechat_ruby_plugin, &ruby_scripts,
ruby_current_script);
}
return 0;
+249 -20
View File
@@ -43,6 +43,247 @@ script_api_charset_set (struct t_plugin_script *script,
script->charset = (charset) ? strdup (charset) : NULL;
}
/*
* script_api_config_new: create a new configuration file
* return new configuration file, NULL if error
*/
struct t_config_file *
script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
char *filename,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
char *function)
{
struct t_script_callback *new_script_callback;
struct t_config_file *new_config_file;
if (function && function[0])
{
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_config_file = weechat_config_new (filename, callback_reload,
new_script_callback);
if (!new_config_file)
{
free (new_script_callback);
return NULL;
}
new_script_callback->script = script;
new_script_callback->function = strdup (function);
new_script_callback->config_file = new_config_file;
script_callback_add (script, new_script_callback);
}
else
{
new_config_file = weechat_config_new (filename, NULL, NULL);
}
return new_config_file;
}
/*
* script_api_config_new_section: create a new section in configuration file
* return new section, NULL if error
*/
struct t_config_section *
script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
char *name,
void (*callback_read)(void *data,
struct t_config_file *config_file,
char *option_name,
char *value),
char *function_read,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
char *function_write,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
char *function_write_default)
{
struct t_script_callback *new_script_callback1, *new_script_callback2;
struct t_script_callback *new_script_callback3;
struct t_config_section *new_section;
void *callback1, *callback2, *callback3;
new_script_callback1 = NULL;
new_script_callback2 = NULL;
new_script_callback3 = NULL;
callback1 = NULL;
callback2 = NULL;
callback3 = NULL;
if (function_read && function_read[0])
{
new_script_callback1 = script_callback_alloc ();
if (!new_script_callback1)
return NULL;
callback1 = callback_read;
}
if (function_write && function_write[0])
{
new_script_callback2 = script_callback_alloc ();
if (!new_script_callback2)
{
if (new_script_callback1)
free (new_script_callback1);
return NULL;
}
callback2 = callback_write;
}
if (function_write_default && function_write_default[0])
{
new_script_callback3 = script_callback_alloc ();
if (!new_script_callback3)
{
if (new_script_callback1)
free (new_script_callback1);
if (new_script_callback2)
free (new_script_callback2);
return NULL;
}
callback3 = callback_write_default;
}
new_section = weechat_config_new_section (config_file,
name,
callback1,
new_script_callback1,
callback2,
new_script_callback2,
callback3,
new_script_callback3);
if (!new_section)
{
if (new_script_callback1)
free (new_script_callback1);
if (new_script_callback2)
free (new_script_callback2);
if (new_script_callback3)
free (new_script_callback3);
return NULL;
}
if (new_script_callback1)
{
new_script_callback1->script = script;
new_script_callback1->function = strdup (function_read);
new_script_callback1->config_file = config_file;
new_script_callback1->config_section = new_section;
script_callback_add (script, new_script_callback1);
}
if (new_script_callback2)
{
new_script_callback2->script = script;
new_script_callback2->function = strdup (function_write);
new_script_callback2->config_file = config_file;
new_script_callback2->config_section = new_section;
script_callback_add (script, new_script_callback2);
}
if (new_script_callback3)
{
new_script_callback3->script = script;
new_script_callback3->function = strdup (function_write_default);
new_script_callback3->config_file = config_file;
new_script_callback3->config_section = new_section;
script_callback_add (script, new_script_callback3);
}
return new_section;
}
/*
* script_api_config_new_option: create a new option in section
* return new option, NULL if error
*/
struct t_config_option *
script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
struct t_config_section *section,
char *name, char *type,
char *description, char *string_values,
int min, int max, char *default_value,
void (*callback_change)(void *data),
char *function)
{
struct t_script_callback *new_script_callback;
struct t_config_option *new_option;
if (function && function[0])
{
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_option = weechat_config_new_option (config_file, section, name, type,
description, string_values, min,
max, default_value,
callback_change,
new_script_callback);
if (!new_option)
{
free (new_script_callback);
return NULL;
}
new_script_callback->script = script;
new_script_callback->function = strdup (function);
new_script_callback->config_file = config_file;
new_script_callback->config_section = section;
new_script_callback->config_option = new_option;
script_callback_add (script, new_script_callback);
}
else
{
new_option = weechat_config_new_option (config_file, section, name, type,
description, string_values, min,
max, default_value, NULL, NULL);
}
return new_option;
}
/*
* script_api_config_free: free configuration file
*/
void
script_api_config_free (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file)
{
struct t_script_callback *ptr_script_callback;
if (!weechat_plugin || !script || !config_file)
return;
weechat_config_free (config_file);
for (ptr_script_callback = script->callbacks; ptr_script_callback;
ptr_script_callback = ptr_script_callback->next_callback)
{
if (ptr_script_callback->config_file == config_file)
script_callback_remove (script, ptr_script_callback);
}
}
/*
* script_api_printf: print a message
*/
@@ -140,10 +381,6 @@ script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_script_callback->script = NULL;
new_script_callback->function = NULL;
new_script_callback->hook = NULL;
new_hook = weechat_hook_command (command, description, args,
args_description, completion,
callback, new_script_callback);
@@ -423,10 +660,9 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
/*
* script_api_unhook: unhook something
* return 1 if ok, 0 if error
*/
int
void
script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook)
@@ -434,22 +670,16 @@ script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_script_callback *ptr_script_callback;
if (!weechat_plugin || !script || !hook)
return 0;
return;
weechat_unhook (hook);
for (ptr_script_callback = script->callbacks; ptr_script_callback;
ptr_script_callback = ptr_script_callback->next_callback)
{
if (ptr_script_callback->hook == hook)
break;
script_callback_remove (script, ptr_script_callback);
}
if (ptr_script_callback)
{
script_callback_remove (weechat_plugin, script, ptr_script_callback);
return 1;
}
return 0;
}
/*
@@ -457,8 +687,7 @@ script_api_unhook (struct t_weechat_plugin *weechat_plugin,
*/
void
script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script)
script_api_unhook_all (struct t_plugin_script *script)
{
struct t_script_callback *ptr_callback, *next_callback;
@@ -467,7 +696,7 @@ script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
{
next_callback = ptr_callback->next_callback;
script_callback_remove (weechat_plugin, script, ptr_callback);
script_callback_remove (script, ptr_callback);
ptr_callback = next_callback;
}
@@ -539,7 +768,7 @@ script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
if (ptr_script_callback)
{
script_callback_remove (weechat_plugin, script, ptr_script_callback);
script_callback_remove (script, ptr_script_callback);
}
}
+42 -5
View File
@@ -21,6 +21,44 @@
extern void script_api_charset_set (struct t_plugin_script *script,
char *charset);
extern struct t_config_file *script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
char *filename,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
char *function);
extern struct t_config_section *script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
char *name,
void (*callback_read)(void *data,
struct t_config_file *config_file,
char *option_name,
char *value),
char *function_read,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
char *function_write,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
char *function_write_default);
extern struct t_config_option *script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file,
struct t_config_section *section,
char *name,
char *type,
char *description,
char *string_values,
int min, int max,
char *default_value,
void (*callback_change)(void *data),
char *function);
extern void script_api_config_free (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_config_file *config_file);
extern void script_api_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
@@ -95,11 +133,10 @@ extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat
char *modifier_data,
char *string),
char *function);
extern int script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);
extern void script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script);
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);
extern void script_api_unhook_all (struct t_plugin_script *script);
struct t_gui_buffer *script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
char *category, char *name,
+6 -7
View File
@@ -41,6 +41,9 @@ script_callback_alloc ()
{
new_script_callback->script = NULL;
new_script_callback->function = NULL;
new_script_callback->config_file = NULL;
new_script_callback->config_section = NULL;
new_script_callback->config_option = NULL;
new_script_callback->hook = NULL;
new_script_callback->buffer = NULL;
return new_script_callback;
@@ -69,8 +72,7 @@ script_callback_add (struct t_plugin_script *script,
*/
void
script_callback_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
script_callback_remove (struct t_plugin_script *script,
struct t_script_callback *script_callback)
{
/* remove callback from list */
@@ -86,8 +88,6 @@ script_callback_remove (struct t_weechat_plugin *weechat_plugin,
/* unhook and free data */
if (script_callback->function)
free (script_callback->function);
if (script_callback->hook)
weechat_unhook (script_callback->hook);
free (script_callback);
}
@@ -97,12 +97,11 @@ script_callback_remove (struct t_weechat_plugin *weechat_plugin,
*/
void
script_callback_remove_all (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script)
script_callback_remove_all (struct t_plugin_script *script)
{
while (script->callbacks)
{
script_callback_remove (weechat_plugin, script, script->callbacks);
script_callback_remove (script, script->callbacks);
}
}
+9 -8
View File
@@ -21,10 +21,13 @@
struct t_script_callback
{
void *script; /* pointer to script */
char *function; /* script function called */
struct t_hook *hook; /* not NULL if hook */
struct t_gui_buffer *buffer; /* not NULL if buffer callback */
void *script; /* pointer to script */
char *function; /* script function called */
struct t_config_file *config_file; /* not NULL for config file */
struct t_config_section *config_section; /* not NULL for config section */
struct t_config_option *config_option; /* not NULL for config option */
struct t_hook *hook; /* not NULL for hook */
struct t_gui_buffer *buffer; /* not NULL for buffer callback*/
struct t_script_callback *prev_callback; /* link to next callback */
struct t_script_callback *next_callback; /* link to previous callback */
};
@@ -32,11 +35,9 @@ struct t_script_callback
extern struct t_script_callback *script_callback_alloc ();
extern void script_callback_add (struct t_plugin_script *script,
struct t_script_callback *callback);
extern void script_callback_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
extern void script_callback_remove (struct t_plugin_script *script,
struct t_script_callback *script_callback);
extern void script_callback_remove_all (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script);
extern void script_callback_remove_all (struct t_plugin_script *script);
extern void script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
struct t_script_callback *script_callback);
+20 -1
View File
@@ -411,8 +411,27 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script *script)
{
struct t_script_callback *ptr_script_callback;
for (ptr_script_callback = script->callbacks; ptr_script_callback;
ptr_script_callback = ptr_script_callback->next_callback)
{
if (ptr_script_callback->hook)
{
weechat_unhook (ptr_script_callback->hook);
}
if (ptr_script_callback->config_file
&& !ptr_script_callback->config_section
&& !ptr_script_callback->config_option)
{
if (weechat_config_boolean (weechat_config_get_weechat ("plugins_save_config_on_unload")))
weechat_config_write (ptr_script_callback->config_file);
weechat_config_free (ptr_script_callback->config_file);
}
}
/* remove all callbacks created by this script */
script_callback_remove_all (weechat_plugin, script);
script_callback_remove_all (script);
/* free data */
if (script->filename)
+39 -24
View File
@@ -157,28 +157,35 @@ struct t_weechat_plugin
/* config files */
struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
char *filename,
int (*callback_reload)(struct t_config_file *config_file));
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_reload_data);
struct t_config_section *(*config_new_section) (struct t_config_file *config_file,
char *name,
void (*callback_read)
(struct t_config_file *config_file,
char *option_name,
char *value),
void (*callback_write)
(struct t_config_file *config_file,
char *section_name),
void (*callback_write_default)
(struct t_config_file *config_file,
char *section_name));
void (*callback_read)(void *data,
struct t_config_file *config_file,
char *option_name,
char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
void *callback_write_default_data);
struct t_config_section *(*config_search_section) (struct t_config_file *config_file,
char *section_name);
struct t_config_option *(*config_new_option) (struct t_config_section *config_file,
struct t_config_option *(*config_new_option) (struct t_config_file *config_file,
struct t_config_section *section,
char *name, char *type,
char *description,
char *string_values,
int min, int max,
char *default_value,
void (*callback_change)());
void (*callback_change)(void *data),
void *callback_change_data);
struct t_config_option *(*config_search_option) (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name);
@@ -449,22 +456,30 @@ struct t_weechat_plugin
weechat_plugin->list_free(__list)
/* config files */
#define weechat_config_new(__filename, __callback_reload) \
weechat_plugin->config_new(weechat_plugin, __filename, \
__callback_reload)
#define weechat_config_new(__filename, __callback_reload, \
__callback_reload_data) \
weechat_plugin->config_new(weechat_plugin, __filename, \
__callback_reload, \
__callback_reload_data)
#define weechat_config_new_section(__config, __name, __cb_read, \
__cb_write_std, __cb_write_def) \
__cb_read_data, __cb_write_std, \
__cb_write_std_data, __cb_write_def, \
__cb_write_def_data) \
weechat_plugin->config_new_section(__config, __name, __cb_read, \
__cb_write_std, __cb_write_def)
__cb_read_data, __cb_write_std, \
__cb_write_std_data,\
__cb_write_def, \
__cb_write_def_data)
#define weechat_config_search_section(__config, __name) \
weechat_plugin->config_search_section(__config, __name)
#define weechat_config_new_option(__section, __name, __type, __desc, \
__string_values, __min, __max, \
__default, __callback) \
weechat_plugin->config_new_option(__section, __name, __type, \
__desc, __string_values, \
#define weechat_config_new_option(__config, __section, __name, __type, \
__desc, __string_values, __min, \
__max, __default, __callback, \
__callback_data) \
weechat_plugin->config_new_option(__config, __section, __name, \
__type, __desc, __string_values, \
__min, __max, __default, \
__callback)
__callback, __callback_data)
#define weechat_config_search_option(__config, __section, __name) \
weechat_plugin->config_search_option(__config, __section, __name)
#define weechat_config_string_to_boolean(__string) \