core: add functions "key_bind" and "key_unbind" in plugin API

v2.8-utf8proc
Sebastien Helleu 2011-08-20 10:52:27 +02:00
parent 221fff960e
commit 44f2b7caf4
38 changed files with 1174 additions and 232 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.6-dev, 2011-08-18
v0.3.6-dev, 2011-08-20
Version 0.3.6 (under dev!)
@ -52,11 +52,11 @@ Version 0.3.6 (under dev!)
/window scroll_horiz) (task #11112)
* api: use arguments for infolist "window" to return only one window by number
* api: add info "cursor_mode"
* api: add new functions hook_focus, hdata_new, hdata_new_var, hdata_new_list,
hdata_get, hdata_get_var_offset, hdata_get_var_type,
hdata_get_var_type_string, hdata_get_var_hdata, hdata_get_var,
hdata_get_var_at_offset, hdata_get_list, hdata_move, hdata_integer,
hdata_string, hdata_pointer, hdata_time, hdata_get_string
* api: add new functions key_bind, key_unbind, hook_focus, hdata_new,
hdata_new_var, hdata_new_list, hdata_get, hdata_get_var_offset,
hdata_get_var_type, hdata_get_var_type_string, hdata_get_var_hdata,
hdata_get_var, hdata_get_var_at_offset, hdata_get_list, hdata_move,
hdata_integer, hdata_string, hdata_pointer, hdata_time, hdata_get_string
* api: fix bug with function config_set_desc_plugin (use immediately
description for option when function is called)
* scripts: fix crash with scripts not auto-loaded having a buffer opened after

View File

@ -405,6 +405,9 @@
| weechat | key | Tastenbelegung (Tastaturkurzbefehl) |
'key' (string) +
'area_type' (pointer) +
'area_name' (pointer) +
'area_key' (string) +
'command' (string) +
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |

View File

@ -366,6 +366,7 @@ For context "mouse" (possible in context "cursor" too), key has format: "@area:k
item(xxx): bar item "xxx"
The key can start or end with '*' to match many mouse events.
A special value for command wit format "hsignal:name" can be used for context mouse, this will send the hsignal "name" with the focus hashtable as argument.
Another special value "-" can be used to disable key (it will be ignored when looking for keys).
Examples:
key alt-x to toggle nicklist bar:

View File

@ -273,6 +273,9 @@ Liste der Skript API Funktionen:
config_free, +
config_get, config_get_plugin, config_is_set_plugin, config_set_plugin,
config_set_desc_plugin, config_unset_plugin
// TRANSLATION MISSING
| key bindings |
key_bind, key_unbind
| Ausgabe |
prefix, color, print (für Python: prnt), print_date_tags (für Python:
prnt_date_tags), print_y (für Python: prnt_y), log_print

View File

@ -405,6 +405,9 @@
| weechat | key | a key (keyboard shortcut) |
'key' (string) +
'area_type' (pointer) +
'area_name' (pointer) +
'area_key' (string) +
'command' (string) +
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |

View File

@ -366,6 +366,7 @@ For context "mouse" (possible in context "cursor" too), key has format: "@area:k
item(xxx): bar item "xxx"
The key can start or end with '*' to match many mouse events.
A special value for command wit format "hsignal:name" can be used for context mouse, this will send the hsignal "name" with the focus hashtable as argument.
Another special value "-" can be used to disable key (it will be ignored when looking for keys).
Examples:
key alt-x to toggle nicklist bar:

View File

@ -5679,6 +5679,127 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----------------------------------------
[[key_bindings]]
Key bindings
~~~~~~~~~~~~
Functions for key bindings.
weechat_key_bind
^^^^^^^^^^^^^^^^
Add new key bindings.
[NOTE]
Unlike command `/key bind`, this function will never change an existing key
binding, only new keys are created. To remove a key binding, use
<<_weechat_key_unbind,weechat_key_unbind>>.
Prototype:
[source,C]
----------------------------------------
int weechat_key_bind (const char *context, struct t_hashtable *keys);
----------------------------------------
Arguments:
* 'context': context for keys:
** 'default': default context (common actions)
** 'search': search context (when searching text in buffer)
** 'cursor': free movement of cursor on screen
** 'mouse': keys for mouse events
* 'keys': hashtable with key bindings
Return value:
* number of key bindings added
C example:
[source,C]
----------------------------------------
struct t_hashtable *keys = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (keys)
{
weechat_hashtable_set (keys, "@chat(plugin.buffer):button1", "hsignal:test_mouse");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheelup", "/mycommand up");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheeldown", "/mycommand down");
weechat_key_bind ("mouse", keys);
weechat_hashtable_free (keys);
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_bind(context, keys)
# example
keys = { "@chat(python.test):button1": "hsignal:test_mouse",
"@chat(python.test):wheelup": "/mycommand up",
"@chat(python.test):wheeldown": "/mycommand down" }
weechat.key_bind("mouse", keys)
----------------------------------------
weechat_key_unbind
^^^^^^^^^^^^^^^^^^
Remove key binding(s).
[WARNING]
When calling this function, ensure that you will not remove a user key binding.
Prototype:
[source,C]
----------------------------------------
int weechat_key_unbind (const char *context, const char *key);
----------------------------------------
Arguments:
* 'context': context for keys (see <<_weechat_key_bind,weechat_key_bind>>)
* 'key': key to remove or a special value "area:XXX" to remove all keys having
'XXX' as first or second area
Return value:
* number of key bindings removed
C examples:
[source,C]
----------------------------------------
/* remove a single key */
weechat_key_unbind ("mouse", "@chat(plugin.buffer):button1");
/* remove all keys with area "chat(plugin.buffer)" */
weechat_key_unbind ("mouse", "area:chat(plugin.buffer)");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_unbind(context, key)
# examples
# remove a single key
weechat.key_unbind("mouse", "@chat(plugin.buffer):button1")
# remove all keys with area "chat(python.test)"
weechat.key_unbind("mouse", "area:chat(python.test)")
----------------------------------------
[[display]]
Display
~~~~~~~

View File

@ -266,6 +266,8 @@ List of functions in script API:
config_free, +
config_get, config_get_plugin, config_is_set_plugin, config_set_plugin,
config_set_desc_plugin, config_unset_plugin
| key bindings |
key_bind, key_unbind
| display |
prefix, color, print (for python: prnt), print_date_tags (for python:
prnt_date_tags), print_y (for python: prnt_y), log_print

View File

@ -405,6 +405,9 @@
| weechat | key | une touche (un raccourci clavier) |
'key' (string) +
'area_type' (pointer) +
'area_name' (pointer) +
'area_key' (string) +
'command' (string) +
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |

View File

@ -366,6 +366,7 @@ Pour le contexte "mouse" (possible aussi pour le contexte "cursor"), la touche a
item(xxx): l'objet de barre "xxx"
La touche peut commencer ou se terminer par '*' pour plusieurs évènements de la souris.
Une valeur spéciale pour la commande avec le format "hsignal:nom" peut être utilisée dans le contexte "mouse", cela enverra le signal "nom" avec la hashtable du focus comme paramètre.
Une autre valeur spéciale "-" peut être utilisée pour désactiver la touche (elle sera ignorée lors de la recherche de touches).
Exemples:
touche alt-x pour activer/désactiver la liste des pseudos:

View File

@ -5739,6 +5739,130 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----------------------------------------
[[key_bindings]]
Associations de touches
~~~~~~~~~~~~~~~~~~~~~~~
Fonctions pour les associations de touches.
weechat_key_bind
^^^^^^^^^^^^^^^^
Ajouter de nouvelles associations de touches.
[NOTE]
Contrairement à la commande `/key bind`, cette fonction ne changera jamais
une association de touche existante, seulement des nouvelles touches seront
créées. Pour supprimer une association de touche, utilisez
<<_weechat_key_unbind,weechat_key_unbind>>.
Prototype :
[source,C]
----------------------------------------
int weechat_key_bind (const char *context, struct t_hashtable *keys);
----------------------------------------
Paramètres :
* 'context' : contexte pour les touches :
** 'default' : contexte par défaut (actions courantes)
** 'search' : contexte de recherche (lors de la recherche de texte dans le
tampon)
** 'cursor' : mouvement libre du curseur à l'écran
** 'mouse' : touches pour les évènements de souris
* 'keys' : hashtable avec les associations de touches
Valeur de retour :
* nombre d'associations de touches ajoutées
Exemple en C :
[source,C]
----------------------------------------
struct t_hashtable *keys = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (keys)
{
weechat_hashtable_set (keys, "@chat(plugin.buffer):button1", "hsignal:test_mouse");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheelup", "/mycommand up");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheeldown", "/mycommand down");
weechat_key_bind ("mouse", keys);
weechat_hashtable_free (keys);
}
----------------------------------------
Script (Python) :
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_bind(context, keys)
# exemple
keys = { "@chat(python.test):button1": "hsignal:test_mouse",
"@chat(python.test):wheelup": "/mycommand up",
"@chat(python.test):wheeldown": "/mycommand down" }
weechat.key_bind("mouse", keys)
----------------------------------------
weechat_key_unbind
^^^^^^^^^^^^^^^^^^
Supprimer une/des association(s) de touche(s).
[WARNING]
When calling this function, ensure that you will not remove a user key binding.
Prototype :
[source,C]
----------------------------------------
int weechat_key_unbind (const char *context, const char *key);
----------------------------------------
Paramètres :
* 'context' : contexte pour les touches (voir
<<_weechat_key_bind,weechat_key_bind>>)
* 'key' : touche à supprimer ou la valeur spéciale "area:XXX" pour supprimer
toutes les touches ayant 'XXX' comme première ou deuxième zone
Valeur de retour :
* nombre d'associations de touches supprimées
Exemples en C :
[source,C]
----------------------------------------
/* supprimer une seule touche */
weechat_key_unbind ("mouse", "@chat(plugin.buffer):button1");
/* supprimer toutes les touches avec la zone "chat(plugin.buffer)" */
weechat_key_unbind ("mouse", "area:chat(plugin.buffer)");
----------------------------------------
Script (Python) :
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_unbind(context, key)
# exemples
# supprimer une seule touche
weechat.key_unbind("mouse", "@chat(plugin.buffer):button1")
# supprimer toutes les touches avec la zone "chat(python.test)"
weechat.key_unbind("mouse", "area:chat(python.test)")
----------------------------------------
[[display]]
Affichage
~~~~~~~~~

View File

@ -275,6 +275,8 @@ Liste des fonctions de l'API script :
config_free, +
config_get, config_get_plugin, config_is_set_plugin, config_set_plugin,
config_set_desc_plugin, config_unset_plugin
| associations de touches |
key_bind, key_unbind
| affichage |
prefix, color, print (for python: prnt), print_date_tags (for python:
prnt_date_tags), print_y (for python: prnt_y), log_print

View File

@ -405,6 +405,9 @@
| weechat | key | un tasto (scorciatoia da tastiera) |
'key' (string) +
'area_type' (pointer) +
'area_name' (pointer) +
'area_key' (string) +
'command' (string) +
'prev_key' (pointer, hdata: 'key') +
'next_key' (pointer, hdata: 'key') |

View File

@ -341,42 +341,43 @@ Questo comando viene usato dall'associazione tasti o dai plugin.
resetall -yes [<contesto>]
missing [<contesto>]
list: elenca tutti i tasti correnti (senza argomento, viene visualizzata questa lista)
listdefault: elenca i tasti predefiniti
listdiff: elenca le differenze tra tasti attuali e predefiniti (tasti aggiunti, ridefiniti o eliminati)
contesto: nome del contesto ("default" oppure "search")
bind: associa un comando ad un tasto o visualizza il comando associato al tasto (per il contesto "default")
bindctxt: associa un comando ad un tasto o mostra il comando associato al tasto, per il contesto fornito
unbind: rimuove una associazione di tasti (per il contesto "default")
unbindctxt: rimuove l'associazione tasti per il contesto fornito
reset: ripristina un tasto all'assegnazione predefinita
resetctxt: ripristina un tasto all'associazione predefinita per il contesto fornito
resetall: ripristina le associazioni ai valori predefiniti ed elimina TUTTE le associazioni personalizzate (usare con cautela!)
missing: aggiunge tasti mancanti (utilizzando le associazioni predefinite), utile dopo l'installazione di una nuova versione di WeeChat
list: list all current keys (without argument, this list is displayed)
listdefault: list default keys
listdiff: list differences between current and default keys (keys added, redefined or deleted)
context: name of context ("default" or "search")
bind: bind a command to a key or display command bound to key (for context "default")
bindctxt: bind a command to a key or display command bound to key, for given context
unbind: remove a key binding (for context "default")
unbindctxt: remove a key binding for given context
reset: reset a key to default binding (for context "default")
resetctxt: reset a key to default binding, for given context
resetall: restore bindings to the default values and delete ALL personal bindings (use carefully!)
missing: add missing keys (using default bindings), useful after installing new WeeChat version
Al momento di associare un comando ad un tasto si raccomanda di utilizzare il tasto alt+k (oppure Esc e k), e digitare il tasto da associare: il codice tasto verrà inserito nella riga di comando.
When binding a command to a key, it is recommended to use key alt+k (or Esc then k), and then press the key to bind: this will insert key code in command line.
Per il contesto "mouse" (possibile anche nel contesto "cursor"), il formato del tasto è: "@area:tasto" oppure "@area1>area2:tasto" dove area può essere:
*: qualunque area sullo schermo
chat: area di chat (qualunque buffer)
chat(xxx): area di chat per il buffer con il nome "xxx" (nome completo includendo il plugin)
bar(*): qualunque barra
bar(xxx): barra "xxx"
item(*): qualunque elemento barra
item(xxx): elemento barra "xxx"
Il tasto può iniziare o terminare con '*' per corrispondere a più eventi del mouse.
Un valore speciale per questo comando con il formato "hsignal:nome" può essere usato per il contesto del mouse, e invierà hsignal "nome" con la tabella hash di focuse come argomento.
For context "mouse" (possible in context "cursor" too), key has format: "@area:key" or "@area1>area2:key" where area can be:
*: any area on screen
chat: chat area (any buffer)
chat(xxx): char area for buffer with name "xxx" (full name including plugin)
bar(*): any bar
bar(xxx): bar "xxx"
item(*): any bar item
item(xxx): bar item "xxx"
The key can start or end with '*' to match many mouse events.
A special value for command wit format "hsignal:name" can be used for context mouse, this will send the hsignal "name" with the focus hashtable as argument.
Another special value "-" can be used to disable key (it will be ignored when looking for keys).
Esempi:
il tasto alt-x per alternare la barra della nicklist:
Examples:
key alt-x to toggle nicklist bar:
/key bind meta-x /bar toggle nicklist
il tasto alt-r per passare al canale IRC #weechat:
key alt-r to jump to #weechat IRC channel:
/key bind meta-r /buffer #weechat
ripristinare l'associazione predefinita per il tasto alt-r:
restore default binding for key alt-r:
/key reset meta-r
il tasto "tab" per fermare la ricerca nel buffer:
key "tab" to stop search in buffer:
/key bindctxt search ctrl-I /input search_stop
il tasto centrale del mouse su un nick per ottenere le informazioni:
middle button of mouse on a nick to retrieve info on nick:
/key bindctxt mouse @item(buffer_nicklist):button3 /msg nickserv info ${nick}
........................................

View File

@ -5685,6 +5685,130 @@ elif rc == weechat.WEECHAT_CONFIG_OPTION_UNSET_ERROR:
# ...
----------------------------------------
// TRANSLATION MISSING
[[key_bindings]]
Key bindings
~~~~~~~~~~~~
Functions for key bindings.
// TRANSLATION MISSING
weechat_key_bind
^^^^^^^^^^^^^^^^
Add new key bindings.
[NOTE]
Unlike command `/key bind`, this function will never change an existing key
binding, only new keys are created. To remove a key binding, use
<<_weechat_key_unbind,weechat_key_unbind>>.
Prototype:
[source,C]
----------------------------------------
int weechat_key_bind (const char *context, struct t_hashtable *keys);
----------------------------------------
Arguments:
* 'context': context for keys:
** 'default': default context (common actions)
** 'search': search context (when searching text in buffer)
** 'cursor': free movement of cursor on screen
** 'mouse': keys for mouse events
* 'keys': hashtable with key bindings
Return value:
* number of key bindings added
C example:
[source,C]
----------------------------------------
struct t_hashtable *keys = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (keys)
{
weechat_hashtable_set (keys, "@chat(plugin.buffer):button1", "hsignal:test_mouse");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheelup", "/mycommand up");
weechat_hashtable_set (keys, "@chat(plugin.buffer):wheeldown", "/mycommand down");
weechat_key_bind ("mouse", keys);
weechat_hashtable_free (keys);
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_bind(context, keys)
# example
keys = { "@chat(python.test):button1": "hsignal:test_mouse",
"@chat(python.test):wheelup": "/mycommand up",
"@chat(python.test):wheeldown": "/mycommand down" }
weechat.key_bind("mouse", keys)
----------------------------------------
// TRANSLATION MISSING
weechat_key_unbind
^^^^^^^^^^^^^^^^^^
Remove key binding(s).
[WARNING]
When calling this function, ensure that you will not remove a user key binding.
Prototype:
[source,C]
----------------------------------------
int weechat_key_unbind (const char *context, const char *key);
----------------------------------------
Arguments:
* 'context': context for keys (see <<_weechat_key_bind,weechat_key_bind>>)
* 'key': key to remove or a special value "area:XXX" to remove all keys having
'XXX' as first or second area
Return value:
* number of key bindings removed
C examples:
[source,C]
----------------------------------------
/* remove a single key */
weechat_key_unbind ("mouse", "@chat(plugin.buffer):button1");
/* remove all keys with area "chat(plugin.buffer)" */
weechat_key_unbind ("mouse", "area:chat(plugin.buffer)");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
num_keys = weechat.key_unbind(context, key)
# examples
# remove a single key
weechat.key_unbind("mouse", "@chat(plugin.buffer):button1")
# remove all keys with area "chat(python.test)"
weechat.key_unbind("mouse", "area:chat(python.test)")
----------------------------------------
[[display]]
Visualizzazione
~~~~~~~~~~~~~~~

View File

@ -275,6 +275,9 @@ Elenco di funzioni nelle API per gli script:
config_free, +
config_get, config_get_plugin, config_is_set_plugin, config_set_plugin,
config_set_desc_plugin, config_unset_plugin
// TRANSLATION MISSING
| key bindings |
key_bind, key_unbind
| visualizzazione |
prefix, color, print (for python: prnt), print_date_tags (for python:
prnt_date_tags), print_y (for python: prnt_y), log_print

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-07-05 15:37+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -395,10 +395,6 @@ msgstr "%sChyba: nemohu napojit kalávesu \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "Klávesa \"%s\" již má výhozí hodnotu"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Klávesa \"%s\" odpojena"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sChyba: nemohu odpojit klávesu \"%s\""
@ -1472,6 +1468,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3236,12 +3234,9 @@ msgstr "Chyba: nedostatek paměti pro přidáni bufferu do hotlistu"
msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nová klávesová zkratka: %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Chyba: nemohu napojit kalávesu \"%s\""
msgid "Error: not enough memory for key binding"
msgstr "Chyba: nedostatek paměti pro klávesovou zkratku"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Klávesa \"%s\" odpojena"
#, fuzzy
msgid "Hashtable focus:"
@ -8001,6 +7996,12 @@ msgstr ""
msgid "Lists"
msgstr ""
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Chyba: nemohu napojit kalávesu \"%s\""
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Chyba: nedostatek paměti pro klávesovou zkratku"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%sChyba: nekorektní číslo bufferu"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-08-15 10:10+0100\n"
"Last-Translator: Nils Görs\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -412,10 +412,6 @@ msgstr "%sFehler: kann die Taste \"%s\" nicht zuordnen"
msgid "Key \"%s\" has already default value"
msgstr "Die Taste \"%s\" ist schon mit einem Standardbefehl belegt"
#, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tastenbelegung \"%s\" entfernt (Kontext: \"%s\")"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sFehler: kann die Tastenbelegung \"%s\" nicht entfernen"
@ -1543,6 +1539,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3481,11 +3479,8 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Neue Tastenbelegung (Kontext \"%s\"): %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Fehler: kann die Taste \"%s\" nicht zuordnen"
msgid "Error: not enough memory for key binding"
msgstr "Fehler: nicht genügend Speicher für Tastenzuordnung"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tastenbelegung \"%s\" entfernt (Kontext: \"%s\")"
msgid "Hashtable focus:"
msgstr "Hashtable Fokus:"
@ -8399,6 +8394,12 @@ msgstr "Variablen"
msgid "Lists"
msgstr "Listen"
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Fehler: kann die Taste \"%s\" nicht zuordnen"
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Fehler: nicht genügend Speicher für Tastenzuordnung"
#~ msgid "window name (can start or end with \"*\" as wildcard) (optional)"
#~ msgstr ""
#~ "Fenstername (darf mit einem \"*\" als Platzhalter beginnen oder enden) "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-07-05 15:37+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -399,10 +399,6 @@ msgstr "%sError: no se pudo crear el atajo \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "Atajo \"%s\" ya tiene un valor por defecto"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Atajo \"%s\" deshecho"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sError: no se pudo deshacer el atajo \"%s\""
@ -1482,6 +1478,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3296,12 +3294,9 @@ msgstr ""
msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nuevo atajo: %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Error: no es posible crear el atajo \"%s\""
msgid "Error: not enough memory for key binding"
msgstr "Error: no hay suficiente memoria para crear el atajo"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Atajo \"%s\" deshecho"
#, fuzzy
msgid "Hashtable focus:"
@ -8131,6 +8126,12 @@ msgstr ""
msgid "Lists"
msgstr ""
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Error: no es posible crear el atajo \"%s\""
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Error: no hay suficiente memoria para crear el atajo"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%sError: número del buffer incorrecto"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"PO-Revision-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-08-20 08:18+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -402,10 +402,6 @@ msgstr "%sErreur: impossible de créer la touche \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "La touche \"%s\" a déjà la valeur par défaut"
#, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Touche \"%s\" supprimée (contexte: \"%s\")"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sErreur: impossible de supprimer la touche \"%s\""
@ -1513,6 +1509,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -1567,6 +1565,8 @@ msgstr ""
"Une valeur spéciale pour la commande avec le format \"hsignal:nom\" peut "
"être utilisée dans le contexte \"mouse\", cela enverra le signal \"nom\" "
"avec la hashtable du focus comme paramètre.\n"
"Une autre valeur spéciale \"-\" peut être utilisée pour désactiver la touche "
"(elle sera ignorée lors de la recherche de touches).\n"
"\n"
"Exemples:\n"
" touche alt-x pour activer/désactiver la liste des pseudos:\n"
@ -3405,11 +3405,8 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nouvelle touche (contexte \"%s\"): %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Erreur: impossible de créer la touche \"%s\""
msgid "Error: not enough memory for key binding"
msgstr "Erreur: pas assez de mémoire pour la touche"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Touche \"%s\" supprimée (contexte: \"%s\")"
msgid "Hashtable focus:"
msgstr "Hashtable focus:"
@ -8235,6 +8232,12 @@ msgstr "Variables"
msgid "Lists"
msgstr "Listes"
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Erreur: impossible de créer la touche \"%s\""
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Erreur: pas assez de mémoire pour la touche"
#~ msgid "%sError: incorrect interval"
#~ msgstr "%sErreur: intervalle incorrect"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -411,10 +411,6 @@ msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
msgid "Key \"%s\" has already default value"
msgstr ""
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "A(z) \"%s\" billentyűparancs visszavonva\n"
#, fuzzy, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%s nem sikerült a(z) \"%s\" billentyűparancsot visszavonni\n"
@ -1308,6 +1304,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -2920,12 +2918,8 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Új billentyűparancs: %s"
#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
#, fuzzy
msgid "Error: not enough memory for key binding"
msgstr "%s nincs elég memória a billentyűhozzárendeléshez\n"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "A(z) \"%s\" billentyűparancs visszavonva\n"
msgid "Hashtable focus:"
msgstr ""
@ -7554,6 +7548,14 @@ msgstr ""
msgid "Lists"
msgstr ""
#, fuzzy
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
#, fuzzy
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "%s nincs elég memória a billentyűhozzárendeléshez\n"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%s helytelen pufferszám\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-17 15:07+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-08-16 17:48+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -397,10 +397,6 @@ msgstr "%sErrore: impossibile associare il tasto \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "Il tasto \"%s\" ha già un valore predefinito"
#, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tasto \"%s\" non associato (contesto: \"%s\")"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sErrore: impossibile rimuovere l'associazione del tasto \"%s\""
@ -1464,6 +1460,7 @@ msgstr ""
"unbindctxt <contesto> <chiave> || reset <tasto> || resetctxt <contesto> "
"<tasto> || resetall -yes [<contesto>] || missing [<contesto>]"
#, fuzzy
msgid ""
" list: list all current keys (without argument, this list is "
"displayed)\n"
@ -1502,6 +1499,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3375,11 +3374,8 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nuova associazione tasti (contesto \"%s\"): %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Errore: impossibile associare il testo \"%s\""
msgid "Error: not enough memory for key binding"
msgstr "Errore: memoria non sufficiente per l'associazione tasti"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tasto \"%s\" non associato (contesto: \"%s\")"
msgid "Hashtable focus:"
msgstr "Tabella hash del focus:"
@ -8169,6 +8165,12 @@ msgstr "Variabili"
msgid "Lists"
msgstr "Liste"
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Errore: impossibile associare il testo \"%s\""
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Errore: memoria non sufficiente per l'associazione tasti"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%sErrore: intervallo non corretto"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-07-05 15:38+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -398,10 +398,6 @@ msgstr "%sBłąd: nie można przypisać klawisza \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "Klawisz \"%s\" juz ma domyślną wartość"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Klawisz \"%s\" nieprzypisany"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sBłąd: nie można odbindować klawisza \"%s\""
@ -1486,6 +1482,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3274,12 +3272,9 @@ msgstr "Błąd: za mało pamięci, aby dodać bufor do hotlisty"
msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nowy skrót klawiszowy %s%s => %s%s"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "Błąd: nie można przypisać klawisza \"%s\""
msgid "Error: not enough memory for key binding"
msgstr "Błąd: za mało pamięci do przypisania klawisza"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Klawisz \"%s\" nieprzypisany"
#, fuzzy
msgid "Hashtable focus:"
@ -8036,6 +8031,12 @@ msgstr ""
msgid "Lists"
msgstr ""
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "Błąd: nie można przypisać klawisza \"%s\""
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "Błąd: za mało pamięci do przypisania klawisza"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%sBłąd: nieprawidłowy numer buforu"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -401,10 +401,6 @@ msgstr "%sErro: incapaz de associar o atalho à tecla \"%s\""
msgid "Key \"%s\" has already default value"
msgstr "Tecla \"%s\" já possui valor padrão"
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tecla \"%s\" não associada à nenhum atalho"
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%sErro: incapaz de desassociar a tecla de atalho \"%s\""
@ -1479,6 +1475,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -3172,12 +3170,9 @@ msgstr ""
msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Nenhum atalho de teclado padrão"
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr ""
msgid "Error: not enough memory for key binding"
msgstr ""
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Tecla \"%s\" não associada à nenhum atalho"
msgid "Hashtable focus:"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -414,10 +414,6 @@ msgstr "%s не могу установить клавишу \"%s\"\n"
msgid "Key \"%s\" has already default value"
msgstr ""
#, fuzzy, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Клавиша \"%s\" не привязана\n"
#, fuzzy, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr "%s не могу отвязать клавишу \"%s\"\n"
@ -1316,6 +1312,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -2941,12 +2939,8 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr "Новая комбинация клавиш: %s"
#, fuzzy, c-format
msgid "Error: unable to bind key \"%s\""
msgstr "%s не могу установить клавишу \"%s\"\n"
#, fuzzy
msgid "Error: not enough memory for key binding"
msgstr "%s недостаточно памяти для установки клавиши\n"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr "Клавиша \"%s\" не привязана\n"
msgid "Hashtable focus:"
msgstr ""
@ -7563,6 +7557,14 @@ msgstr ""
msgid "Lists"
msgstr ""
#, fuzzy
#~ msgid "Error: unable to bind key \"%s\""
#~ msgstr "%s не могу установить клавишу \"%s\"\n"
#, fuzzy
#~ msgid "Error: not enough memory for key binding"
#~ msgstr "%s недостаточно памяти для установки клавиши\n"
#, fuzzy
#~ msgid "%sError: incorrect interval"
#~ msgstr "%s неправильный номер буфера\n"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-08-16 22:19+0200\n"
"POT-Creation-Date: 2011-08-20 08:17+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"
@ -356,10 +356,6 @@ msgstr ""
msgid "Key \"%s\" has already default value"
msgstr ""
#, c-format
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr ""
#, c-format
msgid "%sError: unable to unbind key \"%s\""
msgstr ""
@ -1160,6 +1156,8 @@ msgid ""
"A special value for command wit format \"hsignal:name\" can be used for "
"context mouse, this will send the hsignal \"name\" with the focus hashtable "
"as argument.\n"
"Another special value \"-\" can be used to disable key (it will be ignored "
"when looking for keys).\n"
"\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
@ -2557,10 +2555,7 @@ msgid "New key binding (context \"%s\"): %s%s => %s%s"
msgstr ""
#, c-format
msgid "Error: unable to bind key \"%s\""
msgstr ""
msgid "Error: not enough memory for key binding"
msgid "Key \"%s\" unbound (context: \"%s\")"
msgstr ""
msgid "Hashtable focus:"

View File

@ -2504,6 +2504,7 @@ command_key_reset (int context, const char *key)
{
char *internal_code;
struct t_gui_key *ptr_key, *ptr_default_key, *ptr_new_key;
int rc;
internal_code = gui_key_get_internal_code (key);
if (!internal_code)
@ -2545,14 +2546,10 @@ command_key_reset (int context, const char *key)
else if (ptr_key)
{
/* no default key, so just unbind key */
if (gui_key_unbind (NULL, context, key, 1))
{
gui_chat_printf (NULL,
_("Key \"%s\" unbound (context: \"%s\")"),
key,
gui_key_context_string[context]);
}
else
gui_key_verbose = 1;
rc = gui_key_unbind (NULL, context, key);
gui_key_verbose = 0;
if (!rc)
{
gui_chat_printf (NULL,
_("%sError: unable to unbind key \"%s\""),
@ -2595,7 +2592,7 @@ COMMAND_CALLBACK(key)
{
char *internal_code;
struct t_gui_key *ptr_new_key;
int old_keys_count, keys_added, i, context;
int old_keys_count, keys_added, i, context, rc;
/* make C compiler happy */
(void) data;
@ -2760,15 +2757,11 @@ COMMAND_CALLBACK(key)
if (string_strcasecmp (argv[1], "unbind") == 0)
{
COMMAND_MIN_ARGS(3, "key unbind");
if (gui_key_unbind (NULL, GUI_KEY_CONTEXT_DEFAULT, argv[2], 1))
{
gui_chat_printf (NULL,
_("Key \"%s\" unbound (context: \"%s\")"),
argv[2],
gui_key_context_string[GUI_KEY_CONTEXT_DEFAULT]);
}
else
gui_key_verbose = 1;
rc = gui_key_unbind (NULL, GUI_KEY_CONTEXT_DEFAULT, argv[2]);
gui_key_verbose = 0;
if (!rc)
{
gui_chat_printf (NULL,
_("%sError: unable to unbind key \"%s\""),
@ -2794,15 +2787,11 @@ COMMAND_CALLBACK(key)
argv[2]);
return WEECHAT_RC_OK;
}
if (gui_key_unbind (NULL, context, argv[3], 1))
{
gui_chat_printf (NULL,
_("Key \"%s\" unbound (context: \"%s\")"),
argv[3],
gui_key_context_string[context]);
}
else
gui_key_verbose = 1;
rc = gui_key_unbind (NULL, context, argv[3]);
gui_key_verbose = 0;
if (!rc)
{
gui_chat_printf (NULL,
_("%sError: unable to unbind key \"%s\""),
@ -5702,7 +5691,9 @@ command_init ()
"events.\n"
"A special value for command wit format \"hsignal:name\" "
"can be used for context mouse, this will send the hsignal "
"\"name\" with the focus hashtable as argument.\n\n"
"\"name\" with the focus hashtable as argument.\n"
"Another special value \"-\" can be used to disable key "
"(it will be ignored when looking for keys).\n\n"
"Examples:\n"
" key alt-x to toggle nicklist bar:\n"
" /key bind meta-x /bar toggle nicklist\n"

View File

@ -1463,7 +1463,7 @@ config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
else
{
/* unbind key if no value given */
gui_key_unbind (NULL, context, option_name, 1);
gui_key_unbind (NULL, context, option_name);
}
}

View File

@ -1600,7 +1600,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
&buffer->keys_count);
}
else
gui_key_unbind (buffer, 0, property + 11, 1);
gui_key_unbind (buffer, 0, property + 11);
}
else if (string_strcasecmp (property, "input") == 0)
{

View File

@ -256,7 +256,8 @@ gui_key_grab_end_timer_cb (void *data, int remaining_calls)
/*
* gui_key_get_internal_code: get internal code from user key name
* for example: return "\x01+R" for "ctrl-R"
* for example: return '\x01'+'R' for "ctrl-R"
* Note: returned value has to be free() after use
*/
char *
@ -264,6 +265,9 @@ gui_key_get_internal_code (const char *key)
{
char *result;
if ((key[0] == '@') && strchr (key, ':'))
return strdup (key);
if ((result = malloc (strlen (key) + 1)))
{
result[0] = '\0';
@ -460,6 +464,53 @@ gui_key_insert_sorted (struct t_gui_key **keys,
(*keys_count)++;
}
/*
* gui_key_set_area_type_name: set area type and name
* for example: "bar(nicklist)" will return:
* type: 2 (bar)
* name: "nicklist"
* Warning: if no area is found, values are NOT set
*/
void
gui_key_set_area_type_name (const char *area,
int *area_type, char **area_name)
{
int focus, length;
char *pos_end;
for (focus = 0; focus < GUI_KEY_NUM_FOCUS; focus++)
{
length = strlen (gui_key_focus_string[focus]);
if (strncmp (area, gui_key_focus_string[focus], length) == 0)
{
if (focus == GUI_KEY_FOCUS_ANY)
{
*area_type = focus;
*area_name = strdup ("*");
break;
}
if (!area[length])
{
*area_type = focus;
*area_name = strdup ("*");
break;
}
if ((area[length] == '(') && area[length + 1])
{
pos_end = strchr (area + length, ')');
if (pos_end)
{
*area_type = focus;
*area_name = string_strndup (area + length + 1,
pos_end - area - length - 1);
break;
}
}
}
}
}
/*
* gui_key_set_areas: set areas types (any, chat, bar or item) and names for a
* key
@ -468,8 +519,8 @@ gui_key_insert_sorted (struct t_gui_key **keys,
void
gui_key_set_areas (struct t_gui_key *key)
{
int area, focus, length;
char *pos_colon, *pos_area2, *pos_end, *areas[2];
int area;
char *pos_colon, *pos_area2, *areas[2];
for (area = 0; area < 2; area++)
{
@ -478,6 +529,9 @@ gui_key_set_areas (struct t_gui_key *key)
}
key->area_key = NULL;
if (key->key[0] != '@')
return;
areas[0] = NULL;
areas[1] = NULL;
@ -504,37 +558,9 @@ gui_key_set_areas (struct t_gui_key *key)
key->area_name[area] = strdup ("*");
continue;
}
for (focus = 0; focus < GUI_KEY_NUM_FOCUS; focus++)
{
length = strlen (gui_key_focus_string[focus]);
if (strncmp (areas[area], gui_key_focus_string[focus], length) == 0)
{
if (focus == GUI_KEY_FOCUS_ANY)
{
key->area_type[area] = focus;
key->area_name[area] = strdup ("*");
break;
}
if (!areas[area][length])
{
key->area_type[area] = focus;
key->area_name[area] = strdup ("*");
break;
}
if ((areas[area][length] == '(') && areas[area][length + 1])
{
pos_end = strchr (areas[area] + length, ')');
if (pos_end)
{
key->area_type[area] = focus;
key->area_name[area] = string_strndup (areas[area] + length + 1,
pos_end - areas[area] - length - 1);
break;
}
}
}
}
gui_key_set_area_type_name (areas[area],
&(key->area_type[area]),
&(key->area_name[area]));
}
if (areas[0])
@ -689,47 +715,99 @@ gui_key_search_part (struct t_gui_buffer *buffer, int context,
* gui_key_bind: bind a key to a function (command or special function)
* if buffer is not null, then key is specific to buffer
* otherwise it's general key (for most keys)
* Note: if key already exists, it is removed then added again
* with new value
*/
struct t_gui_key *
gui_key_bind (struct t_gui_buffer *buffer, int context, const char *key,
const char *command)
{
struct t_gui_key *new_key;
if (!key || !command)
{
log_printf (_("Error: unable to bind key \"%s\""), key);
return NULL;
}
gui_key_unbind (buffer, context, key, 0);
gui_key_unbind (buffer, context, key);
new_key = gui_key_new (buffer, context, key, command);
if (!new_key)
{
log_printf (_("Error: not enough memory for key binding"));
return NULL;
}
return new_key;
return gui_key_new (buffer, context, key, command);
}
/*
* gui_key_unbind: remove a key binding
* gui_key_bind_plugin_hashtable_map_cb: bind keys in hashtable
*/
void
gui_key_bind_plugin_hashtable_map_cb (void *data,
struct t_hashtable *hashtable,
const void *key, const void *value)
{
int *user_data;
struct t_gui_key *ptr_key;
char *internal_code;
/* make C compiler happy */
(void) hashtable;
user_data = (int *)data;
if (user_data && key && value)
{
internal_code = gui_key_get_internal_code (key);
if (internal_code)
{
ptr_key = gui_key_search (gui_keys[user_data[0]], internal_code);
if (!ptr_key)
{
if (gui_key_new (NULL, user_data[0], key, value))
user_data[1]++;
}
free (internal_code);
}
}
}
/*
* gui_key_bind_plugin: create many keys using a hashtable
* (used by plugins only)
* return: number of keys added
* note: if key already exists, it is NOT changed (plugins
* should never overwrite user keys)
*/
int
gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key,
int send_signal)
gui_key_bind_plugin (const char *context, struct t_hashtable *keys)
{
int data[2];
data[0] = gui_key_search_context (context);
if (data[0] < 0)
return 0;
gui_key_verbose = 1;
data[1] = 0;
hashtable_map (keys, &gui_key_bind_plugin_hashtable_map_cb, data);
gui_key_verbose = 0;
return data[1];
}
/*
* gui_key_unbind: remove one key binding
* return: 1 if key removed, 0 if not removed
*/
int
gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key)
{
struct t_gui_key *ptr_key;
char *internal_code;
internal_code = gui_key_get_internal_code (key);
if (!internal_code)
return 0;
ptr_key = gui_key_search ((buffer) ? buffer->keys : gui_keys[context],
(internal_code) ? internal_code : key);
free (internal_code);
if (ptr_key)
{
if (buffer)
@ -739,21 +817,74 @@ gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key,
}
else
{
if (gui_key_verbose)
{
gui_chat_printf (NULL,
_("Key \"%s\" unbound (context: \"%s\")"),
key,
gui_key_context_string[context]);
}
gui_key_free (&gui_keys[context], &last_gui_key[context],
&gui_keys_count[context], ptr_key);
}
}
if (internal_code)
free (internal_code);
if (send_signal)
{
hook_signal_send ("key_unbind",
WEECHAT_HOOK_SIGNAL_STRING, (char *)key);
return 1;
}
return (ptr_key != NULL);
return 0;
}
/*
* gui_key_unbind_plugin: remove one or more key binding(s)
* (used by plugins only)
* return: number of keys removed
*/
int
gui_key_unbind_plugin (const char *context, const char *key)
{
int ctxt, num_keys, area_type;
char *area_name;
struct t_gui_key *ptr_key;
ctxt = gui_key_search_context (context);
if (ctxt < 0)
return 0;
if (strncmp (key, "area:", 5) == 0)
{
num_keys = 0;
area_type = -1;
area_name = NULL;
gui_key_set_area_type_name (key + 5, &area_type, &area_name);
if (area_name)
{
for (ptr_key = gui_keys[ctxt]; ptr_key; ptr_key = ptr_key->next_key)
{
if (((ptr_key->area_type[0] == area_type)
&& ptr_key->area_name[0]
&& (strcmp (ptr_key->area_name[0], area_name) == 0))
|| ((ptr_key->area_type[1] == area_type)
&& ptr_key->area_name[1]
&& (strcmp (ptr_key->area_name[1], area_name) == 0)))
{
gui_key_verbose = 1;
num_keys += gui_key_unbind (NULL, ctxt, ptr_key->key);
gui_key_verbose = 0;
}
}
free (area_name);
}
}
else
{
gui_key_verbose = 1;
num_keys = gui_key_unbind (NULL, ctxt, key);
gui_key_verbose = 0;
}
return num_keys;
}
/*
@ -843,12 +974,19 @@ gui_key_focus_command (const char *key, int context,
for (ptr_key = gui_keys[context]; ptr_key;
ptr_key = ptr_key->next_key)
{
/* ignore key if it has not area name or key for area */
if (!ptr_key->area_name[0] || !ptr_key->area_key)
continue;
/* the special command "-" is used to ignore key */
if (strcmp (ptr_key->command, "-") == 0)
continue;
/* ignore key if key for area is not matching */
if (gui_key_cmp (key, ptr_key->area_key, context) != 0)
continue;
/* check if focus is matching with key */
matching = gui_key_focus_matching (ptr_key, hashtable_focus);
if (!matching)
continue;
@ -1332,6 +1470,9 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
if (hdata)
{
HDATA_VAR(struct t_gui_key, key, STRING, NULL);
HDATA_VAR(struct t_gui_key, area_type, POINTER, NULL);
HDATA_VAR(struct t_gui_key, area_name, POINTER, NULL);
HDATA_VAR(struct t_gui_key, area_key, STRING, NULL);
HDATA_VAR(struct t_gui_key, command, STRING, NULL);
HDATA_VAR(struct t_gui_key, prev_key, POINTER, hdata_name);
HDATA_VAR(struct t_gui_key, next_key, POINTER, hdata_name);
@ -1389,6 +1530,16 @@ gui_key_add_to_infolist (struct t_infolist *infolist, struct t_gui_key *key)
return 0;
free (expanded_key);
}
if (!infolist_new_var_integer (ptr_item, "area_type1", key->area_type[0]))
return 0;
if (!infolist_new_var_string (ptr_item, "area_name1", key->area_name[0]))
return 0;
if (!infolist_new_var_integer (ptr_item, "area_type2", key->area_type[1]))
return 0;
if (!infolist_new_var_string (ptr_item, "area_name2", key->area_name[1]))
return 0;
if (!infolist_new_var_string (ptr_item, "area_key", key->area_key))
return 0;
if (!infolist_new_var_string (ptr_item, "command", key->command))
return 0;

View File

@ -20,6 +20,8 @@
#ifndef __WEECHAT_GUI_KEY_H
#define __WEECHAT_GUI_KEY_H 1
struct t_hashtable;
#define GUI_KEY_BUFFER_BLOCK_SIZE 256
#define GUI_KEY_GRAB_DELAY_DEFAULT 500
@ -92,8 +94,10 @@ extern struct t_gui_key *gui_key_bind (struct t_gui_buffer *buffer,
int context,
const char *key,
const char *command);
extern int gui_key_bind_plugin (const char *context, struct t_hashtable *keys);
extern int gui_key_unbind (struct t_gui_buffer *buffer, int context,
const char *key, int send_signal);
const char *key);
extern int gui_key_unbind_plugin (const char *context, const char *key);
extern int gui_key_focus (const char *key, int context);
extern int gui_key_pressed (const char *key_str);
extern void gui_key_free (struct t_gui_key **keys,

View File

@ -55,6 +55,7 @@
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-key.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
#include "plugin.h"
@ -580,6 +581,9 @@ plugin_load (const char *filename)
new_plugin->config_set_desc_plugin = &plugin_api_config_set_desc_plugin;
new_plugin->config_unset_plugin = &plugin_api_config_unset_plugin;
new_plugin->key_bind = &gui_key_bind_plugin;
new_plugin->key_unbind = &gui_key_unbind_plugin;
new_plugin->prefix = &plugin_api_prefix;
new_plugin->color = &plugin_api_color;
new_plugin->printf_date_tags = &gui_chat_printf_date_tags;

View File

@ -2988,6 +2988,81 @@ weechat_lua_api_config_unset_plugin (lua_State *L)
LUA_RETURN_INT(rc);
}
/*
* weechat_lua_api_key_bind: bind key(s)
*/
static int
weechat_lua_api_key_bind (lua_State *L)
{
const char *context;
struct t_hashtable *hashtable;
int n, num_keys;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "key_bind");
LUA_RETURN_INT(0);
}
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "key_bind");
LUA_RETURN_INT(0);
}
context = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
num_keys = weechat_key_bind (context, hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
LUA_RETURN_INT(num_keys);
}
/*
* weechat_lua_api_key_unbind: unbind key(s)
*/
static int
weechat_lua_api_key_unbind (lua_State *L)
{
const char *context, *key;
int n, num_keys;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "key_unbind");
LUA_RETURN_INT(0);
}
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "key_unbind");
LUA_RETURN_INT(0);
}
context = lua_tostring (lua_current_interpreter, -2);
key = lua_tostring (lua_current_interpreter, -1);
num_keys = weechat_key_unbind (context, key);
LUA_RETURN_INT(num_keys);
}
/*
* weechat_lua_api_prefix: get a prefix, used for display
*/
@ -8367,6 +8442,8 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_set_plugin", &weechat_lua_api_config_set_plugin },
{ "config_set_desc_plugin", &weechat_lua_api_config_set_desc_plugin },
{ "config_unset_plugin", &weechat_lua_api_config_unset_plugin },
{ "key_bind", &weechat_lua_api_key_bind },
{ "key_unbind", &weechat_lua_api_key_unbind },
{ "prefix", &weechat_lua_api_prefix },
{ "color", &weechat_lua_api_color },
{ "print", &weechat_lua_api_print },

View File

@ -2682,6 +2682,77 @@ XS (XS_weechat_api_config_unset_plugin)
PERL_RETURN_INT(rc);
}
/*
* weechat::key_bind: bind key(s)
*/
XS (XS_weechat_api_key_bind)
{
char *context;
struct t_hashtable *hashtable;
int num_keys;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "key_bind");
PERL_RETURN_INT(0);
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "key_bind");
PERL_RETURN_INT(0);
}
context = SvPV_nolen (ST (0));
hashtable = weechat_perl_hash_to_hashtable (ST (1),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
num_keys = weechat_key_bind (context, hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
PERL_RETURN_INT(num_keys);
}
/*
* weechat::key_unbind: unbind key(s)
*/
XS (XS_weechat_api_key_unbind)
{
char *context, *key;
int num_keys;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "key_unbind");
PERL_RETURN_INT(0);
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "key_unbind");
PERL_RETURN_INT(0);
}
context = SvPV_nolen (ST (0));
key = SvPV_nolen (ST (1));
num_keys = weechat_key_unbind (context, key);
PERL_RETURN_INT(num_keys);
}
/*
* weechat::prefix: get a prefix, used for display
*/
@ -7254,6 +7325,8 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat");
newXS ("weechat::config_set_desc_plugin", XS_weechat_api_config_set_desc_plugin, "weechat");
newXS ("weechat::config_unset_plugin", XS_weechat_api_config_unset_plugin, "weechat");
newXS ("weechat::key_bind", XS_weechat_api_key_bind, "weechat");
newXS ("weechat::key_unbind", XS_weechat_api_key_unbind, "weechat");
newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat");
newXS ("weechat::color", XS_weechat_api_color, "weechat");
newXS ("weechat::print", XS_weechat_api_print, "weechat");

View File

@ -2830,6 +2830,79 @@ weechat_python_api_config_unset_plugin (PyObject *self, PyObject *args)
PYTHON_RETURN_INT(rc);
}
/*
* weechat_python_api_key_bind: bind key(s)
*/
static PyObject *
weechat_python_api_key_bind (PyObject *self, PyObject *args)
{
char *context;
struct t_hashtable *hashtable;
PyObject *dict;
int num_keys;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
PYTHON_RETURN_INT(0);
}
context = NULL;
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_bind");
PYTHON_RETURN_INT(0);
}
hashtable = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
num_keys = weechat_key_bind (context, hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
PYTHON_RETURN_INT(num_keys);
}
/*
* weechat_python_api_key_unbind: unbind key(s)
*/
static PyObject *
weechat_python_api_key_unbind (PyObject *self, PyObject *args)
{
char *context, *key;
int num_keys;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
PYTHON_RETURN_INT(0);
}
context = NULL;
key = NULL;
if (!PyArg_ParseTuple (args, "ss", &context, &key))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "key_unbind");
PYTHON_RETURN_INT(0);
}
num_keys = weechat_key_unbind (context, key);
PYTHON_RETURN_INT(num_keys);
}
/*
* weechat_python_api_prefix: get a prefix, used for display
*/
@ -6316,6 +6389,7 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
}
info_name = NULL;
arguments = NULL;
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
{
@ -7597,6 +7671,8 @@ PyMethodDef weechat_python_funcs[] =
{ "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" },
{ "config_set_desc_plugin", &weechat_python_api_config_set_desc_plugin, METH_VARARGS, "" },
{ "config_unset_plugin", &weechat_python_api_config_unset_plugin, METH_VARARGS, "" },
{ "key_bind", &weechat_python_api_key_bind, METH_VARARGS, "" },
{ "key_unbind", &weechat_python_api_key_unbind, METH_VARARGS, "" },
{ "prefix", &weechat_python_api_prefix, METH_VARARGS, "" },
{ "color", &weechat_python_api_color, METH_VARARGS, "" },
{ "prnt", &weechat_python_api_prnt, METH_VARARGS, "" },

View File

@ -3069,6 +3069,83 @@ weechat_ruby_api_config_unset_plugin (VALUE class, VALUE option)
RUBY_RETURN_INT(rc);
}
/*
* weechat_ruby_api_key_bind: bind key(s)
*/
static VALUE
weechat_ruby_api_key_bind (VALUE class, VALUE context, VALUE keys)
{
char *c_context;
struct t_hashtable *c_keys;
int num_keys;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "key_bind");
RUBY_RETURN_INT(0);
}
if (NIL_P (context) || NIL_P (keys))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "key_bind");
RUBY_RETURN_INT(0);
}
Check_Type (context, T_STRING);
Check_Type (keys, T_HASH);
c_context = StringValuePtr (context);
c_keys = weechat_ruby_hash_to_hashtable (keys,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
num_keys = weechat_key_bind (c_context, c_keys);
if (c_keys)
weechat_hashtable_free (c_keys);
RUBY_RETURN_INT(num_keys);
}
/*
* weechat_ruby_api_key_unbind: unbind key(s)
*/
static VALUE
weechat_ruby_api_key_unbind (VALUE class, VALUE context, VALUE key)
{
char *c_context, *c_key;
int num_keys;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "key_unbind");
RUBY_RETURN_INT(0);
}
if (NIL_P (context) || NIL_P (key))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "key_unbind");
RUBY_RETURN_INT(0);
}
Check_Type (context, T_STRING);
Check_Type (key, T_STRING);
c_context = StringValuePtr (context);
c_key = StringValuePtr (key);
num_keys = weechat_key_unbind (c_context, c_key);
RUBY_RETURN_INT(num_keys);
}
/*
* weechat_ruby_api_prefix: get a prefix, used for display
*/
@ -8326,6 +8403,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2);
rb_define_module_function (ruby_mWeechat, "config_set_desc_plugin", &weechat_ruby_api_config_set_desc_plugin, 2);
rb_define_module_function (ruby_mWeechat, "config_unset_plugin", &weechat_ruby_api_config_unset_plugin, 1);
rb_define_module_function (ruby_mWeechat, "key_bind", &weechat_ruby_api_key_bind, 2);
rb_define_module_function (ruby_mWeechat, "key_unbind", &weechat_ruby_api_key_unbind, 2);
rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1);
rb_define_module_function (ruby_mWeechat, "color", &weechat_ruby_api_color, 1);
rb_define_module_function (ruby_mWeechat, "print", &weechat_ruby_api_print, 2);

View File

@ -3073,6 +3073,81 @@ weechat_tcl_api_config_unset_plugin (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_INT(rc);
}
/*
* weechat_tcl_api_key_bind: bind key(s)
*/
static int
weechat_tcl_api_key_bind (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *context;
struct t_hashtable *hashtable;
int i, num_keys;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "key_bind");
TCL_RETURN_INT(0);
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "key_bind");
TCL_RETURN_INT(0);
}
context = Tcl_GetStringFromObj (objv[1], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[2],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
num_keys = weechat_key_bind (context, hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
TCL_RETURN_INT(num_keys);
}
/*
* weechat_tcl_api_key_unbind: unbind key(s)
*/
static int
weechat_tcl_api_key_unbind (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *context, *key;
int i, num_keys;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "key_unbind");
TCL_RETURN_INT(0);
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "key_unbind");
TCL_RETURN_INT(0);
}
context = Tcl_GetStringFromObj (objv[1], &i);
key = Tcl_GetStringFromObj (objv[2], &i);
num_keys = weechat_key_unbind (context, key);
TCL_RETURN_INT(num_keys);
}
/*
* weechat_tcl_api_prefix: get a prefix, used for display
*/
@ -8224,6 +8299,10 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_config_set_desc_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::config_unset_plugin",
weechat_tcl_api_config_unset_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::key_bind",
weechat_tcl_api_key_bind, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::key_unbind",
weechat_tcl_api_key_unbind, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::prefix",
weechat_tcl_api_prefix, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::color",

View File

@ -46,7 +46,7 @@ struct timeval;
*/
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20110802-01"
#define WEECHAT_PLUGIN_API_VERSION "20110820-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -422,6 +422,10 @@ struct t_weechat_plugin
int (*config_unset_plugin) (struct t_weechat_plugin *plugin,
const char *option_name);
/* key bindings */
int (*key_bind) (const char *context, struct t_hashtable *keys);
int (*key_unbind) (const char *context, const char *key);
/* display */
const char *(*prefix) (const char *prefix);
const char *(*color) (const char *color_name);
@ -1166,6 +1170,12 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_config_unset_plugin(__option) \
weechat_plugin->config_unset_plugin(weechat_plugin, __option)
/* key bindings */
#define weechat_key_bind(__context, __keys) \
weechat_plugin->key_bind(__context, __keys)
#define weechat_key_unbind(__context, __key) \
weechat_plugin->key_unbind(__context, __key)
/* display */
#define weechat_prefix(__prefix) \
weechat_plugin->prefix(__prefix)