From 00a3f990b3e512a7dc14343dd522a3a8497c4762 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 6 Dec 2011 22:57:21 +0100 Subject: [PATCH] api: add new function nicklist_get_next_item --- ChangeLog | 5 +-- doc/en/weechat_plugin_api.en.txt | 51 ++++++++++++++++++++++++++++++ doc/fr/weechat_plugin_api.fr.txt | 52 ++++++++++++++++++++++++++++++ doc/it/weechat_plugin_api.it.txt | 54 ++++++++++++++++++++++++++++++++ src/plugins/plugin.c | 1 + src/plugins/weechat-plugin.h | 7 ++++- 6 files changed, 167 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5b1f0e4a..795d77148 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.3.7-dev, 2011-11-27 +v0.3.7-dev, 2011-12-06 Version 0.3.7 (under dev!) @@ -30,7 +30,8 @@ Version 0.3.7 (under dev!) * core: fix compilation error with "pid_t" on Mac OS X (bug #34639) * core: enable background process under Cygwin to connect to servers, fix reconnection problem (bug #34626) -* api: add new functions strcasecmp_range, strncasecmp_range and hdata_char +* api: add new functions strcasecmp_range, strncasecmp_range, hdata_char and + nicklist_get_next_item * irc: fix crash when signon time in message 317 (whois, idle) is invalid (too large) (bug #34905) * irc: do not delete servers added in irc.conf on /reload (bug #34872) diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index ca59b681e..3c5cb4c94 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -10129,6 +10129,57 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +weechat_nicklist_get_next_item +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_New in version 0.3.7._ + +Get next group or nick from nicklist (mainly used to display nicklist). + +Prototype: + +[source,C] +---------------------------------------- +void gui_nicklist_get_next_item (struct t_gui_buffer *buffer, + struct t_gui_nick_group **group, + struct t_gui_nick **nick); +---------------------------------------- + +Arguments: + +* 'buffer': buffer pointer +* 'group': pointer on pointer to group +* 'nick': pointer on pointer to nick + +C example: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *ptr_group; +struct t_gui_nick *ptr_nick; + +ptr_group = NULL; +ptr_nick = NULL; +gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +while (ptr_group || ptr_nick) +{ + if (ptr_nick) + { + /* nick */ + /* ... */ + } + else + { + /* group */ + /* ... */ + } + gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +} +---------------------------------------- + +[NOTE] +This function is not available in scripting API. + weechat_nicklist_group_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 82fc16e41..a9cc46294 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -10304,6 +10304,58 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +weechat_nicklist_get_next_item +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.7._ + +Retourne le prochain groupe ou pseudo de la liste des pseudos (utilisé +principalement pour afficher la liste des pseudos). + +Prototype : + +[source,C] +---------------------------------------- +void gui_nicklist_get_next_item (struct t_gui_buffer *buffer, + struct t_gui_nick_group **group, + struct t_gui_nick **nick); +---------------------------------------- + +Paramètres : + +* 'buffer' : pointeur vers le tampon +* 'group' : pointeur vers un pointeur sur le groupe +* 'nick' : pointeur vers un pointeur sur le pseudo + +Exemple en C : + +[source,C] +---------------------------------------- +struct t_gui_nick_group *ptr_group; +struct t_gui_nick *ptr_nick; + +ptr_group = NULL; +ptr_nick = NULL; +gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +while (ptr_group || ptr_nick) +{ + if (ptr_nick) + { + /* pseudo */ + /* ... */ + } + else + { + /* groupe */ + /* ... */ + } + gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +} +---------------------------------------- + +[NOTE] +Cette fonction n'est pas disponible dans l'API script. + weechat_nicklist_group_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index 019218728..d9f87a51c 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -10211,6 +10211,60 @@ weechat.nicklist_remove_all(buffer) weechat.nicklist_remove_all(my_buffer) ---------------------------------------- +weechat_nicklist_get_next_item +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +_Novità nella versione 0.3.7._ + +// TRANSLATION MISSING +Get next group or nick from nicklist (mainly used to display nicklist). + +Prototipo: + +[source,C] +---------------------------------------- +void gui_nicklist_get_next_item (struct t_gui_buffer *buffer, + struct t_gui_nick_group **group, + struct t_gui_nick **nick); +---------------------------------------- + +Argomenti: + +* 'buffer': puntatore al buffer +// TRANSLATION MISSING +* 'group': pointer on pointer to group +// TRANSLATION MISSING +* 'nick': pointer on pointer to nick + +Esempio in C: + +[source,C] +---------------------------------------- +struct t_gui_nick_group *ptr_group; +struct t_gui_nick *ptr_nick; + +ptr_group = NULL; +ptr_nick = NULL; +gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +while (ptr_group || ptr_nick) +{ + if (ptr_nick) + { + /* nick */ + /* ... */ + } + else + { + /* group */ + /* ... */ + } + gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); +} +---------------------------------------- + +[NOTE] +Questa funzione non è disponibile nelle API per lo scripting. + weechat_nicklist_group_get_integer ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index fe9b13e0c..5242f3293 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -681,6 +681,7 @@ plugin_load (const char *filename, int argc, char **argv) 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_get_next_item = &gui_nicklist_get_next_item; 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; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 8cbc1ae9b..32ac0be96 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -46,7 +46,7 @@ struct timeval; */ /* API version (used to check that plugin has same API and can be loaded) */ -#define WEECHAT_PLUGIN_API_VERSION "20111125-01" +#define WEECHAT_PLUGIN_API_VERSION "20111206-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -694,6 +694,9 @@ 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); + void (*nicklist_get_next_item) (struct t_gui_buffer *buffer, + struct t_gui_nick_group **group, + struct t_gui_nick **nick); int (*nicklist_group_get_integer) (struct t_gui_buffer *buffer, struct t_gui_nick_group *group, const char *property); @@ -1416,6 +1419,8 @@ 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_get_next_item(__buffer, __group, __nick) \ + weechat_plugin->nicklist_get_next_item(__buffer, __group, __nick) #define weechat_nicklist_group_get_integer(__buffer, __group, \ __property) \ weechat_plugin->nicklist_group_get_integer(__buffer, __group, \