diff --git a/po/POTFILES.in b/po/POTFILES.in index a60c58950..cb2e1c1ec 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,6 +4,8 @@ ./src/core/weechat.h ./src/core/wee-command.c ./src/core/wee-command.h +./src/core/wee-completion.c +./src/core/wee-completion.h ./src/core/wee-config.c ./src/core/wee-config-file.c ./src/core/wee-config-file.h diff --git a/po/cs.po b/po/cs.po index ebccad6b0..27204781c 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-06 11:55+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1675,6 +1675,77 @@ msgstr "" " posunout na začátek aktuálního dne:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "jména bufferů" + +msgid "numbers of buffers" +msgstr "čísla bufferů" + +msgid "names of buffers (including plugins names)" +msgstr "jména bufferů (včetně jmen pluginů)" + +msgid "properties that can be set on a buffer" +msgstr "vlastnosti, které mohou být nastaveny bufferu" + +msgid "properties that can be read on a buffer" +msgstr "vlastnosti, které mohou být čteny o bufferu" + +msgid "configuration files" +msgstr "konfigurační soubory" + +msgid "filename" +msgstr "jméno souboru" + +msgid "names of filters" +msgstr "jména filtrů" + +msgid "commands (weechat and plugins)" +msgstr "příkazy (weechat a pluginů)" + +msgid "names of infos hooked" +msgstr "jména napojených info" + +msgid "names of infolists hooked" +msgstr "jména napojených infolistů" + +msgid "nicks in nicklist of current buffer" +msgstr "přezdívky v seznamu přezdívek aktuálního bufferu" + +msgid "configuration options" +msgstr "konfigurační nastavení" + +msgid "names of plugins" +msgstr "jména pluginů" + +msgid "commands defined by plugins" +msgstr "příkazy definované pluginy" + +msgid "names of bars" +msgstr "jména polí" + +msgid "values for a configuration option" +msgstr "hodnoty pro konfigurační nastavení" + +msgid "weechat commands" +msgstr "příkazy weechat" + +msgid "names of proxies" +msgstr "jména prefixů" + +msgid "options for proxies" +msgstr "volby pro proxy" + +msgid "options for bars" +msgstr "volby pro pole" + +msgid "key codes" +msgstr "klávesové kódy" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"klávesové kódy mohou být resetovány (klávesy přidány, redefinovány nebo " +"smazány)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2548,77 +2619,6 @@ msgstr "%sChyba: buffer se stejným jménem (%s) už existuje" msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "%sChyba: je možné spojovat pouze bufferz s formátovaným obsahem" -msgid "names of buffers" -msgstr "jména bufferů" - -msgid "numbers of buffers" -msgstr "čísla bufferů" - -msgid "names of buffers (including plugins names)" -msgstr "jména bufferů (včetně jmen pluginů)" - -msgid "properties that can be set on a buffer" -msgstr "vlastnosti, které mohou být nastaveny bufferu" - -msgid "properties that can be read on a buffer" -msgstr "vlastnosti, které mohou být čteny o bufferu" - -msgid "configuration files" -msgstr "konfigurační soubory" - -msgid "filename" -msgstr "jméno souboru" - -msgid "names of filters" -msgstr "jména filtrů" - -msgid "commands (weechat and plugins)" -msgstr "příkazy (weechat a pluginů)" - -msgid "names of infos hooked" -msgstr "jména napojených info" - -msgid "names of infolists hooked" -msgstr "jména napojených infolistů" - -msgid "nicks in nicklist of current buffer" -msgstr "přezdívky v seznamu přezdívek aktuálního bufferu" - -msgid "configuration options" -msgstr "konfigurační nastavení" - -msgid "names of plugins" -msgstr "jména pluginů" - -msgid "commands defined by plugins" -msgstr "příkazy definované pluginy" - -msgid "names of bars" -msgstr "jména polí" - -msgid "values for a configuration option" -msgstr "hodnoty pro konfigurační nastavení" - -msgid "weechat commands" -msgstr "příkazy weechat" - -msgid "names of proxies" -msgstr "jména prefixů" - -msgid "options for proxies" -msgstr "volby pro proxy" - -msgid "options for bars" -msgstr "volby pro pole" - -msgid "key codes" -msgstr "klávesové kódy" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"klávesové kódy mohou být resetovány (klávesy přidány, redefinovány nebo " -"smazány)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "Chyba: nedostatek paměti pro přidáni bufferu do hotlistu" diff --git a/po/de.po b/po/de.po index e1b97a663..7dd6545ea 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-06 11:55+0100\n" "Last-Translator: Nils G.\n" "Language-Team: weechat-dev \n" @@ -1734,6 +1734,77 @@ msgstr "" " Scrollt zum Beginn des aktuellen Tages:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "Auflistung der vorhandenen Buffer" + +msgid "numbers of buffers" +msgstr "Anzahl der Buffer" + +msgid "names of buffers (including plugins names)" +msgstr "Liste der Buffer (inkl. der Erweiterungen)" + +msgid "properties that can be set on a buffer" +msgstr "Eigenschaften die für den Buffer gesetzt werden können" + +msgid "properties that can be read on a buffer" +msgstr "Eigenschaften die für den Buffer gelesen werden können" + +msgid "configuration files" +msgstr "Konfigurationsdateien" + +msgid "filename" +msgstr "Dateinamen" + +msgid "names of filters" +msgstr "Liste der Filter" + +msgid "commands (weechat and plugins)" +msgstr "Befehle (WeeChat und Erweiterungen)" + +msgid "names of infos hooked" +msgstr "Namen der ge-hook-ten Infos" + +msgid "names of infolists hooked" +msgstr "Namem der ge-hook-ten Infolisten" + +msgid "nicks in nicklist of current buffer" +msgstr "Nicks in Nickliste des aktuellen Buffers" + +msgid "configuration options" +msgstr "Konfigurationsoptionen" + +msgid "names of plugins" +msgstr "Liste der Erweiterungen" + +msgid "commands defined by plugins" +msgstr "Befehle, definiert durch Erweiterungen" + +msgid "names of bars" +msgstr "Namen der Infobars" + +msgid "values for a configuration option" +msgstr "Werte für eine Konfigurationsoption" + +msgid "weechat commands" +msgstr "WeeChat Befehle" + +msgid "names of proxies" +msgstr "Namen der Proxies" + +msgid "options for proxies" +msgstr "Optionen für Proxies" + +msgid "options for bars" +msgstr "Optionen für Infobars" + +msgid "key codes" +msgstr "Tastaturcodes" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"Tastenbelegungen die zurückgesetzt werden können (hinzugefügte/verändert/" +"gelöschte Tastenbelegungen)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2666,77 +2737,6 @@ msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" "%sFehler: Es ist nur möglich Buffer mit formatiertem Inhalt zusammenzufügen" -msgid "names of buffers" -msgstr "Auflistung der vorhandenen Buffer" - -msgid "numbers of buffers" -msgstr "Anzahl der Buffer" - -msgid "names of buffers (including plugins names)" -msgstr "Liste der Buffer (inkl. der Erweiterungen)" - -msgid "properties that can be set on a buffer" -msgstr "Eigenschaften die für den Buffer gesetzt werden können" - -msgid "properties that can be read on a buffer" -msgstr "Eigenschaften die für den Buffer gelesen werden können" - -msgid "configuration files" -msgstr "Konfigurationsdateien" - -msgid "filename" -msgstr "Dateinamen" - -msgid "names of filters" -msgstr "Liste der Filter" - -msgid "commands (weechat and plugins)" -msgstr "Befehle (WeeChat und Erweiterungen)" - -msgid "names of infos hooked" -msgstr "Namen der ge-hook-ten Infos" - -msgid "names of infolists hooked" -msgstr "Namem der ge-hook-ten Infolisten" - -msgid "nicks in nicklist of current buffer" -msgstr "Nicks in Nickliste des aktuellen Buffers" - -msgid "configuration options" -msgstr "Konfigurationsoptionen" - -msgid "names of plugins" -msgstr "Liste der Erweiterungen" - -msgid "commands defined by plugins" -msgstr "Befehle, definiert durch Erweiterungen" - -msgid "names of bars" -msgstr "Namen der Infobars" - -msgid "values for a configuration option" -msgstr "Werte für eine Konfigurationsoption" - -msgid "weechat commands" -msgstr "WeeChat Befehle" - -msgid "names of proxies" -msgstr "Namen der Proxies" - -msgid "options for proxies" -msgstr "Optionen für Proxies" - -msgid "options for bars" -msgstr "Optionen für Infobars" - -msgid "key codes" -msgstr "Tastaturcodes" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"Tastenbelegungen die zurückgesetzt werden können (hinzugefügte/verändert/" -"gelöschte Tastenbelegungen)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "" "Fehler: nicht genügend Speicher um den Buffer der Hotlist hinzu zu fügen" diff --git a/po/es.po b/po/es.po index 329f3c30a..822caed2c 100644 --- a/po/es.po +++ b/po/es.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-06 11:56+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -1689,6 +1689,76 @@ msgstr "" " desplazar al principio del día actual:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "nombres de los buffers" + +msgid "numbers of buffers" +msgstr "números de los buffers" + +msgid "names of buffers (including plugins names)" +msgstr "nombre de los buffers (incluyendo nombre de los plugins)" + +msgid "properties that can be set on a buffer" +msgstr "propiedades del buffer que pueden configurarse" + +msgid "properties that can be read on a buffer" +msgstr "propiedades del buffer que pueden leerse" + +msgid "configuration files" +msgstr "archivos de configuración" + +msgid "filename" +msgstr "nombre de archivo" + +msgid "names of filters" +msgstr "nombre de los filtros" + +msgid "commands (weechat and plugins)" +msgstr "comandos (weechat y plugins)" + +msgid "names of infos hooked" +msgstr "nombres de infos enganchados" + +msgid "names of infolists hooked" +msgstr "nombres de infolists enganchados" + +msgid "nicks in nicklist of current buffer" +msgstr "apodos en la lista de apodos del buffer actual" + +msgid "configuration options" +msgstr "opciones de configuración" + +msgid "names of plugins" +msgstr "nombres de plugins" + +msgid "commands defined by plugins" +msgstr "comandos definidos por plugins" + +msgid "names of bars" +msgstr "nombres de barras" + +msgid "values for a configuration option" +msgstr "valores de una opción de configuración" + +msgid "weechat commands" +msgstr "comandos de weechat" + +msgid "names of proxies" +msgstr "nombres de proxies" + +msgid "options for proxies" +msgstr "opciones para proxies" + +msgid "options for bars" +msgstr "opciones para barras" + +msgid "key codes" +msgstr "códigos de tecla" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"Atajos que se pueden restaurar (atajos agregados, redefinidos o borrados)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2585,76 +2655,6 @@ msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" "%sError: solamente es posible fusionar buffers con contenido formateado" -msgid "names of buffers" -msgstr "nombres de los buffers" - -msgid "numbers of buffers" -msgstr "números de los buffers" - -msgid "names of buffers (including plugins names)" -msgstr "nombre de los buffers (incluyendo nombre de los plugins)" - -msgid "properties that can be set on a buffer" -msgstr "propiedades del buffer que pueden configurarse" - -msgid "properties that can be read on a buffer" -msgstr "propiedades del buffer que pueden leerse" - -msgid "configuration files" -msgstr "archivos de configuración" - -msgid "filename" -msgstr "nombre de archivo" - -msgid "names of filters" -msgstr "nombre de los filtros" - -msgid "commands (weechat and plugins)" -msgstr "comandos (weechat y plugins)" - -msgid "names of infos hooked" -msgstr "nombres de infos enganchados" - -msgid "names of infolists hooked" -msgstr "nombres de infolists enganchados" - -msgid "nicks in nicklist of current buffer" -msgstr "apodos en la lista de apodos del buffer actual" - -msgid "configuration options" -msgstr "opciones de configuración" - -msgid "names of plugins" -msgstr "nombres de plugins" - -msgid "commands defined by plugins" -msgstr "comandos definidos por plugins" - -msgid "names of bars" -msgstr "nombres de barras" - -msgid "values for a configuration option" -msgstr "valores de una opción de configuración" - -msgid "weechat commands" -msgstr "comandos de weechat" - -msgid "names of proxies" -msgstr "nombres de proxies" - -msgid "options for proxies" -msgstr "opciones para proxies" - -msgid "options for bars" -msgstr "opciones para barras" - -msgid "key codes" -msgstr "códigos de tecla" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"Atajos que se pueden restaurar (atajos agregados, redefinidos o borrados)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "" "Error: no hay suficiente memoria para agregar el buffer a la lista de " diff --git a/po/fr.po b/po/fr.po index 518d459cd..f8ca2bd70 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-08 15:03+0100\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" @@ -1704,6 +1704,77 @@ msgstr "" " défilement jusqu'au début du jour courant:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "noms des tampons" + +msgid "numbers of buffers" +msgstr "numéros des tampons" + +msgid "names of buffers (including plugins names)" +msgstr "noms des tampons (incluant les noms d'extensions)" + +msgid "properties that can be set on a buffer" +msgstr "propriétés qui peuvent être changées sur un tampon" + +msgid "properties that can be read on a buffer" +msgstr "propriétés qui peuvent être lues sur un tampon" + +msgid "configuration files" +msgstr "fichiers de configuration" + +msgid "filename" +msgstr "nom de fichier" + +msgid "names of filters" +msgstr "noms des filtres" + +msgid "commands (weechat and plugins)" +msgstr "commandes (weechat et extensions)" + +msgid "names of infos hooked" +msgstr "noms des infos accrochées" + +msgid "names of infolists hooked" +msgstr "noms des infolistes accrochées" + +msgid "nicks in nicklist of current buffer" +msgstr "pseudos dans la liste des pseudos du tampon courant" + +msgid "configuration options" +msgstr "options de configuration" + +msgid "names of plugins" +msgstr "noms des extensions" + +msgid "commands defined by plugins" +msgstr "commandes définies par les extensions" + +msgid "names of bars" +msgstr "noms des barres" + +msgid "values for a configuration option" +msgstr "valeurs pour une option de configuration" + +msgid "weechat commands" +msgstr "commandes weechat" + +msgid "names of proxies" +msgstr "noms des proxies" + +msgid "options for proxies" +msgstr "options pour les proxies" + +msgid "options for bars" +msgstr "options pour les barres" + +msgid "key codes" +msgstr "codes des touches" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"codes des touches pouvant être réinitialisées (touches ajoutées, redéfinies " +"ou supprimées)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2622,77 +2693,6 @@ msgstr "" "%sErreur: il est possible de mélanger seulement des tampons avec du contenu " "formaté" -msgid "names of buffers" -msgstr "noms des tampons" - -msgid "numbers of buffers" -msgstr "numéros des tampons" - -msgid "names of buffers (including plugins names)" -msgstr "noms des tampons (incluant les noms d'extensions)" - -msgid "properties that can be set on a buffer" -msgstr "propriétés qui peuvent être changées sur un tampon" - -msgid "properties that can be read on a buffer" -msgstr "propriétés qui peuvent être lues sur un tampon" - -msgid "configuration files" -msgstr "fichiers de configuration" - -msgid "filename" -msgstr "nom de fichier" - -msgid "names of filters" -msgstr "noms des filtres" - -msgid "commands (weechat and plugins)" -msgstr "commandes (weechat et extensions)" - -msgid "names of infos hooked" -msgstr "noms des infos accrochées" - -msgid "names of infolists hooked" -msgstr "noms des infolistes accrochées" - -msgid "nicks in nicklist of current buffer" -msgstr "pseudos dans la liste des pseudos du tampon courant" - -msgid "configuration options" -msgstr "options de configuration" - -msgid "names of plugins" -msgstr "noms des extensions" - -msgid "commands defined by plugins" -msgstr "commandes définies par les extensions" - -msgid "names of bars" -msgstr "noms des barres" - -msgid "values for a configuration option" -msgstr "valeurs pour une option de configuration" - -msgid "weechat commands" -msgstr "commandes weechat" - -msgid "names of proxies" -msgstr "noms des proxies" - -msgid "options for proxies" -msgstr "options pour les proxies" - -msgid "options for bars" -msgstr "options pour les barres" - -msgid "key codes" -msgstr "codes des touches" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"codes des touches pouvant être réinitialisées (touches ajoutées, redéfinies " -"ou supprimées)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "Erreur: impossible d'ajouter le tampon à la liste des tampons actifs" diff --git a/po/hu.po b/po/hu.po index 3a4a9e89c..5dae0c1a1 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-05 17:17+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1479,6 +1479,96 @@ msgstr "" "hogy az új ablak hány százaléka lesz a szülőablaknak. Például 25 esetén a " "szülőablak negyedét kapjuk." +#, fuzzy +msgid "names of buffers" +msgstr "puffer betöltése sikertelen" + +#, fuzzy +msgid "numbers of buffers" +msgstr "puffer betöltése sikertelen" + +msgid "names of buffers (including plugins names)" +msgstr "" + +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "puffer betöltése sikertelen" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "puffer betöltése sikertelen" + +#, fuzzy +msgid "configuration files" +msgstr "szerver konfigurációs fájljának újraolvastatása" + +#, fuzzy +msgid "filename" +msgstr "a felhasználók le lettek tiltva" + +#, fuzzy +msgid "names of filters" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "commands (weechat and plugins)" +msgstr " (nem található bővítőmodul)\n" + +#, fuzzy +msgid "names of infos hooked" +msgstr " időkezelők:\n" + +#, fuzzy +msgid "names of infolists hooked" +msgstr " időkezelők:\n" + +#, fuzzy +msgid "nicks in nicklist of current buffer" +msgstr "érvénytelen pufferhossz" + +#, fuzzy +msgid "configuration options" +msgstr "Nem található az opció\n" + +#, fuzzy +msgid "names of plugins" +msgstr "konfigurációs paraméterek beállítása" + +#, fuzzy +msgid "commands defined by plugins" +msgstr " (nem található bővítőmodul)\n" + +#, fuzzy +msgid "names of bars" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "values for a configuration option" +msgstr "Nem található az opció\n" + +#, fuzzy +msgid "weechat commands" +msgstr "%s belső parancsok:\n" + +#, fuzzy +msgid "names of proxies" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "options for proxies" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "options for bars" +msgstr "Aliaszok listája:\n" + +msgid "key codes" +msgstr "" + +#, fuzzy +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "Billentyűparancsok:\n" + #, fuzzy msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " @@ -2376,96 +2466,6 @@ msgstr "%s nem sikerült a \"%s\" modult betölteni: már van ilyen nevű modul\ msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" -#, fuzzy -msgid "names of buffers" -msgstr "puffer betöltése sikertelen" - -#, fuzzy -msgid "numbers of buffers" -msgstr "puffer betöltése sikertelen" - -msgid "names of buffers (including plugins names)" -msgstr "" - -#, fuzzy -msgid "properties that can be set on a buffer" -msgstr "puffer betöltése sikertelen" - -#, fuzzy -msgid "properties that can be read on a buffer" -msgstr "puffer betöltése sikertelen" - -#, fuzzy -msgid "configuration files" -msgstr "szerver konfigurációs fájljának újraolvastatása" - -#, fuzzy -msgid "filename" -msgstr "a felhasználók le lettek tiltva" - -#, fuzzy -msgid "names of filters" -msgstr "Aliaszok listája:\n" - -#, fuzzy -msgid "commands (weechat and plugins)" -msgstr " (nem található bővítőmodul)\n" - -#, fuzzy -msgid "names of infos hooked" -msgstr " időkezelők:\n" - -#, fuzzy -msgid "names of infolists hooked" -msgstr " időkezelők:\n" - -#, fuzzy -msgid "nicks in nicklist of current buffer" -msgstr "érvénytelen pufferhossz" - -#, fuzzy -msgid "configuration options" -msgstr "Nem található az opció\n" - -#, fuzzy -msgid "names of plugins" -msgstr "konfigurációs paraméterek beállítása" - -#, fuzzy -msgid "commands defined by plugins" -msgstr " (nem található bővítőmodul)\n" - -#, fuzzy -msgid "names of bars" -msgstr "Aliaszok listája:\n" - -#, fuzzy -msgid "values for a configuration option" -msgstr "Nem található az opció\n" - -#, fuzzy -msgid "weechat commands" -msgstr "%s belső parancsok:\n" - -#, fuzzy -msgid "names of proxies" -msgstr "Aliaszok listája:\n" - -#, fuzzy -msgid "options for proxies" -msgstr "Aliaszok listája:\n" - -#, fuzzy -msgid "options for bars" -msgstr "Aliaszok listája:\n" - -msgid "key codes" -msgstr "" - -#, fuzzy -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "Billentyűparancsok:\n" - #, fuzzy msgid "Error: not enough memory to add a buffer to hotlist" msgstr "%s nincs elég memória az ignore elkészítéséhez\n" diff --git a/po/it.po b/po/it.po index 3aca8687e..664a169ea 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-06 11:56+0100\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -1695,6 +1695,77 @@ msgstr "" " scorre all'inizio del giorno attuale:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "nomi dei buffer" + +msgid "numbers of buffers" +msgstr "numeri dei buffer" + +msgid "names of buffers (including plugins names)" +msgstr "nomi dei buffer (inclusi i nomi plugin)" + +msgid "properties that can be set on a buffer" +msgstr "proprietà che possono essere impostate su un buffer" + +msgid "properties that can be read on a buffer" +msgstr "proprietà che possono essere lette su un buffer" + +msgid "configuration files" +msgstr "file di configurazione" + +msgid "filename" +msgstr "nome file" + +msgid "names of filters" +msgstr "nomi dei filtri" + +msgid "commands (weechat and plugins)" +msgstr "comandi (weechat e plugin)" + +msgid "names of infos hooked" +msgstr "nomi degli hook sulle info" + +msgid "names of infolists hooked" +msgstr "nomi degli hook liste info" + +msgid "nicks in nicklist of current buffer" +msgstr "nick nella lista nick del buffer corrente" + +msgid "configuration options" +msgstr "opzioni di configurazione" + +msgid "names of plugins" +msgstr "nomi dei plugin" + +msgid "commands defined by plugins" +msgstr "comandi definiti dai plugin" + +msgid "names of bars" +msgstr "nomi delle barre" + +msgid "values for a configuration option" +msgstr "valori per una opzione di configurazione" + +msgid "weechat commands" +msgstr "comandi di weechat" + +msgid "names of proxies" +msgstr "nomi dei proxy" + +msgid "options for proxies" +msgstr "opzioni per i proxy" + +msgid "options for bars" +msgstr "opzioni per le barre" + +msgid "key codes" +msgstr "codici tasti" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"codici tasti che possono essere ripristinati (tasti aggiunti, ridefiniti o " +"rimossi)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2597,77 +2668,6 @@ msgstr "%sErrore: un buffer con lo stesso nome (%s) esiste già" msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "%sErrore: è possibile solo unire i buffer con il contenuto formattato" -msgid "names of buffers" -msgstr "nomi dei buffer" - -msgid "numbers of buffers" -msgstr "numeri dei buffer" - -msgid "names of buffers (including plugins names)" -msgstr "nomi dei buffer (inclusi i nomi plugin)" - -msgid "properties that can be set on a buffer" -msgstr "proprietà che possono essere impostate su un buffer" - -msgid "properties that can be read on a buffer" -msgstr "proprietà che possono essere lette su un buffer" - -msgid "configuration files" -msgstr "file di configurazione" - -msgid "filename" -msgstr "nome file" - -msgid "names of filters" -msgstr "nomi dei filtri" - -msgid "commands (weechat and plugins)" -msgstr "comandi (weechat e plugin)" - -msgid "names of infos hooked" -msgstr "nomi degli hook sulle info" - -msgid "names of infolists hooked" -msgstr "nomi degli hook liste info" - -msgid "nicks in nicklist of current buffer" -msgstr "nick nella lista nick del buffer corrente" - -msgid "configuration options" -msgstr "opzioni di configurazione" - -msgid "names of plugins" -msgstr "nomi dei plugin" - -msgid "commands defined by plugins" -msgstr "comandi definiti dai plugin" - -msgid "names of bars" -msgstr "nomi delle barre" - -msgid "values for a configuration option" -msgstr "valori per una opzione di configurazione" - -msgid "weechat commands" -msgstr "comandi di weechat" - -msgid "names of proxies" -msgstr "nomi dei proxy" - -msgid "options for proxies" -msgstr "opzioni per i proxy" - -msgid "options for bars" -msgstr "opzioni per le barre" - -msgid "key codes" -msgstr "codici tasti" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"codici tasti che possono essere ripristinati (tasti aggiunti, ridefiniti o " -"rimossi)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "Errore: memoria non sufficiente per aggiungere un buffer alla hotlist" diff --git a/po/pl.po b/po/pl.po index a6129ddfa..07c665882 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-06 11:56+0100\n" "Last-Translator: Krzysztof Koroscik \n" "Language-Team: weechat-dev \n" @@ -1696,6 +1696,77 @@ msgstr "" " przewiń do początku obecnego dnia:\n" " /window scroll -d" +msgid "names of buffers" +msgstr "nazwy buforów" + +msgid "numbers of buffers" +msgstr "numery buforów" + +msgid "names of buffers (including plugins names)" +msgstr "nazwy buforów (włącznie z nazwami wtyczek)" + +msgid "properties that can be set on a buffer" +msgstr "właściwości, jakie mogą być ustawione w buforze" + +msgid "properties that can be read on a buffer" +msgstr "właściwości, jakie moga być przeczytane w buforze" + +msgid "configuration files" +msgstr "pliki konfiguracyjne" + +msgid "filename" +msgstr "nazwa pliku" + +msgid "names of filters" +msgstr "nazwy wiltrów" + +msgid "commands (weechat and plugins)" +msgstr "komendy (weechata i pluginów)" + +msgid "names of infos hooked" +msgstr "nazwy powiązanych informacji" + +msgid "names of infolists hooked" +msgstr "nazwy powiązanych infolist" + +msgid "nicks in nicklist of current buffer" +msgstr "nicki na liście nicków obecnego bufora" + +msgid "configuration options" +msgstr "opcje konfiguracyjne" + +msgid "names of plugins" +msgstr "nazwy wtyczek" + +msgid "commands defined by plugins" +msgstr "komendy zdefiniowane przez wtyczki" + +msgid "names of bars" +msgstr "nazwy pasków" + +msgid "values for a configuration option" +msgstr "wartości opcji konfiguracyunych" + +msgid "weechat commands" +msgstr "komendy weechata" + +msgid "names of proxies" +msgstr "nazwy proxy" + +msgid "options for proxies" +msgstr "opcje proxy" + +msgid "options for bars" +msgstr "opcje pasków" + +msgid "key codes" +msgstr "kody klawiszowe" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" +"kody klawiszy, które mogą być zresetowane (klawisze dodane, zredefiniowane " +"lub udunięte)" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2579,77 +2650,6 @@ msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" "%sBłąd: możliwe jest tylko połączenie buforów z sformatowaną zawartością" -msgid "names of buffers" -msgstr "nazwy buforów" - -msgid "numbers of buffers" -msgstr "numery buforów" - -msgid "names of buffers (including plugins names)" -msgstr "nazwy buforów (włącznie z nazwami wtyczek)" - -msgid "properties that can be set on a buffer" -msgstr "właściwości, jakie mogą być ustawione w buforze" - -msgid "properties that can be read on a buffer" -msgstr "właściwości, jakie moga być przeczytane w buforze" - -msgid "configuration files" -msgstr "pliki konfiguracyjne" - -msgid "filename" -msgstr "nazwa pliku" - -msgid "names of filters" -msgstr "nazwy wiltrów" - -msgid "commands (weechat and plugins)" -msgstr "komendy (weechata i pluginów)" - -msgid "names of infos hooked" -msgstr "nazwy powiązanych informacji" - -msgid "names of infolists hooked" -msgstr "nazwy powiązanych infolist" - -msgid "nicks in nicklist of current buffer" -msgstr "nicki na liście nicków obecnego bufora" - -msgid "configuration options" -msgstr "opcje konfiguracyjne" - -msgid "names of plugins" -msgstr "nazwy wtyczek" - -msgid "commands defined by plugins" -msgstr "komendy zdefiniowane przez wtyczki" - -msgid "names of bars" -msgstr "nazwy pasków" - -msgid "values for a configuration option" -msgstr "wartości opcji konfiguracyunych" - -msgid "weechat commands" -msgstr "komendy weechata" - -msgid "names of proxies" -msgstr "nazwy proxy" - -msgid "options for proxies" -msgstr "opcje proxy" - -msgid "options for bars" -msgstr "opcje pasków" - -msgid "key codes" -msgstr "kody klawiszowe" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" -"kody klawiszy, które mogą być zresetowane (klawisze dodane, zredefiniowane " -"lub udunięte)" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "Błąd: za mało pamięci, aby dodać bufor do hotlisty" diff --git a/po/ru.po b/po/ru.po index 4c0f75b08..10e998e00 100644 --- a/po/ru.po +++ b/po/ru.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: 2010-11-05 17:17+0100\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -1488,6 +1488,96 @@ msgstr "" "Для splith и splitv <прцт> - процент размера создаваемого окна относительно " "текущего. Например, 25 означает создать окно в 4 раза меньше текущего" +#, fuzzy +msgid "names of buffers" +msgstr "загрузка буфера не удалась" + +#, fuzzy +msgid "numbers of buffers" +msgstr "загрузка буфера не удалась" + +msgid "names of buffers (including plugins names)" +msgstr "" + +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "загрузка буфера не удалась" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "загрузка буфера не удалась" + +#, fuzzy +msgid "configuration files" +msgstr "перезагрузить конфигурационный файл сервера" + +#, fuzzy +msgid "filename" +msgstr "команда users отключена" + +#, fuzzy +msgid "names of filters" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "commands (weechat and plugins)" +msgstr " (нет pluginа)\n" + +#, fuzzy +msgid "names of infos hooked" +msgstr " обработчики таймера:\n" + +#, fuzzy +msgid "names of infolists hooked" +msgstr " обработчики таймера:\n" + +#, fuzzy +msgid "nicks in nicklist of current buffer" +msgstr "некорректная длина буфера" + +#, fuzzy +msgid "configuration options" +msgstr "Не найден параметр\n" + +#, fuzzy +msgid "names of plugins" +msgstr "настроить параметры конфигурации" + +#, fuzzy +msgid "commands defined by plugins" +msgstr " (нет pluginа)\n" + +#, fuzzy +msgid "names of bars" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "values for a configuration option" +msgstr "Не найден параметр\n" + +#, fuzzy +msgid "weechat commands" +msgstr "Внутренние команды %s:\n" + +#, fuzzy +msgid "names of proxies" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "options for proxies" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "options for bars" +msgstr "Список сокращений:\n" + +msgid "key codes" +msgstr "" + +#, fuzzy +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "Комбинации клавиш:\n" + #, fuzzy msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " @@ -2396,96 +2486,6 @@ msgstr "" msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" -#, fuzzy -msgid "names of buffers" -msgstr "загрузка буфера не удалась" - -#, fuzzy -msgid "numbers of buffers" -msgstr "загрузка буфера не удалась" - -msgid "names of buffers (including plugins names)" -msgstr "" - -#, fuzzy -msgid "properties that can be set on a buffer" -msgstr "загрузка буфера не удалась" - -#, fuzzy -msgid "properties that can be read on a buffer" -msgstr "загрузка буфера не удалась" - -#, fuzzy -msgid "configuration files" -msgstr "перезагрузить конфигурационный файл сервера" - -#, fuzzy -msgid "filename" -msgstr "команда users отключена" - -#, fuzzy -msgid "names of filters" -msgstr "Список сокращений:\n" - -#, fuzzy -msgid "commands (weechat and plugins)" -msgstr " (нет pluginа)\n" - -#, fuzzy -msgid "names of infos hooked" -msgstr " обработчики таймера:\n" - -#, fuzzy -msgid "names of infolists hooked" -msgstr " обработчики таймера:\n" - -#, fuzzy -msgid "nicks in nicklist of current buffer" -msgstr "некорректная длина буфера" - -#, fuzzy -msgid "configuration options" -msgstr "Не найден параметр\n" - -#, fuzzy -msgid "names of plugins" -msgstr "настроить параметры конфигурации" - -#, fuzzy -msgid "commands defined by plugins" -msgstr " (нет pluginа)\n" - -#, fuzzy -msgid "names of bars" -msgstr "Список сокращений:\n" - -#, fuzzy -msgid "values for a configuration option" -msgstr "Не найден параметр\n" - -#, fuzzy -msgid "weechat commands" -msgstr "Внутренние команды %s:\n" - -#, fuzzy -msgid "names of proxies" -msgstr "Список сокращений:\n" - -#, fuzzy -msgid "options for proxies" -msgstr "Список сокращений:\n" - -#, fuzzy -msgid "options for bars" -msgstr "Список сокращений:\n" - -msgid "key codes" -msgstr "" - -#, fuzzy -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "Комбинации клавиш:\n" - #, fuzzy msgid "Error: not enough memory to add a buffer to hotlist" msgstr "%s не могу добавить буфер в хотлист\n" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index e3069e1cc..0978fa1e2 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -5,6 +5,8 @@ SET(WEECHAT_SOURCES ./src/core/weechat.h ./src/core/wee-command.c ./src/core/wee-command.h +./src/core/wee-completion.c +./src/core/wee-completion.h ./src/core/wee-config.c ./src/core/wee-config-file.c ./src/core/wee-config-file.h diff --git a/po/weechat.pot b/po/weechat.pot index 88fdd23d9..873e3fa52 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-11-08 15:03+0100\n" +"POT-Creation-Date: 2010-11-09 15:01+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1273,6 +1273,75 @@ msgid "" " /window scroll -d" msgstr "" +msgid "names of buffers" +msgstr "" + +msgid "numbers of buffers" +msgstr "" + +msgid "names of buffers (including plugins names)" +msgstr "" + +msgid "properties that can be set on a buffer" +msgstr "" + +msgid "properties that can be read on a buffer" +msgstr "" + +msgid "configuration files" +msgstr "" + +msgid "filename" +msgstr "" + +msgid "names of filters" +msgstr "" + +msgid "commands (weechat and plugins)" +msgstr "" + +msgid "names of infos hooked" +msgstr "" + +msgid "names of infolists hooked" +msgstr "" + +msgid "nicks in nicklist of current buffer" +msgstr "" + +msgid "configuration options" +msgstr "" + +msgid "names of plugins" +msgstr "" + +msgid "commands defined by plugins" +msgstr "" + +msgid "names of bars" +msgstr "" + +msgid "values for a configuration option" +msgstr "" + +msgid "weechat commands" +msgstr "" + +msgid "names of proxies" +msgstr "" + +msgid "options for proxies" +msgstr "" + +msgid "options for bars" +msgstr "" + +msgid "key codes" +msgstr "" + +msgid "key codes that can be reset (keys added, redefined or removed)" +msgstr "" + msgid "" "Warning: you should now issue /save to write \"save_config_on_exit\" option " "in configuration file" @@ -2049,75 +2118,6 @@ msgstr "" msgid "%sError: it is only possible to merge buffers with formatted content" msgstr "" -msgid "names of buffers" -msgstr "" - -msgid "numbers of buffers" -msgstr "" - -msgid "names of buffers (including plugins names)" -msgstr "" - -msgid "properties that can be set on a buffer" -msgstr "" - -msgid "properties that can be read on a buffer" -msgstr "" - -msgid "configuration files" -msgstr "" - -msgid "filename" -msgstr "" - -msgid "names of filters" -msgstr "" - -msgid "commands (weechat and plugins)" -msgstr "" - -msgid "names of infos hooked" -msgstr "" - -msgid "names of infolists hooked" -msgstr "" - -msgid "nicks in nicklist of current buffer" -msgstr "" - -msgid "configuration options" -msgstr "" - -msgid "names of plugins" -msgstr "" - -msgid "commands defined by plugins" -msgstr "" - -msgid "names of bars" -msgstr "" - -msgid "values for a configuration option" -msgstr "" - -msgid "weechat commands" -msgstr "" - -msgid "names of proxies" -msgstr "" - -msgid "options for proxies" -msgstr "" - -msgid "options for bars" -msgstr "" - -msgid "key codes" -msgstr "" - -msgid "key codes that can be reset (keys added, redefined or removed)" -msgstr "" - msgid "Error: not enough memory to add a buffer to hotlist" msgstr "" diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c1a22c81e..dd18ba928 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -23,6 +23,7 @@ SET(LIB_CORE_SRC weechat.c weechat.h wee-backtrace.c wee-backtrace.h wee-command.c wee-command.h +wee-completion.c wee-completion.h wee-config.c wee-config.h wee-config-file.c wee-config-file.h wee-debug.c wee-debug.h diff --git a/src/core/Makefile.am b/src/core/Makefile.am index aa663769e..7f9fb525f 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -27,6 +27,8 @@ lib_weechat_core_a_SOURCES = weechat.c \ wee-backtrace.h \ wee-command.c \ wee-command.h \ + wee-completion.c \ + wee-completion.h \ wee-config.c \ wee-config.h \ wee-config-file.c \ diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c new file mode 100644 index 000000000..cd4bbf576 --- /dev/null +++ b/src/core/wee-completion.c @@ -0,0 +1,1188 @@ +/* + * Copyright (C) 2003-2010 Sebastien Helleu + * Copyright (C) 2006 Emmanuel Bouthenot + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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 3 of the License, or + * (at your option) any later version. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * wee-completion.c: completion for WeeChat commands + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "weechat.h" +#include "wee-config.h" +#include "wee-hook.h" +#include "wee-list.h" +#include "wee-proxy.h" +#include "wee-string.h" +#include "../plugins/plugin.h" +#include "../gui/gui-completion.h" +#include "../gui/gui-bar.h" +#include "../gui/gui-buffer.h" +#include "../gui/gui-color.h" +#include "../gui/gui-filter.h" +#include "../gui/gui-keyboard.h" +#include "../gui/gui-nicklist.h" + + +/* + * completion_list_add_bars_names_cb: add bars names to completion list + */ + +int +completion_list_add_bars_names_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_bar *ptr_bar; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) + { + gui_completion_list_add (completion, ptr_bar->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_bars_options: add bars options to completion list + */ + +int +completion_list_add_bars_options_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++) + { + gui_completion_list_add (completion, gui_bar_option_string[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_buffers_names_cb: add buffers names to completion list + */ + +int +completion_list_add_buffers_names_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_buffer *ptr_buffer; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + gui_completion_list_add (completion, ptr_buffer->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_buffers_numbers_cb: add buffers numbers to completion list + */ + +int +completion_list_add_buffers_numbers_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_buffer *ptr_buffer; + char str_number[32]; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + snprintf (str_number, sizeof (str_number), "%d", ptr_buffer->number); + gui_completion_list_add (completion, str_number, + 0, WEECHAT_LIST_POS_END); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_buffers_plugins_names_cb: add plugins + buffers names to + * completion list + */ + +int +completion_list_add_buffers_plugins_names_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_buffer *ptr_buffer; + char name[512]; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_buffer = gui_buffers; ptr_buffer; + ptr_buffer = ptr_buffer->next_buffer) + { + snprintf (name, sizeof (name), "%s.%s", + plugin_get_name (ptr_buffer->plugin), + ptr_buffer->name); + gui_completion_list_add (completion, name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_buffer_properties_set_cb: add buffer properties (that + * can be set) to completion list + */ + +int +completion_list_add_buffer_properties_set_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; gui_buffer_properties_set[i]; i++) + { + gui_completion_list_add (completion, + gui_buffer_properties_set[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_buffer_properties_get_cb: add buffer properties (that + * can be read) to completion list + */ + +int +completion_list_add_buffer_properties_get_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; gui_buffer_properties_get_integer[i]; i++) + { + gui_completion_list_add (completion, + gui_buffer_properties_get_integer[i], + 0, WEECHAT_LIST_POS_SORT); + } + for (i = 0; gui_buffer_properties_get_string[i]; i++) + { + gui_completion_list_add (completion, + gui_buffer_properties_get_string[i], + 0, WEECHAT_LIST_POS_SORT); + } + for (i = 0; gui_buffer_properties_get_pointer[i]; i++) + { + gui_completion_list_add (completion, + gui_buffer_properties_get_pointer[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_config_files_cb: add config files to completion list + */ + +int +completion_list_add_config_files_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_config_file *ptr_config_file; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_config_file = config_files; ptr_config_file; + ptr_config_file = ptr_config_file->next_config) + { + gui_completion_list_add (completion, ptr_config_file->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_filename: add filename to completion list + */ + +int +completion_list_add_filename_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + char *path_d, *path_b, *p, *d_name; + char *real_prefix, *prefix; + char *buf; + int buf_len; + DIR *dp; + struct dirent *entry; + struct stat statbuf; + char home[3] = { '~', DIR_SEPARATOR_CHAR, '\0' }; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + buf_len = PATH_MAX; + buf = malloc (buf_len); + if (!buf) + return WEECHAT_RC_OK; + + completion->add_space = 0; + + if ((strncmp (completion->base_word, home, 2) == 0) && getenv("HOME")) + { + real_prefix = strdup (getenv("HOME")); + prefix = strdup (home); + } + else + { + if ((strncmp (completion->base_word, DIR_SEPARATOR, 1) != 0) + || (strcmp (completion->base_word, "") == 0)) + { + real_prefix = strdup (weechat_home); + prefix = strdup (""); + } + else + { + real_prefix = strdup (DIR_SEPARATOR); + prefix = strdup (DIR_SEPARATOR); + } + } + + snprintf (buf, buf_len, "%s", completion->base_word + strlen (prefix)); + p = strrchr (buf, DIR_SEPARATOR_CHAR); + if (p) + { + p[0] = '\0'; + path_d = strdup (buf); + p++; + path_b = strdup (p); + } + else + { + path_d = strdup (""); + path_b = strdup (buf); + } + + sprintf (buf, "%s%s%s", real_prefix, DIR_SEPARATOR, path_d); + d_name = strdup (buf); + dp = opendir (d_name); + if (dp != NULL) + { + while ((entry = readdir (dp)) != NULL) + { + if (strncmp (entry->d_name, path_b, strlen (path_b)) == 0) + { + if (strcmp (entry->d_name, ".") == 0 || strcmp (entry->d_name, "..") == 0) + continue; + + snprintf (buf, buf_len, "%s%s%s", + d_name, DIR_SEPARATOR, entry->d_name); + if (stat (buf, &statbuf) == -1) + continue; + + snprintf (buf, buf_len, "%s%s%s%s%s%s", + prefix, + ((strcmp(prefix, "") == 0) + || strchr(prefix, DIR_SEPARATOR_CHAR)) ? "" : DIR_SEPARATOR, + path_d, + strcmp(path_d, "") == 0 ? "" : DIR_SEPARATOR, + entry->d_name, + S_ISDIR(statbuf.st_mode) ? DIR_SEPARATOR : ""); + + gui_completion_list_add (completion, buf, + 0, WEECHAT_LIST_POS_SORT); + } + } + closedir (dp); + } + + free (d_name); + free (prefix); + free (real_prefix); + free (path_d); + free (path_b); + free (buf); + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_filters_cb: add filters to completion list + */ + +int +completion_list_add_filters_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_filter *ptr_filter; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_filter = gui_filters; ptr_filter; + ptr_filter = ptr_filter->next_filter) + { + gui_completion_list_add (completion, ptr_filter->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_commands_cb: add command hooks to completion list + */ + +int +completion_list_add_commands_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_hook *ptr_hook; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if (!ptr_hook->deleted + && (HOOK_COMMAND(ptr_hook, command)) + && (HOOK_COMMAND(ptr_hook, command)[0])) + gui_completion_list_add (completion, + HOOK_COMMAND(ptr_hook, command), + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_infos_cb: add info hooks to completion list + */ + +int +completion_list_add_infos_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_hook *ptr_hook; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_hook = weechat_hooks[HOOK_TYPE_INFO]; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if (!ptr_hook->deleted + && (HOOK_INFO(ptr_hook, info_name)) + && (HOOK_INFO(ptr_hook, info_name)[0])) + gui_completion_list_add (completion, + HOOK_INFO(ptr_hook, info_name), + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_infolists_cb: add infolist hooks to completion list + */ + +int +completion_list_add_infolists_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_hook *ptr_hook; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST]; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if (!ptr_hook->deleted + && (HOOK_INFOLIST(ptr_hook, infolist_name)) + && (HOOK_INFOLIST(ptr_hook, infolist_name)[0])) + gui_completion_list_add (completion, + HOOK_INFOLIST(ptr_hook, infolist_name), + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_nicks_cb: add nicks to completion list + */ + +int +completion_list_add_nicks_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_nick_group *ptr_group; + struct t_gui_nick *ptr_nick; + int count_before; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + count_before = weelist_size (completion->completion_list); + hook_completion_exec (completion->buffer->plugin, + "nick", + completion->buffer, + completion); + if (weelist_size (completion->completion_list) == count_before) + { + /* no plugin overrides nick completion, then we use default nick */ + /* completion, wich nicks of nicklist, in order of nicklist */ + ptr_group = NULL; + ptr_nick = NULL; + gui_nicklist_get_next_item (completion->buffer, + &ptr_group, &ptr_nick); + while (ptr_group || ptr_nick) + { + if (ptr_nick && ptr_nick->visible) + { + gui_completion_list_add (completion, + ptr_nick->name, + 1, WEECHAT_LIST_POS_END); + } + gui_nicklist_get_next_item (completion->buffer, + &ptr_group, &ptr_nick); + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_config_options_cb: add config option to completion + * list + */ + +int +completion_list_add_config_options_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_config_file *ptr_config; + struct t_config_section *ptr_section; + struct t_config_option *ptr_option; + int length; + char *option_full_name; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_config = config_files; ptr_config; + ptr_config = ptr_config->next_config) + { + for (ptr_section = ptr_config->sections; ptr_section; + ptr_section = ptr_section->next_section) + { + for (ptr_option = ptr_section->options; ptr_option; + ptr_option = ptr_option->next_option) + { + length = strlen (ptr_config->name) + 1 + + strlen (ptr_section->name) + 1 + + strlen (ptr_option->name) + 1; + option_full_name = malloc (length); + if (option_full_name) + { + snprintf (option_full_name, length, "%s.%s.%s", + ptr_config->name, ptr_section->name, + ptr_option->name); + gui_completion_list_add (completion, + option_full_name, + 0, WEECHAT_LIST_POS_SORT); + free (option_full_name); + } + } + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_plugins_cb: add plugin name to completion list + */ + +int +completion_list_add_plugins_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_weechat_plugin *ptr_plugin; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_plugin = weechat_plugins; ptr_plugin; + ptr_plugin = ptr_plugin->next_plugin) + { + gui_completion_list_add (completion, ptr_plugin->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_plugins_commands_cb: add plugin commands to completion + * list (plugin name is previous + * argument) + */ + +int +completion_list_add_plugins_commands_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + char *pos_space, *plugin_name; + struct t_weechat_plugin *ptr_plugin; + struct t_hook *ptr_hook; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + if (completion->args) + { + pos_space = strchr (completion->args, ' '); + if (pos_space) + plugin_name = string_strndup (completion->args, + pos_space - completion->args); + else + plugin_name = strdup (completion->args); + + if (plugin_name) + { + ptr_plugin = NULL; + if (string_strcasecmp (plugin_name, PLUGIN_CORE) != 0) + { + /* + * plugin name is different from "core", then search it in + * plugin list + */ + ptr_plugin = plugin_search (plugin_name); + if (!ptr_plugin) + return WEECHAT_RC_OK; + } + for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if (!ptr_hook->deleted + && (ptr_hook->plugin == ptr_plugin) + && HOOK_COMMAND(ptr_hook, command) + && HOOK_COMMAND(ptr_hook, command)[0]) + { + gui_completion_list_add (completion, + HOOK_COMMAND(ptr_hook, command), + 0, WEECHAT_LIST_POS_SORT); + } + } + free (plugin_name); + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_config_option_values_cb: add option value to completion + * list + */ + +int +completion_list_add_config_option_values_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + char *pos_space, *option_full_name, *pos_section, *pos_option; + char *file, *section, *value_string; + const char *color_name; + int length, i, num_colors; + struct t_config_file *ptr_config; + struct t_config_section *ptr_section, *section_found; + struct t_config_option *option_found; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + if (completion->args) + { + pos_space = strchr (completion->args, ' '); + if (pos_space) + option_full_name = string_strndup (completion->args, + pos_space - completion->args); + else + option_full_name = strdup (completion->args); + + if (option_full_name) + { + file = NULL; + section = NULL; + pos_option = NULL; + + pos_section = strchr (option_full_name, '.'); + pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL; + + if (pos_section && pos_option) + { + file = string_strndup (option_full_name, + pos_section - option_full_name); + section = string_strndup (pos_section + 1, + pos_option - pos_section - 1); + pos_option++; + } + if (file && section && pos_option) + { + ptr_config = config_file_search (file); + if (ptr_config) + { + ptr_section = config_file_search_section (ptr_config, + section); + if (ptr_section) + { + config_file_search_section_option (ptr_config, + ptr_section, + pos_option, + §ion_found, + &option_found); + if (option_found) + { + switch (option_found->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + gui_completion_list_add (completion, "on", + 0, WEECHAT_LIST_POS_SORT); + gui_completion_list_add (completion, "off", + 0, WEECHAT_LIST_POS_SORT); + gui_completion_list_add (completion, "toggle", + 0, WEECHAT_LIST_POS_END); + if (option_found->value) + { + if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE) + gui_completion_list_add (completion, "on", + 0, WEECHAT_LIST_POS_BEGINNING); + else + gui_completion_list_add (completion, "off", + 0, WEECHAT_LIST_POS_BEGINNING); + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (option_found->string_values) + { + for (i = 0; option_found->string_values[i]; i++) + { + gui_completion_list_add (completion, + option_found->string_values[i], + 0, WEECHAT_LIST_POS_SORT); + } + gui_completion_list_add (completion, "++1", + 0, WEECHAT_LIST_POS_END); + gui_completion_list_add (completion, "--1", + 0, WEECHAT_LIST_POS_END); + if (option_found->value) + { + gui_completion_list_add (completion, + option_found->string_values[CONFIG_INTEGER(option_found)], + 0, WEECHAT_LIST_POS_BEGINNING); + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + } + else + { + if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min) + gui_completion_list_add (completion, "--1", + 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max) + gui_completion_list_add (completion, "++1", + 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value) + { + length = 64; + value_string = malloc (length); + if (value_string) + { + snprintf (value_string, length, + "%d", CONFIG_INTEGER(option_found)); + gui_completion_list_add (completion, + value_string, + 0, WEECHAT_LIST_POS_BEGINNING); + free (value_string); + } + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + } + break; + case CONFIG_OPTION_TYPE_STRING: + gui_completion_list_add (completion, + "\"\"", + 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value) + { + length = strlen (CONFIG_STRING(option_found)) + 2 + 1; + value_string = malloc (length); + if (value_string) + { + snprintf (value_string, length, + "\"%s\"", + CONFIG_STRING(option_found)); + gui_completion_list_add (completion, + value_string, + 0, WEECHAT_LIST_POS_BEGINNING); + free (value_string); + } + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + break; + case CONFIG_OPTION_TYPE_COLOR: + num_colors = gui_color_get_number (); + for (i = 0; i < num_colors; i++) + { + color_name = gui_color_get_name (i); + if (color_name) + gui_completion_list_add (completion, + color_name, + 0, WEECHAT_LIST_POS_SORT); + } + gui_completion_list_add (completion, "++1", + 0, WEECHAT_LIST_POS_END); + gui_completion_list_add (completion, "--1", + 0, WEECHAT_LIST_POS_END); + if (option_found->value) + { + color_name = gui_color_get_name (CONFIG_INTEGER(option_found)); + if (color_name) + { + gui_completion_list_add (completion, + color_name, + 0, WEECHAT_LIST_POS_BEGINNING); + } + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + break; + case CONFIG_NUM_OPTION_TYPES: + break; + } + if (option_found->value + && option_found->null_value_allowed) + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, + WEECHAT_LIST_POS_END); + } + } + } + } + } + if (file) + free (file); + if (section) + free (section); + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_weechat_commands_cb: add WeeChat commands to + * completion list + */ + +int +completion_list_add_weechat_commands_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_hook *ptr_hook; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; + ptr_hook = ptr_hook->next_hook) + { + if (!ptr_hook->deleted + && !ptr_hook->plugin + && HOOK_COMMAND(ptr_hook, command) + && HOOK_COMMAND(ptr_hook, command)[0]) + { + gui_completion_list_add (completion, + HOOK_COMMAND(ptr_hook, command), + 0, WEECHAT_LIST_POS_SORT); + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_proxies_names_cb: add proxies names to completion list + */ + +int +completion_list_add_proxies_names_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_proxy *ptr_proxy; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_proxy = weechat_proxies; ptr_proxy; + ptr_proxy = ptr_proxy->next_proxy) + { + gui_completion_list_add (completion, ptr_proxy->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_proxies_options: add proxies options to completion list + */ + +int +completion_list_add_proxies_options_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + int i; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (i = 0; i < PROXY_NUM_OPTIONS; i++) + { + gui_completion_list_add (completion, proxy_option_string[i], + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_keys_codes_cb: add keys to completion list + */ + +int +completion_list_add_keys_codes_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_key *ptr_key; + char *expanded_name; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) + { + expanded_name = gui_keyboard_get_expanded_name (ptr_key->key); + gui_completion_list_add (completion, + (expanded_name) ? expanded_name : ptr_key->key, + 0, WEECHAT_LIST_POS_SORT); + if (expanded_name) + free (expanded_name); + } + + return WEECHAT_RC_OK; +} + +/* + * completion_list_add_keys_codes_for_reset_cb: add keys that can be reset + * (keys added, redefined or + * removed) to completion list + */ + +int +completion_list_add_keys_codes_for_reset_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_gui_key *ptr_key, *ptr_default_key; + char *expanded_name; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + /* keys added or redefined */ + for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) + { + ptr_default_key = gui_keyboard_search (gui_default_keys, ptr_key->key); + if (!ptr_default_key + || (strcmp (ptr_default_key->command, ptr_key->command) != 0)) + { + expanded_name = gui_keyboard_get_expanded_name (ptr_key->key); + gui_completion_list_add (completion, + (expanded_name) ? expanded_name : ptr_key->key, + 0, WEECHAT_LIST_POS_SORT); + if (expanded_name) + free (expanded_name); + } + } + + /* keys deleted */ + for (ptr_default_key = gui_default_keys; ptr_default_key; + ptr_default_key = ptr_default_key->next_key) + { + ptr_key = gui_keyboard_search (gui_keys, ptr_default_key->key); + if (!ptr_key) + { + expanded_name = gui_keyboard_get_expanded_name (ptr_default_key->key); + gui_completion_list_add (completion, + (expanded_name) ? expanded_name : ptr_default_key->key, + 0, WEECHAT_LIST_POS_SORT); + if (expanded_name) + free (expanded_name); + } + } + + return WEECHAT_RC_OK; +} + +/* + * completion_init: add hooks for completions done by WeeChat core + */ + +void +completion_init () +{ + hook_completion (NULL, "buffers_names", /* formerly "%b" */ + N_("names of buffers"), + &completion_list_add_buffers_names_cb, NULL); + hook_completion (NULL, "buffers_numbers", + N_("numbers of buffers"), + &completion_list_add_buffers_numbers_cb, NULL); + hook_completion (NULL, "buffers_plugins_names", /* formerly "%B" */ + N_("names of buffers (including plugins names)"), + &completion_list_add_buffers_plugins_names_cb, NULL); + hook_completion (NULL, "buffer_properties_set", + N_("properties that can be set on a buffer"), + &completion_list_add_buffer_properties_set_cb, NULL); + hook_completion (NULL, "buffer_properties_get", + N_("properties that can be read on a buffer"), + &completion_list_add_buffer_properties_get_cb, NULL); + hook_completion (NULL, "config_files", /* formerly "%c" */ + N_("configuration files"), + &completion_list_add_config_files_cb, NULL); + hook_completion (NULL, "filename", /* formerly "%f" */ + N_("filename"), + &completion_list_add_filename_cb, NULL); + hook_completion (NULL, "filters_names", /* formerly "%F" */ + N_("names of filters"), + &completion_list_add_filters_cb, NULL); + hook_completion (NULL, "commands", /* formerly "%h" */ + N_("commands (weechat and plugins)"), + &completion_list_add_commands_cb, NULL); + hook_completion (NULL, "infos", /* formerly "%i" */ + N_("names of infos hooked"), + &completion_list_add_infos_cb, NULL); + hook_completion (NULL, "infolists", /* formerly "%I" */ + N_("names of infolists hooked"), + &completion_list_add_infolists_cb, NULL); + hook_completion (NULL, "nicks", /* formerly "%n" */ + N_("nicks in nicklist of current buffer"), + &completion_list_add_nicks_cb, NULL); + hook_completion (NULL, "config_options", /* formerly "%o" */ + N_("configuration options"), + &completion_list_add_config_options_cb, NULL); + hook_completion (NULL, "plugins_names", /* formerly "%p" */ + N_("names of plugins"), + &completion_list_add_plugins_cb, NULL); + hook_completion (NULL, "plugins_commands", /* formerly "%P" */ + N_("commands defined by plugins"), + &completion_list_add_plugins_commands_cb, NULL); + hook_completion (NULL, "bars_names", /* formerly "%r" */ + N_("names of bars"), + &completion_list_add_bars_names_cb, NULL); + hook_completion (NULL, "config_option_values", /* formerly "%v" */ + N_("values for a configuration option"), + &completion_list_add_config_option_values_cb, NULL); + hook_completion (NULL, "weechat_commands", /* formerly "%w" */ + N_("weechat commands"), + &completion_list_add_weechat_commands_cb, NULL); + hook_completion (NULL, "proxies_names", /* formerly "%y" */ + N_("names of proxies"), + &completion_list_add_proxies_names_cb, NULL); + hook_completion (NULL, "proxies_options", + N_("options for proxies"), + &completion_list_add_proxies_options_cb, NULL); + hook_completion (NULL, "bars_options", + N_("options for bars"), + &completion_list_add_bars_options_cb, NULL); + hook_completion (NULL, "keys_codes", + N_("key codes"), + &completion_list_add_keys_codes_cb, NULL); + hook_completion (NULL, "keys_codes_for_reset", + N_("key codes that can be reset (keys added, redefined " + "or removed)"), + &completion_list_add_keys_codes_for_reset_cb, NULL); +} diff --git a/src/core/wee-completion.h b/src/core/wee-completion.h new file mode 100644 index 000000000..e13dc9870 --- /dev/null +++ b/src/core/wee-completion.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2003-2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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 3 of the License, or + * (at your option) any later version. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_COMPLETION_H +#define __WEECHAT_COMPLETION_H 1 + +struct t_gui_buffer; +struct t_gui_completion; + +extern int completion_list_add_filename_cb (void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion); +extern void completion_init (); + +#endif /* __WEECHAT_COMPLETION_H */ diff --git a/src/core/weechat.c b/src/core/weechat.c index 322558ffd..75dac6b3c 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -54,6 +54,7 @@ #include "weechat.h" #include "wee-command.h" +#include "wee-completion.h" #include "wee-config.h" #include "wee-debug.h" #include "wee-hook.h" @@ -389,7 +390,7 @@ main (int argc, char *argv[]) gui_main_pre_init (&argc, &argv); /* pre-initiliaze interface */ weechat_init_vars (); /* initialize some variables */ command_init (); /* initialize WeeChat commands */ - gui_completion_init (); /* add core completion hooks */ + completion_init (); /* add core completion hooks */ gui_keyboard_init (); /* init keyboard */ if (!config_weechat_init ()) /* init options with default values */ exit (EXIT_FAILURE); diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 7cf125d21..02a7745b4 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1,6 +1,5 @@ /* * Copyright (C) 2003-2010 Sebastien Helleu - * Copyright (C) 2006 Emmanuel Bouthenot * * This file is part of WeeChat, the extensible chat client. * @@ -36,22 +35,15 @@ #include #include "../core/weechat.h" +#include "../core/wee-completion.h" #include "../core/wee-config.h" #include "../core/wee-hook.h" #include "../core/wee-list.h" #include "../core/wee-log.h" -#include "../core/wee-proxy.h" #include "../core/wee-string.h" #include "../core/wee-utf8.h" #include "../plugins/plugin.h" -#include "../plugins/plugin-config.h" #include "gui-completion.h" -#include "gui-bar.h" -#include "gui-buffer.h" -#include "gui-color.h" -#include "gui-filter.h" -#include "gui-keyboard.h" -#include "gui-nicklist.h" /* @@ -359,1069 +351,6 @@ gui_completion_list_add (struct t_gui_completion *completion, const char *word, } } -/* - * gui_completion_list_add_bars_names_cb: add bars names to completion list - */ - -int -gui_completion_list_add_bars_names_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_bar *ptr_bar; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) - { - gui_completion_list_add (completion, ptr_bar->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_bars_options: add bars options to completion list - */ - -int -gui_completion_list_add_bars_options_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - int i; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++) - { - gui_completion_list_add (completion, gui_bar_option_string[i], - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_buffers_names_cb: add buffers names to completion - * list - */ - -int -gui_completion_list_add_buffers_names_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_buffer *ptr_buffer; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_buffer = gui_buffers; ptr_buffer; - ptr_buffer = ptr_buffer->next_buffer) - { - gui_completion_list_add (completion, ptr_buffer->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_buffers_numbers_cb: add buffers numbers to - * completion list - */ - -int -gui_completion_list_add_buffers_numbers_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_buffer *ptr_buffer; - char str_number[32]; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_buffer = gui_buffers; ptr_buffer; - ptr_buffer = ptr_buffer->next_buffer) - { - snprintf (str_number, sizeof (str_number), "%d", ptr_buffer->number); - gui_completion_list_add (completion, str_number, - 0, WEECHAT_LIST_POS_END); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_buffers_plugins_names_cb: add plugins + buffers names - * to completion list - */ - -int -gui_completion_list_add_buffers_plugins_names_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_buffer *ptr_buffer; - char name[512]; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_buffer = gui_buffers; ptr_buffer; - ptr_buffer = ptr_buffer->next_buffer) - { - snprintf (name, sizeof (name), "%s.%s", - plugin_get_name (ptr_buffer->plugin), - ptr_buffer->name); - gui_completion_list_add (completion, name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_buffer_properties_set_cb: add buffer properties - * (that can be set) to - * completion list - */ - -int -gui_completion_list_add_buffer_properties_set_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - int i; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (i = 0; gui_buffer_properties_set[i]; i++) - { - gui_completion_list_add (completion, - gui_buffer_properties_set[i], - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_buffer_properties_get_cb: add buffer properties - * (that can be read) to - * completion list - */ - -int -gui_completion_list_add_buffer_properties_get_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - int i; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (i = 0; gui_buffer_properties_get_integer[i]; i++) - { - gui_completion_list_add (completion, - gui_buffer_properties_get_integer[i], - 0, WEECHAT_LIST_POS_SORT); - } - for (i = 0; gui_buffer_properties_get_string[i]; i++) - { - gui_completion_list_add (completion, - gui_buffer_properties_get_string[i], - 0, WEECHAT_LIST_POS_SORT); - } - for (i = 0; gui_buffer_properties_get_pointer[i]; i++) - { - gui_completion_list_add (completion, - gui_buffer_properties_get_pointer[i], - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_config_files_cb: add config files to completion list - */ - -int -gui_completion_list_add_config_files_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_config_file *ptr_config_file; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_config_file = config_files; ptr_config_file; - ptr_config_file = ptr_config_file->next_config) - { - gui_completion_list_add (completion, ptr_config_file->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_filename: add filename to completion list - */ - -int -gui_completion_list_add_filename_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - char *path_d, *path_b, *p, *d_name; - char *real_prefix, *prefix; - char *buf; - int buf_len; - DIR *dp; - struct dirent *entry; - struct stat statbuf; - char home[3] = { '~', DIR_SEPARATOR_CHAR, '\0' }; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - buf_len = PATH_MAX; - buf = malloc (buf_len); - if (!buf) - return WEECHAT_RC_OK; - - completion->add_space = 0; - - if ((strncmp (completion->base_word, home, 2) == 0) && getenv("HOME")) - { - real_prefix = strdup (getenv("HOME")); - prefix = strdup (home); - } - else - { - if ((strncmp (completion->base_word, DIR_SEPARATOR, 1) != 0) - || (strcmp (completion->base_word, "") == 0)) - { - real_prefix = strdup (weechat_home); - prefix = strdup (""); - } - else - { - real_prefix = strdup (DIR_SEPARATOR); - prefix = strdup (DIR_SEPARATOR); - } - } - - snprintf (buf, buf_len, "%s", completion->base_word + strlen (prefix)); - p = strrchr (buf, DIR_SEPARATOR_CHAR); - if (p) - { - p[0] = '\0'; - path_d = strdup (buf); - p++; - path_b = strdup (p); - } - else - { - path_d = strdup (""); - path_b = strdup (buf); - } - - sprintf (buf, "%s%s%s", real_prefix, DIR_SEPARATOR, path_d); - d_name = strdup (buf); - dp = opendir (d_name); - if (dp != NULL) - { - while ((entry = readdir (dp)) != NULL) - { - if (strncmp (entry->d_name, path_b, strlen (path_b)) == 0) - { - if (strcmp (entry->d_name, ".") == 0 || strcmp (entry->d_name, "..") == 0) - continue; - - snprintf (buf, buf_len, "%s%s%s", - d_name, DIR_SEPARATOR, entry->d_name); - if (stat (buf, &statbuf) == -1) - continue; - - snprintf (buf, buf_len, "%s%s%s%s%s%s", - prefix, - ((strcmp(prefix, "") == 0) - || strchr(prefix, DIR_SEPARATOR_CHAR)) ? "" : DIR_SEPARATOR, - path_d, - strcmp(path_d, "") == 0 ? "" : DIR_SEPARATOR, - entry->d_name, - S_ISDIR(statbuf.st_mode) ? DIR_SEPARATOR : ""); - - gui_completion_list_add (completion, buf, - 0, WEECHAT_LIST_POS_SORT); - } - } - closedir (dp); - } - - free (d_name); - free (prefix); - free (real_prefix); - free (path_d); - free (path_b); - free (buf); - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_filters_cb: add filters to completion list - */ - -int -gui_completion_list_add_filters_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_filter *ptr_filter; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_filter = gui_filters; ptr_filter; - ptr_filter = ptr_filter->next_filter) - { - gui_completion_list_add (completion, ptr_filter->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_commands_cb: add command hooks to completion list - */ - -int -gui_completion_list_add_commands_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_hook *ptr_hook; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if (!ptr_hook->deleted - && (HOOK_COMMAND(ptr_hook, command)) - && (HOOK_COMMAND(ptr_hook, command)[0])) - gui_completion_list_add (completion, - HOOK_COMMAND(ptr_hook, command), - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_infos_cb: add info hooks to completion list - */ - -int -gui_completion_list_add_infos_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_hook *ptr_hook; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_hook = weechat_hooks[HOOK_TYPE_INFO]; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if (!ptr_hook->deleted - && (HOOK_INFO(ptr_hook, info_name)) - && (HOOK_INFO(ptr_hook, info_name)[0])) - gui_completion_list_add (completion, - HOOK_INFO(ptr_hook, info_name), - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_infolists_cb: add infolist hooks to completion list - */ - -int -gui_completion_list_add_infolists_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_hook *ptr_hook; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST]; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if (!ptr_hook->deleted - && (HOOK_INFOLIST(ptr_hook, infolist_name)) - && (HOOK_INFOLIST(ptr_hook, infolist_name)[0])) - gui_completion_list_add (completion, - HOOK_INFOLIST(ptr_hook, infolist_name), - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_nicks_cb: add nicks to completion list - */ - -int -gui_completion_list_add_nicks_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_nick_group *ptr_group; - struct t_gui_nick *ptr_nick; - int count_before; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - count_before = weelist_size (completion->completion_list); - hook_completion_exec (completion->buffer->plugin, - "nick", - completion->buffer, - completion); - if (weelist_size (completion->completion_list) == count_before) - { - /* no plugin overrides nick completion, then we use default nick */ - /* completion, wich nicks of nicklist, in order of nicklist */ - ptr_group = NULL; - ptr_nick = NULL; - gui_nicklist_get_next_item (completion->buffer, - &ptr_group, &ptr_nick); - while (ptr_group || ptr_nick) - { - if (ptr_nick && ptr_nick->visible) - { - gui_completion_list_add (completion, - ptr_nick->name, - 1, WEECHAT_LIST_POS_END); - } - gui_nicklist_get_next_item (completion->buffer, - &ptr_group, &ptr_nick); - } - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_config_options_cb: add config option to completion - * list - */ - -int -gui_completion_list_add_config_options_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_config_file *ptr_config; - struct t_config_section *ptr_section; - struct t_config_option *ptr_option; - int length; - char *option_full_name; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_config = config_files; ptr_config; - ptr_config = ptr_config->next_config) - { - for (ptr_section = ptr_config->sections; ptr_section; - ptr_section = ptr_section->next_section) - { - for (ptr_option = ptr_section->options; ptr_option; - ptr_option = ptr_option->next_option) - { - length = strlen (ptr_config->name) + 1 - + strlen (ptr_section->name) + 1 - + strlen (ptr_option->name) + 1; - option_full_name = malloc (length); - if (option_full_name) - { - snprintf (option_full_name, length, "%s.%s.%s", - ptr_config->name, ptr_section->name, - ptr_option->name); - gui_completion_list_add (completion, - option_full_name, - 0, WEECHAT_LIST_POS_SORT); - free (option_full_name); - } - } - } - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_plugins_cb: add plugin name to completion list - */ - -int -gui_completion_list_add_plugins_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_weechat_plugin *ptr_plugin; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_plugin = weechat_plugins; ptr_plugin; - ptr_plugin = ptr_plugin->next_plugin) - { - gui_completion_list_add (completion, ptr_plugin->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_plugins_commands_cb: add plugin commands to completion - * list (plugin name is previous - * argument) - */ - -int -gui_completion_list_add_plugins_commands_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - char *pos_space, *plugin_name; - struct t_weechat_plugin *ptr_plugin; - struct t_hook *ptr_hook; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - if (completion->args) - { - pos_space = strchr (completion->args, ' '); - if (pos_space) - plugin_name = string_strndup (completion->args, - pos_space - completion->args); - else - plugin_name = strdup (completion->args); - - if (plugin_name) - { - ptr_plugin = NULL; - if (string_strcasecmp (plugin_name, PLUGIN_CORE) != 0) - { - /* - * plugin name is different from "core", then search it in - * plugin list - */ - ptr_plugin = plugin_search (plugin_name); - if (!ptr_plugin) - return WEECHAT_RC_OK; - } - for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if (!ptr_hook->deleted - && (ptr_hook->plugin == ptr_plugin) - && HOOK_COMMAND(ptr_hook, command) - && HOOK_COMMAND(ptr_hook, command)[0]) - { - gui_completion_list_add (completion, - HOOK_COMMAND(ptr_hook, command), - 0, WEECHAT_LIST_POS_SORT); - } - } - free (plugin_name); - } - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_config_option_values_cb: add option value to - * completion list - */ - -int -gui_completion_list_add_config_option_values_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - char *pos_space, *option_full_name, *pos_section, *pos_option; - char *file, *section, *value_string; - const char *color_name; - int length, i, num_colors; - struct t_config_file *ptr_config; - struct t_config_section *ptr_section, *section_found; - struct t_config_option *option_found; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - if (completion->args) - { - pos_space = strchr (completion->args, ' '); - if (pos_space) - option_full_name = string_strndup (completion->args, - pos_space - completion->args); - else - option_full_name = strdup (completion->args); - - if (option_full_name) - { - file = NULL; - section = NULL; - pos_option = NULL; - - pos_section = strchr (option_full_name, '.'); - pos_option = (pos_section) ? strchr (pos_section + 1, '.') : NULL; - - if (pos_section && pos_option) - { - file = string_strndup (option_full_name, - pos_section - option_full_name); - section = string_strndup (pos_section + 1, - pos_option - pos_section - 1); - pos_option++; - } - if (file && section && pos_option) - { - ptr_config = config_file_search (file); - if (ptr_config) - { - ptr_section = config_file_search_section (ptr_config, - section); - if (ptr_section) - { - config_file_search_section_option (ptr_config, - ptr_section, - pos_option, - §ion_found, - &option_found); - if (option_found) - { - switch (option_found->type) - { - case CONFIG_OPTION_TYPE_BOOLEAN: - gui_completion_list_add (completion, "on", - 0, WEECHAT_LIST_POS_SORT); - gui_completion_list_add (completion, "off", - 0, WEECHAT_LIST_POS_SORT); - gui_completion_list_add (completion, "toggle", - 0, WEECHAT_LIST_POS_END); - if (option_found->value) - { - if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE) - gui_completion_list_add (completion, "on", - 0, WEECHAT_LIST_POS_BEGINNING); - else - gui_completion_list_add (completion, "off", - 0, WEECHAT_LIST_POS_BEGINNING); - } - else - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, WEECHAT_LIST_POS_BEGINNING); - } - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (option_found->string_values) - { - for (i = 0; option_found->string_values[i]; i++) - { - gui_completion_list_add (completion, - option_found->string_values[i], - 0, WEECHAT_LIST_POS_SORT); - } - gui_completion_list_add (completion, "++1", - 0, WEECHAT_LIST_POS_END); - gui_completion_list_add (completion, "--1", - 0, WEECHAT_LIST_POS_END); - if (option_found->value) - { - gui_completion_list_add (completion, - option_found->string_values[CONFIG_INTEGER(option_found)], - 0, WEECHAT_LIST_POS_BEGINNING); - } - else - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, WEECHAT_LIST_POS_BEGINNING); - } - } - else - { - if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min) - gui_completion_list_add (completion, "--1", - 0, WEECHAT_LIST_POS_BEGINNING); - if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max) - gui_completion_list_add (completion, "++1", - 0, WEECHAT_LIST_POS_BEGINNING); - if (option_found->value) - { - length = 64; - value_string = malloc (length); - if (value_string) - { - snprintf (value_string, length, - "%d", CONFIG_INTEGER(option_found)); - gui_completion_list_add (completion, - value_string, - 0, WEECHAT_LIST_POS_BEGINNING); - free (value_string); - } - } - else - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, WEECHAT_LIST_POS_BEGINNING); - } - } - break; - case CONFIG_OPTION_TYPE_STRING: - gui_completion_list_add (completion, - "\"\"", - 0, WEECHAT_LIST_POS_BEGINNING); - if (option_found->value) - { - length = strlen (CONFIG_STRING(option_found)) + 2 + 1; - value_string = malloc (length); - if (value_string) - { - snprintf (value_string, length, - "\"%s\"", - CONFIG_STRING(option_found)); - gui_completion_list_add (completion, - value_string, - 0, WEECHAT_LIST_POS_BEGINNING); - free (value_string); - } - } - else - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, WEECHAT_LIST_POS_BEGINNING); - } - break; - case CONFIG_OPTION_TYPE_COLOR: - num_colors = gui_color_get_number (); - for (i = 0; i < num_colors; i++) - { - color_name = gui_color_get_name (i); - if (color_name) - gui_completion_list_add (completion, - color_name, - 0, WEECHAT_LIST_POS_SORT); - } - gui_completion_list_add (completion, "++1", - 0, WEECHAT_LIST_POS_END); - gui_completion_list_add (completion, "--1", - 0, WEECHAT_LIST_POS_END); - if (option_found->value) - { - color_name = gui_color_get_name (CONFIG_INTEGER(option_found)); - if (color_name) - { - gui_completion_list_add (completion, - color_name, - 0, WEECHAT_LIST_POS_BEGINNING); - } - } - else - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, WEECHAT_LIST_POS_BEGINNING); - } - break; - case CONFIG_NUM_OPTION_TYPES: - break; - } - if (option_found->value - && option_found->null_value_allowed) - { - gui_completion_list_add (completion, - WEECHAT_CONFIG_OPTION_NULL, - 0, - WEECHAT_LIST_POS_END); - } - } - } - } - } - if (file) - free (file); - if (section) - free (section); - } - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_weechat_commands_cb: add WeeChat commands to - * completion list - */ - -int -gui_completion_list_add_weechat_commands_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_hook *ptr_hook; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook; - ptr_hook = ptr_hook->next_hook) - { - if (!ptr_hook->deleted - && !ptr_hook->plugin - && HOOK_COMMAND(ptr_hook, command) - && HOOK_COMMAND(ptr_hook, command)[0]) - { - gui_completion_list_add (completion, - HOOK_COMMAND(ptr_hook, command), - 0, WEECHAT_LIST_POS_SORT); - } - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_proxies_names_cb: add proxies names to completion - * list - */ - -int -gui_completion_list_add_proxies_names_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_proxy *ptr_proxy; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_proxy = weechat_proxies; ptr_proxy; - ptr_proxy = ptr_proxy->next_proxy) - { - gui_completion_list_add (completion, ptr_proxy->name, - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_proxies_options: add proxies options to completion - * list - */ - -int -gui_completion_list_add_proxies_options_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - int i; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (i = 0; i < PROXY_NUM_OPTIONS; i++) - { - gui_completion_list_add (completion, proxy_option_string[i], - 0, WEECHAT_LIST_POS_SORT); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_keys_codes_cb: add keys to completion list - */ - -int -gui_completion_list_add_keys_codes_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_key *ptr_key; - char *expanded_name; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) - { - expanded_name = gui_keyboard_get_expanded_name (ptr_key->key); - gui_completion_list_add (completion, - (expanded_name) ? expanded_name : ptr_key->key, - 0, WEECHAT_LIST_POS_SORT); - if (expanded_name) - free (expanded_name); - } - - return WEECHAT_RC_OK; -} - -/* - * gui_completion_list_add_keys_codes_for_reset_cb: add keys that can be reset - * (keys added, redefined or - * removed) to completion list - */ - -int -gui_completion_list_add_keys_codes_for_reset_cb (void *data, - const char *completion_item, - struct t_gui_buffer *buffer, - struct t_gui_completion *completion) -{ - struct t_gui_key *ptr_key, *ptr_default_key; - char *expanded_name; - - /* make C compiler happy */ - (void) data; - (void) completion_item; - (void) buffer; - - /* keys added or redefined */ - for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key) - { - ptr_default_key = gui_keyboard_search (gui_default_keys, ptr_key->key); - if (!ptr_default_key - || (strcmp (ptr_default_key->command, ptr_key->command) != 0)) - { - expanded_name = gui_keyboard_get_expanded_name (ptr_key->key); - gui_completion_list_add (completion, - (expanded_name) ? expanded_name : ptr_key->key, - 0, WEECHAT_LIST_POS_SORT); - if (expanded_name) - free (expanded_name); - } - } - - /* keys deleted */ - for (ptr_default_key = gui_default_keys; ptr_default_key; - ptr_default_key = ptr_default_key->next_key) - { - ptr_key = gui_keyboard_search (gui_keys, ptr_default_key->key); - if (!ptr_key) - { - expanded_name = gui_keyboard_get_expanded_name (ptr_default_key->key); - gui_completion_list_add (completion, - (expanded_name) ? expanded_name : ptr_default_key->key, - 0, WEECHAT_LIST_POS_SORT); - if (expanded_name) - free (expanded_name); - } - } - - return WEECHAT_RC_OK; -} - /* * gui_completion_custom: custom completion by a plugin */ @@ -2149,7 +1078,7 @@ gui_completion_auto (struct t_gui_completion *completion) || (completion->base_word[0] == '~')) { if (!completion->completion_list->items) - gui_completion_list_add_filename_cb (NULL, NULL, NULL, completion); + completion_list_add_filename_cb (NULL, NULL, NULL, completion); gui_completion_complete (completion); return; } @@ -2279,82 +1208,3 @@ gui_completion_print_log (struct t_gui_completion *completion) } } } - -/* - * gui_completion_init: add hooks for completions done by WeeChat core - */ - -void -gui_completion_init () -{ - hook_completion (NULL, "buffers_names", /* formerly "%b" */ - N_("names of buffers"), - &gui_completion_list_add_buffers_names_cb, NULL); - hook_completion (NULL, "buffers_numbers", - N_("numbers of buffers"), - &gui_completion_list_add_buffers_numbers_cb, NULL); - hook_completion (NULL, "buffers_plugins_names", /* formerly "%B" */ - N_("names of buffers (including plugins names)"), - &gui_completion_list_add_buffers_plugins_names_cb, NULL); - hook_completion (NULL, "buffer_properties_set", - N_("properties that can be set on a buffer"), - &gui_completion_list_add_buffer_properties_set_cb, NULL); - hook_completion (NULL, "buffer_properties_get", - N_("properties that can be read on a buffer"), - &gui_completion_list_add_buffer_properties_get_cb, NULL); - hook_completion (NULL, "config_files", /* formerly "%c" */ - N_("configuration files"), - &gui_completion_list_add_config_files_cb, NULL); - hook_completion (NULL, "filename", /* formerly "%f" */ - N_("filename"), - &gui_completion_list_add_filename_cb, NULL); - hook_completion (NULL, "filters_names", /* formerly "%F" */ - N_("names of filters"), - &gui_completion_list_add_filters_cb, NULL); - hook_completion (NULL, "commands", /* formerly "%h" */ - N_("commands (weechat and plugins)"), - &gui_completion_list_add_commands_cb, NULL); - hook_completion (NULL, "infos", /* formerly "%i" */ - N_("names of infos hooked"), - &gui_completion_list_add_infos_cb, NULL); - hook_completion (NULL, "infolists", /* formerly "%I" */ - N_("names of infolists hooked"), - &gui_completion_list_add_infolists_cb, NULL); - hook_completion (NULL, "nicks", /* formerly "%n" */ - N_("nicks in nicklist of current buffer"), - &gui_completion_list_add_nicks_cb, NULL); - hook_completion (NULL, "config_options", /* formerly "%o" */ - N_("configuration options"), - &gui_completion_list_add_config_options_cb, NULL); - hook_completion (NULL, "plugins_names", /* formerly "%p" */ - N_("names of plugins"), - &gui_completion_list_add_plugins_cb, NULL); - hook_completion (NULL, "plugins_commands", /* formerly "%P" */ - N_("commands defined by plugins"), - &gui_completion_list_add_plugins_commands_cb, NULL); - hook_completion (NULL, "bars_names", /* formerly "%r" */ - N_("names of bars"), - &gui_completion_list_add_bars_names_cb, NULL); - hook_completion (NULL, "config_option_values", /* formerly "%v" */ - N_("values for a configuration option"), - &gui_completion_list_add_config_option_values_cb, NULL); - hook_completion (NULL, "weechat_commands", /* formerly "%w" */ - N_("weechat commands"), - &gui_completion_list_add_weechat_commands_cb, NULL); - hook_completion (NULL, "proxies_names", /* formerly "%y" */ - N_("names of proxies"), - &gui_completion_list_add_proxies_names_cb, NULL); - hook_completion (NULL, "proxies_options", - N_("options for proxies"), - &gui_completion_list_add_proxies_options_cb, NULL); - hook_completion (NULL, "bars_options", - N_("options for bars"), - &gui_completion_list_add_bars_options_cb, NULL); - hook_completion (NULL, "keys_codes", - N_("key codes"), - &gui_completion_list_add_keys_codes_cb, NULL); - hook_completion (NULL, "keys_codes_for_reset", - N_("key codes that can be reset (keys added, redefined " - "or removed)"), - &gui_completion_list_add_keys_codes_for_reset_cb, NULL); -} diff --git a/src/gui/gui-completion.h b/src/gui/gui-completion.h index 7d75ccb1a..de0433997 100644 --- a/src/gui/gui-completion.h +++ b/src/gui/gui-completion.h @@ -77,6 +77,5 @@ extern void gui_completion_search (struct t_gui_completion *completion, int direction, const char *data, int size, int pos); extern void gui_completion_print_log (struct t_gui_completion *completion); -extern void gui_completion_init (); #endif /* __WEECHAT_GUI_COMPLETION_H */