summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config-file.c105
-rw-r--r--src/core/wee-debug.c22
-rw-r--r--src/core/wee-hdata.c749
-rw-r--r--src/core/wee-hdata.h42
-rw-r--r--src/gui/gui-bar-item.c15
-rw-r--r--src/gui/gui-bar-window.c45
-rw-r--r--src/gui/gui-bar.c31
-rw-r--r--src/gui/gui-buffer.c155
-rw-r--r--src/gui/gui-chat.c3
-rw-r--r--src/gui/gui-completion.c52
-rw-r--r--src/gui/gui-filter.c29
-rw-r--r--src/gui/gui-history.c9
-rw-r--r--src/gui/gui-hotlist.c17
-rw-r--r--src/gui/gui-key.c19
-rw-r--r--src/gui/gui-line.c143
-rw-r--r--src/gui/gui-nicklist.c44
-rw-r--r--src/gui/gui-window.c88
-rw-r--r--src/plugins/guile/weechat-guile-api.c33
-rw-r--r--src/plugins/irc/irc-channel.c64
-rw-r--r--src/plugins/irc/irc-ignore.c17
-rw-r--r--src/plugins/irc/irc-nick.c19
-rw-r--r--src/plugins/irc/irc-notify.c19
-rw-r--r--src/plugins/irc/irc-redirect.c62
-rw-r--r--src/plugins/irc/irc-server.c131
-rw-r--r--src/plugins/lua/weechat-lua-api.c36
-rw-r--r--src/plugins/perl/weechat-perl-api.c36
-rw-r--r--src/plugins/plugin-script.c29
-rw-r--r--src/plugins/plugin.c27
-rw-r--r--src/plugins/python/weechat-python-api.c49
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c41
-rw-r--r--src/plugins/script/script-repo.c49
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c38
-rw-r--r--src/plugins/weechat-plugin.h42
33 files changed, 1403 insertions, 857 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 646d85485..db34d95ee 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -2606,19 +2606,20 @@ config_file_hdata_config_file_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config");
+ hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_config_file, plugin, POINTER, NULL, "plugin");
- HDATA_VAR(struct t_config_file, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_config_file, filename, STRING, NULL, NULL);
- HDATA_VAR(struct t_config_file, file, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_file, callback_reload, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_file, callback_reload_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_file, sections, POINTER, NULL, "config_section");
- HDATA_VAR(struct t_config_file, last_section, POINTER, NULL, "config_section");
- HDATA_VAR(struct t_config_file, prev_config, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_config_file, next_config, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_config_file, plugin, POINTER, 0, NULL, "plugin");
+ HDATA_VAR(struct t_config_file, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_file, filename, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_file, file, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_file, callback_reload, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_file, callback_reload_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_file, sections, POINTER, 0, NULL, "config_section");
+ HDATA_VAR(struct t_config_file, last_section, POINTER, 0, NULL, "config_section");
+ HDATA_VAR(struct t_config_file, prev_config, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_config_file, next_config, POINTER, 0, NULL, hdata_name);
HDATA_LIST(config_files);
HDATA_LIST(last_config_file);
}
@@ -2637,27 +2638,28 @@ config_file_hdata_config_section_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section");
+ hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_config_section, config_file, POINTER, NULL, "config_file");
- HDATA_VAR(struct t_config_section, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_config_section, user_can_add_options, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_section, user_can_delete_options, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_read, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_read_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_write, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_write_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_write_default, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_write_default_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_create_option, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_create_option_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_delete_option, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, callback_delete_option_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_section, options, POINTER, NULL, "config_option");
- HDATA_VAR(struct t_config_section, last_option, POINTER, NULL, "config_option");
- HDATA_VAR(struct t_config_section, prev_section, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_config_section, next_section, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_config_section, config_file, POINTER, 0, NULL, "config_file");
+ HDATA_VAR(struct t_config_section, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, user_can_add_options, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, user_can_delete_options, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_read, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_read_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_write, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_write_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_write_default, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_write_default_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_create_option, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_create_option_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_delete_option, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, callback_delete_option_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_section, options, POINTER, 0, NULL, "config_option");
+ HDATA_VAR(struct t_config_section, last_option, POINTER, 0, NULL, "config_option");
+ HDATA_VAR(struct t_config_section, prev_section, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_config_section, next_section, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -2674,29 +2676,30 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option");
+ hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_config_option, config_file, POINTER, NULL, "config_file");
- HDATA_VAR(struct t_config_option, section, POINTER, NULL, "config_section");
- HDATA_VAR(struct t_config_option, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_config_option, type, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_option, description, STRING, NULL, NULL);
- HDATA_VAR(struct t_config_option, string_values, STRING, "*", NULL);
- HDATA_VAR(struct t_config_option, min, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_option, max, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_option, default_value, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, value, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, null_value_allowed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_check_value, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_check_value_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_change, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_change_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_delete, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, callback_delete_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_config_option, loaded, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_config_option, prev_option, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_config_option, next_option, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_config_option, config_file, POINTER, 0, NULL, "config_file");
+ HDATA_VAR(struct t_config_option, section, POINTER, 0, NULL, "config_section");
+ HDATA_VAR(struct t_config_option, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, type, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, description, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, string_values, STRING, 0, "*", NULL);
+ HDATA_VAR(struct t_config_option, min, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, max, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, default_value, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, value, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, null_value_allowed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_check_value, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_check_value_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_change, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_change_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_delete, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, callback_delete_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, loaded, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_config_option, prev_option, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_config_option, next_option, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c
index b013431bb..3066a08c7 100644
--- a/src/core/wee-debug.c
+++ b/src/core/wee-debug.c
@@ -310,15 +310,16 @@ debug_hdata_hash_var_map_cb (void *data,
const void *key, const void *value)
{
struct t_weelist *list;
+ struct t_hdata_var *var;
char str_offset[16];
/* make C compiler happy */
(void) hashtable;
list = (struct t_weelist *)data;
+ var = (struct t_hdata_var *)value;
- snprintf (str_offset, sizeof (str_offset),
- "%12d", (*((int *)value)) & 0xFFFF);
+ snprintf (str_offset, sizeof (str_offset), "%12d", var->offset);
weelist_add (list, str_offset, WEECHAT_LIST_POS_SORT, (void *)key);
}
@@ -350,9 +351,9 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hdata *ptr_hdata;
+ struct t_hdata_var *ptr_var;
struct t_weelist *list;
struct t_weelist_item *ptr_item;
- void *ptr_value;
/* make C compiler happy */
(void) data;
@@ -379,14 +380,19 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
for (ptr_item = list->items; ptr_item;
ptr_item = ptr_item->next_item)
{
- ptr_value = hashtable_get (ptr_hdata->hash_var, ptr_item->user_data);
- if (ptr_value)
+ ptr_var = hashtable_get (ptr_hdata->hash_var, ptr_item->user_data);
+ if (ptr_var)
{
gui_chat_printf (NULL,
- " %04d -> %s (%s)",
- (*((int *)ptr_value)) & 0xFFFF,
+ " %04d -> %s (%s%s%s%s%s%s)",
+ ptr_var->offset,
(char *)ptr_item->user_data,
- hdata_type_string[(*((int *)ptr_value)) >> 16]);
+ hdata_type_string[(int)ptr_var->type],
+ (ptr_var->update_allowed) ? ", R/W" : "",
+ (ptr_var->array_size) ? ", array size: " : "",
+ (ptr_var->array_size) ? ptr_var->array_size : "",
+ (ptr_var->hdata_name) ? ", hdata: " : "",
+ (ptr_var->hdata_name) ? ptr_var->hdata_name : "");
}
}
weelist_free (list);
diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c
index 3ed13b526..827573cc5 100644
--- a/src/core/wee-hdata.c
+++ b/src/core/wee-hdata.c
@@ -44,12 +44,43 @@ char *hdata_type_string[8] =
/*
+ * hdata_free_var: free a hdata variable
+ */
+
+void
+hdata_free_var (struct t_hashtable *hashtable,
+ const void *key, void *value)
+{
+ struct t_hdata_var *var;
+
+ /* make C compiler happy */
+ (void) hashtable;
+ (void) key;
+
+ var = (struct t_hdata_var *)value;
+ if (var)
+ {
+ if (var->array_size)
+ free (var->array_size);
+ if (var->hdata_name)
+ free (var->hdata_name);
+ free (var);
+ }
+}
+
+/*
* hdata_new: create a new hdata
*/
struct t_hdata *
hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
- const char *var_prev, const char *var_next)
+ const char *var_prev, const char *var_next,
+ int delete_allowed,
+ int (*callback_update)(void *data,
+ struct t_hdata *hdata,
+ void *pointer,
+ struct t_hashtable *hashtable),
+ void *callback_update_data)
{
struct t_hdata *new_hdata;
@@ -62,27 +93,24 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
new_hdata->plugin = plugin;
new_hdata->var_prev = (var_prev) ? strdup (var_prev) : NULL;
new_hdata->var_next = (var_next) ? strdup (var_next) : NULL;
- new_hdata->hash_var = hashtable_new (8,
+ new_hdata->hash_var = hashtable_new (16,
WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_INTEGER,
+ WEECHAT_HASHTABLE_POINTER,
NULL,
NULL);
- new_hdata->hash_var_array_size = hashtable_new (8,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
- new_hdata->hash_var_hdata = hashtable_new (8,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
- new_hdata->hash_list = hashtable_new (8,
+ hashtable_set_pointer (new_hdata->hash_var,
+ "callback_free_value",
+ &hdata_free_var);
+ new_hdata->hash_list = hashtable_new (16,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
NULL);
hashtable_set (weechat_hdata, hdata_name, new_hdata);
+ new_hdata->delete_allowed = delete_allowed;
+ new_hdata->callback_update = callback_update;
+ new_hdata->callback_update_data = callback_update_data;
+ new_hdata->update_pending = 0;
}
return new_hdata;
@@ -94,18 +122,23 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name,
void
hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type,
- const char *array_size, const char *hdata_name)
+ int update_allowed, const char *array_size,
+ const char *hdata_name)
{
- int value;
+ struct t_hdata_var *var;
+
+ if (!hdata || !name)
+ return;
- if (hdata && name)
+ var = malloc (sizeof (*var));
+ if (var)
{
- value = (type << 16) | (offset & 0xFFFF);
- hashtable_set (hdata->hash_var, name, &value);
- if (array_size && array_size[0])
- hashtable_set (hdata->hash_var_array_size, name, array_size);
- if (hdata_name && hdata_name[0])
- hashtable_set (hdata->hash_var_hdata, name, hdata_name);
+ var->offset = offset;
+ var->type = type;
+ var->update_allowed = update_allowed;
+ var->array_size = (array_size && array_size[0]) ? strdup (array_size) : NULL;
+ var->hdata_name = (hdata_name && hdata_name[0]) ? strdup (hdata_name) : NULL;
+ hashtable_set (hdata->hash_var, name, var);
}
}
@@ -116,8 +149,10 @@ hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type,
void
hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer)
{
- if (hdata && name)
- hashtable_set (hdata->hash_list, name, pointer);
+ if (!hdata || !name)
+ return;
+
+ hashtable_set (hdata->hash_list, name, pointer);
}
/*
@@ -127,14 +162,14 @@ hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer)
int
hdata_get_var_offset (struct t_hdata *hdata, const char *name)
{
- int *ptr_value;
+ struct t_hdata_var *var;
- if (hdata && name)
- {
- ptr_value = hashtable_get (hdata->hash_var, name);
- if (ptr_value)
- return (*ptr_value) & 0xFFFF;
- }
+ if (!hdata || !name)
+ return -1;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (var)
+ return var->offset;
return -1;
}
@@ -146,14 +181,14 @@ hdata_get_var_offset (struct t_hdata *hdata, const char *name)
int
hdata_get_var_type (struct t_hdata *hdata, const char *name)
{
- int *ptr_value;
+ struct t_hdata_var *var;
- if (hdata && name)
- {
- ptr_value = hashtable_get (hdata->hash_var, name);
- if (ptr_value)
- return (*ptr_value) >> 16;
- }
+ if (!hdata || !name)
+ return -1;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (var)
+ return var->type;
return -1;
}
@@ -165,14 +200,14 @@ hdata_get_var_type (struct t_hdata *hdata, const char *name)
const char *
hdata_get_var_type_string (struct t_hdata *hdata, const char *name)
{
- int *ptr_value;
+ struct t_hdata_var *var;
- if (hdata && name)
- {
- ptr_value = hashtable_get (hdata->hash_var, name);
- if (ptr_value)
- return hdata_type_string[(*ptr_value) >> 16];
- }
+ if (!hdata || !name)
+ return NULL;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (var)
+ return hdata_type_string[(int)var->type];
return NULL;
}
@@ -188,87 +223,87 @@ int
hdata_get_var_array_size (struct t_hdata *hdata, void *pointer,
const char *name)
{
+ struct t_hdata_var *var;
const char *ptr_size;
char *error;
long value;
- int i, type, offset;
+ int i, offset;
void *ptr_value;
- if (hdata && name)
+ if (!hdata || !name)
+ return -1;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (!var)
+ return -1;
+
+ ptr_size = var->array_size;
+ if (!ptr_size)
+ return -1;
+
+ if (strcmp (ptr_size, "*") == 0)
{
- ptr_size = hashtable_get (hdata->hash_var_array_size, name);
- if (ptr_size)
+ /*
+ * automatic size: look for NULL in array
+ * (this automatic size is possible only with pointers, so with
+ * types: string, pointer, hashtable)
+ */
+ if ((var->type == WEECHAT_HDATA_STRING)
+ || (var->type == WEECHAT_HDATA_POINTER)
+ || (var->type == WEECHAT_HDATA_HASHTABLE))
{
- if (strcmp (ptr_size, "*") == 0)
+ if (!(*((void **)(pointer + var->offset))))
+ return 0;
+ i = 0;
+ while (1)
{
- /*
- * automatic size: look for NULL in array
- * (this automatic size is possible only with pointers, so with
- * types: string, pointer, hashtable)
- */
- type = hdata_get_var_type (hdata, name);
- if ((type == WEECHAT_HDATA_STRING)
- || (type == WEECHAT_HDATA_POINTER)
- || (type == WEECHAT_HDATA_HASHTABLE))
+ ptr_value = NULL;
+ switch (var->type)
{
- offset = hdata_get_var_offset (hdata, name);
- if (offset >= 0)
- {
- if (!(*((void **)(pointer + offset))))
- return 0;
- i = 0;
- while (1)
- {
- ptr_value = NULL;
- switch (type)
- {
- case WEECHAT_HDATA_STRING:
- ptr_value = (*((char ***)(pointer + offset)))[i];
- break;
- case WEECHAT_HDATA_POINTER:
- ptr_value = (*((void ***)(pointer + offset)))[i];
- break;
- case WEECHAT_HDATA_HASHTABLE:
- ptr_value = (*((struct t_hashtable ***)(pointer + offset)))[i];
- break;
- }
- if (!ptr_value)
- break;
- i++;
- }
- return i;
- }
+ case WEECHAT_HDATA_STRING:
+ ptr_value = (*((char ***)(pointer + var->offset)))[i];
+ break;
+ case WEECHAT_HDATA_POINTER:
+ ptr_value = (*((void ***)(pointer + var->offset)))[i];
+ break;
+ case WEECHAT_HDATA_HASHTABLE:
+ ptr_value = (*((struct t_hashtable ***)(pointer + var->offset)))[i];
+ break;
}
+ if (!ptr_value)
+ break;
+ i++;
}
- else
+ return i;
+ }
+ }
+ else
+ {
+ /* fixed size: the size can be a name of variable or integer */
+ offset = hdata_get_var_offset (hdata, ptr_size);
+ if (offset >= 0)
+ {
+ /* size is the name of a variable in hdata, read it */
+ switch (hdata_get_var_type (hdata, ptr_size))
{
- /* fixed size: the size can be a name of variable or integer */
- if (hdata_get_var_offset (hdata, ptr_size) >= 0)
- {
- /* size is the name of a variable in hdata, read it */
- offset = hdata_get_var_offset (hdata, ptr_size);
- switch (hdata_get_var_type (hdata, ptr_size))
- {
- case WEECHAT_HDATA_CHAR:
- return (int)(*((char *)(pointer + offset)));
- case WEECHAT_HDATA_INTEGER:
- return *((int *)(pointer + offset));
- case WEECHAT_HDATA_LONG:
- return (int)(*((long *)(pointer + offset)));
- default:
- break;
- }
- }
- else
- {
- /* check if the size is a valid integer */
- error = NULL;
- value = strtol (ptr_size, &error, 10);
- if (error && !error[0])
- return (int)value;
- }
+ case WEECHAT_HDATA_CHAR:
+ return (int)(*((char *)(pointer + offset)));
+ case WEECHAT_HDATA_INTEGER:
+ return *((int *)(pointer + offset));
+ case WEECHAT_HDATA_LONG:
+ return (int)(*((long *)(pointer + offset)));
+ default:
+ break;
}
}
+ else
+ {
+ /* check if the size is a valid integer */
+ error = NULL;
+ value = strtol (ptr_size, &error, 10);
+ if (error && !error[0])
+ return (int)value;
+ }
}
return -1;
@@ -282,11 +317,17 @@ const char *
hdata_get_var_array_size_string (struct t_hdata *hdata, void *pointer,
const char *name)
{
+ struct t_hdata_var *var;
+
/* make C compiler happy */
(void) pointer;
- if (hdata && name)
- return (const char *)hashtable_get (hdata->hash_var_array_size, name);
+ if (!hdata || !name)
+ return NULL;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (var)
+ return (const char *)var->array_size;
return NULL;
}
@@ -299,8 +340,14 @@ hdata_get_var_array_size_string (struct t_hdata *hdata, void *pointer,
const char *
hdata_get_var_hdata (struct t_hdata *hdata, const char *name)
{
- if (hdata && name)
- return (const char *)hashtable_get (hdata->hash_var_hdata, name);
+ struct t_hdata_var *var;
+
+ if (!hdata || !name)
+ return NULL;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (var)
+ return (const char *)var->hdata_name;
return NULL;
}
@@ -314,12 +361,12 @@ hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
- if (hdata && pointer)
- {
- offset = hdata_get_var_offset (hdata, name);
- if (offset >= 0)
- return pointer + offset;
- }
+ if (!hdata || !pointer)
+ return NULL;
+
+ offset = hdata_get_var_offset (hdata, name);
+ if (offset >= 0)
+ return pointer + offset;
return NULL;
}
@@ -332,10 +379,10 @@ hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name)
void *
hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset)
{
- if (hdata && pointer)
- return pointer + offset;
+ if (!hdata || !pointer)
+ return NULL;
- return NULL;
+ return pointer + offset;
}
/*
@@ -347,12 +394,12 @@ hdata_get_list (struct t_hdata *hdata, const char *name)
{
void *ptr_value;
- if (hdata && name)
- {
- ptr_value = hashtable_get (hdata->hash_list, name);
- if (ptr_value)
- return *((void **)ptr_value);
- }
+ if (!hdata || !name)
+ return NULL;
+
+ ptr_value = hashtable_get (hdata->hash_list, name);
+ if (ptr_value)
+ return *((void **)ptr_value);
return NULL;
}
@@ -368,17 +415,17 @@ hdata_check_pointer (struct t_hdata *hdata, void *list, void *pointer)
{
void *ptr_current;
- if (hdata && list && pointer)
+ if (!hdata || !list || !pointer)
+ return 0;
+
+ if (pointer == list)
+ return 1;
+ ptr_current = list;
+ while (ptr_current)
{
- if (pointer == list)
+ ptr_current = hdata_move (hdata, ptr_current, 1);
+ if (ptr_current && (ptr_current == pointer))
return 1;
- ptr_current = list;
- while (ptr_current)
- {
- ptr_current = hdata_move (hdata, ptr_current, 1);
- if (ptr_current && (ptr_current == pointer))
- return 1;
- }
}
return 0;
@@ -394,17 +441,17 @@ hdata_move (struct t_hdata *hdata, void *pointer, int count)
char *ptr_var;
int i, abs_count;
- if (hdata && pointer && (count != 0))
- {
- ptr_var = (count < 0) ? hdata->var_prev : hdata->var_next;
- abs_count = abs(count);
+ if (!hdata || !pointer || (count == 0))
+ return NULL;
- for (i = 0; i < abs_count; i++)
- {
- pointer = hdata_pointer (hdata, pointer, ptr_var);
- if (pointer)
- return pointer;
- }
+ ptr_var = (count < 0) ? hdata->var_prev : hdata->var_next;
+ abs_count = abs(count);
+
+ for (i = 0; i < abs_count; i++)
+ {
+ pointer = hdata_pointer (hdata, pointer, ptr_var);
+ if (pointer)
+ return pointer;
}
return NULL;
@@ -459,23 +506,24 @@ hdata_get_index_and_name (const char *name, int *index, const char **ptr_name)
char
hdata_char (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
+
+ if (!hdata || !pointer || !name)
+ return '\0';
- if (hdata && pointer && name)
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return (*((char **)(pointer + offset)))[index];
- }
- else
- return *((char *)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return (*((char **)(pointer + var->offset)))[index];
}
+ else
+ return *((char *)(pointer + var->offset));
}
return '\0';
@@ -488,23 +536,24 @@ hdata_char (struct t_hdata *hdata, void *pointer, const char *name)
int
hdata_integer (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
+
+ if (!hdata || !pointer || !name)
+ return 0;
- if (hdata && pointer && name)
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return ((int *)(pointer + offset))[index];
- }
- else
- return *((int *)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return ((int *)(pointer + var->offset))[index];
}
+ else
+ return *((int *)(pointer + var->offset));
}
return 0;
@@ -517,23 +566,24 @@ hdata_integer (struct t_hdata *hdata, void *pointer, const char *name)
long
hdata_long (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
- if (hdata && pointer && name)
+ if (!hdata || !pointer || !name)
+ return 0;
+
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return ((long *)(pointer + offset))[index];
- }
- else
- return *((long *)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return ((long *)(pointer + var->offset))[index];
}
+ else
+ return *((long *)(pointer + var->offset));
}
return 0;
@@ -546,23 +596,24 @@ hdata_long (struct t_hdata *hdata, void *pointer, const char *name)
const char *
hdata_string (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
+
+ if (!hdata || !pointer || !name)
+ return NULL;
- if (hdata && pointer && name)
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return (*((char ***)(pointer + offset)))[index];
- }
- else
- return *((char **)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return (*((char ***)(pointer + var->offset)))[index];
}
+ else
+ return *((char **)(pointer + var->offset));
}
return NULL;
@@ -575,23 +626,24 @@ hdata_string (struct t_hdata *hdata, void *pointer, const char *name)
void *
hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
+
+ if (!hdata || !pointer || !name)
+ return NULL;
- if (hdata && pointer && name)
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return (*((void ***)(pointer + offset)))[index];
- }
- else
- return *((void **)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return (*((void ***)(pointer + var->offset)))[index];
}
+ else
+ return *((void **)(pointer + var->offset));
}
return NULL;
@@ -604,23 +656,24 @@ hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name)
time_t
hdata_time (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
- if (hdata && pointer && name)
+ if (!hdata || !pointer || !name)
+ return 0;
+
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return ((time_t *)(pointer + offset))[index];
- }
- else
- return *((time_t *)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return ((time_t *)(pointer + var->offset))[index];
}
+ else
+ return *((time_t *)(pointer + var->offset));
}
return 0;
@@ -633,28 +686,164 @@ hdata_time (struct t_hdata *hdata, void *pointer, const char *name)
struct t_hashtable *
hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name)
{
- int offset, index;
+ int index;
const char *ptr_name;
+ struct t_hdata_var *var;
+
+ if (!hdata || !pointer || !name)
+ return NULL;
- if (hdata && pointer && name)
+ hdata_get_index_and_name (name, &index, &ptr_name);
+ var = hashtable_get (hdata->hash_var, ptr_name);
+ if (var && (var->offset >= 0))
{
- hdata_get_index_and_name (name, &index, &ptr_name);
- offset = hdata_get_var_offset (hdata, ptr_name);
- if (offset >= 0)
+ if (var->array_size)
{
- if (hdata_get_var_array_size_string (hdata, pointer, ptr_name))
- {
- if (*((void **)(pointer + offset)))
- return (*((struct t_hashtable ***)(pointer + offset)))[index];
- }
- else
- return *((struct t_hashtable **)(pointer + offset));
+ if (*((void **)(pointer + var->offset)))
+ return (*((struct t_hashtable ***)(pointer + var->offset)))[index];
}
+ else
+ return *((struct t_hashtable **)(pointer + var->offset));
}
return NULL;
}
+/* hdata_set: set value for a variable in hdata
+ * WARNING: this is dangerous, and only some variables can be set
+ * by this function (this depends on hdata, see API doc
+ * for more info) and this function can be called *ONLY*
+ * in an "update" callback (in hdata).
+ * Return 1 if ok (value set), 0 if error (or not allowed)
+ */
+
+int
+hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
+ const char *value)
+{
+ struct t_hdata_var *var;
+ char **ptr_string, *error;
+ long number;
+ long unsigned int ptr;
+ int rc;
+
+ if (!hdata->update_pending)
+ return 0;
+
+ var = hashtable_get (hdata->hash_var, name);
+ if (!var)
+ return 0;
+
+ if (!var->update_allowed)
+ return 0;
+
+ switch (var->type)
+ {
+ case WEECHAT_HDATA_OTHER:
+ break;
+ case WEECHAT_HDATA_CHAR:
+ *((char *)(pointer + var->offset)) = (value) ? value[0] : '\0';
+ return 1;
+ break;
+ case WEECHAT_HDATA_INTEGER:
+ error = NULL;
+ number = strtol (value, &error, 10);
+ if (error && !error[0])
+ {
+ *((int *)(pointer + var->offset)) = (int)number;
+ return 1;
+ }
+ break;
+ case WEECHAT_HDATA_LONG:
+ error = NULL;
+ number = strtol (value, &error, 10);
+ if (error && !error[0])
+ {
+ *((long *)(pointer + var->offset)) = number;
+ return 1;
+ }
+ break;
+ case WEECHAT_HDATA_STRING:
+ ptr_string = (char **)(pointer + var->offset);
+ if (*ptr_string)
+ free (*ptr_string);
+ *ptr_string = (value) ? strdup (value) : NULL;
+ return 1;
+ break;
+ case WEECHAT_HDATA_POINTER:
+ rc = sscanf (value, "%lx", &ptr);
+ if ((rc != EOF) && (rc != 0))
+ {
+ *((void **)(pointer + var->offset)) = (void *)ptr;
+ return 1;
+ }
+ break;
+ case WEECHAT_HDATA_TIME:
+ error = NULL;
+ number = strtol (value, &error, 10);
+ if (error && !error[0])
+ {
+ *((time_t *)(pointer + var->offset)) = (time_t)number;
+ return 1;
+ }
+ break;
+ case WEECHAT_HDATA_HASHTABLE:
+ break;
+ }
+ return 0;
+}
+
+/*
+ * hdata_update: update some data in hdata
+ * The hashtable contains keys with new values.
+ * A special key "__delete" can be used to delete the whole
+ * structure at pointer (if allowed for this hdata).
+ * WARNING: this is dangerous, and only some data can be updated
+ * by this function (this depends on hdata, see API doc
+ * for more info)
+ * Return number of variables updated or 0 if nothing has been
+ * updated. In case of deletion, return 1 if ok, 0 if error.
+ */
+
+int
+hdata_update (struct t_hdata *hdata, void *pointer,
+ struct t_hashtable *hashtable)
+{
+ const char *value;
+ struct t_hdata_var *var;
+ int rc;
+
+ if (!hdata || !hashtable || !hdata->callback_update)
+ return 0;
+
+ /* check if delete of structure is allowed */
+ if (hashtable_has_key (hashtable, "__delete_allowed"))
+ return (int)hdata->delete_allowed;
+
+ /* check if update of variable is allowed */
+ value = hashtable_get (hashtable, "__update_allowed");
+ if (value)
+ {
+ if (!hdata->callback_update)
+ return 0;
+ var = hashtable_get (hdata->hash_var, value);
+ if (!var)
+ return 0;
+ return (var->update_allowed) ? 1 : 0;
+ }
+
+ if (!pointer)
+ return 0;
+
+ /* update data */
+ hdata->update_pending = 1;
+ rc = (hdata->callback_update) (hdata->callback_update_data,
+ hdata, pointer, hashtable);
+ hdata->update_pending = 0;
+
+ return rc;
+}
+
/*
* hdata_get_string: get a hdata property as string
*/
@@ -662,37 +851,25 @@ hdata_hashtable (struct t_hdata *hdata, void *pointer, const char *name)
const char *
hdata_get_string (struct t_hdata *hdata, const char *property)
{
- if (hdata && property)
- {
- if (string_strcasecmp (property, "var_keys") == 0)
- return hashtable_get_string (hdata->hash_var, "keys");
- else if (string_strcasecmp (property, "var_values") == 0)
- return hashtable_get_string (hdata->hash_var, "values");
- else if (string_strcasecmp (property, "var_keys_values") == 0)
- return hashtable_get_string (hdata->hash_var, "keys_values");
- else if (string_strcasecmp (property, "var_prev") == 0)
- return hdata->var_prev;
- else if (string_strcasecmp (property, "var_next") == 0)
- return hdata->var_next;
- else if (string_strcasecmp (property, "var_array_size_keys") == 0)
- return hashtable_get_string (hdata->hash_var_array_size, "keys");
- else if (string_strcasecmp (property, "var_array_size_values") == 0)
- return hashtable_get_string (hdata->hash_var_array_size, "values");
- else if (string_strcasecmp (property, "var_array_size_keys_values") == 0)
- return hashtable_get_string (hdata->hash_var_array_size, "keys_values");
- else if (string_strcasecmp (property, "var_hdata_keys") == 0)
- return hashtable_get_string (hdata->hash_var_hdata, "keys");
- else if (string_strcasecmp (property, "var_hdata_values") == 0)
- return hashtable_get_string (hdata->hash_var_hdata, "values");
- else if (string_strcasecmp (property, "var_hdata_keys_values") == 0)
- return hashtable_get_string (hdata->hash_var_hdata, "keys_values");
- else if (string_strcasecmp (property, "list_keys") == 0)
- return hashtable_get_string (hdata->hash_list, "keys");
- else if (string_strcasecmp (property, "list_values") == 0)
- return hashtable_get_string (hdata->hash_list, "values");
- else if (string_strcasecmp (property, "list_keys_values") == 0)
- return hashtable_get_string (hdata->hash_list, "keys_values");
- }
+ if (!hdata || !property)
+ return NULL;
+
+ if (string_strcasecmp (property, "var_keys") == 0)
+ return hashtable_get_string (hdata->hash_var, "keys");
+ else if (string_strcasecmp (property, "var_values") == 0)
+ return hashtable_get_string (hdata->hash_var, "values");
+ else if (string_strcasecmp (property, "var_keys_values") == 0)
+ return hashtable_get_string (hdata->hash_var, "keys_values");
+ else if (string_strcasecmp (property, "var_prev") == 0)
+ return hdata->var_prev;
+ else if (string_strcasecmp (property, "var_next") == 0)
+ return hdata->var_next;
+ else if (string_strcasecmp (property, "list_keys") == 0)
+ return hashtable_get_string (hdata->hash_list, "keys");
+ else if (string_strcasecmp (property, "list_values") == 0)
+ return hashtable_get_string (hdata->hash_list, "values");
+ else if (string_strcasecmp (property, "list_keys_values") == 0)
+ return hashtable_get_string (hdata->hash_list, "keys_values");
return NULL;
}
@@ -710,10 +887,6 @@ hdata_free (struct t_hdata *hdata)
free (hdata->var_prev);
if (hdata->var_next)
free (hdata->var_next);
- if (hdata->hash_var_array_size)
- hashtable_free (hdata->hash_var_array_size);
- if (hdata->hash_var_hdata)
- hashtable_free (hdata->hash_var_hdata);
if (hdata->hash_list)
hashtable_free (hdata->hash_list);
@@ -779,6 +952,31 @@ hdata_free_all ()
}
/*
+ * hdata_print_log_var_map_cb: function called for each variable in hdata
+ */
+
+void
+hdata_print_log_var_map_cb (void *data, struct t_hashtable *hashtable,
+ const void *key, const void *value)
+{
+ struct t_hdata_var *var;
+
+ /* make C compiler happy */
+ (void) data;
+ (void) hashtable;
+
+ var = (struct t_hdata_var *)value;
+
+ log_printf ("");
+ log_printf (" [hdata var '%s']", (const char *)key);
+ log_printf (" offset . . . . . . . . : %d", var->offset);
+ log_printf (" type . . . . . . . . . : %d ('%s')", var->type, hdata_type_string[(int)var->type]);
+ log_printf (" update_allowed . . . . : %d", (int)var->update_allowed);
+ log_printf (" array_size . . . . . . : '%s'", var->array_size);
+ log_printf (" hdata_name . . . . . . : '%s'", var->hdata_name);
+}
+
+/*
* hdata_print_log_map_cb: function called for each hdata in memory
*/
@@ -802,15 +1000,14 @@ hdata_print_log_map_cb (void *data, struct t_hashtable *hashtable,
log_printf (" hash_var . . . . . . . : 0x%lx (hashtable: '%s')",
ptr_hdata->hash_var,
hashtable_get_string (ptr_hdata->hash_var, "keys_values"));
- log_printf (" hash_var_array_size. . : 0x%lx (hashtable: '%s')",
- ptr_hdata->hash_var_array_size,
- hashtable_get_string (ptr_hdata->hash_var_array_size, "keys_values"));
- log_printf (" hash_var_hdata . . . . : 0x%lx (hashtable: '%s')",
- ptr_hdata->hash_var_hdata,
- hashtable_get_string (ptr_hdata->hash_var_hdata, "keys_values"));
log_printf (" hash_list. . . . . . . : 0x%lx (hashtable: '%s')",
ptr_hdata->hash_list,
hashtable_get_string (ptr_hdata->hash_list, "keys_values"));
+ 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);
+ log_printf (" update_pending . . . . : %d", (int)ptr_hdata->update_pending);
+ hashtable_map (ptr_hdata->hash_var, &hdata_print_log_var_map_cb, NULL);
}
/*
diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h
index 0eacf669e..3139af4ef 100644
--- a/src/core/wee-hdata.h
+++ b/src/core/wee-hdata.h
@@ -20,11 +20,22 @@
#ifndef __WEECHAT_HDATA_H
#define __WEECHAT_HDATA_H 1
-#define HDATA_VAR(__struct, __name, __type, __array_size, __hdata_name) \
+#define HDATA_VAR(__struct, __name, __type, __update_allowed, \
+ __array_size, __hdata_name) \
hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
- WEECHAT_HDATA_##__type, __array_size, __hdata_name)
+ WEECHAT_HDATA_##__type, __update_allowed, \
+ __array_size, __hdata_name)
#define HDATA_LIST(__name) hdata_new_list (hdata, #__name, &(__name));
+struct t_hdata_var
+{
+ int offset; /* offset */
+ char type; /* type */
+ char update_allowed; /* update allowed? */
+ char *array_size; /* array size */
+ char *hdata_name; /* hdata name */
+};
+
struct t_hdata
{
struct t_weechat_plugin *plugin; /* plugin which created this hdata */
@@ -34,10 +45,19 @@ struct t_hdata
char *var_next; /* name of var with pointer to */
/* next element in list */
struct t_hashtable *hash_var; /* hash with type & offset of vars */
- struct t_hashtable *hash_var_array_size; /* array size */
- struct t_hashtable *hash_var_hdata; /* hashtable with hdata names */
struct t_hashtable *hash_list; /* hashtable with pointers on lists */
/* (used to search objects) */
+
+ char delete_allowed; /* delete allowed? */
+ int (*callback_update) /* update callback */
+ (void *data,
+ struct t_hdata *hdata,
+ void *pointer,
+ struct t_hashtable *hashtable);
+ void *callback_update_data; /* data sent to update callback */
+
+ /* internal vars */
+ char update_pending; /* update pending: hdata_set allowed */
};
extern struct t_hashtable *weechat_hdata;
@@ -46,9 +66,15 @@ 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);
+ const char *var_next,
+ int delete_allowed,
+ int (*callback_update)(void *data,
+ struct t_hdata *hdata,
+ void *pointer,
+ struct t_hashtable *hashtable),
+ void *callback_update_data);
extern void hdata_new_var (struct t_hdata *hdata, const char *name, int offset,
- int type, const char *array_size,
+ int type, int update_allowed, const char *array_size,
const char *hdata_name);
extern void hdata_new_list (struct t_hdata *hdata, const char *name,
void *pointer);
@@ -85,6 +111,10 @@ extern time_t hdata_time (struct t_hdata *hdata, void *pointer,
const char *name);
extern struct t_hashtable *hdata_hashtable (struct t_hdata *hdata,
void *pointer, const char *name);
+extern int hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
+ const char *value);
+extern int hdata_update (struct t_hdata *hdata, void *pointer,
+ struct t_hashtable *hashtable);
extern const char *hdata_get_string (struct t_hdata *hdata,
const char *property);
extern void hdata_free_all_plugin (struct t_weechat_plugin *plugin);
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 58668c33c..fade60939 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -1852,15 +1852,16 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
+ hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, NULL, "plugin");
- HDATA_VAR(struct t_gui_bar_item, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, 0, NULL, "plugin");
+ HDATA_VAR(struct t_gui_bar_item, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_bar_items);
HDATA_LIST(last_gui_bar_item);
}
diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c
index a6479d7c9..66ac6f6e5 100644
--- a/src/gui/gui-bar-window.c
+++ b/src/gui/gui-bar-window.c
@@ -1404,30 +1404,31 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window");
+ hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_bar_window, bar, POINTER, NULL, "bar");
- HDATA_VAR(struct t_gui_bar_window, x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, width, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, height, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, coords, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar_window, bar, POINTER, 0, NULL, "bar");
+ HDATA_VAR(struct t_gui_bar_window, x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, width, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, height, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, coords, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 2c7718f8e..31ec7f677 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -2243,23 +2243,24 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar");
+ hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_bar, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, options, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, conditions_array, STRING, "conditions_count", NULL);
- HDATA_VAR(struct t_gui_bar, items_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, items_array, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, items_name, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, bar_window, POINTER, NULL, "bar_window");
- HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_bar, next_bar, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, options, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, conditions_array, STRING, 0, "conditions_count", NULL);
+ HDATA_VAR(struct t_gui_bar, items_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, items_array, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, items_name, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, bar_window, POINTER, 0, NULL, "bar_window");
+ HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_bar, next_bar, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_bars);
HDATA_LIST(last_gui_bar);
}
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 168649c4b..509846628 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -3125,75 +3125,76 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer");
+ hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_buffer, plugin, POINTER, NULL, "plugin");
- HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, number, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, full_name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, short_name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, type, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, notify, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, active, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, close_callback, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, title, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, NULL, "lines");
- HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, NULL, "lines");
- HDATA_VAR(struct t_gui_buffer, lines, POINTER, NULL, "lines");
- HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER, NULL, "nick_group");
- HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_callback, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER, NULL, "input_undo");
- HDATA_VAR(struct t_gui_buffer, input_undo, POINTER, NULL, "input_undo");
- HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER, NULL, "input_undo");
- HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER, NULL, "input_undo");
- HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, completion, POINTER, NULL, "completion");
- HDATA_VAR(struct t_gui_buffer, history, POINTER, NULL, "history");
- HDATA_VAR(struct t_gui_buffer, last_history, POINTER, NULL, "history");
- HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER, NULL, "history");
- HDATA_VAR(struct t_gui_buffer, num_history, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, text_search, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, text_search_input, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_words, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_regex, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_regex_compiled, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, highlight_tags_array, STRING, "highlight_tags_count", NULL);
- HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, HASHTABLE, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, keys, POINTER, NULL, "key");
- HDATA_VAR(struct t_gui_buffer, last_key, POINTER, NULL, "key");
- HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, local_variables, HASHTABLE, NULL, NULL);
- HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_buffer, plugin, POINTER, 0, NULL, "plugin");
+ HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, number, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, full_name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, short_name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, type, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, notify, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, active, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, close_callback, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, title, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, 0, NULL, "lines");
+ HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, 0, NULL, "lines");
+ HDATA_VAR(struct t_gui_buffer, lines, POINTER, 0, NULL, "lines");
+ HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER, 0, NULL, "nick_group");
+ HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nickcmp_callback, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, nickcmp_callback_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_callback, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER, 0, NULL, "input_undo");
+ HDATA_VAR(struct t_gui_buffer, input_undo, POINTER, 0, NULL, "input_undo");
+ HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER, 0, NULL, "input_undo");
+ HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER, 0, NULL, "input_undo");
+ HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, completion, POINTER, 0, NULL, "completion");
+ HDATA_VAR(struct t_gui_buffer, history, POINTER, 0, NULL, "history");
+ HDATA_VAR(struct t_gui_buffer, last_history, POINTER, 0, NULL, "history");
+ HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER, 0, NULL, "history");
+ HDATA_VAR(struct t_gui_buffer, num_history, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, text_search, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, text_search_input, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_words, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_regex, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_regex_compiled, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, highlight_tags_array, STRING, 0, "highlight_tags_count", NULL);
+ HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, HASHTABLE, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, keys, POINTER, 0, NULL, "key");
+ HDATA_VAR(struct t_gui_buffer, last_key, POINTER, 0, NULL, "key");
+ HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, local_variables, HASHTABLE, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_buffers);
HDATA_LIST(last_gui_buffer);
HDATA_LIST(gui_buffer_last_displayed);
@@ -3213,13 +3214,14 @@ gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo");
+ hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_input_undo, data, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_input_undo, pos, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_input_undo, data, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_input_undo, pos, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -3236,12 +3238,13 @@ gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer");
+ hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, NULL, "buffer");
- HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_buffers_visited);
HDATA_LIST(last_gui_buffer_visited);
}
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 6c6b1eeee..410a5b684 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -339,6 +339,9 @@ gui_chat_get_time_string (time_t date)
int i, time_first_digit, time_last_digit, last_color;
struct tm *local_time;
+ if (date == 0)
+ return NULL;
+
if (!CONFIG_STRING(config_look_buffer_time_format)
|| !CONFIG_STRING(config_look_buffer_time_format)[0])
return NULL;
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index 9b7ef2fe2..74581da13 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -1214,28 +1214,29 @@ gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, NULL, NULL);
+ hdata = hdata_new (NULL, hdata_name, NULL, NULL,
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_completion, buffer, POINTER, NULL, "buffer");
- HDATA_VAR(struct t_gui_completion, context, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, base_command, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, base_word, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, position, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, args, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, direction, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, add_space, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, completion_list, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, word_found, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, NULL, "completion_partial");
- HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, NULL, "completion_partial");
+ HDATA_VAR(struct t_gui_completion, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_completion, context, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, base_command, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, base_word, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, position, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, args, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, direction, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, add_space, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, completion_list, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, word_found, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, 0, NULL, "completion_partial");
+ HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, 0, NULL, "completion_partial");
}
return hdata;
}
@@ -1253,13 +1254,14 @@ gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
+ hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_completion_partial, word, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_completion_partial, word, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index 6f4ea13f8..8df37a261 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -449,22 +449,23 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter");
+ hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_filter, enabled, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, buffer_name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, buffers, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, tags, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, tags_array, STRING, "tags_count", NULL);
- HDATA_VAR(struct t_gui_filter, regex, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, regex_message, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_filter, next_filter, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_filter, enabled, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, buffer_name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, buffers, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, tags, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, tags_array, STRING, 0, "tags_count", NULL);
+ HDATA_VAR(struct t_gui_filter, regex, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, regex_message, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_filter, next_filter, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_filters);
HDATA_LIST(last_gui_filter);
}
diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c
index e122e9f08..c9071ccee 100644
--- a/src/gui/gui-history.c
+++ b/src/gui/gui-history.c
@@ -227,12 +227,13 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history");
+ hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_history, text, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_history, prev_history, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_history, next_history, POINTER, NULL, hdata_name);
+ 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);
}
return hdata;
}
diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c
index d7e6bf06a..7ebc9750e 100644
--- a/src/gui/gui-hotlist.c
+++ b/src/gui/gui-hotlist.c
@@ -474,16 +474,17 @@ gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist");
+ hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_hotlist, creation_time.tv_sec, TIME, NULL, NULL);
- HDATA_VAR(struct t_gui_hotlist, creation_time.tv_usec, LONG, NULL, NULL);
- HDATA_VAR(struct t_gui_hotlist, buffer, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_hotlist, count, INTEGER, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
- HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_hotlist, creation_time.tv_sec, TIME, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_hotlist, creation_time.tv_usec, LONG, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_hotlist, buffer, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_hotlist, count, INTEGER, 0, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
+ HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_hotlist);
HDATA_LIST(last_gui_hotlist);
}
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index 81abbd565..492e0d9e4 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -1715,17 +1715,18 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key");
+ hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_key, key, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_key, area_type, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_key, area_name, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_key, area_key, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_key, command, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_key, score, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_key, prev_key, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_key, next_key, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_key, key, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, area_type, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, area_name, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, area_key, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, command, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, score, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_key, prev_key, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_key, next_key, POINTER, 0, NULL, hdata_name);
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
snprintf (str_list, sizeof (str_list),
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 9e86b891a..81a736728 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -1012,8 +1012,7 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
new_line->data->y = -1;
new_line->data->date = date;
new_line->data->date_printed = date_printed;
- new_line->data->str_time = (date == 0) ?
- NULL : gui_chat_get_time_string (date);
+ new_line->data->str_time = gui_chat_get_time_string (date);
if (tags)
{
new_line->data->tags_array = string_split (tags, ",", 0, 0,
@@ -1355,17 +1354,17 @@ 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);
+ hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_lines, first_line, POINTER, NULL, "line");
- HDATA_VAR(struct t_gui_lines, last_line, POINTER, NULL, "line");
- HDATA_VAR(struct t_gui_lines, last_read_line, POINTER, NULL, "line");
- HDATA_VAR(struct t_gui_lines, lines_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER, NULL, NULL);
+ HDATA_VAR(struct t_gui_lines, first_line, POINTER, 0, NULL, "line");
+ HDATA_VAR(struct t_gui_lines, last_line, POINTER, 0, NULL, "line");
+ HDATA_VAR(struct t_gui_lines, last_read_line, POINTER, 0, NULL, "line");
+ HDATA_VAR(struct t_gui_lines, lines_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER, 0, NULL, NULL);
}
return hdata;
}
@@ -1382,17 +1381,102 @@ gui_line_hdata_line_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line");
+ hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_line, data, POINTER, NULL, "line_data");
- HDATA_VAR(struct t_gui_line, prev_line, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_line, next_line, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_line, data, POINTER, 0, NULL, "line_data");
+ HDATA_VAR(struct t_gui_line, prev_line, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_line, next_line, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
/*
+ * gui_line_hdata_line_data_update_cb: callback for updating data of a line
+ */
+
+int
+gui_line_hdata_line_data_update_cb (void *data,
+ struct t_hdata *hdata,
+ void *pointer,
+ struct t_hashtable *hashtable)
+{
+ const char *value;
+ struct t_gui_line_data *line_data;
+ int rc;
+
+ /* make C compiler happy */
+ (void) data;
+
+ line_data = (struct t_gui_line_data *)pointer;
+
+ rc = 0;
+
+ if (hashtable_has_key (hashtable, "date"))
+ {
+ value = hashtable_get (hashtable, "date");
+ if (value)
+ {
+ hdata_set (hdata, pointer, "date", value);
+ if (line_data->str_time)
+ free (line_data->str_time);
+ line_data->str_time = gui_chat_get_time_string (line_data->date);
+ rc++;
+ }
+ }
+
+ if (hashtable_has_key (hashtable, "date_printed"))
+ {
+ value = hashtable_get (hashtable, "date_printed");
+ if (value)
+ {
+ hdata_set (hdata, pointer, "date_printed", value);
+ rc++;
+ }
+ }
+
+ if (hashtable_has_key (hashtable, "tags_array"))
+ {
+ value = hashtable_get (hashtable, "tags_array");
+ if (line_data->tags_array)
+ string_free_split (line_data->tags_array);
+ if (value)
+ {
+ line_data->tags_array = string_split (value, ",", 0, 0,
+ &line_data->tags_count);
+ }
+ else
+ {
+ line_data->tags_count = 0;
+ line_data->tags_array = NULL;
+ }
+ rc++;
+ }
+
+ if (hashtable_has_key (hashtable, "prefix"))
+ {
+ value = hashtable_get (hashtable, "prefix");
+ hdata_set (hdata, pointer, "prefix", value);
+ line_data->prefix_length = (line_data->prefix) ?
+ gui_chat_strlen_screen (line_data->prefix) : 0;
+ gui_line_compute_prefix_max_length (line_data->buffer->lines);
+ rc++;
+ }
+
+ if (hashtable_has_key (hashtable, "message"))
+ {
+ value = hashtable_get (hashtable, "message");
+ hdata_set (hdata, pointer, "message", value);
+ rc++;
+ }
+
+ gui_buffer_ask_chat_refresh (line_data->buffer, 1);
+
+ return rc;
+}
+
+/*
* gui_line_hdata_line_data_cb: return hdata for line data
*/
@@ -1404,22 +1488,23 @@ gui_line_hdata_line_data_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, NULL, NULL);
+ hdata = hdata_new (NULL, hdata_name, NULL, NULL,
+ 0, &gui_line_hdata_line_data_update_cb, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_line_data, buffer, POINTER, NULL, "buffer");
- HDATA_VAR(struct t_gui_line_data, y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, date, TIME, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, date_printed, TIME, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, str_time, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, tags_array, STRING, "tags_count", NULL);
- HDATA_VAR(struct t_gui_line_data, displayed, CHAR, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, highlight, CHAR, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, refresh_needed, CHAR, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, prefix, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_line_data, message, STRING, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_line_data, y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, date, TIME, 1, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, date_printed, TIME, 1, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, str_time, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, tags_array, STRING, 1, "tags_count", NULL);
+ HDATA_VAR(struct t_gui_line_data, displayed, CHAR, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, highlight, CHAR, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, refresh_needed, CHAR, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, prefix, STRING, 1, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_line_data, message, STRING, 1, NULL, NULL);
}
return hdata;
}
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 879573b0c..d160aae02 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -971,20 +971,21 @@ gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group");
+ hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_nick_group, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick_group, color, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_nick_group, level, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_nick_group, parent, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_nick_group, children, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, NULL, "nick");
- HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, NULL, "nick");
- HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick_group, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick_group, color, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick_group, level, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick_group, parent, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick_group, children, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, 0, NULL, "nick");
+ HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, 0, NULL, "nick");
+ HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -1001,17 +1002,18 @@ gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick");
+ hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_nick, group, POINTER, NULL, "nick_group");
- HDATA_VAR(struct t_gui_nick, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick, color, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick, prefix, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick, prefix_color, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_nick, visible, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_nick, next_nick, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick, group, POINTER, 0, NULL, "nick_group");
+ HDATA_VAR(struct t_gui_nick, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick, color, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick, prefix, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick, prefix_color, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick, visible, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_nick, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index a1cb23c3d..d763ce6e2 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -1609,33 +1609,34 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window");
+ hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_window, number, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_width, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_height, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, bar_windows, POINTER, NULL, "bar_window");
- HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, NULL, "bar_window");
- HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL, NULL);
- HDATA_VAR(struct t_gui_window, buffer, POINTER, NULL, "buffer");
- HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING, NULL, NULL);
- HDATA_VAR(struct t_gui_window, scroll, POINTER, NULL, "window_scroll");
- HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, NULL, "window_tree");
- HDATA_VAR(struct t_gui_window, prev_window, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_window, next_window, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window, number, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_width, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_height, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, bar_windows, POINTER, 0, NULL, "bar_window");
+ HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, 0, NULL, "bar_window");
+ HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, gui_objects, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window, scroll, POINTER, 0, NULL, "window_scroll");
+ HDATA_VAR(struct t_gui_window, ptr_tree, POINTER, 0, NULL, "window_tree");
+ HDATA_VAR(struct t_gui_window, prev_window, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window, next_window, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_windows);
HDATA_LIST(last_gui_window);
HDATA_LIST(gui_current_window);
@@ -1655,19 +1656,20 @@ gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll");
+ hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, NULL, "buffer");
- HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER, NULL, "line");
- HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER, 0, NULL, "line");
+ HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -1684,15 +1686,15 @@ 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);
+ hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_gui_window_tree, child1, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_window_tree, child2, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_gui_window_tree, window, POINTER, NULL, "window");
+ HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_window_tree, child1, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window_tree, child2, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_gui_window_tree, window, POINTER, 0, NULL, "window");
HDATA_LIST(gui_windows_tree);
}
return hdata;
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index 5033e785c..071b3a0ff 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -5102,7 +5102,6 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
{
char timebuffer[64], *result;
time_t time;
- struct tm *date_tmp;
SCM return_value;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -5113,9 +5112,7 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
time = weechat_hdata_time (API_STR2PTR(scm_i_string_chars (hdata)),
API_STR2PTR(scm_i_string_chars (pointer)),
scm_i_string_chars (name));
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
+ snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5145,6 +5142,33 @@ weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name)
}
/*
+ * weechat_guile_api_hdata_update: update data in a hdata
+ */
+
+SCM
+weechat_guile_api_hdata_update (SCM hdata, SCM pointer, SCM hashtable)
+{
+ struct t_hashtable *c_hashtable;
+ int value;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_list_p (hashtable))
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ c_hashtable = weechat_guile_alist_to_hashtable (hashtable,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(scm_i_string_chars (hdata)),
+ API_STR2PTR(scm_i_string_chars (pointer)),
+ c_hashtable);
+
+ if (c_hashtable)
+ weechat_hashtable_free (c_hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat_guile_api_hdata_get_string: get hdata property as string
*/
@@ -5494,6 +5518,7 @@ weechat_guile_api_module_init (void *data)
API_DEF_FUNC(hdata_pointer, 3);
API_DEF_FUNC(hdata_time, 3);
API_DEF_FUNC(hdata_hashtable, 3);
+ API_DEF_FUNC(hdata_update, 3);
API_DEF_FUNC(hdata_get_string, 2);
API_DEF_FUNC(upgrade_new, 2);
API_DEF_FUNC(upgrade_write_object, 3);
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index c1547e12c..638b92ac7 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -876,34 +876,35 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
+ hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, NULL, "irc_nick");
- WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, NULL, "irc_nick");
- WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, NULL, "irc_channel_speaking");
- WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, NULL, "irc_channel_speaking");
- WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, NULL, "buffer");
- WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, 0, NULL, "irc_nick");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, 0, NULL, "irc_nick");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, 0, NULL, "buffer");
+ WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -920,13 +921,14 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
+ hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index fa756fa50..7748f7d05 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -318,16 +318,17 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
+ hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(irc_ignore_list);
WEECHAT_HDATA_LIST(last_irc_ignore);
}
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 00b7bb24e..0ceddf3ba 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -1031,17 +1031,18 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
+ hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 442add9d4..546e707b4 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -963,17 +963,18 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
+ hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, NULL, "irc_server");
- WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, 0, NULL, "irc_server");
+ WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c
index 2bad81e0b..4c0341cc6 100644
--- a/src/plugins/irc/irc-redirect.c
+++ b/src/plugins/irc/irc-redirect.c
@@ -975,17 +975,18 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
+ hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(irc_redirect_patterns);
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
}
@@ -1004,29 +1005,30 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
+ hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, NULL, "irc_server");
- WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, 0, NULL, "irc_server");
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 0873be623..e6a8fc179 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -4367,75 +4367,76 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server");
+ hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, STRING, "addresses_count", NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, INTEGER, "addresses_count", NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, NULL, "hook");
- WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, NULL, "hook");
- WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, NULL, "hook");
- WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, NULL, "hook");
- WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, STRING, 0, "addresses_count", NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, INTEGER, 0, "addresses_count", NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, 0, NULL, "hook");
+ WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, 0, NULL, "hook");
+ WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, 0, NULL, "hook");
+ WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, 0, NULL, "hook");
+ WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, 0, NULL, NULL);
#ifdef HAVE_GNUTLS
- WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, 0, NULL, NULL);
#endif
- WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, "nicks_count", NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, NULL, "irc_redirect");
- WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, NULL, "irc_redirect");
- WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, NULL, "irc_notify");
- WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, NULL, "irc_notify");
- WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, NULL, "buffer");
- WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, NULL, "irc_channel");
- WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, NULL, "irc_channel");
- WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, 0, "nicks_count", NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, 0, NULL, "irc_redirect");
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, 0, NULL, "irc_redirect");
+ WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, 0, NULL, "irc_notify");
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, 0, NULL, "irc_notify");
+ WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, 0, NULL, "buffer");
+ WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, 0, NULL, "irc_channel");
+ WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, 0, NULL, "irc_channel");
+ WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(irc_servers);
WEECHAT_HDATA_LIST(last_irc_server);
}
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 70aeb8fe9..618cc3cd3 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -5627,7 +5627,6 @@ weechat_lua_api_hdata_time (lua_State *L)
{
const char *hdata, *pointer, *name;
time_t time;
- struct tm *date_tmp;
char timebuffer[64], *result;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -5642,9 +5641,7 @@ weechat_lua_api_hdata_time (lua_State *L)
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
+ snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5677,6 +5674,36 @@ weechat_lua_api_hdata_hashtable (lua_State *L)
}
/*
+ * weechat_lua_api_hdata_update: update data in a hdata
+ */
+
+static int
+weechat_lua_api_hdata_update (lua_State *L)
+{
+ const char *hdata, *pointer;
+ struct t_hashtable *hashtable;
+ int value;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ if (lua_gettop (lua_current_interpreter) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ hdata = lua_tostring (lua_current_interpreter, -3);
+ pointer = lua_tostring (lua_current_interpreter, -2);
+ hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(hdata),
+ API_STR2PTR(pointer),
+ hashtable);
+
+ if (hashtable)
+ weechat_hashtable_free (hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat_lua_api_hdata_get_string: get hdata property as string
*/
@@ -6419,6 +6446,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(hdata_pointer),
API_DEF_FUNC(hdata_time),
API_DEF_FUNC(hdata_hashtable),
+ API_DEF_FUNC(hdata_update),
API_DEF_FUNC(hdata_get_string),
API_DEF_FUNC(upgrade_new),
API_DEF_FUNC(upgrade_write_object),
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index cb79f3fbf..c0e05ac8e 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -5358,7 +5358,6 @@ XS (XS_weechat_api_hdata_pointer)
XS (XS_weechat_api_hdata_time)
{
time_t time;
- struct tm *date_tmp;
char timebuffer[64], *result, *hdata, *pointer, *name;
dXSARGS;
@@ -5374,9 +5373,7 @@ XS (XS_weechat_api_hdata_time)
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
+ snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5410,6 +5407,36 @@ XS (XS_weechat_api_hdata_hashtable)
}
/*
+ * weechat::hdata_update: update data in a hdata
+ */
+
+XS (XS_weechat_api_hdata_update)
+{
+ char *hdata, *pointer;
+ struct t_hashtable *hashtable;
+ int value;
+ dXSARGS;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ if (items < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ hdata = SvPV_nolen (ST (0));
+ pointer = SvPV_nolen (ST (1));
+ hashtable = weechat_perl_hash_to_hashtable (ST (2),
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(hdata),
+ API_STR2PTR(pointer),
+ hashtable);
+
+ if (hashtable)
+ weechat_hashtable_free (hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat::hdata_get_string: get hdata property as string
*/
@@ -5763,6 +5790,7 @@ weechat_perl_api_init (pTHX)
API_DEF_FUNC(hdata_pointer);
API_DEF_FUNC(hdata_time);
API_DEF_FUNC(hdata_hashtable);
+ API_DEF_FUNC(hdata_update);
API_DEF_FUNC(hdata_get_string);
API_DEF_FUNC(upgrade_new);
API_DEF_FUNC(upgrade_write_object);
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 3d29ed062..b1df0f49d 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -1202,22 +1202,23 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
{
struct t_hdata *hdata;
- hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
+ hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, 0, NULL, hdata_name);
weechat_hdata_new_list (hdata, "scripts", scripts);
weechat_hdata_new_list (hdata, "last_script", last_script);
}
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 8fa3f1e87..64ce41b6d 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -756,6 +756,8 @@ plugin_load (const char *filename, int argc, char **argv)
new_plugin->hdata_pointer = &hdata_pointer;
new_plugin->hdata_time = &hdata_time;
new_plugin->hdata_hashtable = &hdata_hashtable;
+ new_plugin->hdata_set = &hdata_set;
+ new_plugin->hdata_update = &hdata_update;
new_plugin->hdata_get_string = &hdata_get_string;
new_plugin->upgrade_new = &upgrade_file_new;
@@ -1211,20 +1213,21 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin");
+ hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin",
+ 0, NULL, NULL);
if (hdata)
{
- HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL, NULL);
- HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, NULL, hdata_name);
- HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, NULL, hdata_name);
+ HDATA_VAR(struct t_weechat_plugin, filename, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, handle, POINTER, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, name, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, description, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, author, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, version, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, license, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, charset, STRING, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name);
+ HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name);
HDATA_LIST(weechat_plugins);
HDATA_LIST(last_weechat_plugin);
}
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index ddb6ef9ca..291d2b4e6 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -388,7 +388,7 @@ weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
char *string, *replacement, *result;
PyObject *return_value;
- API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
+ API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
string = NULL;
replacement = NULL;
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
@@ -2075,6 +2075,7 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
API_FUNC(1, "key_bind", API_RETURN_INT(0));
context = NULL;
+ dict = NULL;
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
API_WRONG_ARGS(API_RETURN_INT(0));
@@ -2641,6 +2642,7 @@ weechat_python_api_hook_process_hashtable (PyObject *self, PyObject *args)
API_FUNC(1, "hook_process_hashtable", API_RETURN_EMPTY);
command = NULL;
+ dict = NULL;
options = NULL;
timeout = 0;
function = NULL;
@@ -3066,6 +3068,7 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
signal = NULL;
+ dict = NULL;
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
API_WRONG_ARGS(API_RETURN_ERROR);
@@ -4829,6 +4832,7 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
info_name = NULL;
+ dict = NULL;
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
API_WRONG_ARGS(API_RETURN_EMPTY);
hashtable = weechat_python_dict_to_hashtable (dict,
@@ -5543,10 +5547,8 @@ weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_hdata_time (PyObject *self, PyObject *args)
{
- char *hdata, *pointer, *name, timebuffer[64], *result;
+ char *hdata, *pointer, *name;
time_t time;
- struct tm *date_tmp;
- PyObject *return_value;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
hdata = NULL;
@@ -5555,16 +5557,11 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
API_WRONG_ARGS(API_RETURN_EMPTY);
- timebuffer[0] = '\0';
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
- result = strdup (timebuffer);
- API_RETURN_STRING_FREE(result);
+ API_RETURN_LONG(time);
}
/*
@@ -5594,6 +5591,37 @@ weechat_python_api_hdata_hashtable (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_hdata_update: updata data in a hdata
+ */
+
+static PyObject *
+weechat_python_api_hdata_update (PyObject *self, PyObject *args)
+{
+ char *hdata, *pointer;
+ struct t_hashtable *hashtable;
+ PyObject *dict;
+ int value;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ hdata = NULL;
+ pointer = NULL;
+ dict = NULL;
+ if (!PyArg_ParseTuple (args, "ssO", &hdata, &pointer, &dict))
+ API_WRONG_ARGS(API_RETURN_INT(0));
+ hashtable = weechat_python_dict_to_hashtable (dict,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(hdata),
+ API_STR2PTR(pointer),
+ hashtable);
+
+ if (hashtable)
+ weechat_hashtable_free (hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat_python_api_hdata_get_string: get hdata property as string
*/
@@ -5939,6 +5967,7 @@ PyMethodDef weechat_python_funcs[] =
API_DEF_FUNC(hdata_pointer),
API_DEF_FUNC(hdata_time),
API_DEF_FUNC(hdata_hashtable),
+ API_DEF_FUNC(hdata_update),
API_DEF_FUNC(hdata_get_string),
API_DEF_FUNC(upgrade_new),
API_DEF_FUNC(upgrade_write_object),
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 17eb4f79e..6d5978e10 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -6382,7 +6382,6 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
time_t time;
- struct tm *date_tmp;
VALUE return_value;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -6401,9 +6400,7 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
time = weechat_hdata_time (API_STR2PTR(c_hdata),
API_STR2PTR(c_pointer),
c_name);
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
+ snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -6442,6 +6439,41 @@ weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer,
}
/*
+ * weechat_ruby_api_hdata_update: update data in a hdata
+ */
+
+static VALUE
+weechat_ruby_api_hdata_update (VALUE class, VALUE hdata, VALUE pointer,
+ VALUE hashtable)
+{
+ char *c_hdata, *c_pointer;
+ struct t_hashtable *c_hashtable;
+ int value;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (hashtable))
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ Check_Type (hdata, T_STRING);
+ Check_Type (pointer, T_STRING);
+ Check_Type (hashtable, T_HASH);
+
+ c_hdata = StringValuePtr (hdata);
+ c_pointer = StringValuePtr (pointer);
+ c_hashtable = weechat_ruby_hash_to_hashtable (hashtable,
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(c_hdata),
+ API_STR2PTR(c_pointer),
+ c_hashtable);
+
+ if (c_hashtable)
+ weechat_hashtable_free (c_hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat_ruby_api_hdata_get_string: get hdata property as string
*/
@@ -6859,6 +6891,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(hdata_pointer, 3);
API_DEF_FUNC(hdata_time, 3);
API_DEF_FUNC(hdata_hashtable, 3);
+ API_DEF_FUNC(hdata_update, 3);
API_DEF_FUNC(hdata_get_string, 2);
API_DEF_FUNC(upgrade_new, 2);
API_DEF_FUNC(upgrade_write_object, 3);
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index 5b3fc08fb..2afa13611 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -1318,32 +1318,33 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
- hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
+ hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
+ 0, NULL, NULL);
if (hdata)
{
- WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, 0, NULL, hdata_name);
+ WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(repo_scripts);
WEECHAT_HDATA_LIST(last_repo_script);
}
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 6b05eb87d..1ea448691 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -6103,7 +6103,6 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
time_t time;
- struct tm *date_tmp;
char timebuffer[64], *result, *hdata, *pointer, *name;
int i;
@@ -6119,9 +6118,7 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
- date_tmp = localtime (&time);
- if (date_tmp)
- strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
+ snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -6158,6 +6155,38 @@ weechat_tcl_api_hdata_hashtable (ClientData clientData, Tcl_Interp *interp,
}
/*
+ * weechat_tcl_api_hdata_update: update data in a hdata
+ */
+
+static int
+weechat_tcl_api_hdata_update (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *hdata, *pointer;
+ struct t_hashtable *hashtable;
+ int i, value;
+
+ API_FUNC(1, "hdata_update", API_RETURN_INT(0));
+ if (objc < 4)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ hdata = Tcl_GetStringFromObj (objv[1], &i);
+ pointer = Tcl_GetStringFromObj (objv[2], &i);
+ hashtable = weechat_tcl_dict_to_hashtable (interp, objv[3],
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
+
+ value = weechat_hdata_update (API_STR2PTR(hdata),
+ API_STR2PTR(pointer),
+ hashtable);
+
+ if (hashtable)
+ weechat_hashtable_free (hashtable);
+
+ API_RETURN_INT(value);
+}
+
+/*
* weechat_tcl_api_hdata_get_string: get hdata property as string
*/
@@ -6624,6 +6653,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
API_DEF_FUNC(hdata_pointer);
API_DEF_FUNC(hdata_time);
API_DEF_FUNC(hdata_hashtable);
+ API_DEF_FUNC(hdata_update);
API_DEF_FUNC(hdata_get_string);
API_DEF_FUNC(upgrade_new);
API_DEF_FUNC(upgrade_write_object);
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index b5f14851b..08ed8cd40 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 "20120804-01"
+#define WEECHAT_PLUGIN_API_VERSION "20120827-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -833,9 +833,15 @@ struct t_weechat_plugin
/* hdata */
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
- const char *var_next);
+ const char *var_next,
+ int delete_allowed,
+ int (*callback_update)(void *data,
+ struct t_hdata *hdata,
+ void *pointer,
+ struct t_hashtable *hashtable),
+ void *callback_update_data);
void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset,
- int type, const char *array_size,
+ int type, int update_allowed, const char *array_size,
const char *hdata_name);
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
void *pointer);
@@ -874,6 +880,10 @@ struct t_weechat_plugin
const char *name);
struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata,
void *pointer, const char *name);
+ int (*hdata_set) (struct t_hdata *hdata, void *pointer, const char *name,
+ const char *value);
+ int (*hdata_update) (struct t_hdata *hdata, void *pointer,
+ struct t_hashtable *hashtable);
const char *(*hdata_get_string) (struct t_hdata *hdata,
const char *property);
@@ -1598,18 +1608,24 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->infolist_free(__list)
/* hdata */
-#define weechat_hdata_new(__hdata_name, __var_prev, __var_next) \
+#define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \
+ __delete_allowed, __callback_update, \
+ __callback_update_data) \
weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \
- __var_next)
+ __var_next, __delete_allowed, \
+ __callback_update, \
+ __callback_update_data)
#define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
- __array_size, __hdata_name) \
+ __update_allowed, __array_size, \
+ __hdata_name) \
weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type, \
- __array_size, __hdata_name)
-#define WEECHAT_HDATA_VAR(__struct, __name, __type, __array_size, \
- __hdata_name) \
+ __update_allowed, __array_size, \
+ __hdata_name)
+#define WEECHAT_HDATA_VAR(__struct, __name, __type, __update_allowed, \
+ __array_size, __hdata_name) \
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
- WEECHAT_HDATA_##__type, __array_size, \
- __hdata_name)
+ WEECHAT_HDATA_##__type, __update_allowed, \
+ __array_size, __hdata_name)
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
#define WEECHAT_HDATA_LIST(__name) \
@@ -1656,6 +1672,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->hdata_time(__hdata, __pointer, __name)
#define weechat_hdata_hashtable(__hdata, __pointer, __name) \
weechat_plugin->hdata_hashtable(__hdata, __pointer, __name)
+#define weechat_hdata_set(__hdata, __pointer, __name, __value) \
+ weechat_plugin->hdata_set(__hdata, __pointer, __name, __value)
+#define weechat_hdata_update(__hdata, __pointer, __hashtable) \
+ weechat_plugin->hdata_update(__hdata, __pointer, __hashtable)
#define weechat_hdata_get_string(__hdata, __property) \
weechat_plugin->hdata_get_string(__hdata, __property)