summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--doc/de/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/en/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/en/weechat_plugin_api.en.txt15
-rw-r--r--doc/fr/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt16
-rw-r--r--doc/it/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/it/weechat_plugin_api.it.txt18
-rw-r--r--src/gui/gui-buffer.c14
-rw-r--r--src/gui/gui-buffer.h5
-rw-r--r--src/gui/gui-nicklist.c15
11 files changed, 91 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 196413da7..12d07dd2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.9-dev, 2012-06-10
+v0.3.9-dev, 2012-06-14
Version 0.3.9 (under dev!)
--------------------------
+* core: add callback "nickcmp" in buffers
* core: add horizontal separator between windows, new options
weechat.look.window_separator_{horizontal|vertical}
* core: add options weechat.look.color_nick_offline and
diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt
index 1e326f989..976954167 100644
--- a/doc/de/autogen/plugin_api/hdata.txt
+++ b/doc/de/autogen/plugin_api/hdata.txt
@@ -252,6 +252,8 @@
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
+ 'nickcmp_callback' (pointer) +
+ 'nickcmp_callback_data' (pointer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt
index 278358be9..075f94f66 100644
--- a/doc/en/autogen/plugin_api/hdata.txt
+++ b/doc/en/autogen/plugin_api/hdata.txt
@@ -252,6 +252,8 @@
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
+ 'nickcmp_callback' (pointer) +
+ 'nickcmp_callback_data' (pointer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index 70386cb4a..e791cd709 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -9879,6 +9879,21 @@ Arguments:
** 'close_callback_data': set close callback data
** 'input_callback': set input callback function
** 'input_callback_data': set input callback data
+** 'nickcmp_callback': set nick comparison callback function (this callback is
+ called when searching nick in nicklist) (_new in version 0.3.9_)
+** 'nickcmp_callback_data': set nick comparison callback data
+ (_new in version 0.3.9_)
+
+Prototypes for callbacks:
+
+[source,C]
+----------------------------------------
+int close_callback (void *data, struct t_gui_buffer *buffer);
+
+int input_callback (void *data, struct t_gui_buffer *buffer, const char *input_data);
+
+int nickcmp_callback (void *data, struct t_gui_buffer *buffer, const char *nick1, const char *nick2);
+----------------------------------------
C example:
diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt
index db9619d5f..bdeb5fcc3 100644
--- a/doc/fr/autogen/plugin_api/hdata.txt
+++ b/doc/fr/autogen/plugin_api/hdata.txt
@@ -252,6 +252,8 @@
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
+ 'nickcmp_callback' (pointer) +
+ 'nickcmp_callback_data' (pointer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 989f9cb55..521be6ca1 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -10053,6 +10053,22 @@ Paramètres :
entrée
** 'input_callback_data' : définit les données pour le "callback" des données
en entrée
+** 'nickcmp_callback' : définit la fonction "callback" de comparaison de pseudos
+ (ce "callback" est appelé lors de la recherche d'un pseudo dans la liste des
+ pseudos) (_nouveau dans la version 0.3.9_)
+** 'nickcmp_callback_data': définit les données pour le "callback" de
+ comparaison de pseudos (_nouveau dans la version 0.3.9_)
+
+Prototypes pour les "callbacks" :
+
+[source,C]
+----------------------------------------
+int close_callback (void *data, struct t_gui_buffer *buffer);
+
+int input_callback (void *data, struct t_gui_buffer *buffer, const char *input_data);
+
+int nickcmp_callback (void *data, struct t_gui_buffer *buffer, const char *nick1, const char *nick2);
+----------------------------------------
Exemple en C :
diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt
index 1f10aa612..7f534393e 100644
--- a/doc/it/autogen/plugin_api/hdata.txt
+++ b/doc/it/autogen/plugin_api/hdata.txt
@@ -252,6 +252,8 @@
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
+ 'nickcmp_callback' (pointer) +
+ 'nickcmp_callback_data' (pointer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt
index 0a9b5005b..36e5cd524 100644
--- a/doc/it/weechat_plugin_api.it.txt
+++ b/doc/it/weechat_plugin_api.it.txt
@@ -9958,6 +9958,24 @@ Argomenti:
** 'close_callback_data': set close callback data
** 'input_callback': set input callback function
** 'input_callback_data': set input callback data
+// TRANSLATION MISSING
+** 'nickcmp_callback': set nick comparison callback function (this callback is
+ called when searching nick in nicklist) (_novità nella versione 0.3.9_)
+// TRANSLATION MISSING
+** 'nickcmp_callback_data': set nick comparison callback data
+ (_novità nella versione 0.3.9_)
+
+// TRANSLATION MISSING
+Prototypes for callbacks:
+
+[source,C]
+----------------------------------------
+int close_callback (void *data, struct t_gui_buffer *buffer);
+
+int input_callback (void *data, struct t_gui_buffer *buffer, const char *input_data);
+
+int nickcmp_callback (void *data, struct t_gui_buffer *buffer, const char *nick1, const char *nick2);
+----------------------------------------
Esempio in C:
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 814619ad9..5d6e0cf57 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -494,6 +494,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->nicklist_max_length = 0;
new_buffer->nicklist_display_groups = 1;
new_buffer->nicklist_visible_count = 0;
+ new_buffer->nickcmp_callback = NULL;
+ new_buffer->nickcmp_callback_data = NULL;
gui_nicklist_add_group (new_buffer, NULL, "root", NULL, 0);
/* input */
@@ -1678,6 +1680,14 @@ gui_buffer_set_pointer (struct t_gui_buffer *buffer, const char *property,
{
buffer->close_callback_data = pointer;
}
+ else if (string_strcasecmp (property, "nickcmp_callback") == 0)
+ {
+ buffer->nickcmp_callback = pointer;
+ }
+ else if (string_strcasecmp (property, "nickcmp_callback_data") == 0)
+ {
+ buffer->nickcmp_callback_data = pointer;
+ }
else if (string_strcasecmp (property, "input_callback") == 0)
{
buffer->input_callback = pointer;
@@ -3114,6 +3124,8 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, NULL);
HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, NULL);
HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, NULL);
+ HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, NULL);
+ HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, NULL);
HDATA_VAR(struct t_gui_buffer, input, INTEGER, NULL);
HDATA_VAR(struct t_gui_buffer, input_callback, POINTER, NULL);
HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER, NULL);
@@ -3464,6 +3476,8 @@ gui_buffer_print_log ()
log_printf (" nicklist_max_length . . : %d", ptr_buffer->nicklist_max_length);
log_printf (" nicklist_display_groups : %d", ptr_buffer->nicklist_display_groups);
log_printf (" nicklist_visible_count. : %d", ptr_buffer->nicklist_visible_count);
+ log_printf (" nickcmp_callback. . . . : 0x%lx", ptr_buffer->nickcmp_callback);
+ log_printf (" nickcmp_callback_data . : 0x%lx", ptr_buffer->nickcmp_callback_data);
log_printf (" input . . . . . . . . . : %d", ptr_buffer->input);
log_printf (" input_callback. . . . . : 0x%lx", ptr_buffer->input_callback);
log_printf (" input_callback_data . . : 0x%lx", ptr_buffer->input_callback_data);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 3fd028d8b..c0f8a5a81 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -114,6 +114,11 @@ struct t_gui_buffer
int nicklist_max_length; /* max length for a nick */
int nicklist_display_groups; /* display groups ? */
int nicklist_visible_count; /* number of nicks/groups to display */
+ int (*nickcmp_callback)(void *data, /* called to compare nicks (search */
+ struct t_gui_buffer *buffer, /* in nicklist) */
+ const char *nick1,
+ const char *nick2);
+ void *nickcmp_callback_data; /* data for callback */
/* inupt */
int input; /* = 1 if input is enabled */
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 874c786dc..5a0444cdd 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -345,8 +345,19 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
for (ptr_nick = (from_group) ? from_group->nicks : buffer->nicklist_root->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
{
- if (strcmp (ptr_nick->name, name) == 0)
- return ptr_nick;
+ if (buffer->nickcmp_callback)
+ {
+ if ((buffer->nickcmp_callback) (buffer->nickcmp_callback_data,
+ buffer,
+ ptr_nick->name,
+ name) == 0)
+ return ptr_nick;
+ }
+ else
+ {
+ if (strcmp (ptr_nick->name, name) == 0)
+ return ptr_nick;
+ }
}
/* search nick in child groups */