diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-04-03 16:05:39 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-04-03 16:05:39 +0200 |
commit | df0d408ce973f6a14c41044b044ff6a8845ca901 (patch) | |
tree | 4722e95d789345f78f96ab713fb64742ecaa12f9 | |
parent | 1c80407f0ff60160cde983ba3b78817fab73b8b6 (diff) | |
download | weechat-df0d408ce973f6a14c41044b044ff6a8845ca901.zip |
Add option "get" for command /buffer, add completions with buffer properties
-rw-r--r-- | doc/en/autogen/plugin_api/completions.txt | 4 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 3 | ||||
-rw-r--r-- | doc/fr/autogen/plugin_api/completions.txt | 4 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 3 | ||||
-rw-r--r-- | doc/it/autogen/plugin_api/completions.txt | 4 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 3 | ||||
-rw-r--r-- | po/cs.po | 14 | ||||
-rw-r--r-- | po/de.po | 15 | ||||
-rw-r--r-- | po/es.po | 14 | ||||
-rw-r--r-- | po/fr.po | 16 | ||||
-rw-r--r-- | po/hu.po | 13 | ||||
-rw-r--r-- | po/it.po | 14 | ||||
-rw-r--r-- | po/pl.po | 14 | ||||
-rw-r--r-- | po/ru.po | 13 | ||||
-rw-r--r-- | po/weechat.pot | 11 | ||||
-rw-r--r-- | src/core/wee-command.c | 54 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 50 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 5 | ||||
-rw-r--r-- | src/gui/gui-completion.c | 108 |
19 files changed, 321 insertions, 41 deletions
diff --git a/doc/en/autogen/plugin_api/completions.txt b/doc/en/autogen/plugin_api/completions.txt index 9bca76c8e..d3409e6b6 100644 --- a/doc/en/autogen/plugin_api/completions.txt +++ b/doc/en/autogen/plugin_api/completions.txt @@ -54,6 +54,10 @@ | weechat | bars_options | options for bars +| weechat | buffer_properties_get | properties that can be read on a buffer + +| weechat | buffer_properties_set | properties that can be set on a buffer + | weechat | buffers_names | names of buffers | weechat | buffers_numbers | numbers of buffers diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 09f218620..594e75887 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -53,7 +53,7 @@ /bar scroll nicklist * ye ........................................ -• *`/buffer`* `[clear [number | -merged | -all] | move number | merge number | unmerge [number] | close [n1[-n2]] | list | notify level | localvar | set property value | number | name]`:: +• *`/buffer`* `[clear [number | -merged | -all] | move number | merge number | unmerge [number] | close [n1[-n2]] | list | notify level | localvar | set property value | get property | number | name]`:: ........................................ manage buffers @@ -73,6 +73,7 @@ reset: reset to default value (all) localvar: display local variables for current buffer set: set a property for current buffer + get: display a property of current buffer number: jump to buffer by number, possible prefix: '+': relative jump, add number to current '-': relative jump, sub number to current diff --git a/doc/fr/autogen/plugin_api/completions.txt b/doc/fr/autogen/plugin_api/completions.txt index 08be21ebd..60cae5969 100644 --- a/doc/fr/autogen/plugin_api/completions.txt +++ b/doc/fr/autogen/plugin_api/completions.txt @@ -54,6 +54,10 @@ | weechat | bars_options | options pour les barres +| weechat | buffer_properties_get | propriétés qui peuvent être lues sur un tampon + +| weechat | buffer_properties_set | propriétés qui peuvent être changées sur un tampon + | weechat | buffers_names | noms des tampons | weechat | buffers_numbers | numéros des tampons diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index b08f22d49..fe67b3e94 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -53,7 +53,7 @@ /bar scroll nicklist * ye ........................................ -• *`/buffer`* `[clear [nombre | -merged | -all] | move nombre | merge nombre | unmerge [nombre] | close [n1[-n2]] | list | notify niveau | localvar | set propriété valeur | nombre | nom]`:: +• *`/buffer`* `[clear [nombre | -merged | -all] | move nombre | merge nombre | unmerge [nombre] | close [n1[-n2]] | list | notify niveau | localvar | set propriété valeur | get propriété | nombre | nom]`:: ........................................ gestion des tampons @@ -73,6 +73,7 @@ reset: réinitialise à valeur par défaut (all) localvar: affiche la liste des variables locales pour le tampon courant set: modifier une propriété du tampon courant + get: afficher une propriété du tampon courant nombre: saute au tampon qui a ce numéro, préfixe possible: '+': saut relatif, ajoute le numéro au courant, '-': saut relatif, soustrait le numéro au courant, diff --git a/doc/it/autogen/plugin_api/completions.txt b/doc/it/autogen/plugin_api/completions.txt index 3a1af2811..107c50994 100644 --- a/doc/it/autogen/plugin_api/completions.txt +++ b/doc/it/autogen/plugin_api/completions.txt @@ -54,6 +54,10 @@ | weechat | bars_options | opzioni per le barre +| weechat | buffer_properties_get | properties that can be read on a buffer + +| weechat | buffer_properties_set | properties that can be set on a buffer + | weechat | buffers_names | nomi dei buffer | weechat | buffers_numbers | numeri dei buffer diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index 09adbc195..5cba99851 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -53,7 +53,7 @@ /bar scroll nicklist * ye ........................................ -• *`/buffer`* `[clear [numero | -merged | -all] | move numero | merge numero | unmerge [numero] | close [n1[-n2]] | list | notify livello | localvar | set proprietà valore | numero | nome]`:: +• *`/buffer`* `[clear [number | -merged | -all] | move number | merge number | unmerge [number] | close [n1[-n2]] | list | notify level | localvar | set property value | get property | number | name]`:: ........................................ gestione buffer @@ -73,6 +73,7 @@ reset: reset to default value (all) localvar: display local variables for current buffer set: set a property for current buffer + get: display a property of current buffer number: jump to buffer by number, possible prefix: '+': relative jump, add number to current '-': relative jump, sub number to current @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-23 10:19+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -869,10 +869,11 @@ msgstr "" msgid "manage buffers" msgstr "řídit buffery" +#, fuzzy msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [číslo | -merged | -all] | move číslo | merge číslo | unmerge [číslo] " "| close [n1[-n2]] | list | notify úroveň | localvar | set vlastnost hodnota " @@ -898,6 +899,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2437,6 +2439,14 @@ msgstr "čísla bufferů" msgid "names of buffers (including plugins names)" msgstr "jména bufferů (včetně jmen pluginů)" +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "řádků bufferu" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "řádků bufferu" + msgid "configuration files" msgstr "konfigurační soubory" @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-29 22:38+0200\n" "Last-Translator: Nils G <weechatter@arcor.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -887,15 +887,17 @@ msgstr "" msgid "manage buffers" msgstr "Buffer verwalten" +#, fuzzy msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " "value | number | name]" +#, fuzzy msgid "" " clear: clear buffer content (number for a buffer, -merged for merged " "buffers, -all for all buffers, or nothing for current buffer)\n" @@ -915,6 +917,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2564,6 +2567,14 @@ msgstr "Anzahl der Buffer" msgid "names of buffers (including plugins names)" msgstr "Liste der Buffer (inkl. der Erweiterungen)" +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "Zeilen des Buffers" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "Zeilen des Buffers" + msgid "configuration files" msgstr "Konfigurationsdateien" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -872,10 +872,11 @@ msgstr "" msgid "manage buffers" msgstr "gestionar los buffers" +#, fuzzy msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [número | -merged | -all] | move número | merge número | unmerge " "[número] | close [n1[-n2]] | list | notify nivel | localvar | set propiedad " @@ -901,6 +902,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2455,6 +2457,14 @@ msgstr "números de los buffers" msgid "names of buffers (including plugins names)" msgstr "nombre de los buffers (incluyendo nombre de los plugins)" +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "líneas de un buffer" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "líneas de un buffer" + msgid "configuration files" msgstr "archivos de configuración" @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" -"PO-Revision-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"PO-Revision-Date: 2010-04-03 12:51+0200\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -871,11 +871,11 @@ msgstr "gestion des tampons" msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [nombre | -merged | -all] | move nombre | merge nombre | unmerge " "[nombre] | close [n1[-n2]] | list | notify niveau | localvar | set propriété " -"valeur | nombre | nom]" +"valeur | get propriété | nombre | nom]" msgid "" " clear: clear buffer content (number for a buffer, -merged for merged " @@ -896,6 +896,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -943,6 +944,7 @@ msgstr "" " reset: réinitialise à valeur par défaut (all)\n" "localvar: affiche la liste des variables locales pour le tampon courant\n" " set: modifier une propriété du tampon courant\n" +" get: afficher une propriété du tampon courant\n" " nombre: saute au tampon qui a ce numéro, préfixe possible:\n" " '+': saut relatif, ajoute le numéro au courant,\n" " '-': saut relatif, soustrait le numéro au courant,\n" @@ -2528,6 +2530,12 @@ 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" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -875,7 +875,7 @@ msgstr "pufferek kezelése" msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" #, fuzzy @@ -898,6 +898,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2330,6 +2331,14 @@ 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" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Weechat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-24 14:20+0100\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -867,10 +867,11 @@ msgstr "" msgid "manage buffers" msgstr "gestione buffer" +#, fuzzy msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [numero | -merged | -all] | move numero | merge numero | unmerge " "[numero] | close [n1[-n2]] | list | notify livello | localvar | set " @@ -896,6 +897,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2497,6 +2499,14 @@ msgstr "numeri dei buffer" msgid "names of buffers (including plugins names)" msgstr "nomi dei buffer (inclusi i nomi plugin)" +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "righe di un buffer" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "righe di un buffer" + msgid "configuration files" msgstr "file di configurazione" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: Polish\n" @@ -884,10 +884,11 @@ msgstr "" msgid "manage buffers" msgstr "zarządzaj buforami" +#, fuzzy msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" "[clear [numer | -merged | -all] | move numer | merge numer | unmerge [numer] " "| close [n1[-n2]] | list | notify pozom | localvar | set własność wartość | " @@ -913,6 +914,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2466,6 +2468,14 @@ msgstr "numery buforów" msgid "names of buffers (including plugins names)" msgstr "nazwy buforów (włącznie z nazwami wtyczek)" +#, fuzzy +msgid "properties that can be set on a buffer" +msgstr "linie w buforze" + +#, fuzzy +msgid "properties that can be read on a buffer" +msgstr "linie w buforze" + msgid "configuration files" msgstr "pliki konfiguracyjne" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -876,7 +876,7 @@ msgstr "управление буферами" msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" #, fuzzy @@ -899,6 +899,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2342,6 +2343,14 @@ 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 "перезагрузить конфигурационный файл сервера" diff --git a/po/weechat.pot b/po/weechat.pot index 5cf9d8297..b6888a4d1 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-03-31 23:38+0200\n" +"POT-Creation-Date: 2010-04-03 12:50+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -779,7 +779,7 @@ msgstr "" msgid "" "[clear [number | -merged | -all] | move number | merge number | unmerge " "[number] | close [n1[-n2]] | list | notify level | localvar | set property " -"value | number | name]" +"value | get property | number | name]" msgstr "" msgid "" @@ -801,6 +801,7 @@ msgid "" " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" +" get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -2008,6 +2009,12 @@ 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 "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index c618cc4b5..90b775f16 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -827,6 +827,54 @@ command_buffer (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_OK; } + + /* get a buffer property */ + if (string_strcasecmp (argv[1], "get") == 0) + { + if (argc < 3) + { + gui_chat_printf (NULL, + _("%sError: missing arguments for \"%s\" " + "command"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "buffer"); + return WEECHAT_RC_ERROR; + } + if (gui_buffer_property_in_list (gui_buffer_properties_get_integer, + argv[2])) + { + gui_chat_printf (NULL, "%s%s.%s%s: (int) %s = %d", + GUI_COLOR(GUI_COLOR_CHAT_BUFFER), + plugin_get_name (buffer->plugin), + buffer->name, + GUI_COLOR(GUI_COLOR_CHAT), + argv[2], + gui_buffer_get_integer (buffer, argv[2])); + } + if (gui_buffer_property_in_list (gui_buffer_properties_get_string, + argv[2])) + { + gui_chat_printf (NULL, "%s%s.%s%s: (str) %s = %s", + GUI_COLOR(GUI_COLOR_CHAT_BUFFER), + plugin_get_name (buffer->plugin), + buffer->name, + GUI_COLOR(GUI_COLOR_CHAT), + argv[2], + gui_buffer_get_string (buffer, argv[2])); + } + if (gui_buffer_property_in_list (gui_buffer_properties_get_pointer, + argv[2])) + { + gui_chat_printf (NULL, "%s%s.%s%s: (ptr) %s = 0x%lx", + GUI_COLOR(GUI_COLOR_CHAT_BUFFER), + plugin_get_name (buffer->plugin), + buffer->name, + GUI_COLOR(GUI_COLOR_CHAT), + argv[2], + gui_buffer_get_pointer (buffer, argv[2])); + } + return WEECHAT_RC_OK; + } /* relative jump '-' */ if (argv[1][0] == '-') @@ -4377,7 +4425,7 @@ command_init () N_("[clear [number | -merged | -all] | move number | " "merge number | unmerge [number] | close [n1[-n2]] | " "list | notify level | localvar | set property value | " - "number | name]"), + "get property | number | name]"), N_(" clear: clear buffer content (number for a buffer, " "-merged for merged buffers, -all for all buffers, or " "nothing for current buffer)\n" @@ -4402,6 +4450,7 @@ command_init () " reset: reset to default value (all)\n" "localvar: display local variables for current buffer\n" " set: set a property for current buffer\n" + " get: display a property of current buffer\n" " number: jump to buffer by number, possible prefix:\n" " '+': relative jump, add number to current\n" " '-': relative jump, sub number to current\n" @@ -4433,7 +4482,8 @@ command_init () " || list" " || notify reset|none|highlight|message|all" " || localvar" - " || set" + " || set %(buffer_properties_set)" + " || get %(buffer_properties_get)" " || %(buffers_names)" " || %(irc_channels)" " || %(irc_privates)" diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index e538d06c8..baebf72b5 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -68,6 +68,33 @@ int gui_buffers_visited_frozen = 0; /* 1 to forbid list updates */ char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] = { "none", "highlight", "message", "all" }; +char *gui_buffer_properties_get_integer[] = +{ "number", "layout_number", "type", "notify", "num_displayed", "active", + "print_hooks_enabled", "lines_hidden", "prefix_max_length", + "time_for_each_line", "nicklist", "nicklist_case_sensitive", + "nicklist_max_length", "nicklist_display_groups", "nicklist_visible_count", + "input", "input_get_unknown_commands", "input_size", "input_length", + "input_pos", "input_1st_display", "num_history", "text_search", + "text_search_exact", "text_search_found", + NULL +}; +char *gui_buffer_properties_get_string[] = +{ "plugin", "name", "short_name", "title", "input", "text_search_input", + "highlight_words", "highlight_tags", + NULL +}; +char *gui_buffer_properties_get_pointer[] = +{ "plugin", + NULL +}; +char *gui_buffer_properties_set[] = +{ "unread", "display", "print_hooks_enabled", "number", "name", "short_name", + "type", "notify", "title", "time_for_each_line", "nicklist", + "nicklist_case_sensitive", "nicklist_display_groups", "highlight_words", + "highlight_tags", "input", "input_pos", "input_get_unknown_commands", + NULL +}; + /* * gui_buffer_find_pos: find position for buffer in list @@ -640,6 +667,29 @@ gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin) } /* + * gui_buffer_property_in_list: return 1 if buffer property name is in a list + * 0 if property is not in list + */ + +int +gui_buffer_property_in_list (char *properties[], char *property) +{ + int i; + + if (!properties || !property) + return 0; + + for (i = 0; properties[i]; i++) + { + if (strcmp (properties[i], property) == 0) + return 1; + } + + /* property not found in list */ + return 0; +} + +/* * gui_buffer_get_integer: get a buffer property as integer */ diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 62699e5a1..0d6ef808e 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -186,6 +186,10 @@ extern int gui_buffers_visited_index; extern int gui_buffers_visited_count; extern int gui_buffers_visited_frozen; extern char *gui_buffer_notify_string[]; +extern char *gui_buffer_properties_get_integer[]; +extern char *gui_buffer_properties_get_string[]; +extern char *gui_buffer_properties_get_pointer[]; +extern char *gui_buffer_properties_set[]; /* buffer functions */ @@ -206,6 +210,7 @@ extern char *gui_buffer_string_replace_local_var (struct t_gui_buffer *buffer, const char *string); extern void gui_buffer_set_plugin_for_upgrade (char *name, struct t_weechat_plugin *plugin); +extern int gui_buffer_property_in_list (char *properties[], char *property); extern int gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property); extern const char *gui_buffer_get_string (struct t_gui_buffer *buffer, diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 2e23ca727..0d1c1b2c4 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -499,6 +499,76 @@ gui_completion_list_add_buffers_plugins_names_cb (void *data, } /* + * 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 */ @@ -2210,55 +2280,61 @@ gui_completion_print_log (struct t_gui_completion *completion) void gui_completion_init () { - hook_completion (NULL, "buffers_names", /* it was %b */ + 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", /* it was %B */ + 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, "config_files", /* it was %c */ + 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", /* it was %f */ + hook_completion (NULL, "filename", /* formerly "%f" */ N_("filename"), &gui_completion_list_add_filename_cb, NULL); - hook_completion (NULL, "filters_names", /* it was %F */ + hook_completion (NULL, "filters_names", /* formerly "%F" */ N_("names of filters"), &gui_completion_list_add_filters_cb, NULL); - hook_completion (NULL, "commands", /* it was %h */ + hook_completion (NULL, "commands", /* formerly "%h" */ N_("commands (weechat and plugins)"), &gui_completion_list_add_commands_cb, NULL); - hook_completion (NULL, "infos", /* it was %i */ + hook_completion (NULL, "infos", /* formerly "%i" */ N_("names of infos hooked"), &gui_completion_list_add_infos_cb, NULL); - hook_completion (NULL, "infolists", /* it was %I */ + hook_completion (NULL, "infolists", /* formerly "%I" */ N_("names of infolists hooked"), &gui_completion_list_add_infolists_cb, NULL); - hook_completion (NULL, "nicks", /* it was %n */ + 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", /* it was %o */ + hook_completion (NULL, "config_options", /* formerly "%o" */ N_("configuration options"), &gui_completion_list_add_config_options_cb, NULL); - hook_completion (NULL, "plugins_names", /* it was %p */ + hook_completion (NULL, "plugins_names", /* formerly "%p" */ N_("names of plugins"), &gui_completion_list_add_plugins_cb, NULL); - hook_completion (NULL, "plugins_commands", /* it was %P */ + 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", /* it was %r */ + 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", /* it was %v */ + 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", /* it was %w */ + hook_completion (NULL, "weechat_commands", /* formerly "%w" */ N_("weechat commands"), &gui_completion_list_add_weechat_commands_cb, NULL); - hook_completion (NULL, "proxies_names", /* it was %y */ + hook_completion (NULL, "proxies_names", /* formerly "%y" */ N_("names of proxies"), &gui_completion_list_add_proxies_names_cb, NULL); hook_completion (NULL, "proxies_options", |