diff options
Diffstat (limited to 'src')
29 files changed, 152 insertions, 88 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index db34d95ee..505e14a8c 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -2607,7 +2607,7 @@ config_file_hdata_config_file_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_config", "next_config", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_config_file, plugin, POINTER, 0, NULL, "plugin"); @@ -2639,7 +2639,7 @@ config_file_hdata_config_section_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_section", "next_section", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_config_section, config_file, POINTER, 0, NULL, "config_file"); @@ -2677,7 +2677,7 @@ config_file_hdata_config_option_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_option", "next_option", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_config_option, config_file, POINTER, 0, NULL, "config_file"); diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index 827573cc5..0ccad400d 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -75,7 +75,7 @@ hdata_free_var (struct t_hashtable *hashtable, struct t_hdata * hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, const char *var_prev, const char *var_next, - int delete_allowed, + int create_allowed, int delete_allowed, int (*callback_update)(void *data, struct t_hdata *hdata, void *pointer, @@ -107,6 +107,7 @@ hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, NULL, NULL); hashtable_set (weechat_hdata, hdata_name, new_hdata); + new_hdata->create_allowed = create_allowed; new_hdata->delete_allowed = delete_allowed; new_hdata->callback_update = callback_update; new_hdata->callback_update_data = callback_update_data; @@ -816,6 +817,10 @@ hdata_update (struct t_hdata *hdata, void *pointer, if (!hdata || !hashtable || !hdata->callback_update) return 0; + /* check if create of structure is allowed */ + if (hashtable_has_key (hashtable, "__create_allowed")) + return (int)hdata->create_allowed; + /* check if delete of structure is allowed */ if (hashtable_has_key (hashtable, "__delete_allowed")) return (int)hdata->delete_allowed; @@ -832,9 +837,6 @@ hdata_update (struct t_hdata *hdata, void *pointer, return (var->update_allowed) ? 1 : 0; } - if (!pointer) - return 0; - /* update data */ hdata->update_pending = 1; rc = (hdata->callback_update) (hdata->callback_update_data, @@ -1003,6 +1005,7 @@ hdata_print_log_map_cb (void *data, struct t_hashtable *hashtable, log_printf (" hash_list. . . . . . . : 0x%lx (hashtable: '%s')", ptr_hdata->hash_list, hashtable_get_string (ptr_hdata->hash_list, "keys_values")); + log_printf (" create_allowed . . . . : %d", (int)ptr_hdata->create_allowed); log_printf (" delete_allowed . . . . : %d", (int)ptr_hdata->delete_allowed); log_printf (" callback_update. . . . : 0x%lx", ptr_hdata->callback_update); log_printf (" callback_update_data . : 0x%lx", ptr_hdata->callback_update_data); diff --git a/src/core/wee-hdata.h b/src/core/wee-hdata.h index 3139af4ef..f67637e8f 100644 --- a/src/core/wee-hdata.h +++ b/src/core/wee-hdata.h @@ -48,6 +48,7 @@ struct t_hdata struct t_hashtable *hash_list; /* hashtable with pointers on lists */ /* (used to search objects) */ + char create_allowed; /* create allowed? */ char delete_allowed; /* delete allowed? */ int (*callback_update) /* update callback */ (void *data, @@ -67,7 +68,7 @@ extern char *hdata_type_string[]; extern struct t_hdata *hdata_new (struct t_weechat_plugin *plugin, const char *hdata_name, const char *var_prev, const char *var_next, - int delete_allowed, + int create_allowed, int delete_allowed, int (*callback_update)(void *data, struct t_hdata *hdata, void *pointer, diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index fabf86045..ed8109334 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -356,7 +356,7 @@ upgrade_weechat_save () return 0; rc = 1; - rc &= upgrade_weechat_save_history (upgrade_file, last_history_global); + rc &= upgrade_weechat_save_history (upgrade_file, last_gui_history); rc &= upgrade_weechat_save_buffers (upgrade_file); rc &= upgrade_weechat_save_misc (upgrade_file); rc &= upgrade_weechat_save_hotlist (upgrade_file); diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index f4efc03b0..25a584344 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1900,7 +1900,7 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, 0, NULL, "plugin"); diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 66ac6f6e5..29406b49f 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -1405,7 +1405,7 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_bar_window, bar, POINTER, 0, NULL, "bar"); diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 66c839416..32fb6f33a 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -2253,7 +2253,7 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_bar, name, STRING, 0, NULL, NULL); diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 05cb8aa77..db9879506 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -3151,7 +3151,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_buffer, plugin, POINTER, 0, NULL, "plugin"); @@ -3240,7 +3240,7 @@ gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_undo", "next_undo", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_input_undo, data, STRING, 0, NULL, NULL); @@ -3264,7 +3264,7 @@ gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_buffer", "next_buffer", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER, 0, NULL, "buffer"); diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index 74581da13..e83c00f3b 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1215,7 +1215,7 @@ gui_completion_hdata_completion_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, NULL, NULL, - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_completion, buffer, POINTER, 0, NULL, "buffer"); @@ -1255,7 +1255,7 @@ gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_completion_partial, word, STRING, 0, NULL, NULL); diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index 8df37a261..01a45c833 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -450,7 +450,7 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_filter, enabled, INTEGER, 0, NULL, NULL); diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c index c9071ccee..01d82284a 100644 --- a/src/gui/gui-history.c +++ b/src/gui/gui-history.c @@ -27,11 +27,13 @@ #endif #include <stdlib.h> +#include <stdio.h> #include <stddef.h> #include <string.h> #include "../core/weechat.h" #include "../core/wee-config.h" +#include "../core/wee-hashtable.h" #include "../core/wee-hdata.h" #include "../core/wee-hook.h" #include "../core/wee-infolist.h" @@ -41,10 +43,10 @@ #include "gui-buffer.h" -struct t_gui_history *history_global = NULL; -struct t_gui_history *last_history_global = NULL; -struct t_gui_history *history_global_ptr = NULL; -int num_history_global = 0; +struct t_gui_history *gui_history = NULL; +struct t_gui_history *last_gui_history = NULL; +struct t_gui_history *gui_history_ptr = NULL; +int num_gui_history = 0; /* @@ -106,36 +108,36 @@ gui_history_global_add (const char *string) if (!string) return; - if (!history_global - || (history_global - && (strcmp (history_global->text, string) != 0))) + if (!gui_history + || (gui_history + && (strcmp (gui_history->text, string) != 0))) { new_history = malloc (sizeof (*new_history)); if (new_history) { new_history->text = strdup (string); - if (history_global) - history_global->prev_history = new_history; + if (gui_history) + gui_history->prev_history = new_history; else - last_history_global = new_history; - new_history->next_history = history_global; + last_gui_history = new_history; + new_history->next_history = gui_history; new_history->prev_history = NULL; - history_global = new_history; - num_history_global++; + gui_history = new_history; + num_gui_history++; /* remove one command if necessary */ if ((CONFIG_INTEGER(config_history_max_commands) > 0) - && (num_history_global > CONFIG_INTEGER(config_history_max_commands))) + && (num_gui_history > CONFIG_INTEGER(config_history_max_commands))) { - ptr_history = last_history_global->prev_history; - if (history_global_ptr == last_history_global) - history_global_ptr = ptr_history; - (last_history_global->prev_history)->next_history = NULL; - if (last_history_global->text) - free (last_history_global->text); - free (last_history_global); - last_history_global = ptr_history; - num_history_global--; + ptr_history = last_gui_history->prev_history; + if (gui_history_ptr == last_gui_history) + gui_history_ptr = ptr_history; + (last_gui_history->prev_history)->next_history = NULL; + if (last_gui_history->text) + free (last_gui_history->text); + free (last_gui_history); + last_gui_history = ptr_history; + num_gui_history--; } } } @@ -177,18 +179,18 @@ gui_history_global_free () { struct t_gui_history *ptr_history; - while (history_global) + while (gui_history) { - ptr_history = history_global->next_history; - if (history_global->text) - free (history_global->text); - free (history_global); - history_global = ptr_history; + ptr_history = gui_history->next_history; + if (gui_history->text) + free (gui_history->text); + free (gui_history); + gui_history = ptr_history; } - history_global = NULL; - last_history_global = NULL; - history_global_ptr = NULL; - num_history_global = 0; + gui_history = NULL; + last_gui_history = NULL; + gui_history_ptr = NULL; + num_gui_history = 0; } @@ -216,6 +218,62 @@ gui_history_buffer_free (struct t_gui_buffer *buffer) } /* + * gui_history_hdata_history_update_cb: callback for updating history + */ + +int +gui_history_hdata_history_update_cb (void *data, + struct t_hdata *hdata, + void *pointer, + struct t_hashtable *hashtable) +{ + struct t_gui_history *ptr_history; + struct t_gui_buffer *ptr_buffer; + const char *text, *buffer; + long unsigned int value; + int rc; + + /* make C compiler happy */ + (void) data; + + rc = 0; + + text = hashtable_get (hashtable, "text"); + if (!text) + return rc; + + if (pointer) + { + /* update history */ + ptr_history = (struct t_gui_history *)pointer; + if (ptr_history->text) + free (ptr_history->text); + ptr_history->text = strdup (text); + } + else + { + /* create new entry in history */ + ptr_buffer = NULL; + if (hashtable_has_key (hashtable, "buffer")) + { + buffer = hashtable_get (hashtable, "buffer"); + if (buffer) + { + rc = sscanf (buffer, "%lx", &value); + if ((rc != EOF) && (rc != 0)) + ptr_buffer = (struct t_gui_buffer *)value; + } + } + if (ptr_buffer) + gui_history_add (ptr_buffer, text); + else + gui_history_global_add (text); + } + + return rc; +} + +/* * gui_history_hdata_history_cb: return hdata for history */ @@ -228,12 +286,14 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history", - 0, NULL, NULL); + 1, 1, &gui_history_hdata_history_update_cb, NULL); if (hdata) { HDATA_VAR(struct t_gui_history, text, STRING, 0, NULL, NULL); HDATA_VAR(struct t_gui_history, prev_history, POINTER, 0, NULL, hdata_name); HDATA_VAR(struct t_gui_history, next_history, POINTER, 0, NULL, hdata_name); + HDATA_LIST(gui_history); + HDATA_LIST(last_gui_history); } return hdata; } diff --git a/src/gui/gui-history.h b/src/gui/gui-history.h index 79bce5230..7a4447cec 100644 --- a/src/gui/gui-history.h +++ b/src/gui/gui-history.h @@ -29,9 +29,9 @@ struct t_gui_history struct t_gui_history *prev_history;/* link to previous text/command */ }; -extern struct t_gui_history *history_global; -extern struct t_gui_history *last_history_global; -extern struct t_gui_history *history_global_ptr; +extern struct t_gui_history *gui_history; +extern struct t_gui_history *last_gui_history; +extern struct t_gui_history *gui_history_ptr; extern void gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string); diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index 7ebc9750e..1837897ea 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -475,7 +475,7 @@ gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, 0, NULL, NULL); diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index a4dc2ef69..735d335bb 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -391,7 +391,7 @@ gui_input_return (struct t_gui_buffer *buffer) gui_completion_stop (window->buffer->completion, 1); gui_buffer_undo_free_all (window->buffer); window->buffer->ptr_history = NULL; - history_global_ptr = NULL; + gui_history_ptr = NULL; gui_input_optimize_size (window->buffer); gui_input_text_changed_modifier_and_signal (window->buffer, 0); input_data (window->buffer, command); @@ -1215,8 +1215,8 @@ gui_input_history_global_previous (struct t_gui_buffer *buffer) if (window) { gui_input_history_previous (window, - history_global, - &history_global_ptr); + gui_history, + &gui_history_ptr); } } @@ -1234,8 +1234,8 @@ gui_input_history_global_next (struct t_gui_buffer *buffer) if (window) { gui_input_history_next (window, - history_global, - &history_global_ptr); + gui_history, + &gui_history_ptr); } } diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c index 16e87677a..4a415b5ea 100644 --- a/src/gui/gui-key.c +++ b/src/gui/gui-key.c @@ -1751,7 +1751,7 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_key, key, STRING, 0, NULL, NULL); diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index c9a32a532..19fed22ac 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -1351,7 +1351,7 @@ gui_line_hdata_lines_cb (void *data, const char *hdata_name) /* make C compiler happy */ (void) data; - hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL); + hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_lines, first_line, POINTER, 0, NULL, "line"); @@ -1379,7 +1379,7 @@ gui_line_hdata_line_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_line", "next_line", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_line, data, POINTER, 0, NULL, "line_data"); @@ -1486,7 +1486,7 @@ gui_line_hdata_line_data_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, NULL, NULL, - 0, &gui_line_hdata_line_data_update_cb, NULL); + 0, 0, &gui_line_hdata_line_data_update_cb, NULL); if (hdata) { HDATA_VAR(struct t_gui_line_data, buffer, POINTER, 0, NULL, "buffer"); diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index d160aae02..ba6e32c0c 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -972,7 +972,7 @@ gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_nick_group, name, STRING, 0, NULL, NULL); @@ -1003,7 +1003,7 @@ gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_nick, group, POINTER, 0, NULL, "nick_group"); diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index d763ce6e2..31ee5cc9a 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1610,7 +1610,7 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_window", "next_window", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_window, number, INTEGER, 0, NULL, NULL); @@ -1657,7 +1657,7 @@ gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_scroll", "next_scroll", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER, 0, NULL, "buffer"); @@ -1686,7 +1686,7 @@ gui_window_hdata_window_tree_cb (void *data, const char *hdata_name) /* make C compiler happy */ (void) data; - hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, NULL, NULL); + hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER, 0, NULL, hdata_name); diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index d47d7c048..3b58896ce 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -895,7 +895,7 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, 0, NULL, NULL); @@ -940,7 +940,7 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, 0, NULL, NULL); diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c index 7748f7d05..b13a3c23e 100644 --- a/src/plugins/irc/irc-ignore.c +++ b/src/plugins/irc/irc-ignore.c @@ -319,7 +319,7 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, 0, NULL, NULL); diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 0ceddf3ba..2ea99207d 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -1032,7 +1032,7 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, 0, NULL, NULL); diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c index 12547461d..d51ead139 100644 --- a/src/plugins/irc/irc-notify.c +++ b/src/plugins/irc/irc-notify.c @@ -964,7 +964,7 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, 0, NULL, "irc_server"); diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c index 4c0341cc6..c938a5b57 100644 --- a/src/plugins/irc/irc-redirect.c +++ b/src/plugins/irc/irc-redirect.c @@ -976,7 +976,7 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, 0, NULL, NULL); @@ -1006,7 +1006,7 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, 0, NULL, "irc_server"); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index b4dc4d7ee..4e625f276 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -4440,7 +4440,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, 0, NULL, NULL); diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 90b9bca0f..ede44e2e4 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -641,7 +641,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, if (ptr_infolist) { for (ptr_history = (pointer) ? - ((struct t_gui_buffer *)pointer)->history : history_global; + ((struct t_gui_buffer *)pointer)->history : gui_history; ptr_history; ptr_history = ptr_history->next_history) { if (!gui_history_add_to_infolist (ptr_infolist, ptr_history)) diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c index bc2babc49..fa5348869 100644 --- a/src/plugins/plugin-script.c +++ b/src/plugins/plugin-script.c @@ -1203,7 +1203,7 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin, struct t_hdata *hdata; hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, 0, NULL, NULL); diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index dfec3a14c..0f0fa7faa 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -1220,7 +1220,7 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name) (void) data; hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { HDATA_VAR(struct t_weechat_plugin, filename, STRING, 0, NULL, NULL); diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index 3039ab2b5..fd3ae7ee0 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -1470,7 +1470,7 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name) (void) data; hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script", - 0, NULL, NULL); + 0, 0, NULL, NULL); if (hdata) { WEECHAT_HDATA_VAR(struct t_script_repo, name, STRING, 0, NULL, NULL); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 8b55e560c..189d0dd8a 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -50,7 +50,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20121102-01" +#define WEECHAT_PLUGIN_API_VERSION "20121208-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -843,7 +843,7 @@ struct t_weechat_plugin struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin, const char *hdata_name, const char *var_prev, const char *var_next, - int delete_allowed, + int create_allowed, int delete_allowed, int (*callback_update)(void *data, struct t_hdata *hdata, void *pointer, @@ -1623,11 +1623,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); /* hdata */ #define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \ - __delete_allowed, __callback_update, \ - __callback_update_data) \ + __create_allowed, __delete_allowed, \ + __callback_update, __callback_update_data) \ weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \ - __var_next, __delete_allowed, \ - __callback_update, \ + __var_next, __create_allowed, \ + __delete_allowed, __callback_update, \ __callback_update_data) #define weechat_hdata_new_var(__hdata, __name, __offset, __type, \ __update_allowed, __array_size, \ |