1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

Added new plugins functions: set_config, get_plugin_config, set_plugin_config.

New file is used to store plugin variables (~/.weechat/plugins.rc)
This commit is contained in:
Sebastien Helleu
2005-10-23 22:07:18 +00:00
parent b7484eeea7
commit 32a7fbb767
32 changed files with 2960 additions and 1334 deletions
+68 -1
View File
@@ -35,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 23 2005
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 24 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2066,6 +2066,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+68 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 23 de octubre de 2005
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 24 de octubre de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2069,6 +2069,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+70 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.6-cvs - 23 octobre 2005
@subtitle Documentation pour WeeChat v0.1.6-cvs - 24 octobre 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2090,6 +2090,75 @@ NB: le r@'esultat doit @^etre lib@'er@'e par un appel @`a la fonction
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Modifie la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a mettre @`a jour
@item @option{value}: nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si l'option a @'et@'e modifi@'ee avec succ@`es, 0 si une erreur
s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Renvoie la valeur d'une option de l'extension.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a lire
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, NULL si non trouv@'ee.@*
NB: le r@'esultat doit @^etre lib@'er@'e par un appel @`a la fonction
``free'' apr@`es utilisation.@*
@*
@emph{Exemple :}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "ma_variable");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Modifie la valeur d'une option de l'extension.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a mettre @`a jour
@item @option{value}: nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si l'option a @'et@'e modifi@'ee avec succ@`es, 0 si une erreur
s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{plugin->set_plugin_config (plugin, "ma_variable", "valeur");}@*
@*
@end itemize
@subsection Compiler l'extension
+68 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 23 de outubro de 2005
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 24 de outubro de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2064,6 +2064,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+37 -29
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:32+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s nemůžu přidělit novou přezdívku\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "Nemůžu získat jméno uživatele"
@@ -2175,42 +2175,42 @@ msgstr ""
"%s funkce \"weechat_plugin_init\" nebyla v pluginu \"%s\" nalezena, načtení "
"selhalo\n"
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr "Inicializuji plugin \"%s\" %s\n"
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr "%s nemohu načíst plugin \"%s\"\n"
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr "%s nemohu načíst plugin \"%s\" (nedostatek paměti)\n"
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr "Plugin \"%s\" (%s) načten.\n"
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr "Plugin \"%s\" odebrán.\n"
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr "%s plugin \"%s\" nenalezen\n"
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr "Změnil se den na %s\n"
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s zpoždění je veliké, odpojuji se od serveru...\n"
@@ -4395,42 +4395,42 @@ msgstr "%s nemohu přiřadit výchozí číslo s řetězcem (\"%s\")\n"
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s nemohu přiřadit výchozí barvu (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s konfigurační soubor \"%s\" nenalezen\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, řádek %d: nevalidní syntaxe, chybí \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, řádek %d: neznámý identifikátor sekce (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, řádek %d: nevalidní sekce pro volbu, řádek je ignorován\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, řádek %d: nevalidní syntax, chybí \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, řádek %d: nevalidní volba \"%s\"\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr "%s %s, řádek %d: nevalidní volba \"%s\" pro ignorování\n"
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4439,7 +4439,7 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: hodnota boolean: 'off' nebo 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4448,7 +4448,7 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: celé číslo mezi %d a %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4457,34 +4457,42 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: jeden z těchto řetězců: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, řádek %d: nevalidní jméno barvy pro hodnotu '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s nemohu vytvořit soubor \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: vytvářím výchozí konfigurační soubor...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Vytvářím výchozí konfigurační soubor\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s konfigurační soubor, vytvořil %s v%s %s#\n"
"# %s konfigurační soubor, vytvořil %s v%s %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Ukládám konfiguraci na disk\n"
+42 -31
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:53+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s no ha sido posible crear un nuevo nick\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "No ha sido posible obtener el nombre de usuario"
@@ -2172,42 +2172,42 @@ msgid ""
"load\n"
msgstr ""
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr ""
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr ""
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr ""
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr ""
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr ""
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr ""
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr ""
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s el lag (retraso) es alto, desconectando del servidor...\n"
@@ -2722,7 +2722,9 @@ msgstr "gesti
msgid ""
"[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | "
"all]]]"
msgstr "[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | all]]]"
msgstr ""
"[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | "
"all]]]"
#: src/common/command.c:140
#, fuzzy
@@ -2735,7 +2737,8 @@ msgid ""
"splitv: split current window vertically\n"
"merge: merge window with another"
msgstr ""
"list: lista las ventanas abiertas (si no hay parámetros, significa esta lista)\n"
"list: lista las ventanas abiertas (si no hay parámetros, significa esta "
"lista)\n"
"-1: jump to previous window\n"
"+1: jump to next window\n"
"b#: jump to next window displaying buffer number #\n"
@@ -4378,42 +4381,42 @@ msgstr "%s no es posible asignar el valor entero con la cadena (\"%s\")\n"
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s no es posible asignar el color por defecto (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s fichero de configuración \"%s\" no encontrado.\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, línea %d: sintaxis inválida, falta \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, línea %d: identificador de sección desconocido (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, línea %d: sección inválida para la opción, línea ignorada\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, línea %d: sintaxis inválida, falta \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, línea %d: opción \"%s\" inválida\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4422,7 +4425,7 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción '%s'\n"
"Esperado: valor booleano: 'off' u 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4431,7 +4434,7 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción %s'\n"
"Esperado: entero comprendido entre %d y %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4440,34 +4443,42 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción '%s'\n"
"Esperado: una de estas cadenas: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, línea %d: nombre de color inválido para la opción '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s no es posible crear el fichero \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: creando fichero de configuración por defecto...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Creando fichero de configuración por defecto\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s: fichero de configuración, creado por %s v%s el %s#\n"
"# %s: fichero de configuración, creado por %s v%s el %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Guardar configuración a disco\n"
+44 -30
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:53+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s impossible d'allouer un nouveau pseudo\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "Impossible de déterminer le nom d'utilisateur"
@@ -2197,42 +2197,42 @@ msgstr ""
"%s la fonction \"weechat_plugin_init\" est introuvable dans l'extension \"%s"
"\", échec de chargement\n"
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr "Initialisation de l'extension \"%s\" %s\n"
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr "%s impossible d'initialiser l'extension \"%s\"\n"
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr "%s impossible de charger l'extension \"%s\" (mémoire insuffisante)\n"
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr "Extension \"%s\" (%s) chargée.\n"
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr "Extension \"%s\" déchargée.\n"
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr "%s extension \"%s\" non trouvée\n"
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr "Jour changé: %s\n"
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s le lag est élevé, déconnexion du serveur...\n"
@@ -4132,7 +4132,10 @@ msgid ""
"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)"
msgstr "restreint le dcc sortant à utiliser des ports dans la plage donnée (pratique pour le NAT) (syntaxe: un port simple, par exemple 5000, une plage de ports, par exemple 5000-5015, si non renseigné tout port peut être utilisé)"
msgstr ""
"restreint le dcc sortant à utiliser des ports dans la plage donnée (pratique "
"pour le NAT) (syntaxe: un port simple, par exemple 5000, une plage de ports, "
"par exemple 5000-5015, si non renseigné tout port peut être utilisé)"
#: src/common/weeconfig.c:711
msgid "IP address for outgoing dcc"
@@ -4457,42 +4460,42 @@ msgstr ""
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s impossible d'assigner la couleur par défaut (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s fichier de configuration \"%s\" non trouvé.\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, ligne %d: section invalide pour l'option, ligne ignorée\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, ligne %d: option \"%s\" invalide\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr "%s %s, ligne %d: options \"%s\" invalides pour le ignore\n"
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4501,7 +4504,7 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: valeur booléenne: 'off' ou 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4510,7 +4513,7 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: entier compris entre %d et %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4519,34 +4522,45 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: une de ces chaînes: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, ligne %d: nom de couleur invalide pour l'option '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s impossible de créer le fichier \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: création du fichier de configuration par défaut...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Création du fichier de configuration par défaut\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s: fichier de configuration, créé par %s v%s le %s#\n"
"# %s: fichier de configuration, créé par %s v%s le %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
"# ATTENTION ! Soyez prudents en modifiant ce fichier, WeeChat l'écrit en "
"quittant.\n"
"#\n"
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Sauvegarde de la configuration sur disque\n"
+35 -27
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: 2005-10-22 15:52+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\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"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr ""
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr ""
@@ -2046,42 +2046,42 @@ msgid ""
"load\n"
msgstr ""
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr ""
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr ""
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr ""
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr ""
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr ""
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr ""
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr ""
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr ""
@@ -4131,88 +4131,96 @@ msgstr ""
msgid "%s unable to assign default color (\"%s\")\n"
msgstr ""
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr ""
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr ""
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr ""
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr ""
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr ""
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
"Expected: boolean value: 'off' or 'on'\n"
msgstr ""
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
"Expected: integer between %d and %d\n"
msgstr ""
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
"Expected: one of these strings: "
msgstr ""
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr ""
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr ""
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr ""
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr ""
+13 -6
View File
@@ -1535,7 +1535,8 @@ config_read ()
int server_found;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1782,7 +1783,8 @@ config_create_default ()
t_gui_key *ptr_key;
char *expanded_name, *function_name;
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1802,9 +1804,11 @@ config_create_default ()
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when exiting.\n#\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
@@ -1970,12 +1974,13 @@ config_write (char *config_name)
t_irc_ignore *ptr_ignore;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
if (config_name)
filename = strdup (config_name);
else
{
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1996,9 +2001,11 @@ config_write (char *config_name)
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when exiting.\n#\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
+4 -1
View File
@@ -35,4 +35,7 @@ noinst_LIBRARIES = lib_weechat_plugins.a
lib_weechat_plugins_a_SOURCES = weechat-plugin.h \
plugins.h \
plugins.c
plugins.c \
plugins-interface.c \
plugins-config.h \
plugins-config.c
+291
View File
@@ -0,0 +1,291 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* plugins-config.c: plugins configuration */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../common/weechat.h"
#include "weechat-plugin.h"
#include "plugins-config.h"
#include "../irc/irc.h"
t_plugin_option *plugin_options = NULL;
/*
* plugin_config_search_internal: search a plugin option (internal function)
* This function should not be called directly.
*/
t_plugin_option *
plugin_config_search_internal (char *option)
{
t_plugin_option *ptr_plugin_option;
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
ptr_plugin_option = ptr_plugin_option->next_option)
{
if (ascii_strcasecmp (ptr_plugin_option->option_name,
option) == 0)
{
return ptr_plugin_option;
}
}
/* plugin option not found */
return NULL;
}
/*
* plugin_config_search: search a plugin option
*/
t_plugin_option *
plugin_config_search (t_weechat_plugin *plugin, char *option)
{
char *internal_option;
t_plugin_option *ptr_plugin_option;
internal_option = (char *)malloc (strlen (plugin->name) +
strlen (option) + 2);
if (!internal_option)
return NULL;
strcpy (internal_option, plugin->name);
strcat (internal_option, ".");
strcat (internal_option, option);
ptr_plugin_option = plugin_config_search_internal (internal_option);
free (internal_option);
return ptr_plugin_option;
}
/*
* plugin_config_set_internal: set value for a plugin option (internal function)
* This function should not be called directly.
*/
int
plugin_config_set_internal (char *option, char *value)
{
t_plugin_option *ptr_plugin_option;
ptr_plugin_option = plugin_config_search_internal (option);
if (ptr_plugin_option)
{
if (!value || !value[0])
{
/* remove option from list */
if (ptr_plugin_option->prev_option)
(ptr_plugin_option->prev_option)->next_option =
ptr_plugin_option->next_option;
else
plugin_options = ptr_plugin_option->next_option;
if (ptr_plugin_option->next_option)
(ptr_plugin_option->next_option)->prev_option =
ptr_plugin_option->prev_option;
return 1;
}
else
{
/* replace old value by new one */
if (ptr_plugin_option->value)
free (ptr_plugin_option->value);
ptr_plugin_option->value = strdup (value);
return 1;
}
}
else
{
ptr_plugin_option = (t_plugin_option *)malloc (sizeof (t_plugin_option));
if (ptr_plugin_option)
{
/* create new option */
ptr_plugin_option->option_name = strdup (option);
ptr_plugin_option->value = strdup (value);
if (plugin_options)
plugin_options->prev_option = ptr_plugin_option;
ptr_plugin_option->prev_option = NULL;
ptr_plugin_option->next_option = plugin_options;
plugin_options = ptr_plugin_option;
return 1;
}
}
/* failed to set plugin option */
return 0;
}
/*
* plugin_config_set: set value for a plugin option (create it if not found)
*/
int
plugin_config_set (t_weechat_plugin *plugin, char *option, char *value)
{
char *internal_option;
int return_code;
internal_option = (char *)malloc (strlen (plugin->name) +
strlen (option) + 2);
if (!internal_option)
return 0;
strcpy (internal_option, plugin->name);
strcat (internal_option, ".");
strcat (internal_option, option);
return_code = plugin_config_set_internal (internal_option, value);
free (internal_option);
return return_code;
}
/*
* plugin_config_read: read WeeChat plugins configuration
*/
void
plugin_config_read ()
{
int filename_length;
char *filename;
FILE *file;
int line_number;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return;
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "rt")) == NULL)
return;
line_number = 0;
while (!feof (file))
{
ptr_line = fgets (line, sizeof (line) - 1, file);
line_number++;
if (ptr_line)
{
/* skip spaces */
while (ptr_line[0] == ' ')
ptr_line++;
/* not a comment and not an empty line */
if ((ptr_line[0] != '#') && (ptr_line[0] != '\r')
&& (ptr_line[0] != '\n'))
{
pos = strchr (line, '=');
if (pos == NULL)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
WEECHAT_WARNING, filename, line_number);
}
else
{
pos[0] = '\0';
pos++;
pos2 = strchr (pos, '\r');
if (pos2 != NULL)
pos2[0] = '\0';
pos2 = strchr (pos, '\n');
if (pos2 != NULL)
pos2[0] = '\0';
plugin_config_set_internal (ptr_line, pos);
}
}
}
}
fclose (file);
free (filename);
}
/*
* plugin_config_write: write WeeChat configurtion
* return: 0 if ok
* < 0 if error
*/
int
plugin_config_write ()
{
int filename_length;
char *filename;
FILE *file;
time_t current_time;
t_plugin_option *ptr_plugin_option;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "wt")) == NULL)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
WEECHAT_ERROR, filename);
free (filename);
return -1;
}
current_time = time (NULL);
fprintf (file, _("#\n# %s plugins configuration file, created by "
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when options are updated.\n#\n"));
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
ptr_plugin_option = ptr_plugin_option->next_option)
{
fprintf (file, "%s=%s\n",
ptr_plugin_option->option_name,
ptr_plugin_option->value);
}
fclose (file);
chmod (filename, 0600);
free (filename);
return 0;
}
+41
View File
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WEECHAT_PLUGINS_CONFIG_H
#define __WEECHAT_PLUGINS_CONFIG_H 1
#define WEECHAT_PLUGINS_CONFIG_NAME "plugins.rc"
typedef struct t_plugin_option t_plugin_option;
struct t_plugin_option
{
char *option_name; /* option name in config file */
char *value; /* value of option */
t_plugin_option *prev_option; /* link to previous option */
t_plugin_option *next_option; /* link to next option */
};
extern t_plugin_option *plugin_config_search (t_weechat_plugin *, char *);
extern int plugin_config_set (t_weechat_plugin *, char *, char *);
extern void plugin_config_read ();
extern int plugin_config_write ();
#endif /* plugins-config.h */
+665
View File
@@ -0,0 +1,665 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* plugins-interface.c: WeeChat plugins interface */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../common/weechat.h"
#include "plugins.h"
#include "plugins-config.h"
#include "../common/command.h"
#include "../common/weeconfig.h"
#include "../irc/irc.h"
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_ascii_strncasecmp: locale and case independent string comparison
* with max length
*/
int
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
char *string1, char *string2, int max)
{
/* make gcc happy */
(void) plugin;
return ascii_strncasecmp (string1, string2, max);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
int
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
{
char *dir_name;
int dir_length;
/* make gcc happy */
(void) plugin;
if (!path)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (path) + 2;
dir_name =
(char *) malloc (dir_length * sizeof (char));
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
if (mkdir (dir_name, 0755) < 0)
{
if (errno != EEXIST)
{
free (dir_name);
return 0;
}
}
free (dir_name);
return 1;
}
/*
* weechat_plugin_exec_on_files: find files in a directory and execute a
* function on each file
*/
void
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
int (*callback)(t_weechat_plugin *, char *))
{
if (directory && callback)
plugin_exec_on_files (plugin, directory, callback);
}
/*
* weechat_plugin_printf: print a message on a server or channel buffer
*/
void
weechat_plugin_printf (t_weechat_plugin *plugin,
char *server, char *channel, char *message, ...)
{
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
ptr_buffer = plugin_find_buffer (server, channel);
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", buf);
}
/*
* weechat_plugin_printf_server: print a message on server buffer
*/
void
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", buf);
}
/*
* weechat_plugin_infobar_printf: print a message in infobar
*/
void
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
{
va_list argptr;
static char buf[1024];
if (!plugin || (time_displayed < 0) || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
}
/*
* weechat_plugin_msg_handler_add: add a message handler
*/
t_plugin_msg_handler *
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && message && handler_func)
return plugin_msg_handler_add (plugin, message, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_msg_handler_remove: remove a WeeChat message handler
*/
void
weechat_plugin_msg_handler_remove (t_weechat_plugin *plugin,
t_plugin_msg_handler *msg_handler)
{
if (plugin && msg_handler)
plugin_msg_handler_remove (plugin, msg_handler);
}
/*
* weechat_plugin_msg_handler_remove_all: remove all WeeChat message handlers
*/
void
weechat_plugin_msg_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_msg_handler_remove_all (plugin);
}
/*
* weechat_plugin_cmd_handler_add: add a command handler
*/
t_plugin_cmd_handler *
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
char *description, char *arguments,
char *arguments_description,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && command && handler_func)
return plugin_cmd_handler_add (plugin, command, description, arguments,
arguments_description,
handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_cmd_plugin_handler_remove: remove a WeeChat command handler
*/
void
weechat_plugin_cmd_handler_remove (t_weechat_plugin *plugin,
t_plugin_cmd_handler *cmd_handler)
{
if (plugin && cmd_handler)
plugin_cmd_handler_remove (plugin, cmd_handler);
}
/*
* weechat_plugin_cmd_handler_remove_all: remove all WeeChat command handlers
*/
void
weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_cmd_handler_remove_all (plugin);
}
/*
* weechat_plugin_exec_command: execute a command (simulate user entry)
*/
void
weechat_plugin_exec_command (t_weechat_plugin *plugin,
char *server, char *channel, char *command)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !command)
return;
ptr_buffer = plugin_find_buffer (server, channel);
if (ptr_buffer)
user_command (SERVER(ptr_buffer), ptr_buffer, command);
}
/*
* weechat_plugin_get_info: get info about WeeChat
* WARNING: caller should free string returned
* by this function after use
*/
char *
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, char *channel)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !info)
return NULL;
ptr_buffer = plugin_find_buffer (server, channel);
if (!ptr_buffer)
return NULL;
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->nick))
return strdup (SERVER(ptr_buffer)->nick);
}
else if (ascii_strcasecmp (info, "channel") == 0)
{
if (BUFFER_IS_CHANNEL(ptr_buffer))
return strdup (CHANNEL(gui_current_window->buffer)->name);
}
else if (ascii_strcasecmp (info, "server") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->name))
return strdup (SERVER(ptr_buffer)->name);
}
else if (ascii_strcasecmp (info, "away") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected))
{
if (SERVER(ptr_buffer)->is_away)
return strdup ("1");
else
return strdup ("0");
}
}
else if (ascii_strcasecmp (info, "weechatdir") == 0)
{
/* WARNING: deprecated info, you should use weechat_dir */
/* will be removed in a future version */
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
{
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
{
return strdup (WEECHAT_LIBDIR);
}
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
{
return strdup (WEECHAT_SHAREDIR);
}
/* info not found */
return NULL;
}
/*
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
*/
t_plugin_dcc_info *
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
{
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
t_irc_dcc *ptr_dcc;
if (!plugin)
return NULL;
if (dcc_list)
{
dcc_info = NULL;
last_dcc_info = NULL;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
if (new_dcc_info)
{
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
new_dcc_info->type = ptr_dcc->type;
new_dcc_info->status = ptr_dcc->status;
new_dcc_info->start_time = ptr_dcc->start_time;
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
new_dcc_info->addr = ptr_dcc->addr;
new_dcc_info->port = ptr_dcc->port;
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
new_dcc_info->size = ptr_dcc->size;
new_dcc_info->pos = ptr_dcc->pos;
new_dcc_info->start_resume = ptr_dcc->start_resume;
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
new_dcc_info->prev_dcc = last_dcc_info;
new_dcc_info->next_dcc = NULL;
if (!dcc_info)
{
dcc_info = new_dcc_info;
last_dcc_info = new_dcc_info;
}
else
last_dcc_info->next_dcc = new_dcc_info;
}
}
return dcc_info;
}
return NULL;
}
/*
* weechat_plugin_free_dcc_info: free dcc info struct list
*/
void
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
{
t_plugin_dcc_info *new_dcc_info;
if (!plugin || !dcc_info)
return;
while (dcc_info)
{
if (dcc_info->server)
free (dcc_info->server);
if (dcc_info->channel)
free (dcc_info->channel);
if (dcc_info->nick)
free (dcc_info->nick);
if (dcc_info->filename)
free (dcc_info->filename);
if (dcc_info->local_filename)
free (dcc_info->local_filename);
new_dcc_info = dcc_info->next_dcc;
free (dcc_info);
dcc_info = new_dcc_info;
}
}
/*
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
char buf_temp[1024], *color_name;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_plugin_get_config: get value of a config option
*/
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
/* option not found */
return NULL;
}
/*
* weechat_plugin_set_config: set value of a config option
*/
int
weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value)
{
char *pos, *server_name;
t_irc_server *ptr_server;
t_config_option *ptr_option;
/* make gcc happy */
(void) plugin;
if (!option || !value)
return 0;
pos = strchr (option, '.');
if (pos)
{
/* server config option modification */
server_name = (char *)malloc (pos - option + 1);
strncpy (server_name, option, pos - option);
if (server_name)
{
ptr_server = server_search (server_name);
free (server_name);
if (ptr_server)
return (config_set_server_value (ptr_server, pos + 1, value) == 0);
}
}
else
{
ptr_option = config_option_search (option);
if (ptr_option)
{
if (ptr_option->handler_change)
{
if (config_option_set_value (ptr_option, value) == 0)
{
(void) (ptr_option->handler_change());
return 1;
}
}
}
}
/* failed to set config option */
return 0;
}
/*
* weechat_plugin_get_plugin_config: get value of a plugin config option
*/
char *
weechat_plugin_get_plugin_config (t_weechat_plugin *plugin, char *option)
{
t_plugin_option *ptr_plugin_option;
if (!option)
return NULL;
ptr_plugin_option = plugin_config_search (plugin, option);
if (ptr_plugin_option)
return (ptr_plugin_option->value) ? strdup (ptr_plugin_option->value) : NULL;
/* option not found */
return NULL;
}
/*
* weechat_plugin_set_plugin_config: set value of a plugin config option
*/
int
weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char *value)
{
if (!option)
return 0;
if (plugin_config_set (plugin, option, value))
{
plugin_config_write ();
return 1;
}
return 0;
}
+12 -539
View File
@@ -34,8 +34,8 @@
#include <dirent.h>
#include <dlfcn.h>
#include "../common/weechat.h"
#include "weechat-plugin.h"
#include "plugins.h"
#include "plugins-config.h"
#include "../common/command.h"
#include "../common/weeconfig.h"
#include "../irc/irc.h"
@@ -663,6 +663,9 @@ plugin_load (char *filename)
new_plugin->get_dcc_info = &weechat_plugin_get_dcc_info;
new_plugin->free_dcc_info = &weechat_plugin_free_dcc_info;
new_plugin->get_config = &weechat_plugin_get_config;
new_plugin->set_config = &weechat_plugin_set_config;
new_plugin->get_plugin_config = &weechat_plugin_get_plugin_config;
new_plugin->set_plugin_config = &weechat_plugin_set_plugin_config;
/* handlers */
new_plugin->msg_handlers = NULL;
@@ -880,6 +883,10 @@ plugin_init ()
{
char *list_plugins, *pos, *pos2;
/* read plugins options on disk */
plugin_config_read ();
/* auto-load plugins if asked */
if (cfg_plugins_autoload && cfg_plugins_autoload[0])
{
if (ascii_strcasecmp (cfg_plugins_autoload, "*") == 0)
@@ -914,543 +921,9 @@ plugin_init ()
void
plugin_end ()
{
/* write plugins config options */
plugin_config_write ();
/* unload all plugins */
plugin_unload_all ();
}
/*************************** Public plugin interface **************************/
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_ascii_strncasecmp: locale and case independent string comparison
* with max length
*/
int
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
char *string1, char *string2, int max)
{
/* make gcc happy */
(void) plugin;
return ascii_strncasecmp (string1, string2, max);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
int
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
{
char *dir_name;
int dir_length;
/* make gcc happy */
(void) plugin;
if (!path)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (path) + 2;
dir_name =
(char *) malloc (dir_length * sizeof (char));
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
if (mkdir (dir_name, 0755) < 0)
{
if (errno != EEXIST)
{
free (dir_name);
return 0;
}
}
free (dir_name);
return 1;
}
/*
* weechat_plugin_exec_on_files: find files in a directory and execute a
* function on each file
*/
void
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
int (*callback)(t_weechat_plugin *, char *))
{
if (directory && callback)
plugin_exec_on_files (plugin, directory, callback);
}
/*
* weechat_plugin_printf: print a message on a server or channel buffer
*/
void
weechat_plugin_printf (t_weechat_plugin *plugin,
char *server, char *channel, char *message, ...)
{
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
ptr_buffer = plugin_find_buffer (server, channel);
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", buf);
}
/*
* weechat_plugin_printf_server: print a message on server buffer
*/
void
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", buf);
}
/*
* weechat_plugin_infobar_printf: print a message in infobar
*/
void
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
{
va_list argptr;
static char buf[1024];
if (!plugin || (time_displayed < 0) || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
}
/*
* weechat_plugin_msg_handler_add: add a message handler
*/
t_plugin_msg_handler *
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && message && handler_func)
return plugin_msg_handler_add (plugin, message, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_msg_handler_remove: remove a WeeChat message handler
*/
void
weechat_plugin_msg_handler_remove (t_weechat_plugin *plugin,
t_plugin_msg_handler *msg_handler)
{
if (plugin && msg_handler)
plugin_msg_handler_remove (plugin, msg_handler);
}
/*
* weechat_plugin_msg_handler_remove_all: remove all WeeChat message handlers
*/
void
weechat_plugin_msg_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_msg_handler_remove_all (plugin);
}
/*
* weechat_plugin_cmd_handler_add: add a command handler
*/
t_plugin_cmd_handler *
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
char *description, char *arguments,
char *arguments_description,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && command && handler_func)
return plugin_cmd_handler_add (plugin, command, description, arguments,
arguments_description,
handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_cmd_plugin_handler_remove: remove a WeeChat command handler
*/
void
weechat_plugin_cmd_handler_remove (t_weechat_plugin *plugin,
t_plugin_cmd_handler *cmd_handler)
{
if (plugin && cmd_handler)
plugin_cmd_handler_remove (plugin, cmd_handler);
}
/*
* weechat_plugin_cmd_handler_remove_all: remove all WeeChat command handlers
*/
void
weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_cmd_handler_remove_all (plugin);
}
/*
* weechat_plugin_exec_command: execute a command (simulate user entry)
*/
void
weechat_plugin_exec_command (t_weechat_plugin *plugin,
char *server, char *channel, char *command)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !command)
return;
ptr_buffer = plugin_find_buffer (server, channel);
if (ptr_buffer)
user_command (SERVER(ptr_buffer), ptr_buffer, command);
}
/*
* weechat_plugin_get_info: get info about WeeChat
* WARNING: caller should free string returned
* by this function after use
*/
char *
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, char *channel)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !info)
return NULL;
ptr_buffer = plugin_find_buffer (server, channel);
if (!ptr_buffer)
return NULL;
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->nick))
return strdup (SERVER(ptr_buffer)->nick);
}
else if (ascii_strcasecmp (info, "channel") == 0)
{
if (BUFFER_IS_CHANNEL(ptr_buffer))
return strdup (CHANNEL(gui_current_window->buffer)->name);
}
else if (ascii_strcasecmp (info, "server") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->name))
return strdup (SERVER(ptr_buffer)->name);
}
else if (ascii_strcasecmp (info, "away") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected))
{
if (SERVER(ptr_buffer)->is_away)
return strdup ("1");
else
return strdup ("0");
}
}
else if (ascii_strcasecmp (info, "weechatdir") == 0)
{
/* WARNING: deprecated info, you should use weechat_dir */
/* will be removed in a future version */
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
{
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
{
return strdup (WEECHAT_LIBDIR);
}
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
{
return strdup (WEECHAT_SHAREDIR);
}
/* info not found */
return NULL;
}
/*
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
*/
t_plugin_dcc_info *
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
{
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
t_irc_dcc *ptr_dcc;
if (!plugin)
return NULL;
if (dcc_list)
{
dcc_info = NULL;
last_dcc_info = NULL;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
if (new_dcc_info)
{
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
new_dcc_info->type = ptr_dcc->type;
new_dcc_info->status = ptr_dcc->status;
new_dcc_info->start_time = ptr_dcc->start_time;
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
new_dcc_info->addr = ptr_dcc->addr;
new_dcc_info->port = ptr_dcc->port;
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
new_dcc_info->size = ptr_dcc->size;
new_dcc_info->pos = ptr_dcc->pos;
new_dcc_info->start_resume = ptr_dcc->start_resume;
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
new_dcc_info->prev_dcc = last_dcc_info;
new_dcc_info->next_dcc = NULL;
if (!dcc_info)
{
dcc_info = new_dcc_info;
last_dcc_info = new_dcc_info;
}
else
last_dcc_info->next_dcc = new_dcc_info;
}
}
return dcc_info;
}
return NULL;
}
/*
* weechat_plugin_free_dcc_info: free dcc info struct list
*/
void
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
{
t_plugin_dcc_info *new_dcc_info;
if (!plugin || !dcc_info)
return;
while (dcc_info)
{
if (dcc_info->server)
free (dcc_info->server);
if (dcc_info->channel)
free (dcc_info->channel);
if (dcc_info->nick)
free (dcc_info->nick);
if (dcc_info->filename)
free (dcc_info->filename);
if (dcc_info->local_filename)
free (dcc_info->local_filename);
new_dcc_info = dcc_info->next_dcc;
free (dcc_info);
dcc_info = new_dcc_info;
}
}
/*
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
char buf_temp[1024], *color_name;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_get_config: get value of a config option
*/
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
/* option not found */
return NULL;
}
+16
View File
@@ -30,9 +30,25 @@ typedef void (t_weechat_end_func) (t_weechat_plugin *);
extern t_weechat_plugin *weechat_plugins;
extern t_weechat_plugin *last_weechat_plugin;
extern t_gui_buffer *plugin_find_buffer (char *, char *);
extern void plugin_exec_on_files (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
extern t_weechat_plugin *plugin_search (char *);
extern t_plugin_msg_handler *plugin_msg_handler_add (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
extern t_plugin_cmd_handler *plugin_cmd_handler_add (t_weechat_plugin *, char *,
char *, char *, char *,
t_plugin_handler_func *,
char *, void *);
extern int plugin_msg_handler_exec (char *, char *, char *);
extern int plugin_cmd_handler_exec (char *, char *, char *);
extern void plugin_msg_handler_remove (t_weechat_plugin *,
t_plugin_msg_handler *);
extern void plugin_cmd_handler_remove (t_weechat_plugin *,
t_plugin_cmd_handler *);
extern void plugin_msg_handler_remove_all (t_weechat_plugin *);
extern void plugin_cmd_handler_remove_all (t_weechat_plugin *);
extern t_weechat_plugin *plugin_load (char *);
extern void plugin_remove (t_weechat_plugin *);
extern void plugin_unload (t_weechat_plugin *);
+6
View File
@@ -144,6 +144,9 @@ struct t_weechat_plugin
t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *);
void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *);
char *(*get_config) (t_weechat_plugin *, char *);
int (*set_config) (t_weechat_plugin *, char *, char *);
char *(*get_plugin_config) (t_weechat_plugin *, char *);
int (*set_plugin_config) (t_weechat_plugin *, char *, char *);
/* WeeChat developers: ALWAYS add new functions at the end */
};
@@ -181,5 +184,8 @@ extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *, char *
extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *);
extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *);
extern char *weechat_plugin_get_config (t_weechat_plugin *, char *);
extern int weechat_plugin_set_config (t_weechat_plugin *, char *, char *);
extern char *weechat_plugin_get_plugin_config (t_weechat_plugin *, char *);
extern int weechat_plugin_set_plugin_config (t_weechat_plugin *, char *, char *);
#endif /* weechat-plugin.h */
+68 -1
View File
@@ -35,7 +35,7 @@
@title WeeChat - User guide
@subtitle Fast, light and extensible IRC client
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 23 2005
@subtitle Documentation for WeeChat v0.1.6-cvs - October, 24 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2066,6 +2066,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+68 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Gui@'on de usuario.
@subtitle Cliente IRC r@'apido, peque@~no y extensible
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 23 de octubre de 2005
@subtitle Documentaci@'on para WeeChat v0.1.6-cvs - 24 de octubre de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2069,6 +2069,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+70 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guide utilisateur
@subtitle Client IRC rapide, l@'eger et extensible
@subtitle Documentation pour WeeChat v0.1.6-cvs - 23 octobre 2005
@subtitle Documentation pour WeeChat v0.1.6-cvs - 24 octobre 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2090,6 +2090,75 @@ NB: le r@'esultat doit @^etre lib@'er@'e par un appel @`a la fonction
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Modifie la valeur d'une option de configuration WeeChat.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a mettre @`a jour
@item @option{value}: nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si l'option a @'et@'e modifi@'ee avec succ@`es, 0 si une erreur
s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Renvoie la valeur d'une option de l'extension.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a lire
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
La valeur de l'option, NULL si non trouv@'ee.@*
NB: le r@'esultat doit @^etre lib@'er@'e par un appel @`a la fonction
``free'' apr@`es utilisation.@*
@*
@emph{Exemple :}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "ma_variable");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Modifie la valeur d'une option de l'extension.@*
@emph{Param@`etres :}
@itemize @minus
@item @option{plugin}: un pointeur vers la structure de l'extension
@item @option{option}: nom de l'option @`a mettre @`a jour
@item @option{value}: nouvelle valeur pour l'option
@end itemize
@*
@emph{Valeur renvoy@'ee :}@*
@*
1 si l'option a @'et@'e modifi@'ee avec succ@`es, 0 si une erreur
s'est produite.@*
@*
@emph{Exemple :}@*
@*
@code{plugin->set_plugin_config (plugin, "ma_variable", "valeur");}@*
@*
@end itemize
@subsection Compiler l'extension
+68 -1
View File
@@ -36,7 +36,7 @@
@title WeeChat - Guia do Utilizador
@subtitle Cliente de IRC rapido, leve e extencivel
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 23 de outubro de 2005
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.6-cvs - 24 de outubro de 2005
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
@@ -2064,6 +2064,73 @@ use.@*
@code{char *value2 = plugin->get_config (plugin, "freenode.server_autojoin");}@*
@*
@item
@command{int set_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a WeeChat config option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_config (plugin, "look_nicklist", "off");}@*
@*
@item
@command{char *get_plugin_config (t_weechat_plugin
*plugin, char *option)}@*
@*
Return value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to read
@end itemize
@*
@emph{Return value:}@*
@*
Value of option, NULL if not found.@*
Note: result has to be free by a call to ``free'' function after
use.@*
@*
@emph{Example:}@*
@*
@code{char *value = plugin->get_plugin_config (plugin, "my_var");}@*
@*
@item
@command{int set_plugin_config (t_weechat_plugin
*plugin, char *option, char *value)}@*
@*
Update value of a plugin option.@*
@emph{Arguments:}
@itemize @minus
@item @option{plugin}: pointer to plugin structure
@item @option{option}: name of option to update
@item @option{value}: new value for option
@end itemize
@*
@emph{Return value:}@*
@*
1 if option was updated successfully, 0 if error occured.@*
@*
@emph{Example:}@*
@*
@code{plugin->set_plugin_config (plugin, "my_var", "value");}@*
@*
@end itemize
@subsection Compile plugin
+37 -29
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:32+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s nemůžu přidělit novou přezdívku\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "Nemůžu získat jméno uživatele"
@@ -2175,42 +2175,42 @@ msgstr ""
"%s funkce \"weechat_plugin_init\" nebyla v pluginu \"%s\" nalezena, načtení "
"selhalo\n"
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr "Inicializuji plugin \"%s\" %s\n"
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr "%s nemohu načíst plugin \"%s\"\n"
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr "%s nemohu načíst plugin \"%s\" (nedostatek paměti)\n"
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr "Plugin \"%s\" (%s) načten.\n"
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr "Plugin \"%s\" odebrán.\n"
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr "%s plugin \"%s\" nenalezen\n"
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr "Změnil se den na %s\n"
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s zpoždění je veliké, odpojuji se od serveru...\n"
@@ -4395,42 +4395,42 @@ msgstr "%s nemohu přiřadit výchozí číslo s řetězcem (\"%s\")\n"
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s nemohu přiřadit výchozí barvu (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s konfigurační soubor \"%s\" nenalezen\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, řádek %d: nevalidní syntaxe, chybí \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, řádek %d: neznámý identifikátor sekce (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, řádek %d: nevalidní sekce pro volbu, řádek je ignorován\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, řádek %d: nevalidní syntax, chybí \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, řádek %d: nevalidní volba \"%s\"\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr "%s %s, řádek %d: nevalidní volba \"%s\" pro ignorování\n"
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4439,7 +4439,7 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: hodnota boolean: 'off' nebo 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4448,7 +4448,7 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: celé číslo mezi %d a %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4457,34 +4457,42 @@ msgstr ""
"%s %s, řádek %d: nevalidní hodnota pro volbu '%s'\n"
"Očekáváno: jeden z těchto řetězců: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, řádek %d: nevalidní jméno barvy pro hodnotu '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s nemohu vytvořit soubor \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: vytvářím výchozí konfigurační soubor...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Vytvářím výchozí konfigurační soubor\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s konfigurační soubor, vytvořil %s v%s %s#\n"
"# %s konfigurační soubor, vytvořil %s v%s %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Ukládám konfiguraci na disk\n"
+42 -31
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:53+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s no ha sido posible crear un nuevo nick\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "No ha sido posible obtener el nombre de usuario"
@@ -2172,42 +2172,42 @@ msgid ""
"load\n"
msgstr ""
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr ""
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr ""
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr ""
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr ""
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr ""
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr ""
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr ""
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s el lag (retraso) es alto, desconectando del servidor...\n"
@@ -2722,7 +2722,9 @@ msgstr "gesti
msgid ""
"[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | "
"all]]]"
msgstr "[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | all]]]"
msgstr ""
"[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | "
"all]]]"
#: src/common/command.c:140
#, fuzzy
@@ -2735,7 +2737,8 @@ msgid ""
"splitv: split current window vertically\n"
"merge: merge window with another"
msgstr ""
"list: lista las ventanas abiertas (si no hay parámetros, significa esta lista)\n"
"list: lista las ventanas abiertas (si no hay parámetros, significa esta "
"lista)\n"
"-1: jump to previous window\n"
"+1: jump to next window\n"
"b#: jump to next window displaying buffer number #\n"
@@ -4378,42 +4381,42 @@ msgstr "%s no es posible asignar el valor entero con la cadena (\"%s\")\n"
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s no es posible asignar el color por defecto (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s fichero de configuración \"%s\" no encontrado.\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, línea %d: sintaxis inválida, falta \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, línea %d: identificador de sección desconocido (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, línea %d: sección inválida para la opción, línea ignorada\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, línea %d: sintaxis inválida, falta \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, línea %d: opción \"%s\" inválida\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4422,7 +4425,7 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción '%s'\n"
"Esperado: valor booleano: 'off' u 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4431,7 +4434,7 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción %s'\n"
"Esperado: entero comprendido entre %d y %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4440,34 +4443,42 @@ msgstr ""
"%s %s, línea %d: valor inválido para la opción '%s'\n"
"Esperado: una de estas cadenas: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, línea %d: nombre de color inválido para la opción '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s no es posible crear el fichero \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: creando fichero de configuración por defecto...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Creando fichero de configuración por defecto\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s: fichero de configuración, creado por %s v%s el %s#\n"
"# %s: fichero de configuración, creado por %s v%s el %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Guardar configuración a disco\n"
+44 -30
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.1.6-cvs\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2005-10-22 15:52+0200\n"
"PO-Revision-Date: 2005-10-22 15:53+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\n"
"PO-Revision-Date: 2005-10-23 23:31+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr "%s impossible d'allouer un nouveau pseudo\n"
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr "Impossible de déterminer le nom d'utilisateur"
@@ -2197,42 +2197,42 @@ msgstr ""
"%s la fonction \"weechat_plugin_init\" est introuvable dans l'extension \"%s"
"\", échec de chargement\n"
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr "Initialisation de l'extension \"%s\" %s\n"
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr "%s impossible d'initialiser l'extension \"%s\"\n"
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr "%s impossible de charger l'extension \"%s\" (mémoire insuffisante)\n"
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr "Extension \"%s\" (%s) chargée.\n"
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr "Extension \"%s\" déchargée.\n"
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr "%s extension \"%s\" non trouvée\n"
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr "Jour changé: %s\n"
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr "%s le lag est élevé, déconnexion du serveur...\n"
@@ -4132,7 +4132,10 @@ msgid ""
"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)"
msgstr "restreint le dcc sortant à utiliser des ports dans la plage donnée (pratique pour le NAT) (syntaxe: un port simple, par exemple 5000, une plage de ports, par exemple 5000-5015, si non renseigné tout port peut être utilisé)"
msgstr ""
"restreint le dcc sortant à utiliser des ports dans la plage donnée (pratique "
"pour le NAT) (syntaxe: un port simple, par exemple 5000, une plage de ports, "
"par exemple 5000-5015, si non renseigné tout port peut être utilisé)"
#: src/common/weeconfig.c:711
msgid "IP address for outgoing dcc"
@@ -4457,42 +4460,42 @@ msgstr ""
msgid "%s unable to assign default color (\"%s\")\n"
msgstr "%s impossible d'assigner la couleur par défaut (\"%s\")\n"
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr "%s fichier de configuration \"%s\" non trouvé.\n"
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"]\"\n"
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr "%s %s, ligne %d: section inconnue (\"%s\")\n"
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr "%s %s, ligne %d: section invalide pour l'option, ligne ignorée\n"
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr "%s %s, ligne %d: syntaxe invalide, il manque \"=\"\n"
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr "%s %s, ligne %d: option \"%s\" invalide\n"
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr "%s %s, ligne %d: options \"%s\" invalides pour le ignore\n"
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
@@ -4501,7 +4504,7 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: valeur booléenne: 'off' ou 'on'\n"
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4510,7 +4513,7 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: entier compris entre %d et %d\n"
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
@@ -4519,34 +4522,45 @@ msgstr ""
"%s %s, ligne %d: valeur invalide pour l'option '%s'\n"
"Attendu: une de ces chaînes: "
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr "%s %s, ligne %d: nom de couleur invalide pour l'option '%s'\n"
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr "%s impossible de créer le fichier \"%s\"\n"
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr "%s: création du fichier de configuration par défaut...\n"
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr "Création du fichier de configuration par défaut\n"
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
"#\n"
"# %s: fichier de configuration, créé par %s v%s le %s#\n"
"# %s: fichier de configuration, créé par %s v%s le %s"
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
"# ATTENTION ! Soyez prudents en modifiant ce fichier, WeeChat l'écrit en "
"quittant.\n"
"#\n"
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr "Sauvegarde de la configuration sur disque\n"
+35 -27
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: 2005-10-22 15:52+0200\n"
"POT-Creation-Date: 2005-10-23 23:28+0200\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"
@@ -20,7 +20,7 @@ msgstr ""
msgid "%s cannot allocate new nick\n"
msgstr ""
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1934
#: src/irc/irc-server.c:180 src/common/weeconfig.c:1938
msgid "Unable to get user's name"
msgstr ""
@@ -2046,42 +2046,42 @@ msgid ""
"load\n"
msgstr ""
#: src/plugins/plugins.c:684
#: src/plugins/plugins.c:687
#, c-format
msgid "Initializing plugin \"%s\" %s\n"
msgstr ""
#: src/plugins/plugins.c:692
#: src/plugins/plugins.c:695
#, c-format
msgid "%s unable to initialize plugin \"%s\"\n"
msgstr ""
#: src/plugins/plugins.c:703
#: src/plugins/plugins.c:706
#, c-format
msgid "%s unable to load plugin \"%s\" (not enough memory)\n"
msgstr ""
#: src/plugins/plugins.c:711
#: src/plugins/plugins.c:714
#, c-format
msgid "Plugin \"%s\" (%s) loaded.\n"
msgstr ""
#: src/plugins/plugins.c:852
#: src/plugins/plugins.c:855
#, c-format
msgid "Plugin \"%s\" unloaded.\n"
msgstr ""
#: src/plugins/plugins.c:858
#: src/plugins/plugins.c:861
#, c-format
msgid "%s plugin \"%s\" not found\n"
msgstr ""
#: src/gui/curses/gui-input.c:322
#: src/gui/curses/gui-input.c:325
#, c-format
msgid "Day changed to %s\n"
msgstr ""
#: src/gui/curses/gui-input.c:405
#: src/gui/curses/gui-input.c:408
#, c-format
msgid "%s lag is high, disconnecting from server...\n"
msgstr ""
@@ -4131,88 +4131,96 @@ msgstr ""
msgid "%s unable to assign default color (\"%s\")\n"
msgstr ""
#: src/common/weeconfig.c:1547
#: src/common/weeconfig.c:1548
#, c-format
msgid "%s config file \"%s\" not found.\n"
msgstr ""
#: src/common/weeconfig.c:1579
#: src/common/weeconfig.c:1580
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"]\"\n"
msgstr ""
#: src/common/weeconfig.c:1596
#: src/common/weeconfig.c:1597
#, c-format
msgid "%s %s, line %d: unknown section identifier (\"%s\")\n"
msgstr ""
#: src/common/weeconfig.c:1614
#: src/common/weeconfig.c:1615
#, c-format
msgid "%s %s, line %d: invalid section for option, line is ignored\n"
msgstr ""
#: src/common/weeconfig.c:1622
#: src/common/weeconfig.c:1623
#, c-format
msgid "%s %s, line %d: invalid syntax, missing \"=\"\n"
msgstr ""
#: src/common/weeconfig.c:1659 src/common/weeconfig.c:1685
#: src/common/weeconfig.c:1660 src/common/weeconfig.c:1686
#, c-format
msgid "%s %s, line %d: invalid option \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1665
#: src/common/weeconfig.c:1666
#, c-format
msgid "%s %s, line %d: invalid ignore options \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1696
#: src/common/weeconfig.c:1697
#, c-format
msgid ""
"%s %s, line %d: invalid value foroption '%s'\n"
"Expected: boolean value: 'off' or 'on'\n"
msgstr ""
#: src/common/weeconfig.c:1705
#: src/common/weeconfig.c:1706
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
"Expected: integer between %d and %d\n"
msgstr ""
#: src/common/weeconfig.c:1716
#: src/common/weeconfig.c:1717
#, c-format
msgid ""
"%s %s, line %d: invalid value for option '%s'\n"
"Expected: one of these strings: "
msgstr ""
#: src/common/weeconfig.c:1732
#: src/common/weeconfig.c:1733
#, c-format
msgid "%s %s, line %d: invalid color name for option '%s'\n"
msgstr ""
#: src/common/weeconfig.c:1794 src/common/weeconfig.c:1989
#: src/common/weeconfig.c:1796 src/common/weeconfig.c:1994
#, c-format
msgid "%s cannot create file \"%s\"\n"
msgstr ""
#: src/common/weeconfig.c:1800
#: src/common/weeconfig.c:1802
#, c-format
msgid "%s: creating default config file...\n"
msgstr ""
#: src/common/weeconfig.c:1801
#: src/common/weeconfig.c:1803
msgid "Creating default config file\n"
msgstr ""
#: src/common/weeconfig.c:1804 src/common/weeconfig.c:1998
#: src/common/weeconfig.c:1806 src/common/weeconfig.c:2003
#, c-format
msgid ""
"#\n"
"# %s configuration file, created by %s v%s on %s#\n"
"# %s configuration file, created by %s v%s on %s"
msgstr ""
#: src/common/weeconfig.c:1995
#: src/common/weeconfig.c:1810 src/common/weeconfig.c:2007
#, c-format
msgid ""
"# WARNING! Be careful when editing this file, WeeChat writes this file when "
"exiting.\n"
"#\n"
msgstr ""
#: src/common/weeconfig.c:2000
msgid "Saving config to disk\n"
msgstr ""
+13 -6
View File
@@ -1535,7 +1535,8 @@ config_read ()
int server_found;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1782,7 +1783,8 @@ config_create_default ()
t_gui_key *ptr_key;
char *expanded_name, *function_name;
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1802,9 +1804,11 @@ config_create_default ()
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when exiting.\n#\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
@@ -1970,12 +1974,13 @@ config_write (char *config_name)
t_irc_ignore *ptr_ignore;
t_gui_key *ptr_key;
char *expanded_name, *function_name;
if (config_name)
filename = strdup (config_name);
else
{
filename_length = strlen (weechat_home) + 64;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
@@ -1996,9 +2001,11 @@ config_write (char *config_name)
current_time = time (NULL);
fprintf (file, _("#\n# %s configuration file, created by "
"%s v%s on %s#\n"),
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when exiting.\n#\n"));
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
+4 -1
View File
@@ -35,4 +35,7 @@ noinst_LIBRARIES = lib_weechat_plugins.a
lib_weechat_plugins_a_SOURCES = weechat-plugin.h \
plugins.h \
plugins.c
plugins.c \
plugins-interface.c \
plugins-config.h \
plugins-config.c
+291
View File
@@ -0,0 +1,291 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* plugins-config.c: plugins configuration */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../common/weechat.h"
#include "weechat-plugin.h"
#include "plugins-config.h"
#include "../irc/irc.h"
t_plugin_option *plugin_options = NULL;
/*
* plugin_config_search_internal: search a plugin option (internal function)
* This function should not be called directly.
*/
t_plugin_option *
plugin_config_search_internal (char *option)
{
t_plugin_option *ptr_plugin_option;
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
ptr_plugin_option = ptr_plugin_option->next_option)
{
if (ascii_strcasecmp (ptr_plugin_option->option_name,
option) == 0)
{
return ptr_plugin_option;
}
}
/* plugin option not found */
return NULL;
}
/*
* plugin_config_search: search a plugin option
*/
t_plugin_option *
plugin_config_search (t_weechat_plugin *plugin, char *option)
{
char *internal_option;
t_plugin_option *ptr_plugin_option;
internal_option = (char *)malloc (strlen (plugin->name) +
strlen (option) + 2);
if (!internal_option)
return NULL;
strcpy (internal_option, plugin->name);
strcat (internal_option, ".");
strcat (internal_option, option);
ptr_plugin_option = plugin_config_search_internal (internal_option);
free (internal_option);
return ptr_plugin_option;
}
/*
* plugin_config_set_internal: set value for a plugin option (internal function)
* This function should not be called directly.
*/
int
plugin_config_set_internal (char *option, char *value)
{
t_plugin_option *ptr_plugin_option;
ptr_plugin_option = plugin_config_search_internal (option);
if (ptr_plugin_option)
{
if (!value || !value[0])
{
/* remove option from list */
if (ptr_plugin_option->prev_option)
(ptr_plugin_option->prev_option)->next_option =
ptr_plugin_option->next_option;
else
plugin_options = ptr_plugin_option->next_option;
if (ptr_plugin_option->next_option)
(ptr_plugin_option->next_option)->prev_option =
ptr_plugin_option->prev_option;
return 1;
}
else
{
/* replace old value by new one */
if (ptr_plugin_option->value)
free (ptr_plugin_option->value);
ptr_plugin_option->value = strdup (value);
return 1;
}
}
else
{
ptr_plugin_option = (t_plugin_option *)malloc (sizeof (t_plugin_option));
if (ptr_plugin_option)
{
/* create new option */
ptr_plugin_option->option_name = strdup (option);
ptr_plugin_option->value = strdup (value);
if (plugin_options)
plugin_options->prev_option = ptr_plugin_option;
ptr_plugin_option->prev_option = NULL;
ptr_plugin_option->next_option = plugin_options;
plugin_options = ptr_plugin_option;
return 1;
}
}
/* failed to set plugin option */
return 0;
}
/*
* plugin_config_set: set value for a plugin option (create it if not found)
*/
int
plugin_config_set (t_weechat_plugin *plugin, char *option, char *value)
{
char *internal_option;
int return_code;
internal_option = (char *)malloc (strlen (plugin->name) +
strlen (option) + 2);
if (!internal_option)
return 0;
strcpy (internal_option, plugin->name);
strcat (internal_option, ".");
strcat (internal_option, option);
return_code = plugin_config_set_internal (internal_option, value);
free (internal_option);
return return_code;
}
/*
* plugin_config_read: read WeeChat plugins configuration
*/
void
plugin_config_read ()
{
int filename_length;
char *filename;
FILE *file;
int line_number;
char line[1024], *ptr_line, *pos, *pos2;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return;
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "rt")) == NULL)
return;
line_number = 0;
while (!feof (file))
{
ptr_line = fgets (line, sizeof (line) - 1, file);
line_number++;
if (ptr_line)
{
/* skip spaces */
while (ptr_line[0] == ' ')
ptr_line++;
/* not a comment and not an empty line */
if ((ptr_line[0] != '#') && (ptr_line[0] != '\r')
&& (ptr_line[0] != '\n'))
{
pos = strchr (line, '=');
if (pos == NULL)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s %s, line %d: invalid syntax, missing \"=\"\n"),
WEECHAT_WARNING, filename, line_number);
}
else
{
pos[0] = '\0';
pos++;
pos2 = strchr (pos, '\r');
if (pos2 != NULL)
pos2[0] = '\0';
pos2 = strchr (pos, '\n');
if (pos2 != NULL)
pos2[0] = '\0';
plugin_config_set_internal (ptr_line, pos);
}
}
}
}
fclose (file);
free (filename);
}
/*
* plugin_config_write: write WeeChat configurtion
* return: 0 if ok
* < 0 if error
*/
int
plugin_config_write ()
{
int filename_length;
char *filename;
FILE *file;
time_t current_time;
t_plugin_option *ptr_plugin_option;
filename_length = strlen (weechat_home) +
strlen (WEECHAT_PLUGINS_CONFIG_NAME) + 2;
filename =
(char *) malloc (filename_length * sizeof (char));
if (!filename)
return -2;
snprintf (filename, filename_length, "%s%s" WEECHAT_PLUGINS_CONFIG_NAME,
weechat_home, DIR_SEPARATOR);
if ((file = fopen (filename, "wt")) == NULL)
{
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL, _("%s cannot create file \"%s\"\n"),
WEECHAT_ERROR, filename);
free (filename);
return -1;
}
current_time = time (NULL);
fprintf (file, _("#\n# %s plugins configuration file, created by "
"%s v%s on %s"),
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_VERSION,
ctime (&current_time));
fprintf (file, _("# WARNING! Be careful when editing this file, "
"WeeChat writes this file when options are updated.\n#\n"));
for (ptr_plugin_option = plugin_options; ptr_plugin_option;
ptr_plugin_option = ptr_plugin_option->next_option)
{
fprintf (file, "%s=%s\n",
ptr_plugin_option->option_name,
ptr_plugin_option->value);
}
fclose (file);
chmod (filename, 0600);
free (filename);
return 0;
}
+41
View File
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WEECHAT_PLUGINS_CONFIG_H
#define __WEECHAT_PLUGINS_CONFIG_H 1
#define WEECHAT_PLUGINS_CONFIG_NAME "plugins.rc"
typedef struct t_plugin_option t_plugin_option;
struct t_plugin_option
{
char *option_name; /* option name in config file */
char *value; /* value of option */
t_plugin_option *prev_option; /* link to previous option */
t_plugin_option *next_option; /* link to next option */
};
extern t_plugin_option *plugin_config_search (t_weechat_plugin *, char *);
extern int plugin_config_set (t_weechat_plugin *, char *, char *);
extern void plugin_config_read ();
extern int plugin_config_write ();
#endif /* plugins-config.h */
+665
View File
@@ -0,0 +1,665 @@
/*
* Copyright (c) 2003-2005 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* plugins-interface.c: WeeChat plugins interface */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../common/weechat.h"
#include "plugins.h"
#include "plugins-config.h"
#include "../common/command.h"
#include "../common/weeconfig.h"
#include "../irc/irc.h"
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_ascii_strncasecmp: locale and case independent string comparison
* with max length
*/
int
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
char *string1, char *string2, int max)
{
/* make gcc happy */
(void) plugin;
return ascii_strncasecmp (string1, string2, max);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
int
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
{
char *dir_name;
int dir_length;
/* make gcc happy */
(void) plugin;
if (!path)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (path) + 2;
dir_name =
(char *) malloc (dir_length * sizeof (char));
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
if (mkdir (dir_name, 0755) < 0)
{
if (errno != EEXIST)
{
free (dir_name);
return 0;
}
}
free (dir_name);
return 1;
}
/*
* weechat_plugin_exec_on_files: find files in a directory and execute a
* function on each file
*/
void
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
int (*callback)(t_weechat_plugin *, char *))
{
if (directory && callback)
plugin_exec_on_files (plugin, directory, callback);
}
/*
* weechat_plugin_printf: print a message on a server or channel buffer
*/
void
weechat_plugin_printf (t_weechat_plugin *plugin,
char *server, char *channel, char *message, ...)
{
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
ptr_buffer = plugin_find_buffer (server, channel);
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", buf);
}
/*
* weechat_plugin_printf_server: print a message on server buffer
*/
void
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", buf);
}
/*
* weechat_plugin_infobar_printf: print a message in infobar
*/
void
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
{
va_list argptr;
static char buf[1024];
if (!plugin || (time_displayed < 0) || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
}
/*
* weechat_plugin_msg_handler_add: add a message handler
*/
t_plugin_msg_handler *
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && message && handler_func)
return plugin_msg_handler_add (plugin, message, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_msg_handler_remove: remove a WeeChat message handler
*/
void
weechat_plugin_msg_handler_remove (t_weechat_plugin *plugin,
t_plugin_msg_handler *msg_handler)
{
if (plugin && msg_handler)
plugin_msg_handler_remove (plugin, msg_handler);
}
/*
* weechat_plugin_msg_handler_remove_all: remove all WeeChat message handlers
*/
void
weechat_plugin_msg_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_msg_handler_remove_all (plugin);
}
/*
* weechat_plugin_cmd_handler_add: add a command handler
*/
t_plugin_cmd_handler *
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
char *description, char *arguments,
char *arguments_description,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && command && handler_func)
return plugin_cmd_handler_add (plugin, command, description, arguments,
arguments_description,
handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_cmd_plugin_handler_remove: remove a WeeChat command handler
*/
void
weechat_plugin_cmd_handler_remove (t_weechat_plugin *plugin,
t_plugin_cmd_handler *cmd_handler)
{
if (plugin && cmd_handler)
plugin_cmd_handler_remove (plugin, cmd_handler);
}
/*
* weechat_plugin_cmd_handler_remove_all: remove all WeeChat command handlers
*/
void
weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_cmd_handler_remove_all (plugin);
}
/*
* weechat_plugin_exec_command: execute a command (simulate user entry)
*/
void
weechat_plugin_exec_command (t_weechat_plugin *plugin,
char *server, char *channel, char *command)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !command)
return;
ptr_buffer = plugin_find_buffer (server, channel);
if (ptr_buffer)
user_command (SERVER(ptr_buffer), ptr_buffer, command);
}
/*
* weechat_plugin_get_info: get info about WeeChat
* WARNING: caller should free string returned
* by this function after use
*/
char *
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, char *channel)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !info)
return NULL;
ptr_buffer = plugin_find_buffer (server, channel);
if (!ptr_buffer)
return NULL;
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->nick))
return strdup (SERVER(ptr_buffer)->nick);
}
else if (ascii_strcasecmp (info, "channel") == 0)
{
if (BUFFER_IS_CHANNEL(ptr_buffer))
return strdup (CHANNEL(gui_current_window->buffer)->name);
}
else if (ascii_strcasecmp (info, "server") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->name))
return strdup (SERVER(ptr_buffer)->name);
}
else if (ascii_strcasecmp (info, "away") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected))
{
if (SERVER(ptr_buffer)->is_away)
return strdup ("1");
else
return strdup ("0");
}
}
else if (ascii_strcasecmp (info, "weechatdir") == 0)
{
/* WARNING: deprecated info, you should use weechat_dir */
/* will be removed in a future version */
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
{
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
{
return strdup (WEECHAT_LIBDIR);
}
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
{
return strdup (WEECHAT_SHAREDIR);
}
/* info not found */
return NULL;
}
/*
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
*/
t_plugin_dcc_info *
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
{
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
t_irc_dcc *ptr_dcc;
if (!plugin)
return NULL;
if (dcc_list)
{
dcc_info = NULL;
last_dcc_info = NULL;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
if (new_dcc_info)
{
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
new_dcc_info->type = ptr_dcc->type;
new_dcc_info->status = ptr_dcc->status;
new_dcc_info->start_time = ptr_dcc->start_time;
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
new_dcc_info->addr = ptr_dcc->addr;
new_dcc_info->port = ptr_dcc->port;
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
new_dcc_info->size = ptr_dcc->size;
new_dcc_info->pos = ptr_dcc->pos;
new_dcc_info->start_resume = ptr_dcc->start_resume;
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
new_dcc_info->prev_dcc = last_dcc_info;
new_dcc_info->next_dcc = NULL;
if (!dcc_info)
{
dcc_info = new_dcc_info;
last_dcc_info = new_dcc_info;
}
else
last_dcc_info->next_dcc = new_dcc_info;
}
}
return dcc_info;
}
return NULL;
}
/*
* weechat_plugin_free_dcc_info: free dcc info struct list
*/
void
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
{
t_plugin_dcc_info *new_dcc_info;
if (!plugin || !dcc_info)
return;
while (dcc_info)
{
if (dcc_info->server)
free (dcc_info->server);
if (dcc_info->channel)
free (dcc_info->channel);
if (dcc_info->nick)
free (dcc_info->nick);
if (dcc_info->filename)
free (dcc_info->filename);
if (dcc_info->local_filename)
free (dcc_info->local_filename);
new_dcc_info = dcc_info->next_dcc;
free (dcc_info);
dcc_info = new_dcc_info;
}
}
/*
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
char buf_temp[1024], *color_name;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_plugin_get_config: get value of a config option
*/
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
/* option not found */
return NULL;
}
/*
* weechat_plugin_set_config: set value of a config option
*/
int
weechat_plugin_set_config (t_weechat_plugin *plugin, char *option, char *value)
{
char *pos, *server_name;
t_irc_server *ptr_server;
t_config_option *ptr_option;
/* make gcc happy */
(void) plugin;
if (!option || !value)
return 0;
pos = strchr (option, '.');
if (pos)
{
/* server config option modification */
server_name = (char *)malloc (pos - option + 1);
strncpy (server_name, option, pos - option);
if (server_name)
{
ptr_server = server_search (server_name);
free (server_name);
if (ptr_server)
return (config_set_server_value (ptr_server, pos + 1, value) == 0);
}
}
else
{
ptr_option = config_option_search (option);
if (ptr_option)
{
if (ptr_option->handler_change)
{
if (config_option_set_value (ptr_option, value) == 0)
{
(void) (ptr_option->handler_change());
return 1;
}
}
}
}
/* failed to set config option */
return 0;
}
/*
* weechat_plugin_get_plugin_config: get value of a plugin config option
*/
char *
weechat_plugin_get_plugin_config (t_weechat_plugin *plugin, char *option)
{
t_plugin_option *ptr_plugin_option;
if (!option)
return NULL;
ptr_plugin_option = plugin_config_search (plugin, option);
if (ptr_plugin_option)
return (ptr_plugin_option->value) ? strdup (ptr_plugin_option->value) : NULL;
/* option not found */
return NULL;
}
/*
* weechat_plugin_set_plugin_config: set value of a plugin config option
*/
int
weechat_plugin_set_plugin_config (t_weechat_plugin *plugin, char *option, char *value)
{
if (!option)
return 0;
if (plugin_config_set (plugin, option, value))
{
plugin_config_write ();
return 1;
}
return 0;
}
+12 -539
View File
@@ -34,8 +34,8 @@
#include <dirent.h>
#include <dlfcn.h>
#include "../common/weechat.h"
#include "weechat-plugin.h"
#include "plugins.h"
#include "plugins-config.h"
#include "../common/command.h"
#include "../common/weeconfig.h"
#include "../irc/irc.h"
@@ -663,6 +663,9 @@ plugin_load (char *filename)
new_plugin->get_dcc_info = &weechat_plugin_get_dcc_info;
new_plugin->free_dcc_info = &weechat_plugin_free_dcc_info;
new_plugin->get_config = &weechat_plugin_get_config;
new_plugin->set_config = &weechat_plugin_set_config;
new_plugin->get_plugin_config = &weechat_plugin_get_plugin_config;
new_plugin->set_plugin_config = &weechat_plugin_set_plugin_config;
/* handlers */
new_plugin->msg_handlers = NULL;
@@ -880,6 +883,10 @@ plugin_init ()
{
char *list_plugins, *pos, *pos2;
/* read plugins options on disk */
plugin_config_read ();
/* auto-load plugins if asked */
if (cfg_plugins_autoload && cfg_plugins_autoload[0])
{
if (ascii_strcasecmp (cfg_plugins_autoload, "*") == 0)
@@ -914,543 +921,9 @@ plugin_init ()
void
plugin_end ()
{
/* write plugins config options */
plugin_config_write ();
/* unload all plugins */
plugin_unload_all ();
}
/*************************** Public plugin interface **************************/
/*
* weechat_ascii_strcasecmp: locale and case independent string comparison
*/
int
weechat_ascii_strcasecmp (t_weechat_plugin *plugin,
char *string1, char *string2)
{
/* make gcc happy */
(void) plugin;
return ascii_strcasecmp (string1, string2);
}
/*
* weechat_ascii_strncasecmp: locale and case independent string comparison
* with max length
*/
int
weechat_ascii_strncasecmp (t_weechat_plugin *plugin,
char *string1, char *string2, int max)
{
/* make gcc happy */
(void) plugin;
return ascii_strncasecmp (string1, string2, max);
}
/*
* weechat_explode_string: explode a string
*/
char **
weechat_explode_string (t_weechat_plugin *plugin, char *string,
char *separators, int num_items_max,
int *num_items)
{
/* make gcc happy */
(void) plugin;
if (!plugin || !string || !separators || !num_items)
return NULL;
return explode_string (string, separators, num_items_max, num_items);
}
/*
* weechat_free_exploded_string: free exploded string
*/
void
weechat_free_exploded_string (t_weechat_plugin *plugin, char **exploded_string)
{
/* make gcc happy */
(void) plugin;
free_exploded_string (exploded_string);
}
/*
* weechat_plugin_mkdir_home: create a directory for script in WeeChat home
*/
int
weechat_plugin_mkdir_home (t_weechat_plugin *plugin, char *path)
{
char *dir_name;
int dir_length;
/* make gcc happy */
(void) plugin;
if (!path)
return 0;
/* build directory, adding WeeChat home */
dir_length = strlen (weechat_home) + strlen (path) + 2;
dir_name =
(char *) malloc (dir_length * sizeof (char));
if (!dir_name)
return 0;
snprintf (dir_name, dir_length, "%s/%s", weechat_home, path);
if (mkdir (dir_name, 0755) < 0)
{
if (errno != EEXIST)
{
free (dir_name);
return 0;
}
}
free (dir_name);
return 1;
}
/*
* weechat_plugin_exec_on_files: find files in a directory and execute a
* function on each file
*/
void
weechat_plugin_exec_on_files (t_weechat_plugin *plugin, char *directory,
int (*callback)(t_weechat_plugin *, char *))
{
if (directory && callback)
plugin_exec_on_files (plugin, directory, callback);
}
/*
* weechat_plugin_printf: print a message on a server or channel buffer
*/
void
weechat_plugin_printf (t_weechat_plugin *plugin,
char *server, char *channel, char *message, ...)
{
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
ptr_buffer = plugin_find_buffer (server, channel);
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", buf);
}
/*
* weechat_plugin_printf_server: print a message on server buffer
*/
void
weechat_plugin_printf_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
if (!plugin || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
irc_display_prefix (NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", buf);
}
/*
* weechat_plugin_infobar_printf: print a message in infobar
*/
void
weechat_plugin_infobar_printf (t_weechat_plugin *plugin, int time_displayed, char *message, ...)
{
va_list argptr;
static char buf[1024];
if (!plugin || (time_displayed < 0) || !message)
return;
va_start (argptr, message);
vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
gui_infobar_printf (time_displayed, COLOR_WIN_INFOBAR, buf);
}
/*
* weechat_plugin_msg_handler_add: add a message handler
*/
t_plugin_msg_handler *
weechat_plugin_msg_handler_add (t_weechat_plugin *plugin, char *message,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && message && handler_func)
return plugin_msg_handler_add (plugin, message, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_msg_handler_remove: remove a WeeChat message handler
*/
void
weechat_plugin_msg_handler_remove (t_weechat_plugin *plugin,
t_plugin_msg_handler *msg_handler)
{
if (plugin && msg_handler)
plugin_msg_handler_remove (plugin, msg_handler);
}
/*
* weechat_plugin_msg_handler_remove_all: remove all WeeChat message handlers
*/
void
weechat_plugin_msg_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_msg_handler_remove_all (plugin);
}
/*
* weechat_plugin_cmd_handler_add: add a command handler
*/
t_plugin_cmd_handler *
weechat_plugin_cmd_handler_add (t_weechat_plugin *plugin, char *command,
char *description, char *arguments,
char *arguments_description,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && command && handler_func)
return plugin_cmd_handler_add (plugin, command, description, arguments,
arguments_description,
handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_cmd_plugin_handler_remove: remove a WeeChat command handler
*/
void
weechat_plugin_cmd_handler_remove (t_weechat_plugin *plugin,
t_plugin_cmd_handler *cmd_handler)
{
if (plugin && cmd_handler)
plugin_cmd_handler_remove (plugin, cmd_handler);
}
/*
* weechat_plugin_cmd_handler_remove_all: remove all WeeChat command handlers
*/
void
weechat_plugin_cmd_handler_remove_all (t_weechat_plugin *plugin)
{
if (plugin)
plugin_cmd_handler_remove_all (plugin);
}
/*
* weechat_plugin_exec_command: execute a command (simulate user entry)
*/
void
weechat_plugin_exec_command (t_weechat_plugin *plugin,
char *server, char *channel, char *command)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !command)
return;
ptr_buffer = plugin_find_buffer (server, channel);
if (ptr_buffer)
user_command (SERVER(ptr_buffer), ptr_buffer, command);
}
/*
* weechat_plugin_get_info: get info about WeeChat
* WARNING: caller should free string returned
* by this function after use
*/
char *
weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server, char *channel)
{
t_gui_buffer *ptr_buffer;
if (!plugin || !info)
return NULL;
ptr_buffer = plugin_find_buffer (server, channel);
if (!ptr_buffer)
return NULL;
if (ascii_strcasecmp (info, "version") == 0)
{
return strdup (PACKAGE_VERSION);
}
else if (ascii_strcasecmp (info, "nick") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->nick))
return strdup (SERVER(ptr_buffer)->nick);
}
else if (ascii_strcasecmp (info, "channel") == 0)
{
if (BUFFER_IS_CHANNEL(ptr_buffer))
return strdup (CHANNEL(gui_current_window->buffer)->name);
}
else if (ascii_strcasecmp (info, "server") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected)
&& (SERVER(ptr_buffer)->name))
return strdup (SERVER(ptr_buffer)->name);
}
else if (ascii_strcasecmp (info, "away") == 0)
{
if (SERVER(ptr_buffer) && (SERVER(ptr_buffer)->is_connected))
{
if (SERVER(ptr_buffer)->is_away)
return strdup ("1");
else
return strdup ("0");
}
}
else if (ascii_strcasecmp (info, "weechatdir") == 0)
{
/* WARNING: deprecated info, you should use weechat_dir */
/* will be removed in a future version */
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_dir") == 0)
{
return strdup (weechat_home);
}
else if (ascii_strcasecmp (info, "weechat_libdir") == 0)
{
return strdup (WEECHAT_LIBDIR);
}
else if (ascii_strcasecmp (info, "weechat_sharedir") == 0)
{
return strdup (WEECHAT_SHAREDIR);
}
/* info not found */
return NULL;
}
/*
* weechat_plugin_get_dcc_info: get list of DCC files/chats info
*/
t_plugin_dcc_info *
weechat_plugin_get_dcc_info (t_weechat_plugin *plugin)
{
t_plugin_dcc_info *dcc_info, *last_dcc_info, *new_dcc_info;
t_irc_dcc *ptr_dcc;
if (!plugin)
return NULL;
if (dcc_list)
{
dcc_info = NULL;
last_dcc_info = NULL;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
new_dcc_info = (t_plugin_dcc_info *)malloc (sizeof (t_plugin_dcc_info));
if (new_dcc_info)
{
new_dcc_info->server = (ptr_dcc->server) ? strdup (ptr_dcc->server->name) : strdup ("");
new_dcc_info->channel = (ptr_dcc->channel) ? strdup (ptr_dcc->channel->name) : strdup ("");
new_dcc_info->type = ptr_dcc->type;
new_dcc_info->status = ptr_dcc->status;
new_dcc_info->start_time = ptr_dcc->start_time;
new_dcc_info->start_transfer = ptr_dcc->start_transfer;
new_dcc_info->addr = ptr_dcc->addr;
new_dcc_info->port = ptr_dcc->port;
new_dcc_info->nick = (ptr_dcc->nick) ? strdup (ptr_dcc->nick) : strdup ("");
new_dcc_info->filename = (ptr_dcc->filename) ? strdup (ptr_dcc->filename) : strdup ("");
new_dcc_info->local_filename = (ptr_dcc->local_filename) ? strdup (ptr_dcc->local_filename) : strdup ("");
new_dcc_info->filename_suffix = ptr_dcc->filename_suffix;
new_dcc_info->size = ptr_dcc->size;
new_dcc_info->pos = ptr_dcc->pos;
new_dcc_info->start_resume = ptr_dcc->start_resume;
new_dcc_info->bytes_per_sec = ptr_dcc->bytes_per_sec;
new_dcc_info->prev_dcc = last_dcc_info;
new_dcc_info->next_dcc = NULL;
if (!dcc_info)
{
dcc_info = new_dcc_info;
last_dcc_info = new_dcc_info;
}
else
last_dcc_info->next_dcc = new_dcc_info;
}
}
return dcc_info;
}
return NULL;
}
/*
* weechat_plugin_free_dcc_info: free dcc info struct list
*/
void
weechat_plugin_free_dcc_info (t_weechat_plugin *plugin, t_plugin_dcc_info *dcc_info)
{
t_plugin_dcc_info *new_dcc_info;
if (!plugin || !dcc_info)
return;
while (dcc_info)
{
if (dcc_info->server)
free (dcc_info->server);
if (dcc_info->channel)
free (dcc_info->channel);
if (dcc_info->nick)
free (dcc_info->nick);
if (dcc_info->filename)
free (dcc_info->filename);
if (dcc_info->local_filename)
free (dcc_info->local_filename);
new_dcc_info = dcc_info->next_dcc;
free (dcc_info);
dcc_info = new_dcc_info;
}
}
/*
* weechat_plugin_get_config_str_value: return string value for any option
* This function should never be called directly
* (only used by weechat_get_config)
*/
char *
weechat_plugin_get_config_str_value (t_config_option *option, void *value)
{
char buf_temp[1024], *color_name;
if (!value)
{
if (option->option_type == OPTION_TYPE_STRING)
value = option->ptr_string;
else
value = option->ptr_int;
}
switch (option->option_type)
{
case OPTION_TYPE_BOOLEAN:
return (*((int *)value)) ?
strdup ("on") : strdup ("off");
break;
case OPTION_TYPE_INT:
snprintf (buf_temp, sizeof (buf_temp), "%d",
*((int *)value));
return strdup (buf_temp);
break;
case OPTION_TYPE_INT_WITH_STRING:
return option->array_values[*((int *)value)];
break;
case OPTION_TYPE_COLOR:
color_name = gui_get_color_by_value (*((int *)value));
return (color_name) ? strdup (color_name) : strdup ("");
break;
case OPTION_TYPE_STRING:
return (*((char **)value)) ? strdup (*((char **)value)) : strdup ("");
break;
}
/* should never be executed! */
return NULL;
}
/*
* weechat_get_config: get value of a config option
*/
char *
weechat_plugin_get_config (t_weechat_plugin *plugin, char *option)
{
int i, j;
t_irc_server *ptr_server;
char option_name[256];
void *ptr_option_value;
/* make gcc happy */
(void) plugin;
for (i = 0; i < CONFIG_NUMBER_SECTIONS; i++)
{
if ((i != CONFIG_SECTION_KEYS) && (i != CONFIG_SECTION_ALIAS)
&& (i != CONFIG_SECTION_IGNORE) && (i != CONFIG_SECTION_SERVER))
{
for (j = 0; weechat_options[i][j].option_name; j++)
{
if ((!option) ||
((option) && (option[0])
&& (strstr (weechat_options[i][j].option_name, option) != NULL)))
{
return weechat_plugin_get_config_str_value (&weechat_options[i][j], NULL);
}
}
}
}
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
for (i = 0; weechat_options[CONFIG_SECTION_SERVER][i].option_name; i++)
{
snprintf (option_name, sizeof (option_name), "%s.%s",
ptr_server->name,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if ((!option) ||
((option) && (option[0])
&& (strstr (option_name, option) != NULL)))
{
ptr_option_value = config_get_server_option_ptr (ptr_server,
weechat_options[CONFIG_SECTION_SERVER][i].option_name);
if (ptr_option_value)
{
return weechat_plugin_get_config_str_value (&weechat_options[CONFIG_SECTION_SERVER][i],
ptr_option_value);
}
}
}
}
/* option not found */
return NULL;
}
+16
View File
@@ -30,9 +30,25 @@ typedef void (t_weechat_end_func) (t_weechat_plugin *);
extern t_weechat_plugin *weechat_plugins;
extern t_weechat_plugin *last_weechat_plugin;
extern t_gui_buffer *plugin_find_buffer (char *, char *);
extern void plugin_exec_on_files (t_weechat_plugin *, char *,
int (*)(t_weechat_plugin *, char *));
extern t_weechat_plugin *plugin_search (char *);
extern t_plugin_msg_handler *plugin_msg_handler_add (t_weechat_plugin *, char *,
t_plugin_handler_func *,
char *, void *);
extern t_plugin_cmd_handler *plugin_cmd_handler_add (t_weechat_plugin *, char *,
char *, char *, char *,
t_plugin_handler_func *,
char *, void *);
extern int plugin_msg_handler_exec (char *, char *, char *);
extern int plugin_cmd_handler_exec (char *, char *, char *);
extern void plugin_msg_handler_remove (t_weechat_plugin *,
t_plugin_msg_handler *);
extern void plugin_cmd_handler_remove (t_weechat_plugin *,
t_plugin_cmd_handler *);
extern void plugin_msg_handler_remove_all (t_weechat_plugin *);
extern void plugin_cmd_handler_remove_all (t_weechat_plugin *);
extern t_weechat_plugin *plugin_load (char *);
extern void plugin_remove (t_weechat_plugin *);
extern void plugin_unload (t_weechat_plugin *);
+6
View File
@@ -144,6 +144,9 @@ struct t_weechat_plugin
t_plugin_dcc_info *(*get_dcc_info) (t_weechat_plugin *);
void (*free_dcc_info) (t_weechat_plugin *, t_plugin_dcc_info *);
char *(*get_config) (t_weechat_plugin *, char *);
int (*set_config) (t_weechat_plugin *, char *, char *);
char *(*get_plugin_config) (t_weechat_plugin *, char *);
int (*set_plugin_config) (t_weechat_plugin *, char *, char *);
/* WeeChat developers: ALWAYS add new functions at the end */
};
@@ -181,5 +184,8 @@ extern char *weechat_plugin_get_info (t_weechat_plugin *, char *, char *, char *
extern t_plugin_dcc_info *weechat_plugin_get_dcc_info (t_weechat_plugin *);
extern void weechat_plugin_free_dcc_info (t_weechat_plugin *, t_plugin_dcc_info *);
extern char *weechat_plugin_get_config (t_weechat_plugin *, char *);
extern int weechat_plugin_set_config (t_weechat_plugin *, char *, char *);
extern char *weechat_plugin_get_plugin_config (t_weechat_plugin *, char *);
extern int weechat_plugin_set_plugin_config (t_weechat_plugin *, char *, char *);
#endif /* weechat-plugin.h */