api: allow creation of structure with hdata_update (allowed for hdata "history")

v2.8-utf8proc
Sebastien Helleu 2012-12-08 23:54:07 +01:00
parent 3f2155e548
commit 641de51bdb
39 changed files with 213 additions and 118 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-12-07
v0.4.0-dev, 2012-12-08
Version 0.4.0 (under dev!)
@ -30,6 +30,8 @@ Version 0.4.0 (under dev!)
(problem with nick displayed in first line of screen) (bug #37556)
* core: fix wrapping of words with wide chars (the break was made before the
correct position)
* api: allow creation of structure with hdata_update (allowed for hdata
"history")
* api: use hashtable "options" for command arguments in function
hook_process_hashtable (optional, default is a split of string with command)
* api: do not call shell to execute command in hook_process (fix security

View File

@ -561,8 +561,10 @@
'text' (string) +
'next_history' (pointer, hdata: "history") +
'prev_history' (pointer, hdata: "history") |
|
-
`__create` +
`__delete` |
'gui_history' +
'last_gui_history'
| weechat | hotlist | Hotliste |
'priority' (integer) +

View File

@ -231,10 +231,14 @@ def get_hdata():
if variables_update:
variables_update += ' +\n'
variables_update += ' %s' % item['text']
if weechat.hdata_update(ptr_hdata, '', { '__create_allowed' : '' }):
if variables_update:
variables_update += ' +\n'
variables_update += ' `__create`'
if weechat.hdata_update(ptr_hdata, '', { '__delete_allowed' : '' }):
if variables_update:
variables_update += ' +\n'
variables_update += ' \'__delete\''
variables_update += ' `__delete`'
hdata[plugin][hdata_name]['vars'] = '\n%s' % variables
hdata[plugin][hdata_name]['vars_update'] = '\n%s' % variables_update

View File

@ -561,8 +561,10 @@
'text' (string) +
'next_history' (pointer, hdata: "history") +
'prev_history' (pointer, hdata: "history") |
|
-
`__create` +
`__delete` |
'gui_history' +
'last_gui_history'
| weechat | hotlist | hotlist |
'priority' (integer) +

View File

@ -12912,7 +12912,7 @@ something in memory pointed by hdata variables.
weechat_hdata_new
^^^^^^^^^^^^^^^^^
_New in version 0.3.6, updated in 0.3.9._
_New in version 0.3.6, updated in 0.3.9 and 0.4.0._
Create a new hdata.
@ -12932,7 +12932,7 @@ Prototype:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
@ -12947,6 +12947,8 @@ Arguments:
element in list (may be NULL if no such variable is available)
* 'var_next': name of variable in structure which is a pointer to next
element in list (may be NULL if no such variable is available)
* 'create_allowed': 1 if create of structure is allowed, otherwise 0
(_new in version 0.4.0_)
* 'delete_allowed': 1 if delete of structure is allowed, otherwise 0
(_new in version 0.3.9_)
* 'callback_update': callback to update data in hdata, can be NULL if no update
@ -12967,7 +12969,7 @@ C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, &callback_update, NULL);
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, 0, &callback_update, NULL);
----------------------------------------
[NOTE]
@ -14079,11 +14081,13 @@ Arguments:
* 'hashtable': variables to update: keys are name of variables, values are new
values for variables (keys and values are string), some special keys are
allowed:
** key '__delete_allowed' (with any value): return 1 if delete is allowed for
** key `__create_allowed` (with any value): return 1 if create is allowed for
structure, otherwise 0 (_new in version 0.4.0_)
** key `__delete_allowed` (with any value): return 1 if delete is allowed for
structure, otherwise 0
** key '__update_allowed', value is name of a variable: return 1 if update is
** key `__update_allowed`, value is name of a variable: return 1 if update is
allowed for this variable, otherwise 0
** key '__delete' (with any value): delete structure (if allowed)
** key `__delete` (with any value): delete structure (if allowed)
Return value:

View File

@ -561,8 +561,10 @@
'text' (string) +
'next_history' (pointer, hdata: "history") +
'prev_history' (pointer, hdata: "history") |
|
-
`__create` +
`__delete` |
'gui_history' +
'last_gui_history'
| weechat | hotlist | hotlist |
'priority' (integer) +

View File

@ -13130,7 +13130,7 @@ les variables du hdata.
weechat_hdata_new
^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6, mis à jour dans la 0.3.9._
_Nouveau dans la version 0.3.6, mis à jour dans la 0.3.9 et 0.4.0._
Créé un "hdata".
@ -13152,7 +13152,7 @@ Prototype :
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
@ -13169,6 +13169,8 @@ Paramètres :
* 'var_next' : nom de la variable dans la structure qui est un pointeur vers
l'élément suivant dans la liste (peut être NULL si une telle variable
n'existe pas)
* 'create_allowed' : 1 si la création de structure est autorisée, sinon 0
(_nouveau dans la version 0.4.0_)
* 'delete_allowed' : 1 si la suppression de structure est autorisée, sinon 0
(_nouveau dans la version 0.3.9_)
* 'callback_update' : fonction appelée pour mettre à jour des données dans le
@ -13190,7 +13192,7 @@ Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, &callback_update, NULL);
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, 0, &callback_update, NULL);
----------------------------------------
[NOTE]
@ -14324,11 +14326,14 @@ Paramètres :
variables, les valeurs sont les nouvelles valeurs pour les variables (clés et
valeurs sont des chaînes de caractères), quelqes clés spéciales sont
acceptées :
** clé '__delete_allowed' (avec n'importe quelle valeur) : retourne 1 si la
** clé `__create_allowed` (avec n'importe quelle valeur) : retourne 1 si la
création est autorisée pour la strucrure, sinon 0
(_nouveau dans la version 0.4.0_)
** clé `__delete_allowed` (avec n'importe quelle valeur) : retourne 1 si la
suppression est autorisée pour la structure, sinon 0
** clé '__update_allowed', la valeur est le nom d'une variable : retourne 1 si
** clé `__update_allowed`, la valeur est le nom d'une variable : retourne 1 si
la mise à jour est autorisée pour la variable, sinon 0
** clé '__delete' (avec n'importe quelle valeur) : supprime la structure
** clé `__delete` (avec n'importe quelle valeur) : supprime la structure
(si autorisé)
Valeur de retour :

View File

@ -561,8 +561,10 @@
'text' (string) +
'next_history' (pointer, hdata: "history") +
'prev_history' (pointer, hdata: "history") |
|
-
`__create` +
`__delete` |
'gui_history' +
'last_gui_history'
| weechat | hotlist | hotlist |
'priority' (integer) +

View File

@ -13069,7 +13069,7 @@ weechat_hdata_new
^^^^^^^^^^^^^^^^^
// TRANSLATION MISSING
_Novità nella versione 0.3.6, updated in 0.3.9._
_Novità nella versione 0.3.6, updated in 0.3.9 and 0.4.0._
Crea un nuovo hdata.
@ -13090,7 +13090,7 @@ Prototipo:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
@ -13106,6 +13106,9 @@ Argomenti:
* 'var_next': nome della variabile nella struttura che è puntatore all'elemento
successivo nella lista (può essere NULL se non è disponibile tale variabile)
// TRANSLATION MISSING
* 'create_allowed': 1 if create of structure is allowed, otherwise 0
(_novità nella versione 0.4.0_)
// TRANSLATION MISSING
* 'delete_allowed': 1 if delete of structure is allowed, otherwise 0
(_novità nella versione 0.3.9_)
// TRANSLATION MISSING
@ -13127,7 +13130,7 @@ Valore restituito:
Esempio in C:
source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, &callback_update, NULL);
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next", 0, 0, &callback_update, NULL);
----------------------------------------
[NOTE]
@ -14264,11 +14267,14 @@ Argomenti:
* 'hashtable': variables to update: keys are name of variables, values are new
values for variables (keys and values are string), some special keys are
allowed:
** key '__delete_allowed' (with any value): return 1 if delete is allowed for
// TRANSLATION MISSING
** key `__create_allowed` (with any value): return 1 if create is allowed for
structure, otherwise 0 (_new in version 0.4.0_)
** key `__delete_allowed` (with any value): return 1 if delete is allowed for
structure, otherwise 0
** key '__update_allowed', value is name of a variable: return 1 if update is
** key `__update_allowed`, value is name of a variable: return 1 if update is
allowed for this variable, otherwise 0
** key '__delete' (with any value): delete structure (if allowed)
** key `__delete` (with any value): delete structure (if allowed)
Valore restituito:

View File

@ -561,8 +561,10 @@
'text' (string) +
'next_history' (pointer, hdata: "history") +
'prev_history' (pointer, hdata: "history") |
|
-
`__create` +
`__delete` |
'gui_history' +
'last_gui_history'
| weechat | hotlist | ホットリスト |
'priority' (integer) +

View File

@ -2607,7 +2607,7 @@ config_file_hdata_config_file_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_config_file, plugin, POINTER, 0, NULL, "plugin");
@ -2639,7 +2639,7 @@ config_file_hdata_config_section_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_config_section, config_file, POINTER, 0, NULL, "config_file");
@ -2677,7 +2677,7 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_config_option, config_file, POINTER, 0, NULL, "config_file");

View File

@ -75,7 +75,7 @@ hdata_free_var (struct t_hashtable *hashtable,
struct t_hdata *
hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
const char *var_prev, const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
@ -107,6 +107,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
NULL,
NULL);
hashtable_set (weechat_hdata, hdata_name, new_hdata);
new_hdata->create_allowed = create_allowed;
new_hdata->delete_allowed = delete_allowed;
new_hdata->callback_update = callback_update;
new_hdata->callback_update_data = callback_update_data;
@ -816,6 +817,10 @@ hdata_update (struct t_hdata *hdata, void *pointer,
if (!hdata || !hashtable || !hdata->callback_update)
return 0;
/* check if create of structure is allowed */
if (hashtable_has_key (hashtable, "__create_allowed"))
return (int)hdata->create_allowed;
/* check if delete of structure is allowed */
if (hashtable_has_key (hashtable, "__delete_allowed"))
return (int)hdata->delete_allowed;
@ -832,9 +837,6 @@ hdata_update (struct t_hdata *hdata, void *pointer,
return (var->update_allowed) ? 1 : 0;
}
if (!pointer)
return 0;
/* update data */
hdata->update_pending = 1;
rc = (hdata->callback_update) (hdata->callback_update_data,
@ -1003,6 +1005,7 @@ hdata_print_log_map_cb (void *data, struct t_hashtable *hashtable,
log_printf (" hash_list. . . . . . . : 0x%lx (hashtable: '%s')",
ptr_hdata->hash_list,
hashtable_get_string (ptr_hdata->hash_list, "keys_values"));
log_printf (" create_allowed . . . . : %d", (int)ptr_hdata->create_allowed);
log_printf (" delete_allowed . . . . : %d", (int)ptr_hdata->delete_allowed);
log_printf (" callback_update. . . . : 0x%lx", ptr_hdata->callback_update);
log_printf (" callback_update_data . : 0x%lx", ptr_hdata->callback_update_data);

View File

@ -48,6 +48,7 @@ struct t_hdata
struct t_hashtable *hash_list; /* hashtable with pointers on lists */
/* (used to search objects) */
char create_allowed; /* create allowed? */
char delete_allowed; /* delete allowed? */
int (*callback_update) /* update callback */
(void *data,
@ -67,7 +68,7 @@ extern char *hdata_type_string[];
extern struct t_hdata *hdata_new (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,

View File

@ -356,7 +356,7 @@ upgrade_weechat_save ()
return 0;
rc = 1;
rc &= upgrade_weechat_save_history (upgrade_file, last_history_global);
rc &= upgrade_weechat_save_history (upgrade_file, last_gui_history);
rc &= upgrade_weechat_save_buffers (upgrade_file);
rc &= upgrade_weechat_save_misc (upgrade_file);
rc &= upgrade_weechat_save_hotlist (upgrade_file);

View File

@ -1900,7 +1900,7 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, 0, NULL, "plugin");

View File

@ -1405,7 +1405,7 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar_window, bar, POINTER, 0, NULL, "bar");

View File

@ -2253,7 +2253,7 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar, name, STRING, 0, NULL, NULL);

View File

@ -3151,7 +3151,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_buffer, plugin, POINTER, 0, NULL, "plugin");
@ -3240,7 +3240,7 @@ gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_input_undo, data, STRING, 0, NULL, NULL);
@ -3264,7 +3264,7 @@ gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, 0, NULL, "buffer");

View File

@ -1215,7 +1215,7 @@ gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL,
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_completion, buffer, POINTER, 0, NULL, "buffer");
@ -1255,7 +1255,7 @@ gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_completion_partial, word, STRING, 0, NULL, NULL);

View File

@ -450,7 +450,7 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_filter, enabled, INTEGER, 0, NULL, NULL);

View File

@ -27,11 +27,13 @@
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
@ -41,10 +43,10 @@
#include "gui-buffer.h"
struct t_gui_history *history_global = NULL;
struct t_gui_history *last_history_global = NULL;
struct t_gui_history *history_global_ptr = NULL;
int num_history_global = 0;
struct t_gui_history *gui_history = NULL;
struct t_gui_history *last_gui_history = NULL;
struct t_gui_history *gui_history_ptr = NULL;
int num_gui_history = 0;
/*
@ -106,36 +108,36 @@ gui_history_global_add (const char *string)
if (!string)
return;
if (!history_global
|| (history_global
&& (strcmp (history_global->text, string) != 0)))
if (!gui_history
|| (gui_history
&& (strcmp (gui_history->text, string) != 0)))
{
new_history = malloc (sizeof (*new_history));
if (new_history)
{
new_history->text = strdup (string);
if (history_global)
history_global->prev_history = new_history;
if (gui_history)
gui_history->prev_history = new_history;
else
last_history_global = new_history;
new_history->next_history = history_global;
last_gui_history = new_history;
new_history->next_history = gui_history;
new_history->prev_history = NULL;
history_global = new_history;
num_history_global++;
gui_history = new_history;
num_gui_history++;
/* remove one command if necessary */
if ((CONFIG_INTEGER(config_history_max_commands) > 0)
&& (num_history_global > CONFIG_INTEGER(config_history_max_commands)))
&& (num_gui_history > CONFIG_INTEGER(config_history_max_commands)))
{
ptr_history = last_history_global->prev_history;
if (history_global_ptr == last_history_global)
history_global_ptr = ptr_history;
(last_history_global->prev_history)->next_history = NULL;
if (last_history_global->text)
free (last_history_global->text);
free (last_history_global);
last_history_global = ptr_history;
num_history_global--;
ptr_history = last_gui_history->prev_history;
if (gui_history_ptr == last_gui_history)
gui_history_ptr = ptr_history;
(last_gui_history->prev_history)->next_history = NULL;
if (last_gui_history->text)
free (last_gui_history->text);
free (last_gui_history);
last_gui_history = ptr_history;
num_gui_history--;
}
}
}
@ -177,18 +179,18 @@ gui_history_global_free ()
{
struct t_gui_history *ptr_history;
while (history_global)
while (gui_history)
{
ptr_history = history_global->next_history;
if (history_global->text)
free (history_global->text);
free (history_global);
history_global = ptr_history;
ptr_history = gui_history->next_history;
if (gui_history->text)
free (gui_history->text);
free (gui_history);
gui_history = ptr_history;
}
history_global = NULL;
last_history_global = NULL;
history_global_ptr = NULL;
num_history_global = 0;
gui_history = NULL;
last_gui_history = NULL;
gui_history_ptr = NULL;
num_gui_history = 0;
}
@ -215,6 +217,62 @@ gui_history_buffer_free (struct t_gui_buffer *buffer)
buffer->num_history = 0;
}
/*
* gui_history_hdata_history_update_cb: callback for updating history
*/
int
gui_history_hdata_history_update_cb (void *data,
struct t_hdata *hdata,
void *pointer,
struct t_hashtable *hashtable)
{
struct t_gui_history *ptr_history;
struct t_gui_buffer *ptr_buffer;
const char *text, *buffer;
long unsigned int value;
int rc;
/* make C compiler happy */
(void) data;
rc = 0;
text = hashtable_get (hashtable, "text");
if (!text)
return rc;
if (pointer)
{
/* update history */
ptr_history = (struct t_gui_history *)pointer;
if (ptr_history->text)
free (ptr_history->text);
ptr_history->text = strdup (text);
}
else
{
/* create new entry in history */
ptr_buffer = NULL;
if (hashtable_has_key (hashtable, "buffer"))
{
buffer = hashtable_get (hashtable, "buffer");
if (buffer)
{
rc = sscanf (buffer, "%lx", &value);
if ((rc != EOF) && (rc != 0))
ptr_buffer = (struct t_gui_buffer *)value;
}
}
if (ptr_buffer)
gui_history_add (ptr_buffer, text);
else
gui_history_global_add (text);
}
return rc;
}
/*
* gui_history_hdata_history_cb: return hdata for history
*/
@ -228,12 +286,14 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history",
0, NULL, NULL);
1, 1, &gui_history_hdata_history_update_cb, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_history, text, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_history, prev_history, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_history, next_history, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_history);
HDATA_LIST(last_gui_history);
}
return hdata;
}

View File

@ -29,9 +29,9 @@ struct t_gui_history
struct t_gui_history *prev_history;/* link to previous text/command */
};
extern struct t_gui_history *history_global;
extern struct t_gui_history *last_history_global;
extern struct t_gui_history *history_global_ptr;
extern struct t_gui_history *gui_history;
extern struct t_gui_history *last_gui_history;
extern struct t_gui_history *gui_history_ptr;
extern void gui_history_buffer_add (struct t_gui_buffer *buffer,
const char *string);

View File

@ -475,7 +475,7 @@ gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, 0, NULL, NULL);

View File

@ -391,7 +391,7 @@ gui_input_return (struct t_gui_buffer *buffer)
gui_completion_stop (window->buffer->completion, 1);
gui_buffer_undo_free_all (window->buffer);
window->buffer->ptr_history = NULL;
history_global_ptr = NULL;
gui_history_ptr = NULL;
gui_input_optimize_size (window->buffer);
gui_input_text_changed_modifier_and_signal (window->buffer, 0);
input_data (window->buffer, command);
@ -1215,8 +1215,8 @@ gui_input_history_global_previous (struct t_gui_buffer *buffer)
if (window)
{
gui_input_history_previous (window,
history_global,
&history_global_ptr);
gui_history,
&gui_history_ptr);
}
}
@ -1234,8 +1234,8 @@ gui_input_history_global_next (struct t_gui_buffer *buffer)
if (window)
{
gui_input_history_next (window,
history_global,
&history_global_ptr);
gui_history,
&gui_history_ptr);
}
}

View File

@ -1751,7 +1751,7 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_key, key, STRING, 0, NULL, NULL);

View File

@ -1351,7 +1351,7 @@ gui_line_hdata_lines_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL);
hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_lines, first_line, POINTER, 0, NULL, "line");
@ -1379,7 +1379,7 @@ gui_line_hdata_line_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_line, data, POINTER, 0, NULL, "line_data");
@ -1486,7 +1486,7 @@ gui_line_hdata_line_data_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL,
0, &gui_line_hdata_line_data_update_cb, NULL);
0, 0, &gui_line_hdata_line_data_update_cb, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_line_data, buffer, POINTER, 0, NULL, "buffer");

View File

@ -972,7 +972,7 @@ gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_nick_group, name, STRING, 0, NULL, NULL);
@ -1003,7 +1003,7 @@ gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_nick, group, POINTER, 0, NULL, "nick_group");

View File

@ -1610,7 +1610,7 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_window, number, INTEGER, 0, NULL, NULL);
@ -1657,7 +1657,7 @@ gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, 0, NULL, "buffer");
@ -1686,7 +1686,7 @@ gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL);
hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, 0, NULL, hdata_name);

View File

@ -895,7 +895,7 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, 0, NULL, NULL);
@ -940,7 +940,7 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, 0, NULL, NULL);

View File

@ -319,7 +319,7 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, 0, NULL, NULL);

View File

@ -1032,7 +1032,7 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, 0, NULL, NULL);

View File

@ -964,7 +964,7 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, 0, NULL, "irc_server");

View File

@ -976,7 +976,7 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, 0, NULL, NULL);
@ -1006,7 +1006,7 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, 0, NULL, "irc_server");

View File

@ -4440,7 +4440,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, 0, NULL, NULL);

View File

@ -641,7 +641,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
if (ptr_infolist)
{
for (ptr_history = (pointer) ?
((struct t_gui_buffer *)pointer)->history : history_global;
((struct t_gui_buffer *)pointer)->history : gui_history;
ptr_history; ptr_history = ptr_history->next_history)
{
if (!gui_history_add_to_infolist (ptr_infolist, ptr_history))

View File

@ -1203,7 +1203,7 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
struct t_hdata *hdata;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, 0, NULL, NULL);

View File

@ -1220,7 +1220,7 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name)
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_weechat_plugin, filename, STRING, 0, NULL, NULL);

View File

@ -1470,7 +1470,7 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name)
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
0, NULL, NULL);
0, 0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_script_repo, name, STRING, 0, NULL, NULL);

View File

@ -50,7 +50,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20121102-01"
#define WEECHAT_PLUGIN_API_VERSION "20121208-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -843,7 +843,7 @@ struct t_weechat_plugin
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
const char *var_next,
int delete_allowed,
int create_allowed, int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
@ -1623,11 +1623,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* hdata */
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \
__delete_allowed, __callback_update, \
__callback_update_data) \
__create_allowed, __delete_allowed, \
__callback_update, __callback_update_data) \
weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \
__var_next, __delete_allowed, \
__callback_update, \
__var_next, __create_allowed, \
__delete_allowed, __callback_update, \
__callback_update_data)
#define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
__update_allowed, __array_size, \