diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/de/weechat_scripting.de.txt | 4 | ||||
-rw-r--r-- | doc/en/weechat_plugin_api.en.txt | 428 | ||||
-rw-r--r-- | doc/en/weechat_scripting.en.txt | 4 | ||||
-rw-r--r-- | doc/fr/weechat_plugin_api.fr.txt | 537 | ||||
-rw-r--r-- | doc/fr/weechat_scripting.fr.txt | 4 | ||||
-rw-r--r-- | doc/it/weechat_plugin_api.it.txt | 436 | ||||
-rw-r--r-- | doc/it/weechat_scripting.it.txt | 4 | ||||
-rw-r--r-- | src/gui/gui-nicklist.c | 232 | ||||
-rw-r--r-- | src/gui/gui-nicklist.h | 27 | ||||
-rw-r--r-- | src/plugins/plugin.c | 8 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 442 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 296 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 298 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 352 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 352 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 55 |
17 files changed, 3364 insertions, 122 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu <flashcode@flashtux.org> -v0.3.4-dev, 2010-10-28 +v0.3.4-dev, 2010-10-29 Version 0.3.4 (under dev!) @@ -25,7 +25,10 @@ Version 0.3.4 (under dev!) (bug #30759) * api: add priority for hooks (task #10550) * api: add new functions: hashtable_get_string, hook_info_hashtable, - info_get_hashtable, hook_hsignal, hook_hsignal_send + info_get_hashtable, hook_hsignal, hook_hsignal_send, + nicklist_group_get_integer, nicklist_group_get_string, + nicklist_group_get_pointer, nicklist_group_set, nicklist_nick_get_integer, + nicklist_nick_get_string, nicklist_nick_get_pointer, nicklist_nick_set * irc: improve nick prefixes, all modes (even unknown) are used with PREFIX value from message 005 * irc: add command redirection (task #6703) diff --git a/doc/de/weechat_scripting.de.txt b/doc/de/weechat_scripting.de.txt index 25c17c0a1..7d1c22659 100644 --- a/doc/de/weechat_scripting.de.txt +++ b/doc/de/weechat_scripting.de.txt @@ -292,7 +292,9 @@ Liste der Skript API Funktionen: | Nickliste | nicklist_add_group, nicklist_search_group, nicklist_add_nick, nicklist_search_nick, nicklist_remove_group, nicklist_remove_nick, - nicklist_remove_all + nicklist_remove_all, nicklist_group_get_integer, nicklist_group_get_string, + nicklist_group_get_pointer, nicklist_group_set, nicklist_nick_get_integer, + nicklist_nick_get_string, nicklist_nick_get_pointer, nicklist_nick_set | Bars | bar_item_search, bar_item_new, bar_item_update, bar_item_remove, bar_search, bar_new, bar_set, bar_update, bar_remove diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 52c481d65..512823c21 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -8038,8 +8038,8 @@ Prototype: [source,C] ---------------------------------------- -const char *weechat_buffer_pointer (struct t_gui_buffer *buffer, - const char *property); +void *weechat_buffer_pointer (struct t_gui_buffer *buffer, + const char *property); ---------------------------------------- Arguments: @@ -8869,6 +8869,430 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +weechat_nicklist_group_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return integer value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_nicklist_group_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'visible': 1 if group is visible, otherwise 0 +** 'level': group level (root is 0) + +Return value: + +* integer value of property + +C example: + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_group_get_integer (buffer, group, "visible"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_integer(buffer, group, property) + +# example +visible = weechat.nicklist_group_get_integer(buffer, group, "visible") +---------------------------------------- + +weechat_nicklist_group_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return string value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_nicklist_group_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'name': name of group +** 'color': group color in nicklist + +Return value: + +* string value of property + +C example: + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_group_get_string (buffer, group, "color"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_string(buffer, group, property) + +# example +color = weechat.nicklist_group_get_string(buffer, group, "color") +---------------------------------------- + +weechat_nicklist_group_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return pointer value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +void *weechat_nicklist_group_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'parent': pointer to parent group + +Return value: + +* pointer value of property + +C example: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *parent = weechat_nicklist_group_get_pointer (buffer, group, "parent"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_pointer(buffer, group, property) + +# example +parent = weechat.nicklist_group_get_pointer(buffer, group, "parent") +---------------------------------------- + +weechat_nicklist_group_set +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Set string value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +void weechat_nicklist_group_set (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, + const char *value); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property' and 'value': property name, with its value: + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Name | Value | Description + +| color | WeeChat color option name | + see argument "color" of function + <<_weechat_nicklist_add_group,weechat_nicklist_add_group>> + +| visible | "0", "1" | + "0" = hidden group, "1" = visible group +|======================================== + +C examples: + +[source,C] +---------------------------------------- +/* change group color to "bar_fg" */ +weechat_nicklist_group_set (buffer, group, "color", "bar_fg"); + +/* change group color to yellow */ +weechat_nicklist_group_set (buffer, group, "color", "yellow"); + +/* hide group in nicklist */ +weechat_nicklist_group_set (buffer, group, "visible", "0"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_group_set(buffer, group, property, value) + +# examples + +# change group color to "bar_fg" +weechat.nicklist_group_set(buffer, group, "color", "bar_fg") + +# change group color to yellow +weechat.nicklist_group_set(buffer, group, "color", "yellow") + +# hide group in nicklist +weechat.nicklist_group_set(buffer, group, "visible", "0") +---------------------------------------- + +weechat_nicklist_nick_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return integer value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_nicklist_nick_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'visible': 1 if nick is visible, otherwise 0 + +Return value: + +* integer value of property + +C example: + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_nick_get_integer (buffer, nick, "visible"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_integer(buffer, nick, property) + +# example +visible = weechat.nicklist_nick_get_integer(buffer, nick, "visible") +---------------------------------------- + +weechat_nicklist_nick_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return string value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_nicklist_nick_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'name': name of nick +** 'color': nick color in nicklist +** 'prefix': prefix of nick +** 'prefix_color': prefix color in nicklist + +Return value: + +* string value of property + +C example: + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_nick_get_string (buffer, nick, "color"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_string(buffer, nick, property) + +# example +color = weechat.nicklist_nick_get_string(buffer, nick, "color") +---------------------------------------- + +weechat_nicklist_nick_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return pointer value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +void *weechat_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'group': pointer to group containing this nick + +Return value: + +* pointer value of property + +C example: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *group = weechat_nicklist_nick_get_pointer (buffer, nick, "group"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_pointer(buffer, nick, property) + +# example +group = weechat.nicklist_nick_get_pointer(buffer, nick, "group") +---------------------------------------- + +weechat_nicklist_nick_set +^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Set string value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +void weechat_nicklist_nick_set (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, + const char *value); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property' and 'value': property name, with its value: + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Name | Value | Description + +| color | WeeChat color option name | + see argument "color" of function + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| prefix | any string | + prefix of nick + +| prefix_color | WeeChat color option name | + see argument "prefix_color" of function + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| visible | "0", "1" | + "0" = hidden nick, "1" = visible nick +|======================================== + +C examples: + +[source,C] +---------------------------------------- +/* change nick color to cyan */ +weechat_nicklist_nick_set (buffer, nick, "color", "cyan"); + +/* change prefix to "+" */ +weechat_nicklist_nick_set (buffer, nick, "prefix", "+"); + +/* change prefix color to yellow */ +weechat_nicklist_nick_set (buffer, nick, "prefix_color", "yellow"); + +/* hide nick in nicklist */ +weechat_nicklist_nick_set (buffer, nick, "visible", "0"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_nick_set(buffer, nick, property, value) + +# examples + +# change nick color to cyan +weechat.nicklist_nick_set(buffer, nick, "color", "cyan") + +# change prefix to "+" +weechat.nicklist_nick_set(buffer, nick, "prefix", "+") + +# change prefix color to yellow +weechat.nicklist_nick_set(buffer, nick, "prefix_color", "yellow") + +# hide nick in nicklist +weechat.nicklist_nick_set(buffer, nick, "visible", "0") +---------------------------------------- + [[bars]] Bars ~~~~ diff --git a/doc/en/weechat_scripting.en.txt b/doc/en/weechat_scripting.en.txt index 157471160..67123fa07 100644 --- a/doc/en/weechat_scripting.en.txt +++ b/doc/en/weechat_scripting.en.txt @@ -285,7 +285,9 @@ List of functions in script API: | nicklist | nicklist_add_group, nicklist_search_group, nicklist_add_nick, nicklist_search_nick, nicklist_remove_group, nicklist_remove_nick, - nicklist_remove_all + nicklist_remove_all, nicklist_group_get_integer, nicklist_group_get_string, + nicklist_group_get_pointer, nicklist_group_set, nicklist_nick_get_integer, + nicklist_nick_get_string, nicklist_nick_get_pointer, nicklist_nick_set | bars | bar_item_search, bar_item_new, bar_item_update, bar_item_remove, bar_search, bar_new, bar_set, bar_update, bar_remove diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index b9b904d88..cf901a4b1 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -809,7 +809,7 @@ char *weechat_string_expand_home (const char *path); Paramètres : -* 'path': chemin +* 'path' : chemin Valeur de retour : @@ -1295,9 +1295,9 @@ void weechat_string_encode_base64 (const char *from, int length, char *to); Paramètres : -* 'from': chaîne à encoder -* 'length': longueur de chaîne à encoder (par exemple `strlen(from)`) -* 'to': pointeur vers la chaîne pour stocker le résultat (doit être suffisamment +* 'from' : chaîne à encoder +* 'length' : longueur de chaîne à encoder (par exemple `strlen(from)`) +* 'to' : pointeur vers la chaîne pour stocker le résultat (doit être suffisamment long, le résultat est plus long que la chaîne initiale) Exemple en C : @@ -1328,8 +1328,8 @@ int weechat_string_decode_base64 (const char *from, char *to); Paramètres : -* 'from': chaîne à décoder -* 'to': pointeur vers la chaîne pour stocker le résultat (doit être suffisamment +* 'from' : chaîne à décoder +* 'to' : pointeur vers la chaîne pour stocker le résultat (doit être suffisamment long, le résultat est plus court que la chaîne initiale) Valeur de retour : @@ -1366,7 +1366,7 @@ int weechat_string_is_command_char (const char *string); Paramètres : -* 'string': chaîne +* 'string' : chaîne Valeur de retour : @@ -1409,7 +1409,7 @@ const char *weechat_string_input_for_buffer (const char *string); Paramètres : -* 'string': chaîne +* 'string' : chaîne Valeur de retour : @@ -2178,7 +2178,7 @@ char *weechat_file_get_content (const char *filename); Paramètres : -* 'filename': chemin et nom du fichier +* 'filename' : chemin et nom du fichier Valeur de retour : @@ -2315,7 +2315,7 @@ char *weechat_util_get_time_string (const time_t *date); Paramètres : -* 'date': pointeur vers la date +* 'date' : pointeur vers la date Exemple en C : @@ -3136,7 +3136,7 @@ _Nouveau dans la version 0.3.4._ Retourne une valeur pour une propriété d'une hashtable sous forme de chaîne. -Prototype: +Prototype : [source,C] ---------------------------------------- @@ -3144,7 +3144,7 @@ const char *weechat_hashtable_get_string (struct t_hashtable *hashtable, void *property); ---------------------------------------- -Arguments: +Paramètres : * 'hashtable' : pointeur vers la hashtable * 'property' : nom de la propriété : @@ -3154,16 +3154,16 @@ Arguments: *** 'pointer' : pointeur *** 'buffer' : buffer *** 'time' : heure -** 'type_values': type pour les valeurs : +** 'type_values' : type pour les valeurs : *** 'integer' : entier *** 'string' : chaîne *** 'pointer' : pointeur *** 'buffer' : buffer *** 'time' : heure -** 'keys': chaîne avec la liste des clés (format: "clé1,clé2,clé3") -** 'values': chaîne avec la liste des valeurs (format: "valeur1,valeur2,valeur3") -** 'keys_values': chaîne avec la liste des clés et valeurs - (format: "clé1:valeur1,clé2:valeur2,clé3:valeur3") +** 'keys' : chaîne avec la liste des clés (format : "clé1,clé2,clé3") +** 'values' : chaîne avec la liste des valeurs (format : "valeur1,valeur2,valeur3") +** 'keys_values' : chaîne avec la liste des clés et valeurs + (format : "clé1:valeur1,clé2:valeur2,clé3:valeur3") Valeur en retour : @@ -6324,7 +6324,7 @@ struct t_hook *weechat_hook_connect (const char *proxy, Paramètres : -* 'proxy': nom du proxy à utiliser pour la connexion (optionnel, NULL signifie +* 'proxy' : nom du proxy à utiliser pour la connexion (optionnel, NULL signifie une connexion sans proxy) * 'address' : nom ou adresse IP de la machine à laquelle se connecter * 'port' : numéro de port @@ -6332,9 +6332,10 @@ Paramètres : * 'ipv6' : 1 pour utiliser IPv6, 0 pour utiliser IPv4 * 'gnutls_sess' : GnuTLS session (optionnel) * 'gnutls_cb' : callback pour GnuTLS (optionnel) -* 'gnutls_dhkey_size': taille de clé utilisée pour l'échange de clé +* 'gnutls_dhkey_size' : taille de clé utilisée pour l'échange de clé Diffie-Hellman (GnuTLS) -* 'local_hostname': nom de machine local à utiliser pour la connexion (optionnel) +* 'local_hostname' : nom de machine local à utiliser pour la connexion + (optionnel) * 'callback' : fonction appelée lorsque la connexion est ok ou a échoué, paramètres : ** 'void *data' : pointeur @@ -6655,7 +6656,7 @@ Paramètres : | weechat | day_changed | chaîne : nouvelle date, format : "2010-01-31" | le jour de la date système a changé -| weechat | debug_dump | chaîne: nom d'extension | +| weechat | debug_dump | chaîne : nom d'extension | requête de "dump" | weechat | filter_added | pointeur : filtre | @@ -6691,16 +6692,16 @@ Paramètres : | weechat | key_pressed | chaîne : touche appuyée | touche appuyée -| weechat | nicklist_group_added | chaîne: pointeur tampon + "," + nom du groupe | +| weechat | nicklist_group_added | chaîne : pointeur tampon + "," + nom du groupe | groupe ajouté dans la liste des pseudos -| weechat | nicklist_group_removed | chaîne: pointeur tampon + "," + nom du groupe | +| weechat | nicklist_group_removed | chaîne : pointeur tampon + "," + nom du groupe | groupe supprimé de la liste des pseudos -| weechat | nicklist_nick_added | chaîne: pointeur tampon + "," + pseudo | +| weechat | nicklist_nick_added | chaîne : pointeur tampon + "," + pseudo | pseudo ajouté dans la liste des pseudos -| weechat | nicklist_nick_removed | chaîne: pointeur tampon + "," + pseudo | +| weechat | nicklist_nick_removed | chaîne : pointeur tampon + "," + pseudo | pseudo supprimé de la liste des pseudos | weechat | partial_completion | - | @@ -6864,7 +6865,7 @@ struct t_hook *weechat_hook_hsignal (const char *signal, Paramètres : -* 'signal': signal à intercepter, peut commencer ou se terminer par "*" +* 'signal' : signal à intercepter, peut commencer ou se terminer par "*" (priorité autorisée, voir la note sur la <<hook_priority,priorité>>) : [width="100%",cols="^1,^3,5",options="header"] @@ -6886,7 +6887,7 @@ modèle de redirection ("pattern"). * 'callback_data' : pointeur donné au "callback" lorsqu'il est appelé par WeeChat -Return value: +Valeur de retour : * pointeur vers le nouveau "hook", NULL en cas d'erreur @@ -6963,7 +6964,7 @@ Script (Python) : # prototype weechat.hook_hsignal_send(signal, hashtable) -# example +# exemple weechat.hook_hsignal_send("my_hsignal", { "clé": "valeur" }) ---------------------------------------- @@ -7055,7 +7056,7 @@ Paramètres : * 'completion_item' : nom de l'objet de complétion, après vous pouvez utiliser '%(nom)' dans une commande (paramètre 'completion') (priorité autorisée, voir la note sur la <<hook_priority,priorité>>) -* 'description': description de la complétion +* 'description' : description de la complétion * 'callback' : fonction appelée lorsque la complétion est utilisée (l'utilisateur est en train de compléter quelque chose qui fait appel à cette complétion), paramètres : @@ -7452,7 +7453,7 @@ Paramètres : (optionnel, peut être NULL) * 'callback' : fonction appelée quand l'information est demandée, paramètres : ** 'void *data' : pointeur -** 'const char *info_name': nom de l'information +** 'const char *info_name' : nom de l'information ** 'struct t_hashtable *hashtable' : hashtable, dépendant de l'information * 'callback_data' : pointeur donné au "callback" lorsqu'il est appelé par WeeChat @@ -8026,32 +8027,32 @@ Paramètres : * 'buffer' : pointeur vers le tampon * 'property' : nom de la propriété : ** 'number' : numéro du tampon (commence à 1) -** 'layout_number': numéro du tampon sauvegardé dans le "layout" -** 'type': type de tampon (0: formaté, 1: contenu libre) +** 'layout_number' : numéro du tampon sauvegardé dans le "layout" +** 'type' : type de tampon (0 : formaté, 1 : contenu libre) ** 'notify' : niveau de notification du tampon ** 'num_displayed' : nombre de fenêtres affichant ce tampon -** 'active': 1 si le tampon est actif, 0 si le tampon est mélangé et n'est pas +** 'active' : 1 si le tampon est actif, 0 si le tampon est mélangé et n'est pas sélectionné -** 'print_hooks_enabled': 1 si les hooks "print" sont activés, sinon 0 +** 'print_hooks_enabled' : 1 si les hooks "print" sont activés, sinon 0 ** 'lines_hidden' : 1 si au moins une ligne est cachée dans le tampon (filtrée), ou 0 si toutes les lignes sont affichées ** 'prefix_max_length' : longueur maximale du préfixe dans ce tampon ** 'time_for_each_line' : 1 si l'heure est affichée pour chaque ligne du tampon (par défaut), sinon 0 -** 'nicklist': 1 si la liste de pseudos est activée, sinon 0 -** 'nicklist_case_sensitive': 1 si les pseudos sont sensibles à la casse, +** 'nicklist' : 1 si la liste de pseudos est activée, sinon 0 +** 'nicklist_case_sensitive' : 1 si les pseudos sont sensibles à la casse, sinon 0 -** 'nicklist_max_length': longueur maxi d'un pseudo -** 'nicklist_display_groups': 1 si les groupes sont affichés, sinon 0 -** 'nicklist_visible_count': nombre de pseudos/groupes affichés -** 'input': 1 si la zone de saisie est activée, sinon 0 -** 'input_get_unknown_commands': 1 si les commandes inconnues sont envoyées +** 'nicklist_max_length' : longueur maxi d'un pseudo +** 'nicklist_display_groups' : 1 si les groupes sont affichés, sinon 0 +** 'nicklist_visible_count' : nombre de pseudos/groupes affichés +** 'input' : 1 si la zone de saisie est activée, sinon 0 +** 'input_get_unknown_commands' : 1 si les commandes inconnues sont envoyées au "callback input", sinon 0 -** 'input_size': taille de la zone de saisie (en octets) -** 'input_length': longueur de la zone de saisie (nombre de caractères) -** 'input_pos': position du curseur dans la zone de saisie -** 'input_1st_display': premier caractère affiché à l'écran -** 'num_history': nombre de commandes dans l'historique +** 'input_size' : taille de la zone de saisie (en octets) +** 'input_length' : longueur de la zone de saisie (nombre de caractères) +** 'input_pos' : position du curseur dans la zone de saisie +** 'input_1st_display' : premier caractère affiché à l'écran +** 'num_history' : nombre de commandes dans l'historique ** 'text_search' : type de recherche de texte : *** 0 : pas de recherche en cours *** 1 : recherche arrière (vers les messages les plus anciens) @@ -8105,10 +8106,10 @@ Paramètres : ** 'short_name' : nom court du tampon ** 'title' : titre du tampon ** 'input' : texte saisi -** 'text_search_input': texte saisi sauvegardé avant la recherche de texte -** 'highlight_words': liste des mots pour le highlight -** 'highlight_tags': liste des étiquettes pour le highlight -** 'no_highlight_nicks': liste des pseudos à NE PAS mettre en valeur (highlight) +** 'text_search_input' : texte saisi sauvegardé avant la recherche de texte +** 'highlight_words' : liste des mots pour le highlight +** 'highlight_tags' : liste des étiquettes pour le highlight +** 'no_highlight_nicks' : liste des pseudos à NE PAS mettre en valeur (highlight) ** 'localvar_xxx' : contenu de la variable locale "xxx" (remplacer "xxx" par le nom de la variable locale à lire) @@ -8147,8 +8148,8 @@ Prototype : [source,C] ---------------------------------------- -const char *weechat_buffer_pointer (struct t_gui_buffer *buffer, - const char *property); +void *weechat_buffer_pointer (struct t_gui_buffer *buffer, + const char *property); ---------------------------------------- Paramètres : @@ -8638,7 +8639,7 @@ void weechat_window_set_title (const char *title); Paramètres : -* 'title': nouveau titre pour le terminal (NULL pour réinitialiser le titre) +* 'title' : nouveau titre pour le terminal (NULL pour réinitialiser le titre) Exemple en C : @@ -9000,6 +9001,430 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +weechat_nicklist_group_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne une valeur entière pour une propriété du groupe. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_nicklist_group_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'group' : pointeur vers le groupe +* 'property' : nom de la propriété : +** 'visible' : 1 si le groupe est visible, sinon 0 +** 'level' : niveau du groupe (la racine est 0) + +Valeur de retour : + +* valeur entière de la propriété + +Exemple en C : + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_group_get_integer (buffer, group, "visible"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_integer(buffer, group, property) + +# exemple +visible = weechat.nicklist_group_get_integer(buffer, group, "visible") +---------------------------------------- + +weechat_nicklist_group_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne la valeur d'une propriété du groupe sous forme de chaîne. + +Prototype : + +[source,C] +---------------------------------------- +const char *weechat_nicklist_group_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'group' : pointeur vers le groupe +* 'property' : nom de la propriété : +** 'name' : nom du groupe +** 'color' : couleur du groupe dans la liste des pseudos + +Valeur de retour : + +* valeur de la propriété, sous forme de chaîne + +Exemple en C : + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_group_get_string (buffer, group, "color"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_string(buffer, group, property) + +# exemple +color = weechat.nicklist_group_get_string(buffer, group, "color") +---------------------------------------- + +weechat_nicklist_group_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne la valeur d'une propriété du groupe sous forme d'un pointeur. + +Prototype : + +[source,C] +---------------------------------------- +void *weechat_nicklist_group_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'group' : pointeur vers le groupe +* 'property' : nom de la propriété : +** 'parent' : pointeur vers le groupe parent + +Valeur de retour : + +* valeur de la propriété, sous forme de pointeur + +Exemple en C : + +[source,C] +---------------------------------------- +struct t_gui_nick_group *parent = weechat_nicklist_group_get_pointer (buffer, group, "parent"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_pointer(buffer, group, property) + +# exemple +parent = weechat.nicklist_group_get_pointer(buffer, group, "parent") +---------------------------------------- + +weechat_nicklist_group_set +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Affecte une valeur à une propriété d'un groupe. + +Prototype : + +[source,C] +---------------------------------------- +void weechat_nicklist_group_set (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, + const char *value); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'group' : pointeur vers le groupe +* 'property' et 'value' : nom de la propriété, avec sa valeur : + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Nom | Valeur | Description + +| color | nom d'option de couleur WeeChat | + voir le paramètre "color" de la fonction + <<_weechat_nicklist_add_group,weechat_nicklist_add_group>> + +| visible | "0", "1" | + "0" = groupe caché, "1" = groupe visible +|======================================== + +Exemples en C : + +[source,C] +---------------------------------------- +/* changer la couleur du groupe en "bar_fg" */ +weechat_nicklist_group_set (buffer, group, "color", "bar_fg"); + +/* changer la couleur du groupe en jaune */ +weechat_nicklist_group_set (buffer, group, "color", "yellow"); + +/* cacher le groupe dans la liste des pseudos */ +weechat_nicklist_group_set (buffer, group, "visible", "0"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_group_set(buffer, group, property, value) + +# exemples + +# changer la couleur du groupe en "bar_fg" +weechat.nicklist_group_set(buffer, group, "color", "bar_fg") + +# changer la couleur du groupe en jaune +weechat.nicklist_group_set(buffer, group, "color", "yellow") + +# cacher le groupe dans la liste des pseudos +weechat.nicklist_group_set(buffer, group, "visible", "0") +---------------------------------------- + +weechat_nicklist_nick_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne une valeur entière pour une propriété du pseudo. + +Prototype : + +[source,C] +---------------------------------------- +int weechat_nicklist_nick_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'nick' : pointeur vers le pseudo +* 'property' : nom de la propriété : +** 'visible' : 1 si le pseudo est visible, sinon 0 + +Valeur de retour : + +* valeur entière de la propriété + +Exemple en C : + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_nick_get_integer (buffer, nick, "visible"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_integer(buffer, nick, property) + +# exemple +visible = weechat.nicklist_nick_get_integer(buffer, nick, "visible") +---------------------------------------- + +weechat_nicklist_nick_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne la valeur d'une propriété du pseudo sous forme de chaîne. + +Prototype : + +[source,C] +---------------------------------------- +const char *weechat_nicklist_nick_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'nick' : pointeur vers le pseudo +* 'property' : nom de la propriété : +** 'name' : nom du pseudo +** 'color' : couleur du pseudo dans la liste des pseudos +** 'prefix' : préfixe du pseudo +** 'prefix_color' : couleur du préfixe dans la liste des pseudos + +Valeur de retour : + +* valeur de la propriété, sous forme de chaîne + +Exemple en C : + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_nick_get_string (buffer, nick, "color"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_string(buffer, nick, property) + +# exemple +color = weechat.nicklist_nick_get_string(buffer, nick, "color") +---------------------------------------- + +weechat_nicklist_nick_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Retourne la valeur d'une propriété du pseudo sous forme d'un pointeur. + +Prototype : + +[source,C] +---------------------------------------- +void *weechat_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'nick' : pointeur vers le pseudo +* 'property' : nom de la propriété : +** 'group' : pointeur vers le groupe contenant ce pseudo + +Valeur de retour : + +* valeur de la propriété, sous forme de pointeur + +Exemple en C : + +[source,C] +---------------------------------------- +struct t_gui_nick_group *group = weechat_nicklist_nick_get_pointer (buffer, nick, "group"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_pointer(buffer, nick, property) + +# exemple +group = weechat.nicklist_nick_get_pointer(buffer, nick, "group") +---------------------------------------- + +weechat_nicklist_nick_set +^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Affecte une valeur à une propriété d'un pseudo. + +Prototype : + +[source,C] +---------------------------------------- +void weechat_nicklist_nick_set (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, + const char *value); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'nick' : pointeur vers le pseudo +* 'property' et 'value' : nom de la propriété, avec sa valeur : + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Nom | Valeur | Description + +| color | nom d'option de couleur WeeChat | + voir le paramètre "color" de la fonction + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| prefix | toute chaîne | + préfixe du pseudo + +| prefix_color | nom d'option de couleur WeeChat | + voir le paramètre "prefix_color" de la fonction + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| visible | "0", "1" | + "0" = pseudo caché, "1" = pseudo visible +|======================================== + +Exemples en C : + +[source,C] +---------------------------------------- +/* changer la couleur du pseudo en cyan */ +weechat_nicklist_nick_set (buffer, nick, "color", "cyan"); + +/* changer le préfixe en "+" */ +weechat_nicklist_nick_set (buffer, nick, "prefix", "+"); + +/* changer la couleur du préfixe en jaune */ +weechat_nicklist_nick_set (buffer, nick, "prefix_color", "yellow"); + +/* cacher le pseudo dans la liste des pseudos */ +weechat_nicklist_nick_set (buffer, nick, "visible", "0"); +---------------------------------------- + +Script (Python) : + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_nick_set(buffer, nick, property, value) + +# exemples + +# changer la couleur du pseudo en cyan +weechat.nicklist_nick_set(buffer, nick, "color", "cyan") + +# changer le préfixe en "+" +weechat.nicklist_nick_set(buffer, nick, "prefix", "+") + +# changer la couleur du préfixe en jaune +weechat.nicklist_nick_set(buffer, nick, "prefix_color", "yellow") + +# cacher le pseudo dans la liste des pseudos +weechat.nicklist_nick_set(buffer, nick, "visible", "0") +---------------------------------------- + [[bars]] Barres ~~~~~~ @@ -9638,7 +10063,7 @@ _Nouveau dans la version 0.3.4._ Retourne une information, sous forme de hashtable, de WeeChat ou d'une extension. -Prototype: +Prototype : [source,C] ---------------------------------------- @@ -9687,14 +10112,14 @@ if (hashtable_in) } ---------------------------------------- -Script (Python): +Script (Python) : [source,python] ---------------------------------------- # prototype dict = weechat.info_get_hashtable(info_name, dict_in) -# example +# exemple dict_in = { "message": ":nick!user@host PRIVMSG #weechat :message ici" } weechat.prnt("", "message analysé: %s" % weechat.info_get_hashtable("irc_parse_message", dict_in)) diff --git a/doc/fr/weechat_scripting.fr.txt b/doc/fr/weechat_scripting.fr.txt index 447466362..d7448f324 100644 --- a/doc/fr/weechat_scripting.fr.txt +++ b/doc/fr/weechat_scripting.fr.txt @@ -294,7 +294,9 @@ Liste des fonctions de l'API script : | liste des pseudos | nicklist_add_group, nicklist_search_group, nicklist_add_nick, nicklist_search_nick, nicklist_remove_group, nicklist_remove_nick, - nicklist_remove_all + nicklist_remove_all, nicklist_group_get_integer, nicklist_group_get_string, + nicklist_group_get_pointer, nicklist_group_set, nicklist_nick_get_integer, + nicklist_nick_get_string, nicklist_nick_get_pointer, nicklist_nick_set | barres | bar_item_search, bar_item_new, bar_item_update, bar_item_remove, bar_search, bar_new, bar_set, bar_update, bar_remove diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index c7ad74c11..227e6e933 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -8126,8 +8126,8 @@ Prototipo: [source,C] ---------------------------------------- -const char *weechat_buffer_pointer (struct t_gui_buffer *buffer, - const char *property); +void *weechat_buffer_pointer (struct t_gui_buffer *buffer, + const char *property); ---------------------------------------- Argomenti: @@ -8974,6 +8974,438 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +// TRANSLATION MISSING +weechat_nicklist_group_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return integer value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_nicklist_group_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'visible': 1 if group is visible, otherwise 0 +** 'level': group level (root is 0) + +Return value: + +* integer value of property + +C example: + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_group_get_integer (buffer, group, "visible"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_integer(buffer, group, property) + +# example +visible = weechat.nicklist_group_get_integer(buffer, group, "visible") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_group_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return string value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_nicklist_group_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'name': name of group +** 'color': group color in nicklist + +Return value: + +* string value of property + +C example: + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_group_get_string (buffer, group, "color"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_string(buffer, group, property) + +# example +color = weechat.nicklist_group_get_string(buffer, group, "color") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_group_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return pointer value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +void *weechat_nicklist_group_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property': property name: +** 'parent': pointer to parent group + +Return value: + +* pointer value of property + +C example: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *parent = weechat_nicklist_group_get_pointer (buffer, group, "parent"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_group_get_pointer(buffer, group, property) + +# example +parent = weechat.nicklist_group_get_pointer(buffer, group, "parent") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_group_set +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Set string value of a group property. + +Prototype: + +[source,C] +---------------------------------------- +void weechat_nicklist_group_set (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, + const char *value); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': group pointer +* 'property' and 'value': property name, with its value: + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Name | Value | Description + +| color | WeeChat color option name | + see argument "color" of function + <<_weechat_nicklist_add_group,weechat_nicklist_add_group>> + +| visible | "0", "1" | + "0" = hidden group, "1" = visible group +|======================================== + +C examples: + +[source,C] +---------------------------------------- +/* change group color to "bar_fg" */ +weechat_nicklist_group_set (buffer, group, "color", "bar_fg"); + +/* change group color to yellow */ +weechat_nicklist_group_set (buffer, group, "color", "yellow"); + +/* hide group in nicklist */ +weechat_nicklist_group_set (buffer, group, "visible", "0"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_group_set(buffer, group, property, value) + +# examples + +# change group color to "bar_fg" +weechat.nicklist_group_set(buffer, group, "color", "bar_fg") + +# change group color to yellow +weechat.nicklist_group_set(buffer, group, "color", "yellow") + +# hide group in nicklist +weechat.nicklist_group_set(buffer, group, "visible", "0") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_nick_get_integer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return integer value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +int weechat_nicklist_nick_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'visible': 1 if nick is visible, otherwise 0 + +Return value: + +* integer value of property + +C example: + +[source,C] +---------------------------------------- +int visible = weechat_nicklist_nick_get_integer (buffer, nick, "visible"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_integer(buffer, nick, property) + +# example +visible = weechat.nicklist_nick_get_integer(buffer, nick, "visible") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_nick_get_string +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return string value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +const char *weechat_nicklist_nick_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'name': name of nick +** 'color': nick color in nicklist +** 'prefix': prefix of nick +** 'prefix_color': prefix color in nicklist + +Return value: + +* string value of property + +C example: + +[source,C] +---------------------------------------- +const char *color = weechat_nicklist_nick_get_string (buffer, nick, "color"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_string(buffer, nick, property) + +# example +color = weechat.nicklist_nick_get_string(buffer, nick, "color") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_nick_get_pointer +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Return pointer value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +void *weechat_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property': property name: +** 'group': pointer to group containing this nick + +Return value: + +* pointer value of property + +C example: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *group = weechat_nicklist_nick_get_pointer (buffer, nick, "group"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +value = weechat.nicklist_nick_get_pointer(buffer, nick, property) + +# example +group = weechat.nicklist_nick_get_pointer(buffer, nick, "group") +---------------------------------------- + +// TRANSLATION MISSING +weechat_nicklist_nick_set +^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +Set string value of a nick property. + +Prototype: + +[source,C] +---------------------------------------- +void weechat_nicklist_nick_set (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, + const char *value); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'nick': nick pointer +* 'property' and 'value': property name, with its value: + +[width="100%",cols="^2,4,8",options="header"] +|======================================== +| Name | Value | Description + +| color | WeeChat color option name | + see argument "color" of function + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| prefix | any string | + prefix of nick + +| prefix_color | WeeChat color option name | + see argument "prefix_color" of function + <<_weechat_nicklist_add_nick,weechat_nicklist_add_nick>> + +| visible | "0", "1" | + "0" = hidden nick, "1" = visible nick +|======================================== + +C examples: + +[source,C] +---------------------------------------- +/* change nick color to cyan */ +weechat_nicklist_nick_set (buffer, nick, "color", "cyan"); + +/* change prefix to "+" */ +weechat_nicklist_nick_set (buffer, nick, "prefix", "+"); + +/* change prefix color to yellow */ +weechat_nicklist_nick_set (buffer, nick, "prefix_color", "yellow"); + +/* hide nick in nicklist */ +weechat_nicklist_nick_set (buffer, nick, "visible", "0"); +---------------------------------------- + +Script (Python): + +[source,python] +---------------------------------------- +# prototype +weechat.nicklist_nick_set(buffer, nick, property, value) + +# examples + +# change nick color to cyan +weechat.nicklist_nick_set(buffer, nick, "color", "cyan") + +# change prefix to "+" +weechat.nicklist_nick_set(buffer, nick, "prefix", "+") + +# change prefix color to yellow +weechat.nicklist_nick_set(buffer, nick, "prefix_color", "yellow") + +# hide nick in nicklist +weechat.nicklist_nick_set(buffer, nick, "visible", "0") +---------------------------------------- + [[bars]] Barre ~~~~~ diff --git a/doc/it/weechat_scripting.it.txt b/doc/it/weechat_scripting.it.txt index 40c83deed..4943ad8ee 100644 --- a/doc/it/weechat_scripting.it.txt +++ b/doc/it/weechat_scripting.it.txt @@ -294,7 +294,9 @@ Elenco di funzioni nelle API per gli script: | lista nick | nicklist_add_group, nicklist_search_group, nicklist_add_nick, nicklist_search_nick, nicklist_remove_group, nicklist_remove_nick, - nicklist_remove_all + nicklist_remove_all, nicklist_group_get_integer, nicklist_group_get_string, + nicklist_group_get_pointer, nicklist_group_set, nicklist_nick_get_integer, + nicklist_nick_get_string, nicklist_nick_get_pointer, nicklist_nick_set | barre | bar_item_search, bar_item_new, bar_item_update, bar_item_remove, bar_search, bar_new, bar_set, bar_update, bar_remove diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index 8f314785c..f1d95454c 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -684,6 +684,238 @@ gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer, } /* + * gui_nicklist_group_get_integer: get a group property as integer + */ + +int +gui_nicklist_group_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (group && property) + { + if (string_strcasecmp (property, "visible") == 0) + return group->visible; + else if (string_strcasecmp (property, "level") == 0) + return group->level; + } + + return 0; +} + +/* + * gui_nicklist_group_get_string: get a group property as string + */ + +const char * +gui_nicklist_group_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (group && property) + { + if (string_strcasecmp (property, "name") == 0) + return group->name; + else if (string_strcasecmp (property, "color") == 0) + return group->color; + } + + return NULL; +} + +/* + * gui_nicklist_group_get_pointer: get a group property as pointer + */ + +void * +gui_nicklist_group_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (group && property) + { + if (string_strcasecmp (property, "parent") == 0) + return group->parent; + } + + return NULL; +} + +/* + * gui_nicklist_group_set: set a group property (string) + */ + +void +gui_nicklist_group_set (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, const char *value) +{ + long number; + char *error; + int group_changed; + + if (!buffer || !group || !property || !value) + return; + + group_changed = 0; + + if (string_strcasecmp (property, "color") == 0) + { + if (group->color) + free (group->color); + group->color = (value[0]) ? strdup (value) : NULL; + group_changed = 1; + } + else if (string_strcasecmp (property, "visible") == 0) + { + error = NULL; + number = strtol (value, &error, 10); + if (error && !error[0]) + group->visible = (number) ? 1 : 0; + group_changed = 1; + } + + if (group_changed) + { + gui_nicklist_send_signal ("nicklist_group_changed", buffer, + group->name); + } +} + +/* + * gui_nicklist_nick_get_integer: get a nick property as integer + */ + +int +gui_nicklist_nick_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (nick && property) + { + if (string_strcasecmp (property, "visible") == 0) + return nick->visible; + } + + return 0; +} + +/* + * gui_nicklist_nick_get_string: get a nick property as string + */ + +const char * +gui_nicklist_nick_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (nick && property) + { + if (string_strcasecmp (property, "name") == 0) + return nick->name; + else if (string_strcasecmp (property, "color") == 0) + return nick->color; + else if (string_strcasecmp (property, "prefix") == 0) + return nick->prefix; + else if (string_strcasecmp (property, "prefix_color") == 0) + return nick->prefix_color; + } + + return NULL; +} + +/* + * gui_nicklist_nick_get_pointer: get a nick property as pointer + */ + +void * +gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property) +{ + /* make C compiler happy */ + (void) buffer; + + if (nick && property) + { + if (string_strcasecmp (property, "group") == 0) + return nick->group; + } + + return NULL; +} + +/* + * gui_nicklist_nick_set: set a nick property (string) + */ + +void +gui_nicklist_nick_set (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, const char *value) +{ + long number; + char *error; + int nick_changed; + + if (!buffer || !nick || !property || !value) + return; + + nick_changed = 0; + + if (string_strcasecmp (property, "color") == 0) + { + if (nick->color) + free (nick->color); + nick->color = (value[0]) ? strdup (value) : NULL; + nick_changed = 1; + } + else if (string_strcasecmp (property, "prefix") == 0) + { + if (nick->prefix) + free (nick->prefix); + nick->prefix = (value[0]) ? strdup (value) : NULL; + nick_changed = 1; + } + else if (string_strcasecmp (property, "prefix_color") == 0) + { + if (nick->prefix_color) + free (nick->prefix_color); + nick->prefix_color = (value[0]) ? strdup (value) : NULL; + nick_changed = 1; + } + else if (string_strcasecmp (property, "visible") == 0) + { + error = NULL; + number = strtol (value, &error, 10); + if (error && !error[0]) + nick->visible = (number) ? 1 : 0; + nick_changed = 1; + } + + if (nick_changed) + { + gui_nicklist_send_signal ("nicklist_nick_changed", buffer, + nick->name); + } +} + +/* * gui_nicklist_add_group_to_infolist: add a group in an infolist * return 1 if ok, 0 if error */ diff --git a/src/gui/gui-nicklist.h b/src/gui/gui-nicklist.h index 4dbb570fc..6029800b6 100644 --- a/src/gui/gui-nicklist.h +++ b/src/gui/gui-nicklist.h @@ -81,6 +81,33 @@ extern void gui_nicklist_get_next_item (struct t_gui_buffer *buffer, extern char *gui_nicklist_get_group_start (const char *name); extern void gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer, struct t_gui_nick_group *group); + + + +extern int gui_nicklist_group_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +extern const char *gui_nicklist_group_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +extern void *gui_nicklist_group_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); +extern void gui_nicklist_group_set (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, const char *value); +extern int gui_nicklist_nick_get_integer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +extern const char *gui_nicklist_nick_get_string (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +extern void *gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); +extern void gui_nicklist_nick_set (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, const char *value); extern int gui_nicklist_add_to_infolist (struct t_infolist *infolist, struct t_gui_buffer *buffer, const char *name); diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index c0cb75a44..57985c492 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -627,6 +627,14 @@ plugin_load (const char *filename) new_plugin->nicklist_remove_group = &gui_nicklist_remove_group; new_plugin->nicklist_remove_nick = &gui_nicklist_remove_nick; new_plugin->nicklist_remove_all = &gui_nicklist_remove_all; + new_plugin->nicklist_group_get_integer = &gui_nicklist_group_get_integer; + new_plugin->nicklist_group_get_string = &gui_nicklist_group_get_string; + new_plugin->nicklist_group_get_pointer = &gui_nicklist_group_get_pointer; + new_plugin->nicklist_group_set = &gui_nicklist_group_set; + new_plugin->nicklist_nick_get_integer = &gui_nicklist_nick_get_integer; + new_plugin->nicklist_nick_get_string = &gui_nicklist_nick_get_string; + new_plugin->nicklist_nick_get_pointer = &gui_nicklist_nick_get_pointer; + new_plugin->nicklist_nick_set = &gui_nicklist_nick_set; new_plugin->bar_item_search = &gui_bar_item_search; new_plugin->bar_item_new = &gui_bar_item_new; diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index e531ceedc..07db5db24 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -189,7 +189,7 @@ weechat_lua_api_charset_set (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "charset_set"); @@ -618,7 +618,7 @@ weechat_lua_api_mkdir_home (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir_home"); @@ -657,7 +657,7 @@ weechat_lua_api_mkdir (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir"); @@ -697,7 +697,7 @@ weechat_lua_api_mkdir_parents (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "mkdir_parents"); @@ -3315,7 +3315,7 @@ weechat_lua_api_hook_command (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_command"); @@ -3415,7 +3415,7 @@ weechat_lua_api_hook_command_run (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_command_run"); @@ -3502,7 +3502,7 @@ weechat_lua_api_hook_timer (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_timer"); @@ -3594,7 +3594,7 @@ weechat_lua_api_hook_fd (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_fd"); @@ -3694,7 +3694,7 @@ weechat_lua_api_hook_process (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_process"); @@ -3788,7 +3788,7 @@ weechat_lua_api_hook_connect (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_connect"); @@ -3916,7 +3916,7 @@ weechat_lua_api_hook_print (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_print"); @@ -4031,7 +4031,7 @@ weechat_lua_api_hook_signal (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_signal"); @@ -4076,7 +4076,7 @@ weechat_lua_api_hook_signal_send (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_signal_send"); @@ -4174,7 +4174,7 @@ weechat_lua_api_hook_hsignal (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal"); @@ -4220,7 +4220,7 @@ weechat_lua_api_hook_hsignal_send (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_hsignal_send"); @@ -4396,7 +4396,7 @@ weechat_lua_api_hook_completion (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_completion"); @@ -4444,7 +4444,7 @@ weechat_lua_api_hook_completion_list_add (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_completion_list_add"); @@ -4521,7 +4521,7 @@ weechat_lua_api_hook_modifier (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_modifier"); @@ -4567,7 +4567,7 @@ weechat_lua_api_hook_modifier_exec (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_modifier_exec"); @@ -4637,7 +4637,7 @@ weechat_lua_api_hook_info (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_info"); @@ -4719,7 +4719,7 @@ weechat_lua_api_hook_info_hashtable (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_info_hashtable"); @@ -4811,7 +4811,7 @@ weechat_lua_api_hook_infolist (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hook_infolist"); @@ -4865,7 +4865,7 @@ weechat_lua_api_unhook (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "unhook"); @@ -5008,7 +5008,7 @@ weechat_lua_api_buffer_new (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_new"); @@ -5181,7 +5181,7 @@ weechat_lua_api_buffer_close (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_close"); @@ -5297,7 +5297,7 @@ weechat_lua_api_buffer_get_integer (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_integer"); @@ -5336,7 +5336,7 @@ weechat_lua_api_buffer_get_string (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_string"); @@ -5376,7 +5376,7 @@ weechat_lua_api_buffer_get_pointer (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_get_pointer"); @@ -5415,7 +5415,7 @@ weechat_lua_api_buffer_set (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "buffer_set"); @@ -5517,7 +5517,7 @@ weechat_lua_api_window_get_integer (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_integer"); @@ -5556,7 +5556,7 @@ weechat_lua_api_window_get_string (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_string"); @@ -5596,7 +5596,7 @@ weechat_lua_api_window_get_pointer (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_get_pointer"); @@ -5635,7 +5635,7 @@ weechat_lua_api_window_set_title (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_set_title"); @@ -5672,7 +5672,7 @@ weechat_lua_api_nicklist_add_group (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_group"); @@ -5721,7 +5721,7 @@ weechat_lua_api_nicklist_search_group (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_group"); @@ -5764,7 +5764,7 @@ weechat_lua_api_nicklist_add_nick (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_add_nick"); @@ -5819,7 +5819,7 @@ weechat_lua_api_nicklist_search_nick (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_search_nick"); @@ -5861,7 +5861,7 @@ weechat_lua_api_nicklist_remove_group (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_group"); @@ -5900,7 +5900,7 @@ weechat_lua_api_nicklist_remove_nick (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_nick"); @@ -5939,7 +5939,7 @@ weechat_lua_api_nicklist_remove_all (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_remove_all"); @@ -5964,6 +5964,350 @@ weechat_lua_api_nicklist_remove_all (lua_State *L) } /* + * weechat_lua_api_nicklist_group_get_integer: get a group property as integer + */ + +static int +weechat_lua_api_nicklist_group_get_integer (lua_State *L) +{ + const char *buffer, *group, *property; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + LUA_RETURN_INT(-1); + } + + buffer = NULL; + group = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + LUA_RETURN_INT(-1); + } + + buffer = lua_tostring (lua_current_interpreter, -3); + group = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), + script_str2ptr (group), + property); + + LUA_RETURN_INT(value); +} + +/* + * weechat_lua_api_nicklist_group_get_string: get a group property as string + */ + +static int +weechat_lua_api_nicklist_group_get_string (lua_State *L) +{ + const char *buffer, *group, *property, *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + LUA_RETURN_EMPTY; + } + + buffer = NULL; + group = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -3); + group = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + result = weechat_nicklist_group_get_string (script_str2ptr (buffer), + script_str2ptr (group), + property); + + LUA_RETURN_STRING(result); +} + +/* + * weechat_lua_api_nicklist_group_get_pointer: get a group property as pointer + */ + +static int +weechat_lua_api_nicklist_group_get_pointer (lua_State *L) +{ + const char *buffer, *group, *property; + char *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + LUA_RETURN_EMPTY; + } + + buffer = NULL; + group = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -3); + group = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), + script_str2ptr (group), + property)); + + LUA_RETURN_STRING_FREE(result); +} + +/* + * weechat_lua_api_nicklist_group_set: set a group property + */ + +static int +weechat_lua_api_nicklist_group_set (lua_State *L) +{ + const char *buffer, *group, *property, *value; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + LUA_RETURN_ERROR; + } + + buffer = NULL; + group = NULL; + property = NULL; + value = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -4); + group = lua_tostring (lua_current_interpreter, -3); + property = lua_tostring (lua_current_interpreter, -2); + value = lua_tostring (lua_current_interpreter, -1); + + weechat_nicklist_group_set (script_str2ptr (buffer), + script_str2ptr (group), + property, + value); + + LUA_RETURN_OK; +} + +/* + * weechat_lua_api_nicklist_nick_get_integer: get a nick property as integer + */ + +static int +weechat_lua_api_nicklist_nick_get_integer (lua_State *L) +{ + const char *buffer, *nick, *property; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + LUA_RETURN_INT(-1); + } + + buffer = NULL; + nick = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + LUA_RETURN_INT(-1); + } + + buffer = lua_tostring (lua_current_interpreter, -3); + nick = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + LUA_RETURN_INT(value); +} + +/* + * weechat_lua_api_nicklist_nick_get_string: get a nick property as string + */ + +static int +weechat_lua_api_nicklist_nick_get_string (lua_State *L) +{ + const char *buffer, *nick, *property, *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + LUA_RETURN_EMPTY; + } + + buffer = NULL; + nick = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -3); + nick = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + LUA_RETURN_STRING(result); +} + +/* + * weechat_lua_api_nicklist_nick_get_pointer: get a nick property as pointer + */ + +static int +weechat_lua_api_nicklist_nick_get_pointer (lua_State *L) +{ + const char *buffer, *nick, *property; + char *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + LUA_RETURN_EMPTY; + } + + buffer = NULL; + nick = NULL; + property = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -3); + nick = lua_tostring (lua_current_interpreter, -2); + property = lua_tostring (lua_current_interpreter, -1); + + result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), + script_str2ptr (nick), + property)); + + LUA_RETURN_STRING_FREE(result); +} + +/* + * weechat_lua_api_nicklist_nick_set: set a nick property + */ + +static int +weechat_lua_api_nicklist_nick_set (lua_State *L) +{ + const char *buffer, *nick, *property, *value; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script || !lua_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + LUA_RETURN_ERROR; + } + + buffer = NULL; + nick = NULL; + property = NULL; + value = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + LUA_RETURN_EMPTY; + } + + buffer = lua_tostring (lua_current_interpreter, -4); + nick = lua_tostring (lua_current_interpreter, -3); + property = lua_tostring (lua_current_interpreter, -2); + value = lua_tostring (lua_current_interpreter, -1); + + weechat_nicklist_nick_set (script_str2ptr (buffer), + script_str2ptr (nick), + property, + value); + + LUA_RETURN_OK; +} + +/* * weechat_lua_api_bar_item_search: search a bar item */ @@ -5976,7 +6320,7 @@ weechat_lua_api_bar_item_search (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_search"); @@ -6049,7 +6393,7 @@ weechat_lua_api_bar_item_new (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_item_new"); @@ -6169,7 +6513,7 @@ weechat_lua_api_bar_search (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_search"); @@ -6208,7 +6552,7 @@ weechat_lua_api_bar_new (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_new"); @@ -6286,7 +6630,7 @@ weechat_lua_api_bar_set (lua_State *L) /* make C compiler happy */ (void) L; - + if (!lua_current_script || !lua_current_script->name) { WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "bar_set"); @@ -7849,6 +8193,14 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "nicklist_remove_group", &weechat_lua_api_nicklist_remove_group }, { "nicklist_remove_nick", &weechat_lua_api_nicklist_remove_nick }, { "nicklist_remove_all", &weechat_lua_api_nicklist_remove_all }, + { "nicklist_group_get_integer", &weechat_lua_api_nicklist_group_get_integer }, + { "nicklist_group_get_string", &weechat_lua_api_nicklist_group_get_string }, + { "nicklist_group_get_pointer", &weechat_lua_api_nicklist_group_get_pointer }, + { "nicklist_group_set", &weechat_lua_api_nicklist_group_set }, + { "nicklist_nick_get_integer", &weechat_lua_api_nicklist_nick_get_integer }, + { "nicklist_nick_get_string", &weechat_lua_api_nicklist_nick_get_string }, + { "nicklist_nick_get_pointer", &weechat_lua_api_nicklist_nick_get_pointer }, + { "nicklist_nick_set", &weechat_lua_api_nicklist_nick_set }, { "bar_item_search", &weechat_lua_api_bar_item_search }, { "bar_item_new", &weechat_lua_api_bar_item_new }, { "bar_item_update", &weechat_lua_api_bar_item_update }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index aead39eda..8db134118 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -5061,6 +5061,294 @@ XS (XS_weechat_api_nicklist_remove_all) } /* + * weechat::nicklist_group_get_integer: get a group property as integer + */ + +XS (XS_weechat_api_nicklist_group_get_integer) +{ + char *buffer, *group, *property; + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + PERL_RETURN_INT(-1); + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + PERL_RETURN_INT(-1); + } + + buffer = SvPV (ST (0), PL_na); + group = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), + script_str2ptr (group), + property); + + PERL_RETURN_INT(value); +} + +/* + * weechat::nicklist_group_get_string: get a group property as string + */ + +XS (XS_weechat_api_nicklist_group_get_string) +{ + char *buffer, *group, *property; + const char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + PERL_RETURN_EMPTY; + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + PERL_RETURN_EMPTY; + } + + buffer = SvPV (ST (0), PL_na); + group = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + result = weechat_nicklist_group_get_string (script_str2ptr (buffer), + script_str2ptr (group), + property); + + PERL_RETURN_STRING(result); +} + +/* + * weechat::nicklist_group_get_pointer: get a group property as pointer + */ + +XS (XS_weechat_api_nicklist_group_get_pointer) +{ + char *result, *buffer, *group, *property; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + PERL_RETURN_EMPTY; + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + PERL_RETURN_EMPTY; + } + + buffer = SvPV (ST (0), PL_na); + group = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), + script_str2ptr (group), + property)); + + PERL_RETURN_STRING_FREE(result); +} + +/* + * weechat::nicklist_group_set: set a group property + */ + +XS (XS_weechat_api_nicklist_group_set) +{ + char *buffer, *group, *property, *value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + PERL_RETURN_ERROR; + } + + if (items < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + PERL_RETURN_ERROR; + } + + buffer = SvPV (ST (0), PL_na); + group = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + value = SvPV (ST (3), PL_na); + + weechat_nicklist_group_set (script_str2ptr (buffer), + script_str2ptr (group), + property, + value); + + PERL_RETURN_OK; +} + +/* + * weechat::nicklist_nick_get_integer: get a nick property as integer + */ + +XS (XS_weechat_api_nicklist_nick_get_integer) +{ + char *buffer, *nick, *property; + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + PERL_RETURN_INT(-1); + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + PERL_RETURN_INT(-1); + } + + buffer = SvPV (ST (0), PL_na); + nick = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + PERL_RETURN_INT(value); +} + +/* + * weechat::nicklist_nick_get_string: get a nick property as string + */ + +XS (XS_weechat_api_nicklist_nick_get_string) +{ + char *buffer, *nick, *property; + const char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + PERL_RETURN_EMPTY; + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + PERL_RETURN_EMPTY; + } + + buffer = SvPV (ST (0), PL_na); + nick = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + PERL_RETURN_STRING(result); +} + +/* + * weechat::nicklist_nick_get_pointer: get a nick property as pointer + */ + +XS (XS_weechat_api_nicklist_nick_get_pointer) +{ + char *result, *buffer, *nick, *property; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + PERL_RETURN_EMPTY; + } + + if (items < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + PERL_RETURN_EMPTY; + } + + buffer = SvPV (ST (0), PL_na); + nick = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + + result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), + script_str2ptr (nick), + property)); + + PERL_RETURN_STRING_FREE(result); +} + +/* + * weechat::nicklist_nick_set: set a nick property + */ + +XS (XS_weechat_api_nicklist_nick_set) +{ + char *buffer, *nick, *property, *value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script || !perl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + PERL_RETURN_ERROR; + } + + if (items < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + PERL_RETURN_ERROR; + } + + buffer = SvPV (ST (0), PL_na); + nick = SvPV (ST (1), PL_na); + property = SvPV (ST (2), PL_na); + value = SvPV (ST (3), PL_na); + + weechat_nicklist_nick_set (script_str2ptr (buffer), + script_str2ptr (nick), + property, + value); + + PERL_RETURN_OK; +} + +/* * weechat::bar_item_search: search a bar item */ @@ -6328,6 +6616,14 @@ weechat_perl_api_init (pTHX) newXS ("weechat::nicklist_remove_group", XS_weechat_api_nicklist_remove_group, "weechat"); newXS ("weechat::nicklist_remove_nick", XS_weechat_api_nicklist_remove_nick, "weechat"); newXS ("weechat::nicklist_remove_all", XS_weechat_api_nicklist_remove_all, "weechat"); + newXS ("weechat::nicklist_group_get_integer", XS_weechat_api_nicklist_group_get_integer, "weechat"); + newXS ("weechat::nicklist_group_get_string", XS_weechat_api_nicklist_group_get_string, "weechat"); + newXS ("weechat::nicklist_group_get_pointer", XS_weechat_api_nicklist_group_get_pointer, "weechat"); + newXS ("weechat::nicklist_group_set", XS_weechat_api_nicklist_group_set, "weechat"); + newXS ("weechat::nicklist_nick_get_integer", XS_weechat_api_nicklist_nick_get_integer, "weechat"); + newXS ("weechat::nicklist_nick_get_string", XS_weechat_api_nicklist_nick_get_string, "weechat"); + newXS ("weechat::nicklist_nick_get_pointer", XS_weechat_api_nicklist_nick_get_pointer, "weechat"); + newXS ("weechat::nicklist_nick_set", XS_weechat_api_nicklist_nick_set, "weechat"); newXS ("weechat::bar_item_search", XS_weechat_api_bar_item_search, "weechat"); newXS ("weechat::bar_item_new", XS_weechat_api_bar_item_new, "weechat"); newXS ("weechat::bar_item_update", XS_weechat_api_bar_item_update, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index d88e8b9f0..16ff35db0 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -5331,6 +5331,296 @@ weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args) } /* + * weechat_python_api_nicklist_group_get_integer get a group property as integer + */ + +static PyObject * +weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args) +{ + char *buffer, *group, *property; + int value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + PYTHON_RETURN_INT(-1); + } + + buffer = NULL; + group = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + PYTHON_RETURN_INT(-1); + } + + value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), + script_str2ptr (group), + property); + + PYTHON_RETURN_INT(value); +} + +/* + * weechat_python_api_nicklist_group_get_string: get a group property as string + */ + +static PyObject * +weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args) +{ + char *buffer, *group, *property; + const char *result; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + PYTHON_RETURN_ERROR; + } + + buffer = NULL; + group = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + PYTHON_RETURN_EMPTY; + } + + result = weechat_nicklist_group_get_string (script_str2ptr (buffer), + script_str2ptr (group), + property); + + PYTHON_RETURN_STRING(result); +} + +/* + * weechat_python_api_nicklist_group_get_pointer: get a group property as pointer + */ + +static PyObject * +weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args) +{ + char *buffer, *group, *property, *result; + PyObject *object; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + PYTHON_RETURN_EMPTY; + } + + buffer = NULL; + group = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + PYTHON_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), + script_str2ptr (group), + property)); + + PYTHON_RETURN_STRING_FREE(result); +} + +/* + * weechat_python_api_nicklist_group_set: set a group property + */ + +static PyObject * +weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args) +{ + char *buffer, *group, *property, *value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + PYTHON_RETURN_ERROR; + } + + buffer = NULL; + group = NULL; + property = NULL; + value = NULL; + + if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + PYTHON_RETURN_ERROR; + } + + weechat_nicklist_group_set (script_str2ptr (buffer), + script_str2ptr (group), + property, + value); + + PYTHON_RETURN_OK; +} + +/* + * weechat_python_api_nicklist_nick_get_integer get a nick property as integer + */ + +static PyObject * +weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args) +{ + char *buffer, *nick, *property; + int value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + PYTHON_RETURN_INT(-1); + } + + buffer = NULL; + nick = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + PYTHON_RETURN_INT(-1); + } + + value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + PYTHON_RETURN_INT(value); +} + +/* + * weechat_python_api_nicklist_nick_get_string: get a nick property as string + */ + +static PyObject * +weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args) +{ + char *buffer, *nick, *property; + const char *result; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + PYTHON_RETURN_ERROR; + } + + buffer = NULL; + nick = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + PYTHON_RETURN_EMPTY; + } + + result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + PYTHON_RETURN_STRING(result); +} + +/* + * weechat_python_api_nicklist_nick_get_pointer: get a nick property as pointer + */ + +static PyObject * +weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args) +{ + char *buffer, *nick, *property, *result; + PyObject *object; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + PYTHON_RETURN_EMPTY; + } + + buffer = NULL; + nick = NULL; + property = NULL; + + if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + PYTHON_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), + script_str2ptr (nick), + property)); + + PYTHON_RETURN_STRING_FREE(result); +} + +/* + * weechat_python_api_nicklist_nick_set: set a nick property + */ + +static PyObject * +weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args) +{ + char *buffer, *nick, *property, *value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script || !python_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + PYTHON_RETURN_ERROR; + } + + buffer = NULL; + nick = NULL; + property = NULL; + value = NULL; + + if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + PYTHON_RETURN_ERROR; + } + + weechat_nicklist_nick_set (script_str2ptr (buffer), + script_str2ptr (nick), + property, + value); + + PYTHON_RETURN_OK; +} + +/* * weechat_python_api_bar_item_search: search a bar item */ @@ -6655,6 +6945,14 @@ PyMethodDef weechat_python_funcs[] = { "nicklist_remove_group", &weechat_python_api_nicklist_remove_group, METH_VARARGS, "" }, { "nicklist_remove_nick", &weechat_python_api_nicklist_remove_nick, METH_VARARGS, "" }, { "nicklist_remove_all", &weechat_python_api_nicklist_remove_all, METH_VARARGS, "" }, + { "nicklist_group_get_integer", &weechat_python_api_nicklist_group_get_integer, METH_VARARGS, "" }, + { "nicklist_group_get_string", &weechat_python_api_nicklist_group_get_string, METH_VARARGS, "" }, + { "nicklist_group_get_pointer", &weechat_python_api_nicklist_group_get_pointer, METH_VARARGS, "" }, + { "nicklist_group_set", &weechat_python_api_nicklist_group_set, METH_VARARGS, "" }, + { "nicklist_nick_get_integer", &weechat_python_api_nicklist_nick_get_integer, METH_VARARGS, "" }, + { "nicklist_nick_get_string", &weechat_python_api_nicklist_nick_get_string, METH_VARARGS, "" }, + { "nicklist_nick_get_pointer", &weechat_python_api_nicklist_nick_get_pointer, METH_VARARGS, "" }, + { "nicklist_nick_set", &weechat_python_api_nicklist_nick_set, METH_VARARGS, "" }, { "bar_item_search", &weechat_python_api_bar_item_search, METH_VARARGS, "" }, { "bar_item_new", &weechat_python_api_bar_item_new, METH_VARARGS, "" }, { "bar_item_update", &weechat_python_api_bar_item_update, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 7e35525fd..8437d6732 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -5527,7 +5527,7 @@ weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property) c_property = StringValuePtr (property); result = weechat_buffer_get_string (script_str2ptr (c_buffer), - c_property); + c_property); RUBY_RETURN_STRING(result); } @@ -6134,6 +6134,348 @@ weechat_ruby_api_nicklist_remove_all (VALUE class, VALUE buffer) } /* + * weechat_ruby_api_nicklist_group_get_integer: get a group property as integer + */ + +static VALUE +weechat_ruby_api_nicklist_group_get_integer (VALUE class, VALUE buffer, + VALUE group, VALUE property) +{ + char *c_buffer, *c_group, *c_property; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + RUBY_RETURN_INT(-1); + } + + if (NIL_P (buffer) || NIL_P (group) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + RUBY_RETURN_INT(-1); + } + + Check_Type (buffer, T_STRING); + Check_Type (group, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_group = StringValuePtr (group); + c_property = StringValuePtr (property); + + value = weechat_nicklist_group_get_integer (script_str2ptr (c_buffer), + script_str2ptr (c_group), + c_property); + + RUBY_RETURN_INT(value); +} + +/* + * weechat_ruby_api_nicklist_group_get_string: get a group property as string + */ + +static VALUE +weechat_ruby_api_nicklist_group_get_string (VALUE class, VALUE buffer, + VALUE group, VALUE property) +{ + char *c_buffer, *c_group, *c_property; + const char *result; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + RUBY_RETURN_EMPTY; + } + + if (NIL_P (buffer) || NIL_P (group) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + RUBY_RETURN_EMPTY; + } + + Check_Type (buffer, T_STRING); + Check_Type (group, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_group = StringValuePtr (group); + c_property = StringValuePtr (property); + + result = weechat_nicklist_group_get_string (script_str2ptr (c_buffer), + script_str2ptr (c_group), + c_property); + + RUBY_RETURN_STRING(result); +} + +/* + * weechat_ruby_api_nicklist_group_get_pointer: get a group property as pointer + */ + +static VALUE +weechat_ruby_api_nicklist_group_get_pointer (VALUE class, VALUE buffer, + VALUE group, VALUE property) +{ + char *c_buffer, *c_group, *c_property, *result; + VALUE return_value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + RUBY_RETURN_EMPTY; + } + + if (NIL_P (buffer) || NIL_P (group) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + RUBY_RETURN_EMPTY; + } + + Check_Type (buffer, T_STRING); + Check_Type (group, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_group = StringValuePtr (group); + c_property = StringValuePtr (property); + + result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (c_buffer), + script_str2ptr (c_group), + c_property)); + + RUBY_RETURN_STRING_FREE(result); +} + +/* + * weechat_ruby_api_nicklist_group_set: set a group property + */ + +static VALUE +weechat_ruby_api_nicklist_group_set (VALUE class, VALUE buffer, VALUE group, + VALUE property, VALUE value) +{ + char *c_buffer, *c_group, *c_property, *c_value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + RUBY_RETURN_ERROR; + } + + c_buffer = NULL; + c_group = NULL; + c_property = NULL; + c_value = NULL; + + if (NIL_P (buffer) || NIL_P (group) || NIL_P (property) || NIL_P (value)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + RUBY_RETURN_ERROR; + } + + Check_Type (buffer, T_STRING); + Check_Type (group, T_STRING); + Check_Type (property, T_STRING); + Check_Type (value, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_group = StringValuePtr (group); + c_property = StringValuePtr (property); + c_value = StringValuePtr (value); + + weechat_nicklist_group_set (script_str2ptr (c_buffer), + script_str2ptr (c_group), + c_property, + c_value); + + RUBY_RETURN_OK; +} + +/* + * weechat_ruby_api_nicklist_nick_get_integer: get a nick property as integer + */ + +static VALUE +weechat_ruby_api_nicklist_nick_get_integer (VALUE class, VALUE buffer, + VALUE nick, VALUE property) +{ + char *c_buffer, *c_nick, *c_property; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + RUBY_RETURN_INT(-1); + } + + if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + RUBY_RETURN_INT(-1); + } + + Check_Type (buffer, T_STRING); + Check_Type (nick, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_nick = StringValuePtr (nick); + c_property = StringValuePtr (property); + + value = weechat_nicklist_nick_get_integer (script_str2ptr (c_buffer), + script_str2ptr (c_nick), + c_property); + + RUBY_RETURN_INT(value); +} + +/* + * weechat_ruby_api_nicklist_nick_get_string: get a nick property as string + */ + +static VALUE +weechat_ruby_api_nicklist_nick_get_string (VALUE class, VALUE buffer, + VALUE nick, VALUE property) +{ + char *c_buffer, *c_nick, *c_property; + const char *result; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + RUBY_RETURN_EMPTY; + } + + if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + RUBY_RETURN_EMPTY; + } + + Check_Type (buffer, T_STRING); + Check_Type (nick, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_nick = StringValuePtr (nick); + c_property = StringValuePtr (property); + + result = weechat_nicklist_nick_get_string (script_str2ptr (c_buffer), + script_str2ptr (c_nick), + c_property); + + RUBY_RETURN_STRING(result); +} + +/* + * weechat_ruby_api_nicklist_nick_get_pointer: get a nick property as pointer + */ + +static VALUE +weechat_ruby_api_nicklist_nick_get_pointer (VALUE class, VALUE buffer, + VALUE nick, VALUE property) +{ + char *c_buffer, *c_nick, *c_property, *result; + VALUE return_value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + RUBY_RETURN_EMPTY; + } + + if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + RUBY_RETURN_EMPTY; + } + + Check_Type (buffer, T_STRING); + Check_Type (nick, T_STRING); + Check_Type (property, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_nick = StringValuePtr (nick); + c_property = StringValuePtr (property); + + result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (c_buffer), + script_str2ptr (c_nick), + c_property)); + + RUBY_RETURN_STRING_FREE(result); +} + +/* + * weechat_ruby_api_nicklist_nick_set: set a nick property + */ + +static VALUE +weechat_ruby_api_nicklist_nick_set (VALUE class, VALUE buffer, VALUE nick, + VALUE property, VALUE value) +{ + char *c_buffer, *c_nick, *c_property, *c_value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script || !ruby_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + RUBY_RETURN_ERROR; + } + + c_buffer = NULL; + c_nick = NULL; + c_property = NULL; + c_value = NULL; + + if (NIL_P (buffer) || NIL_P (nick) || NIL_P (property) || NIL_P (value)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + RUBY_RETURN_ERROR; + } + + Check_Type (buffer, T_STRING); + Check_Type (nick, T_STRING); + Check_Type (property, T_STRING); + Check_Type (value, T_STRING); + + c_buffer = StringValuePtr (buffer); + c_nick = StringValuePtr (nick); + c_property = StringValuePtr (property); + c_value = StringValuePtr (value); + + weechat_nicklist_nick_set (script_str2ptr (c_buffer), + script_str2ptr (c_nick), + c_property, + c_value); + + RUBY_RETURN_OK; +} + +/* * weechat_ruby_api_bar_item_search: search a bar item */ @@ -7649,6 +7991,14 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "nicklist_remove_group", &weechat_ruby_api_nicklist_remove_group, 2); rb_define_module_function (ruby_mWeechat, "nicklist_remove_nick", &weechat_ruby_api_nicklist_remove_nick, 2); rb_define_module_function (ruby_mWeechat, "nicklist_remove_all", &weechat_ruby_api_nicklist_remove_all, 1); + rb_define_module_function (ruby_mWeechat, "nicklist_group_get_integer", &weechat_ruby_api_nicklist_group_get_integer, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_group_get_string", &weechat_ruby_api_nicklist_group_get_string, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_group_get_pointer", &weechat_ruby_api_nicklist_group_get_pointer, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_group_set", &weechat_ruby_api_nicklist_group_set, 4); + rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_integer", &weechat_ruby_api_nicklist_nick_get_integer, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_string", &weechat_ruby_api_nicklist_nick_get_string, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_nick_get_pointer", &weechat_ruby_api_nicklist_nick_get_pointer, 3); + rb_define_module_function (ruby_mWeechat, "nicklist_nick_set", &weechat_ruby_api_nicklist_nick_set, 4); rb_define_module_function (ruby_mWeechat, "bar_item_search", &weechat_ruby_api_bar_item_search, 1); rb_define_module_function (ruby_mWeechat, "bar_item_new", &weechat_ruby_api_bar_item_new, 3); rb_define_module_function (ruby_mWeechat, "bar_item_update", &weechat_ruby_api_bar_item_update, 1); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 2ee76b65f..196850a0c 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -5129,7 +5129,7 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_EMPTY; } - if (objc < 2) + if (objc < 3) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "buffer_get_pointer"); TCL_RETURN_EMPTY; @@ -5336,7 +5336,7 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_EMPTY; } - if (objc < 2) + if (objc < 3) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_get_pointer"); TCL_RETURN_EMPTY; @@ -5372,7 +5372,7 @@ weechat_tcl_api_window_set_title (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_ERROR; } - if (objc < 1) + if (objc < 2) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_set_title"); TCL_RETURN_ERROR; @@ -5479,7 +5479,7 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *objp; - char *prefix, *result, *buffer, *group, *name, *color, *prefix_color; + char *result, *buffer, *group, *name, *color, *prefix, *prefix_color; int i, visible; /* make C compiler happy */ @@ -5663,6 +5663,324 @@ weechat_tcl_api_nicklist_remove_all (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_nicklist_group_get_integer: get a group property as integer + */ + +static int +weechat_tcl_api_nicklist_group_get_integer (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *group, *property; + int result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + TCL_RETURN_INT(-1); + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_integer"); + TCL_RETURN_INT(-1); + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + group = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_nicklist_group_get_integer (script_str2ptr (buffer), + script_str2ptr (group), + property); + + TCL_RETURN_INT(result); +} + +/* + * weechat_tcl_api_nicklist_group_get_string: get a group property as string + */ + +static int +weechat_tcl_api_nicklist_group_get_string (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *group, *property; + const char *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + TCL_RETURN_EMPTY; + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_string"); + TCL_RETURN_EMPTY; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + group = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_nicklist_group_get_string (script_str2ptr (buffer), + script_str2ptr (group), + property); + + TCL_RETURN_STRING(result); +} + +/* + * weechat_tcl_api_nicklist_group_get_pointer: get a group property as pointer + */ + +static int +weechat_tcl_api_nicklist_group_get_pointer (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *group, *property, *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + TCL_RETURN_EMPTY; + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_get_pointer"); + TCL_RETURN_EMPTY; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + group = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), + script_str2ptr (group), + property)); + + TCL_RETURN_STRING_FREE(result); +} + +/* + * weechat_tcl_api_nicklist_group_set: set a group property + */ + +static int +weechat_tcl_api_nicklist_group_set (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *group, *property, *value; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + TCL_RETURN_ERROR; + } + + if (objc < 5) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_group_set"); + TCL_RETURN_ERROR; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + group = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + value = Tcl_GetStringFromObj (objv[4], &i); + + weechat_nicklist_group_set (script_str2ptr (buffer), + script_str2ptr (group), + property, + value); + + TCL_RETURN_OK; +} + +/* + * weechat_tcl_api_nicklist_nick_get_integer: get a nick property as integer + */ + +static int +weechat_tcl_api_nicklist_nick_get_integer (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *nick, *property; + int result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + TCL_RETURN_INT(-1); + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_integer"); + TCL_RETURN_INT(-1); + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + nick = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + TCL_RETURN_INT(result); +} + +/* + * weechat_tcl_api_nicklist_nick_get_string: get a nick property as string + */ + +static int +weechat_tcl_api_nicklist_nick_get_string (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *nick, *property; + const char *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + TCL_RETURN_EMPTY; + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_string"); + TCL_RETURN_EMPTY; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + nick = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), + script_str2ptr (nick), + property); + + TCL_RETURN_STRING(result); +} + +/* + * weechat_tcl_api_nicklist_nick_get_pointer: get a nick property as pointer + */ + +static int +weechat_tcl_api_nicklist_nick_get_pointer (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *nick, *property, *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + TCL_RETURN_EMPTY; + } + + if (objc < 4) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_get_pointer"); + TCL_RETURN_EMPTY; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + nick = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + + result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), + script_str2ptr (nick), + property)); + + TCL_RETURN_STRING_FREE(result); +} + +/* + * weechat_tcl_api_nicklist_nick_set: set a nick property + */ + +static int +weechat_tcl_api_nicklist_nick_set (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *buffer, *nick, *property, *value; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script || !tcl_current_script->name) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + TCL_RETURN_ERROR; + } + + if (objc < 5) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "nicklist_nick_set"); + TCL_RETURN_ERROR; + } + + buffer = Tcl_GetStringFromObj (objv[1], &i); + nick = Tcl_GetStringFromObj (objv[2], &i); + property = Tcl_GetStringFromObj (objv[3], &i); + value = Tcl_GetStringFromObj (objv[4], &i); + + weechat_nicklist_nick_set (script_str2ptr (buffer), + script_str2ptr (nick), + property, + value); + + TCL_RETURN_OK; +} + +/* * weechat_tcl_api_bar_item_search: search a bar item */ @@ -6190,7 +6508,7 @@ weechat_tcl_api_infolist_new_item (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_INT(0); } - if (objc < 1) + if (objc < 2) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_item"); TCL_RETURN_INT(0); @@ -6223,7 +6541,7 @@ weechat_tcl_api_infolist_new_var_integer (ClientData clientData, Tcl_Interp *int TCL_RETURN_INT(0); } - if (objc < 3) + if (objc < 4) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_integer"); TCL_RETURN_INT(0); @@ -6264,7 +6582,7 @@ weechat_tcl_api_infolist_new_var_string (ClientData clientData, Tcl_Interp *inte TCL_RETURN_INT(0); } - if (objc < 3) + if (objc < 4) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_string"); TCL_RETURN_INT(0); @@ -6298,7 +6616,7 @@ weechat_tcl_api_infolist_new_var_pointer (ClientData clientData, Tcl_Interp *int TCL_RETURN_INT(0); } - if (objc < 3) + if (objc < 4) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_pointer"); TCL_RETURN_INT(0); @@ -6332,7 +6650,7 @@ weechat_tcl_api_infolist_new_var_time (ClientData clientData, Tcl_Interp *interp TCL_RETURN_INT(0); } - if (objc < 3) + if (objc < 4) { WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_var_time"); TCL_RETURN_INT(0); @@ -7239,6 +7557,22 @@ void weechat_tcl_api_init (Tcl_Interp *interp) weechat_tcl_api_nicklist_remove_nick, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::nicklist_remove_all", weechat_tcl_api_nicklist_remove_all, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_integer", + weechat_tcl_api_nicklist_group_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_string", + weechat_tcl_api_nicklist_group_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_group_get_pointer", + weechat_tcl_api_nicklist_group_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_group_set", + weechat_tcl_api_nicklist_group_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_integer", + weechat_tcl_api_nicklist_nick_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_string", + weechat_tcl_api_nicklist_nick_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_get_pointer", + weechat_tcl_api_nicklist_nick_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::nicklist_nick_set", + weechat_tcl_api_nicklist_nick_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::bar_item_search", weechat_tcl_api_bar_item_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::bar_item_new", diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 68db356fe..3ae2cf881 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -45,7 +45,7 @@ struct timeval; */ /* API version (used to check that plugin has same API and can be loaded) */ -#define WEECHAT_PLUGIN_API_VERSION "20101023-01" +#define WEECHAT_PLUGIN_API_VERSION "20101029-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -617,6 +617,30 @@ struct t_weechat_plugin void (*nicklist_remove_nick) (struct t_gui_buffer *buffer, struct t_gui_nick *nick); void (*nicklist_remove_all) (struct t_gui_buffer *buffer); + int (*nicklist_group_get_integer) (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); + const char *(*nicklist_group_get_string) (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); + void *(*nicklist_group_get_pointer) (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property); + void (*nicklist_group_set) (struct t_gui_buffer *buffer, + struct t_gui_nick_group *group, + const char *property, const char *value); + int (*nicklist_nick_get_integer) (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); + const char *(*nicklist_nick_get_string) (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); + void *(*nicklist_nick_get_pointer) (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property); + void (*nicklist_nick_set) (struct t_gui_buffer *buffer, + struct t_gui_nick *nick, + const char *property, const char *value); /* bars */ struct t_gui_bar_item *(*bar_item_search) (const char *name); @@ -1239,6 +1263,35 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->nicklist_remove_nick(__buffer, __nick) #define weechat_nicklist_remove_all(__buffer) \ weechat_plugin->nicklist_remove_all(__buffer) +#define weechat_nicklist_group_get_integer(__buffer, __group, \ + __property) \ + weechat_plugin->nicklist_group_get_integer(__buffer, __group, \ + __property) +#define weechat_nicklist_group_get_string(__buffer, __group, \ + __property) \ + weechat_plugin->nicklist_group_get_string(__buffer, __group, \ + __property) +#define weechat_nicklist_group_get_pointer(__buffer, __group, \ + __property) \ + weechat_plugin->nicklist_group_get_pointer(__buffer, __group, \ + __property) +#define weechat_nicklist_group_set(__buffer, __group, __property, \ + __value) \ + weechat_plugin->nicklist_group_set(__buffer, __group, __property, \ + __value) +#define weechat_nicklist_nick_get_integer(__buffer, __nick, __property) \ + weechat_plugin->nicklist_nick_get_integer(__buffer, __nick, \ + __property) +#define weechat_nicklist_nick_get_string(__buffer, __nick, __property) \ + weechat_plugin->nicklist_nick_get_string(__buffer, __nick, \ + __property) +#define weechat_nicklist_nick_get_pointer(__buffer, __nick, __property) \ + weechat_plugin->nicklist_nick_get_pointer(__buffer, __nick, \ + __property) +#define weechat_nicklist_nick_set(__buffer, __nick, __property, \ + __value) \ + weechat_plugin->nicklist_nick_set(__buffer, __nick, __property, \ + __value) /* bars */ #define weechat_bar_item_search(__name) \ |