summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/CMakeLists.txt3
-rw-r--r--src/plugins/Makefile.am2
-rw-r--r--src/plugins/alias/alias-command.c6
-rw-r--r--src/plugins/alias/alias-completion.c12
-rw-r--r--src/plugins/alias/alias-config.c76
-rw-r--r--src/plugins/alias/alias-info.c14
-rw-r--r--src/plugins/alias/alias.c8
-rw-r--r--src/plugins/aspell/weechat-aspell-bar-item.c14
-rw-r--r--src/plugins/aspell/weechat-aspell-command.c6
-rw-r--r--src/plugins/aspell/weechat-aspell-completion.c11
-rw-r--r--src/plugins/aspell/weechat-aspell-config.c138
-rw-r--r--src/plugins/aspell/weechat-aspell-info.c6
-rw-r--r--src/plugins/aspell/weechat-aspell-speller.c9
-rw-r--r--src/plugins/aspell/weechat-aspell.c32
-rw-r--r--src/plugins/charset/charset.c83
-rw-r--r--src/plugins/exec/exec-buffer.c12
-rw-r--r--src/plugins/exec/exec-command.c12
-rw-r--r--src/plugins/exec/exec-completion.c6
-rw-r--r--src/plugins/exec/exec-config.c37
-rw-r--r--src/plugins/exec/exec.c23
-rw-r--r--src/plugins/exec/exec.h3
-rw-r--r--src/plugins/fifo/fifo-command.c6
-rw-r--r--src/plugins/fifo/fifo-info.c6
-rw-r--r--src/plugins/fifo/fifo.c17
-rw-r--r--src/plugins/guile/weechat-guile-api.c678
-rw-r--r--src/plugins/guile/weechat-guile-api.h6
-rw-r--r--src/plugins/guile/weechat-guile.c71
-rw-r--r--src/plugins/irc/irc-bar-item.c69
-rw-r--r--src/plugins/irc/irc-buffer.c13
-rw-r--r--src/plugins/irc/irc-buffer.h8
-rw-r--r--src/plugins/irc/irc-channel.c29
-rw-r--r--src/plugins/irc/irc-channel.h9
-rw-r--r--src/plugins/irc/irc-color.c6
-rw-r--r--src/plugins/irc/irc-color.h3
-rw-r--r--src/plugins/irc/irc-command.c533
-rw-r--r--src/plugins/irc/irc-command.h6
-rw-r--r--src/plugins/irc/irc-completion.c96
-rw-r--r--src/plugins/irc/irc-config.c1055
-rw-r--r--src/plugins/irc/irc-config.h12
-rw-r--r--src/plugins/irc/irc-debug.c7
-rw-r--r--src/plugins/irc/irc-ignore.c4
-rw-r--r--src/plugins/irc/irc-ignore.h3
-rw-r--r--src/plugins/irc/irc-info.c173
-rw-r--r--src/plugins/irc/irc-input.c8
-rw-r--r--src/plugins/irc/irc-input.h8
-rw-r--r--src/plugins/irc/irc-message.c6
-rw-r--r--src/plugins/irc/irc-nick.c4
-rw-r--r--src/plugins/irc/irc-nick.h5
-rw-r--r--src/plugins/irc/irc-notify.c20
-rw-r--r--src/plugins/irc/irc-notify.h9
-rw-r--r--src/plugins/irc/irc-protocol.c7
-rw-r--r--src/plugins/irc/irc-raw.c7
-rw-r--r--src/plugins/irc/irc-redirect.c22
-rw-r--r--src/plugins/irc/irc-redirect.h12
-rw-r--r--src/plugins/irc/irc-server.c116
-rw-r--r--src/plugins/irc/irc-server.h27
-rw-r--r--src/plugins/irc/irc-upgrade.c25
-rw-r--r--src/plugins/irc/irc.c44
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp749
-rw-r--r--src/plugins/javascript/weechat-js-api.h6
-rw-r--r--src/plugins/javascript/weechat-js.cpp73
-rw-r--r--src/plugins/logger/logger-config.c152
-rw-r--r--src/plugins/logger/logger-info.c15
-rw-r--r--src/plugins/logger/logger.c66
-rw-r--r--src/plugins/logger/logger.h3
-rw-r--r--src/plugins/lua/weechat-lua-api.c681
-rw-r--r--src/plugins/lua/weechat-lua-api.h6
-rw-r--r--src/plugins/lua/weechat-lua.c70
-rw-r--r--src/plugins/perl/weechat-perl-api.c682
-rw-r--r--src/plugins/perl/weechat-perl-api.h6
-rw-r--r--src/plugins/perl/weechat-perl.c83
-rw-r--r--src/plugins/plugin-api.c411
-rw-r--r--src/plugins/plugin-config.c62
-rw-r--r--src/plugins/plugin-script-api.c910
-rw-r--r--src/plugins/plugin-script-api.h132
-rw-r--r--src/plugins/plugin-script-callback.c202
-rw-r--r--src/plugins/plugin-script-callback.h50
-rw-r--r--src/plugins/plugin-script.c395
-rw-r--r--src/plugins/plugin-script.h43
-rw-r--r--src/plugins/plugin.c21
-rw-r--r--src/plugins/plugin.h3
-rw-r--r--src/plugins/python/weechat-python-api.c668
-rw-r--r--src/plugins/python/weechat-python-api.h6
-rw-r--r--src/plugins/python/weechat-python.c81
-rw-r--r--src/plugins/relay/irc/relay-irc.c43
-rw-r--r--src/plugins/relay/relay-buffer.c12
-rw-r--r--src/plugins/relay/relay-buffer.h8
-rw-r--r--src/plugins/relay/relay-client.c34
-rw-r--r--src/plugins/relay/relay-client.h5
-rw-r--r--src/plugins/relay/relay-command.c17
-rw-r--r--src/plugins/relay/relay-completion.c18
-rw-r--r--src/plugins/relay/relay-config.c222
-rw-r--r--src/plugins/relay/relay-config.h2
-rw-r--r--src/plugins/relay/relay-info.c20
-rw-r--r--src/plugins/relay/relay-raw.c7
-rw-r--r--src/plugins/relay/relay-server.c7
-rw-r--r--src/plugins/relay/relay-upgrade.c13
-rw-r--r--src/plugins/relay/relay.c14
-rw-r--r--src/plugins/relay/weechat/relay-weechat-msg.c3
-rw-r--r--src/plugins/relay/weechat/relay-weechat-protocol.c35
-rw-r--r--src/plugins/relay/weechat/relay-weechat-protocol.h15
-rw-r--r--src/plugins/relay/weechat/relay-weechat.c33
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c708
-rw-r--r--src/plugins/ruby/weechat-ruby-api.h6
-rw-r--r--src/plugins/ruby/weechat-ruby.c73
-rw-r--r--src/plugins/script/script-action.c38
-rw-r--r--src/plugins/script/script-buffer.c244
-rw-r--r--src/plugins/script/script-buffer.h9
-rw-r--r--src/plugins/script/script-command.c6
-rw-r--r--src/plugins/script/script-completion.c42
-rw-r--r--src/plugins/script/script-config.c202
-rw-r--r--src/plugins/script/script-info.c17
-rw-r--r--src/plugins/script/script-repo.c29
-rw-r--r--src/plugins/script/script-repo.h3
-rw-r--r--src/plugins/script/script.c42
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c697
-rw-r--r--src/plugins/tcl/weechat-tcl-api.h6
-rw-r--r--src/plugins/tcl/weechat-tcl.c73
-rw-r--r--src/plugins/trigger/trigger-buffer.c17
-rw-r--r--src/plugins/trigger/trigger-callback.c43
-rw-r--r--src/plugins/trigger/trigger-callback.h44
-rw-r--r--src/plugins/trigger/trigger-command.c6
-rw-r--r--src/plugins/trigger/trigger-completion.c66
-rw-r--r--src/plugins/trigger/trigger-config.c129
-rw-r--r--src/plugins/trigger/trigger.c24
-rw-r--r--src/plugins/weechat-plugin.h307
-rw-r--r--src/plugins/xfer/xfer-buffer.c12
-rw-r--r--src/plugins/xfer/xfer-buffer.h6
-rw-r--r--src/plugins/xfer/xfer-chat.c20
-rw-r--r--src/plugins/xfer/xfer-chat.h2
-rw-r--r--src/plugins/xfer/xfer-command.c14
-rw-r--r--src/plugins/xfer/xfer-completion.c6
-rw-r--r--src/plugins/xfer/xfer-config.c136
-rw-r--r--src/plugins/xfer/xfer-info.c14
-rw-r--r--src/plugins/xfer/xfer-network.c35
-rw-r--r--src/plugins/xfer/xfer-upgrade.c16
-rw-r--r--src/plugins/xfer/xfer.c35
137 files changed, 7153 insertions, 5701 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 40d73e10d..d10fd58f2 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -26,8 +26,7 @@ plugin-config.h plugin-config.c)
set(LIB_PLUGINS_SCRIPTS_SRC
plugin-script.c plugin-script.h
-plugin-script-api.c plugin-script-api.h
-plugin-script-callback.c plugin-script-callback.h)
+plugin-script-api.c plugin-script-api.h)
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index aa46965f7..20a29cc19 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -34,8 +34,6 @@ noinst_LTLIBRARIES = lib_weechat_plugins_scripts.la
lib_weechat_plugins_scripts_la_SOURCES = plugin-script.c \
plugin-script.h \
- plugin-script-callback.c \
- plugin-script-callback.h \
plugin-script-api.c \
plugin-script-api.h
diff --git a/src/plugins/alias/alias-command.c b/src/plugins/alias/alias-command.c
index 59975387d..f492faaa5 100644
--- a/src/plugins/alias/alias-command.c
+++ b/src/plugins/alias/alias-command.c
@@ -76,7 +76,8 @@ alias_command_add (const char *alias_name, const char *command,
*/
int
-alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
+alias_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *ptr_alias_name;
@@ -85,6 +86,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
int alias_found, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -287,5 +289,5 @@ alias_command_init ()
" || add %(alias) %(commands)|%(alias_value)"
" || addcompletion %- %(alias) %(commands)|%(alias_value)"
" || del %(alias)|%*",
- &alias_command_cb, NULL);
+ &alias_command_cb, NULL, NULL);
}
diff --git a/src/plugins/alias/alias-completion.c b/src/plugins/alias/alias-completion.c
index 42e3a553e..fd90b1c5d 100644
--- a/src/plugins/alias/alias-completion.c
+++ b/src/plugins/alias/alias-completion.c
@@ -32,13 +32,15 @@
*/
int
-alias_completion_alias_cb (void *data, const char *completion_item,
+alias_completion_alias_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -58,7 +60,8 @@ alias_completion_alias_cb (void *data, const char *completion_item,
*/
int
-alias_completion_alias_value_cb (void *data, const char *completion_item,
+alias_completion_alias_value_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -68,6 +71,7 @@ alias_completion_alias_value_cb (void *data, const char *completion_item,
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -110,7 +114,7 @@ void
alias_completion_init ()
{
weechat_hook_completion ("alias", N_("list of aliases"),
- &alias_completion_alias_cb, NULL);
+ &alias_completion_alias_cb, NULL, NULL);
weechat_hook_completion ("alias_value", N_("value of alias"),
- &alias_completion_alias_value_cb, NULL);
+ &alias_completion_alias_value_cb, NULL, NULL);
}
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c
index 9a2128b39..1ad8780c3 100644
--- a/src/plugins/alias/alias-config.c
+++ b/src/plugins/alias/alias-config.c
@@ -78,11 +78,13 @@ char *alias_default_completion[][2] =
*/
void
-alias_config_cmd_change_cb (void *data, struct t_config_option *option)
+alias_config_cmd_change_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_config_option *ptr_option_completion;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_option_completion = weechat_config_search_option (alias_config_file,
@@ -100,12 +102,14 @@ alias_config_cmd_change_cb (void *data, struct t_config_option *option)
*/
void
-alias_config_cmd_delete_cb (void *data, struct t_config_option *option)
+alias_config_cmd_delete_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_config_option *ptr_option_completion;
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_option_completion = weechat_config_search_option (alias_config_file,
@@ -125,11 +129,13 @@ alias_config_cmd_delete_cb (void *data, struct t_config_option *option)
*/
void
-alias_config_completion_change_cb (void *data, struct t_config_option *option)
+alias_config_completion_change_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
@@ -145,11 +151,13 @@ alias_config_completion_change_cb (void *data, struct t_config_option *option)
*/
void
-alias_config_completion_delete_cb (void *data, struct t_config_option *option)
+alias_config_completion_delete_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
@@ -164,9 +172,11 @@ alias_config_completion_delete_cb (void *data, struct t_config_option *option)
*/
int
-alias_config_reload (void *data, struct t_config_file *config_file)
+alias_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
weechat_config_section_free_options (alias_config_section_cmd);
@@ -181,13 +191,14 @@ alias_config_reload (void *data, struct t_config_file *config_file)
*/
int
-alias_config_cmd_write_default_cb (void *data,
+alias_config_cmd_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!weechat_config_write_line (config_file, section_name, NULL))
@@ -214,9 +225,9 @@ alias_config_cmd_new_option (const char *name, const char *command)
weechat_config_new_option (alias_config_file, alias_config_section_cmd,
name, "string", NULL,
NULL, 0, 0, NULL, command, 0,
- NULL, NULL,
- &alias_config_cmd_change_cb, NULL,
- &alias_config_cmd_delete_cb, NULL);
+ NULL, NULL, NULL,
+ &alias_config_cmd_change_cb, NULL, NULL,
+ &alias_config_cmd_delete_cb, NULL, NULL);
}
/*
@@ -224,7 +235,7 @@ alias_config_cmd_new_option (const char *name, const char *command)
*/
int
-alias_config_cmd_create_option_cb (void *data,
+alias_config_cmd_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
@@ -233,6 +244,7 @@ alias_config_cmd_create_option_cb (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -266,13 +278,14 @@ alias_config_cmd_create_option_cb (void *data,
*/
int
-alias_config_completion_write_default_cb (void *data,
+alias_config_completion_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!weechat_config_write_line (config_file, section_name, NULL))
@@ -300,9 +313,9 @@ alias_config_completion_new_option (const char *name, const char *completion)
alias_config_section_completion,
name, "string", NULL,
NULL, 0, 0, NULL, completion, 0,
- NULL, NULL,
- &alias_config_completion_change_cb, NULL,
- &alias_config_completion_delete_cb, NULL);
+ NULL, NULL, NULL,
+ &alias_config_completion_change_cb, NULL, NULL,
+ &alias_config_completion_delete_cb, NULL, NULL);
}
/*
@@ -310,7 +323,7 @@ alias_config_completion_new_option (const char *name, const char *completion)
*/
int
-alias_config_completion_create_option_cb (void *data,
+alias_config_completion_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -319,6 +332,7 @@ alias_config_completion_create_option_cb (void *data,
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -357,18 +371,19 @@ alias_config_init ()
struct t_config_section *ptr_section;
alias_config_file = weechat_config_new (ALIAS_CONFIG_NAME,
- &alias_config_reload, NULL);
+ &alias_config_reload, NULL, NULL);
if (!alias_config_file)
return 0;
/* cmd */
- ptr_section = weechat_config_new_section (alias_config_file, "cmd",
- 1, 1,
- NULL, NULL,
- NULL, NULL,
- &alias_config_cmd_write_default_cb, NULL,
- &alias_config_cmd_create_option_cb, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ alias_config_file, "cmd",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &alias_config_cmd_write_default_cb, NULL, NULL,
+ &alias_config_cmd_create_option_cb, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (alias_config_file);
@@ -377,13 +392,14 @@ alias_config_init ()
alias_config_section_cmd = ptr_section;
/* completion */
- ptr_section = weechat_config_new_section (alias_config_file, "completion",
- 1, 1,
- NULL, NULL,
- NULL, NULL,
- &alias_config_completion_write_default_cb, NULL,
- &alias_config_completion_create_option_cb, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ alias_config_file, "completion",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &alias_config_completion_write_default_cb, NULL, NULL,
+ &alias_config_completion_create_option_cb, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (alias_config_file);
diff --git a/src/plugins/alias/alias-info.c b/src/plugins/alias/alias-info.c
index 600f0c8c2..484c6082b 100644
--- a/src/plugins/alias/alias-info.c
+++ b/src/plugins/alias/alias-info.c
@@ -30,28 +30,30 @@
*/
struct t_infolist *
-alias_info_infolist_alias_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+alias_info_infolist_alias_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_alias *ptr_alias;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (pointer && !alias_valid (pointer))
+ if (obj_pointer && !alias_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one alias */
- if (!alias_add_to_infolist (ptr_infolist, pointer))
+ if (!alias_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -90,5 +92,5 @@ alias_info_init ()
"alias", N_("list of aliases"),
N_("alias pointer (optional)"),
N_("alias name (wildcard \"*\" is allowed) (optional)"),
- &alias_info_infolist_alias_cb, NULL);
+ &alias_info_infolist_alias_cb, NULL, NULL);
}
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index db02f987c..961748757 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -337,7 +337,8 @@ alias_run_command (struct t_gui_buffer **buffer, const char *command)
*/
int
-alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
+alias_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc, char **argv,
char **argv_eol)
{
struct t_alias *ptr_alias;
@@ -346,9 +347,10 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
int some_args_replaced, length1, length2;
/* make C compiler happy */
+ (void) data;
(void) argv;
- ptr_alias = (struct t_alias *)data;
+ ptr_alias = (struct t_alias *)pointer;
if (ptr_alias->running)
{
@@ -545,7 +547,7 @@ alias_hook_command (struct t_alias *alias)
alias->command,
NULL, NULL,
(str_completion) ? str_completion : alias->completion,
- &alias_cb, alias);
+ &alias_cb, alias, NULL);
if (str_priority_name)
free (str_priority_name);
diff --git a/src/plugins/aspell/weechat-aspell-bar-item.c b/src/plugins/aspell/weechat-aspell-bar-item.c
index c723ce782..efb73ae8c 100644
--- a/src/plugins/aspell/weechat-aspell-bar-item.c
+++ b/src/plugins/aspell/weechat-aspell-bar-item.c
@@ -35,7 +35,8 @@
*/
char *
-weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
+weechat_aspell_bar_item_dict (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -43,6 +44,7 @@ weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
const char *dict_list;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -61,7 +63,8 @@ weechat_aspell_bar_item_dict (void *data, struct t_gui_bar_item *item,
*/
char *
-weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
+weechat_aspell_bar_item_suggest (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -71,6 +74,7 @@ weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
int i, num_suggestions, length;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -132,6 +136,8 @@ weechat_aspell_bar_item_suggest (void *data, struct t_gui_bar_item *item,
void
weechat_aspell_bar_item_init ()
{
- weechat_bar_item_new ("aspell_dict", &weechat_aspell_bar_item_dict, NULL);
- weechat_bar_item_new ("aspell_suggest", &weechat_aspell_bar_item_suggest, NULL);
+ weechat_bar_item_new ("aspell_dict",
+ &weechat_aspell_bar_item_dict, NULL, NULL);
+ weechat_bar_item_new ("aspell_suggest",
+ &weechat_aspell_bar_item_suggest, NULL, NULL);
}
diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c
index 36b06ece7..740f5aac4 100644
--- a/src/plugins/aspell/weechat-aspell-command.c
+++ b/src/plugins/aspell/weechat-aspell-command.c
@@ -330,7 +330,8 @@ end:
*/
int
-weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_aspell_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *dicts;
@@ -339,6 +340,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
int number;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc == 1)
@@ -499,5 +501,5 @@ weechat_aspell_command_init ()
" || setdict %(aspell_dicts)"
" || deldict"
" || addword",
- &weechat_aspell_command_cb, NULL);
+ &weechat_aspell_command_cb, NULL, NULL);
}
diff --git a/src/plugins/aspell/weechat-aspell-completion.c b/src/plugins/aspell/weechat-aspell-completion.c
index c095a0091..30917a012 100644
--- a/src/plugins/aspell/weechat-aspell-completion.c
+++ b/src/plugins/aspell/weechat-aspell-completion.c
@@ -33,13 +33,15 @@
*/
int
-weechat_aspell_completion_langs_cb (void *data, const char *completion_item,
+weechat_aspell_completion_langs_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -81,7 +83,7 @@ weechat_aspell_completion_enchant_add_dict_cb (const char *lang_tag,
*/
int
-weechat_aspell_completion_dicts_cb (void *data,
+weechat_aspell_completion_dicts_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
@@ -94,6 +96,7 @@ weechat_aspell_completion_dicts_cb (void *data,
#endif /* USE_ENCHANT */
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -129,8 +132,8 @@ weechat_aspell_completion_init ()
{
weechat_hook_completion ("aspell_langs",
N_("list of all languages supported by aspell"),
- &weechat_aspell_completion_langs_cb, NULL);
+ &weechat_aspell_completion_langs_cb, NULL, NULL);
weechat_hook_completion ("aspell_dicts",
N_("list of aspell installed dictionaries"),
- &weechat_aspell_completion_dicts_cb, NULL);
+ &weechat_aspell_completion_dicts_cb, NULL, NULL);
}
diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c
index ee46731be..b3a1bb11e 100644
--- a/src/plugins/aspell/weechat-aspell-config.c
+++ b/src/plugins/aspell/weechat-aspell-config.c
@@ -61,13 +61,14 @@ int *weechat_aspell_length_commands_to_check = NULL;
*/
void
-weechat_aspell_config_change_commands (void *data,
+weechat_aspell_config_change_commands (const void *pointer, void *data,
struct t_config_option *option)
{
const char *value;
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (weechat_aspell_commands_to_check)
@@ -106,10 +107,11 @@ weechat_aspell_config_change_commands (void *data,
*/
void
-weechat_aspell_config_change_default_dict (void *data,
+weechat_aspell_config_change_default_dict (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -123,9 +125,11 @@ weechat_aspell_config_change_default_dict (void *data,
*/
void
-weechat_aspell_config_change_enabled (void *data, struct t_config_option *option)
+weechat_aspell_config_change_enabled (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
aspell_enabled = weechat_config_boolean (option);
@@ -140,10 +144,11 @@ weechat_aspell_config_change_enabled (void *data, struct t_config_option *option
*/
void
-weechat_aspell_config_change_suggestions (void *data,
+weechat_aspell_config_change_suggestions (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -155,10 +160,11 @@ weechat_aspell_config_change_suggestions (void *data,
*/
void
-weechat_aspell_config_dict_change (void *data,
+weechat_aspell_config_dict_change (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -172,12 +178,13 @@ weechat_aspell_config_dict_change (void *data,
*/
int
-weechat_aspell_config_dict_delete_option (void *data,
+weechat_aspell_config_dict_delete_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -196,7 +203,7 @@ weechat_aspell_config_dict_delete_option (void *data,
*/
int
-weechat_aspell_config_dict_create_option (void *data,
+weechat_aspell_config_dict_create_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -206,6 +213,7 @@ weechat_aspell_config_dict_create_option (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -236,9 +244,9 @@ weechat_aspell_config_dict_create_option (void *data,
option_name, "string",
_("comma separated list of dictionaries to use on this buffer"),
NULL, 0, 0, "", value, 0,
- NULL, NULL,
- &weechat_aspell_config_dict_change, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_dict_change, NULL, NULL,
+ NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -269,10 +277,11 @@ weechat_aspell_config_dict_create_option (void *data,
*/
void
-weechat_aspell_config_option_change (void *data,
+weechat_aspell_config_option_change (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -286,12 +295,13 @@ weechat_aspell_config_option_change (void *data,
*/
int
-weechat_aspell_config_option_delete_option (void *data,
+weechat_aspell_config_option_delete_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -310,7 +320,7 @@ weechat_aspell_config_option_delete_option (void *data,
*/
int
-weechat_aspell_config_option_create_option (void *data,
+weechat_aspell_config_option_create_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -320,6 +330,7 @@ weechat_aspell_config_option_create_option (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -348,9 +359,9 @@ weechat_aspell_config_option_create_option (void *data,
_("option for aspell (for list of available options and "
"format, run command \"aspell config\" in a shell)"),
NULL, 0, 0, "", value, 0,
- NULL, NULL,
- &weechat_aspell_config_option_change, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_option_change, NULL, NULL,
+ NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -395,7 +406,7 @@ weechat_aspell_config_get_dict (const char *name)
int
weechat_aspell_config_set_dict (const char *name, const char *value)
{
- return weechat_aspell_config_dict_create_option (NULL,
+ return weechat_aspell_config_dict_create_option (NULL, NULL,
weechat_aspell_config_file,
weechat_aspell_config_section_dict,
name,
@@ -416,16 +427,19 @@ weechat_aspell_config_init ()
struct t_config_section *ptr_section;
weechat_aspell_config_file = weechat_config_new (ASPELL_CONFIG_NAME,
- NULL, NULL);
+ NULL, NULL, NULL);
if (!weechat_aspell_config_file)
return 0;
/* color */
- ptr_section = weechat_config_new_section (weechat_aspell_config_file, "color",
- 0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ weechat_aspell_config_file, "color",
+ 0, 0,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -436,19 +450,24 @@ weechat_aspell_config_init ()
weechat_aspell_config_file, ptr_section,
"misspelled", "color",
N_("text color for misspelled words (input bar)"),
- NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "lightred", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_color_suggestions = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"suggestions", "color",
N_("text color for suggestions on a misspelled word (status bar)"),
- NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* check */
- ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
- 0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ weechat_aspell_config_file, "check",
+ 0, 0,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -463,7 +482,9 @@ weechat_aspell_config_init ()
NULL, 0, 0,
"ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,"
"quit,topic", NULL, 0,
- NULL, NULL, &weechat_aspell_config_change_commands, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_change_commands, NULL, NULL,
+ NULL, NULL, NULL);
weechat_aspell_config_check_default_dict = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"default_dict", "string",
@@ -471,24 +492,30 @@ weechat_aspell_config_init ()
"use when buffer has no dictionary defined (leave blank to disable "
"aspell on buffers for which you didn't explicitly enabled it)"),
NULL, 0, 0, "", NULL, 0,
- NULL, NULL, &weechat_aspell_config_change_default_dict, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_change_default_dict, NULL, NULL,
+ NULL, NULL, NULL);
weechat_aspell_config_check_during_search = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"during_search", "boolean",
N_("check words during text search in buffer"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_check_enabled = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"enabled", "boolean",
N_("enable aspell check for command line"),
NULL, 0, 0, "off", NULL, 0,
- NULL, NULL, &weechat_aspell_config_change_enabled, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_change_enabled, NULL, NULL,
+ NULL, NULL, NULL);
weechat_aspell_config_check_real_time = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"real_time", "boolean",
N_("real-time spell checking of words (slower, disabled by default: "
"words are checked only if there's delimiter after)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
weechat_aspell_config_check_suggestions = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"suggestions", "integer",
@@ -496,22 +523,26 @@ weechat_aspell_config_init ()
"for each dictionary set in buffer (-1 = disable suggestions, "
"0 = display all possible suggestions in all languages)"),
NULL, -1, INT_MAX, "-1", NULL, 0,
- NULL, NULL, &weechat_aspell_config_change_suggestions, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &weechat_aspell_config_change_suggestions, NULL, NULL,
+ NULL, NULL, NULL);
weechat_aspell_config_check_word_min_length = weechat_config_new_option (
weechat_aspell_config_file, ptr_section,
"word_min_length", "integer",
N_("minimum length for a word to be spell checked (use 0 to check all "
"words)"),
- NULL, 0, INT_MAX, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, INT_MAX, "2", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* dict */
- ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
- 1, 1,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL,
- &weechat_aspell_config_dict_create_option, NULL,
- &weechat_aspell_config_dict_delete_option, NULL);
+ ptr_section = weechat_config_new_section (
+ weechat_aspell_config_file, "dict",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &weechat_aspell_config_dict_create_option, NULL, NULL,
+ &weechat_aspell_config_dict_delete_option, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -521,13 +552,14 @@ weechat_aspell_config_init ()
weechat_aspell_config_section_dict = ptr_section;
/* option */
- ptr_section = weechat_config_new_section (weechat_aspell_config_file, "option",
- 1, 1,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL,
- &weechat_aspell_config_option_create_option, NULL,
- &weechat_aspell_config_option_delete_option, NULL);
+ ptr_section = weechat_config_new_section (
+ weechat_aspell_config_file, "option",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &weechat_aspell_config_option_create_option, NULL, NULL,
+ &weechat_aspell_config_option_delete_option, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (weechat_aspell_config_file);
@@ -551,8 +583,8 @@ weechat_aspell_config_read ()
weechat_aspell_config_loading = 0;
if (rc == WEECHAT_CONFIG_READ_OK)
{
- weechat_aspell_config_change_commands (NULL,
- weechat_aspell_config_check_commands);
+ weechat_aspell_config_change_commands (
+ NULL, NULL, weechat_aspell_config_check_commands);
}
weechat_aspell_speller_remove_unused ();
diff --git a/src/plugins/aspell/weechat-aspell-info.c b/src/plugins/aspell/weechat-aspell-info.c
index 33e6eed86..3e298c063 100644
--- a/src/plugins/aspell/weechat-aspell-info.c
+++ b/src/plugins/aspell/weechat-aspell-info.c
@@ -32,7 +32,8 @@
*/
const char *
-weechat_aspell_info_info_aspell_dict_cb (void *data, const char *info_name,
+weechat_aspell_info_info_aspell_dict_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
int rc;
@@ -41,6 +42,7 @@ weechat_aspell_info_info_aspell_dict_cb (void *data, const char *info_name,
const char *buffer_full_name;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -83,5 +85,5 @@ weechat_aspell_info_init ()
N_("comma-separated list of dictionaries used in buffer"),
N_("buffer pointer (\"0x12345678\") or buffer full name "
"(\"irc.freenode.#weechat\")"),
- &weechat_aspell_info_info_aspell_dict_cb, NULL);
+ &weechat_aspell_info_info_aspell_dict_cb, NULL, NULL);
}
diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c
index fdaee28f5..65b236e3a 100644
--- a/src/plugins/aspell/weechat-aspell-speller.c
+++ b/src/plugins/aspell/weechat-aspell-speller.c
@@ -272,8 +272,7 @@ weechat_aspell_speller_remove_unused ()
used_spellers = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!used_spellers)
return;
@@ -448,8 +447,7 @@ weechat_aspell_speller_init ()
weechat_aspell_spellers = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
- NULL,
- NULL);
+ NULL, NULL);
if (!weechat_aspell_spellers)
return 0;
weechat_hashtable_set_pointer (weechat_aspell_spellers,
@@ -459,8 +457,7 @@ weechat_aspell_speller_init ()
weechat_aspell_speller_buffer = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_POINTER,
WEECHAT_HASHTABLE_POINTER,
- NULL,
- NULL);
+ NULL, NULL);
if (!weechat_aspell_speller_buffer)
{
weechat_hashtable_free (weechat_aspell_spellers);
diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c
index 961d2553d..1513e2f51 100644
--- a/src/plugins/aspell/weechat-aspell.c
+++ b/src/plugins/aspell/weechat-aspell.c
@@ -604,7 +604,8 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
*/
char *
-weechat_aspell_modifier_cb (void *data, const char *modifier,
+weechat_aspell_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
const char *modifier_data, const char *string)
{
long unsigned int value;
@@ -621,6 +622,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
int input_pos, current_pos, word_start_pos, word_end_pos, word_end_pos_valid;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) modifier;
@@ -932,10 +934,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
*/
int
-weechat_aspell_buffer_switch_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
+weechat_aspell_buffer_switch_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
+ void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -953,10 +957,12 @@ weechat_aspell_buffer_switch_cb (void *data, const char *signal,
*/
int
-weechat_aspell_window_switch_cb (void *data, const char *signal,
+weechat_aspell_window_switch_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -975,10 +981,12 @@ weechat_aspell_window_switch_cb (void *data, const char *signal,
*/
int
-weechat_aspell_buffer_closed_cb (void *data, const char *signal,
+weechat_aspell_buffer_closed_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -993,10 +1001,12 @@ weechat_aspell_buffer_closed_cb (void *data, const char *signal,
*/
int
-weechat_aspell_debug_libs_cb (void *data, const char *signal,
+weechat_aspell_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1059,20 +1069,20 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
* (from other plugins) will be called before this one
*/
weechat_hook_modifier ("500|input_text_display",
- &weechat_aspell_modifier_cb, NULL);
+ &weechat_aspell_modifier_cb, NULL, NULL);
weechat_aspell_bar_item_init ();
weechat_aspell_info_init ();
weechat_hook_signal ("buffer_switch",
- &weechat_aspell_buffer_switch_cb, NULL);
+ &weechat_aspell_buffer_switch_cb, NULL, NULL);
weechat_hook_signal ("window_switch",
- &weechat_aspell_window_switch_cb, NULL);
+ &weechat_aspell_window_switch_cb, NULL, NULL);
weechat_hook_signal ("buffer_closed",
- &weechat_aspell_buffer_closed_cb, NULL);
+ &weechat_aspell_buffer_closed_cb, NULL, NULL);
weechat_hook_signal ("debug_libs",
- &weechat_aspell_debug_libs_cb, NULL);
+ &weechat_aspell_debug_libs_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index 7e6a50baf..919f900eb 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -59,9 +59,11 @@ const char *charset_internal = NULL;
*/
int
-charset_config_reload (void *data, struct t_config_file *config_file)
+charset_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* free all decode/encode charsets */
@@ -107,10 +109,12 @@ charset_decode_is_allowed (const char *charset)
*/
int
-charset_check_charset_decode_cb (void *data, struct t_config_option *option,
+charset_check_charset_decode_cb (const void *pointer, void *data,
+ struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -122,7 +126,8 @@ charset_check_charset_decode_cb (void *data, struct t_config_option *option,
*/
int
-charset_config_create_option (void *data, struct t_config_file *config_file,
+charset_config_create_option (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
@@ -130,6 +135,7 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -159,8 +165,9 @@ charset_config_create_option (void *data, struct t_config_file *config_file,
config_file, section,
option_name, "string", NULL,
NULL, 0, 0, "", value, 0,
- (section == charset_config_section_decode) ? &charset_check_charset_decode_cb : NULL, NULL,
- NULL, NULL, NULL, NULL);
+ (section == charset_config_section_decode) ? &charset_check_charset_decode_cb : NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -195,15 +202,17 @@ charset_config_init ()
struct t_config_section *ptr_section;
charset_config_file = weechat_config_new (CHARSET_CONFIG_NAME,
- &charset_config_reload, NULL);
+ &charset_config_reload, NULL, NULL);
if (!charset_config_file)
return 0;
ptr_section = weechat_config_new_section (charset_config_file, "default",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
@@ -220,7 +229,9 @@ charset_config_init ()
&& (weechat_strcasecmp (charset_terminal,
charset_internal) != 0)) ?
charset_terminal : "iso-8859-1", NULL, 0,
- &charset_check_charset_decode_cb, NULL, NULL, NULL, NULL, NULL);
+ &charset_check_charset_decode_cb, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
charset_default_encode = weechat_config_new_option (
charset_config_file, ptr_section,
"encode", "string",
@@ -228,14 +239,16 @@ charset_config_init ()
"(if empty, default is UTF-8 because it is the WeeChat internal "
"charset)"),
NULL, 0, 0, "", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
-
- ptr_section = weechat_config_new_section (charset_config_file, "decode",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &charset_config_create_option, NULL,
- NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+
+ ptr_section = weechat_config_new_section (
+ charset_config_file, "decode",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &charset_config_create_option, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
@@ -244,12 +257,14 @@ charset_config_init ()
charset_config_section_decode = ptr_section;
- ptr_section = weechat_config_new_section (charset_config_file, "encode",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &charset_config_create_option, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ charset_config_file, "encode",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &charset_config_create_option, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (charset_config_file);
@@ -365,12 +380,14 @@ charset_get (struct t_config_section *section, const char *name,
*/
char *
-charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
+charset_decode_cb (const void *pointer, void *data,
+ const char *modifier, const char *modifier_data,
const char *string)
{
const char *charset;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) modifier;
@@ -394,12 +411,14 @@ charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
*/
char *
-charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
+charset_encode_cb (const void *pointer, void *data,
+ const char *modifier, const char *modifier_data,
const char *string)
{
const char *charset;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) modifier;
@@ -426,7 +445,7 @@ void
charset_set (struct t_config_section *section, const char *type,
const char *name, const char *value)
{
- if (charset_config_create_option (NULL,
+ if (charset_config_create_option (NULL, NULL,
charset_config_file,
section,
name,
@@ -458,7 +477,8 @@ charset_display_charsets ()
*/
int
-charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
+charset_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_config_section *ptr_section;
@@ -467,6 +487,7 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
const char *plugin_name, *name, *charset_modifier;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc < 2)
@@ -594,11 +615,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"charset: new charset for current buffer\n"
" reset: reset charsets for current buffer"),
"decode|encode|reset",
- &charset_command_cb, NULL);
+ &charset_command_cb, NULL, NULL);
/* modifiers hooks */
- weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL);
- weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL);
+ weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL, NULL);
+ weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c
index 1339dbd5b..908d0d044 100644
--- a/src/plugins/exec/exec-buffer.c
+++ b/src/plugins/exec/exec-buffer.c
@@ -35,13 +35,15 @@
*/
int
-exec_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+exec_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
char **argv, **argv_eol;
int argc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* close buffer */
@@ -70,12 +72,14 @@ exec_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-exec_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+exec_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
const char *full_name;
struct t_exec_cmd *ptr_exec_cmd;
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* kill any command whose output is on this buffer */
@@ -153,8 +157,8 @@ exec_buffer_new (const char *name, int free_content, int clear_buffer,
}
new_buffer = weechat_buffer_new (name,
- &exec_buffer_input_cb, NULL,
- &exec_buffer_close_cb, NULL);
+ &exec_buffer_input_cb, NULL, NULL,
+ &exec_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then return */
if (!new_buffer)
diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c
index 9a1e3cc76..91e8cbdcd 100644
--- a/src/plugins/exec/exec-command.c
+++ b/src/plugins/exec/exec-command.c
@@ -458,8 +458,7 @@ exec_command_run (struct t_gui_buffer *buffer,
process_options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!process_options)
{
exec_free (new_exec_cmd);
@@ -570,7 +569,8 @@ exec_command_run (struct t_gui_buffer *buffer,
process_options,
cmd_options.timeout * 1000,
&exec_process_cb,
- new_exec_cmd);
+ new_exec_cmd,
+ NULL);
if (new_exec_cmd->hook)
{
@@ -605,7 +605,8 @@ exec_command_run (struct t_gui_buffer *buffer,
*/
int
-exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc,
+exec_command_exec (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
int i, length, count;
@@ -613,6 +614,7 @@ exec_command_exec (void *data, struct t_gui_buffer *buffer, int argc,
struct t_exec_cmd *ptr_exec_cmd, *ptr_next_exec_cmd;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -878,5 +880,5 @@ exec_command_init ()
" || -killall"
" || -set %(exec_commands_ids) stdin|stdin_close|signal"
" || -del %(exec_commands_ids)|-all %(exec_commands_ids)|%*",
- &exec_command_exec, NULL);
+ &exec_command_exec, NULL, NULL);
}
diff --git a/src/plugins/exec/exec-completion.c b/src/plugins/exec/exec-completion.c
index d243f6692..52475cfdf 100644
--- a/src/plugins/exec/exec-completion.c
+++ b/src/plugins/exec/exec-completion.c
@@ -32,7 +32,8 @@
*/
int
-exec_completion_commands_ids_cb (void *data, const char *completion_item,
+exec_completion_commands_ids_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -40,6 +41,7 @@ exec_completion_commands_ids_cb (void *data, const char *completion_item,
char str_number[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -69,5 +71,5 @@ exec_completion_init ()
{
weechat_hook_completion ("exec_commands_ids",
N_("ids (numbers and names) of executed commands"),
- &exec_completion_commands_ids_cb, NULL);
+ &exec_completion_commands_ids_cb, NULL, NULL);
}
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index 7ead68550..77c3152c6 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -49,10 +49,11 @@ int exec_config_cmd_num_options = 0;
*/
void
-exec_config_change_command_default_options (void *data,
+exec_config_change_command_default_options (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -69,9 +70,11 @@ exec_config_change_command_default_options (void *data,
*/
int
-exec_config_reload_cb (void *data, struct t_config_file *config_file)
+exec_config_reload_cb (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return weechat_config_reload (config_file);
@@ -91,16 +94,18 @@ exec_config_init ()
struct t_config_section *ptr_section;
exec_config_file = weechat_config_new (EXEC_CONFIG_NAME,
- &exec_config_reload_cb, NULL);
+ &exec_config_reload_cb, NULL, NULL);
if (!exec_config_file)
return 0;
/* command */
ptr_section = weechat_config_new_section (exec_config_file, "command",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (exec_config_file);
@@ -113,22 +118,26 @@ exec_config_init ()
N_("default options for command /exec (see /help exec); example: "
"\"-nosh -bg\" to run all commands in background (no output), and "
"without using the shell"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &exec_config_change_command_default_options, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &exec_config_change_command_default_options, NULL, NULL,
+ NULL, NULL, NULL);
exec_config_command_purge_delay = weechat_config_new_option (
exec_config_file, ptr_section,
"purge_delay", "integer",
N_("delay for purging finished commands (in seconds, 0 = purge "
"commands immediately, -1 = never purge)"),
NULL, -1, 36000 * 24 * 30, "0", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (exec_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (exec_config_file);
@@ -140,13 +149,13 @@ exec_config_init ()
"flag_running", "color",
N_("text color for a running command flag in list of commands"),
NULL, 0, 0, "lightgreen", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
exec_config_color_flag_finished = weechat_config_new_option (
exec_config_file, ptr_section,
"flag_finished", "color",
N_("text color for a finished command flag in list of commands"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c
index 3922a1154..5589fd2b8 100644
--- a/src/plugins/exec/exec.c
+++ b/src/plugins/exec/exec.c
@@ -175,14 +175,15 @@ exec_add ()
*/
int
-exec_timer_delete_cb (void *data, int remaining_calls)
+exec_timer_delete_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_exec_cmd *exec_cmd, *ptr_exec_cmd;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- exec_cmd = (struct t_exec_cmd *)data;
+ exec_cmd = (struct t_exec_cmd *)pointer;
if (!exec_cmd)
return WEECHAT_RC_OK;
@@ -424,8 +425,7 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hashtable)
{
weechat_hashtable_set (hashtable, "command", exec_cmd->command);
@@ -526,7 +526,7 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
{
weechat_hook_timer (1 + (1000 * weechat_config_integer (exec_config_command_purge_delay)),
0, 1,
- &exec_timer_delete_cb, exec_cmd);
+ &exec_timer_delete_cb, exec_cmd, NULL);
}
}
@@ -535,16 +535,17 @@ exec_end_command (struct t_exec_cmd *exec_cmd, int return_code)
*/
int
-exec_process_cb (void *data, const char *command, int return_code,
- const char *out, const char *err)
+exec_process_cb (const void *pointer, void *data, const char *command,
+ int return_code, const char *out, const char *err)
{
struct t_exec_cmd *ptr_exec_cmd;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) data;
(void) command;
- ptr_exec_cmd = (struct t_exec_cmd *)data;
+ ptr_exec_cmd = (struct t_exec_cmd *)pointer;
if (!ptr_exec_cmd)
return WEECHAT_RC_ERROR;
@@ -681,10 +682,12 @@ exec_print_log ()
*/
int
-exec_debug_dump_cb (void *data, const char *signal, const char *type_data,
+exec_debug_dump_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -725,7 +728,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
exec_config_read ();
/* hook some signals */
- weechat_hook_signal ("debug_dump", &exec_debug_dump_cb, NULL);
+ weechat_hook_signal ("debug_dump", &exec_debug_dump_cb, NULL, NULL);
/* hook completions */
exec_completion_init ();
diff --git a/src/plugins/exec/exec.h b/src/plugins/exec/exec.h
index e54187a73..2adb1435f 100644
--- a/src/plugins/exec/exec.h
+++ b/src/plugins/exec/exec.h
@@ -80,7 +80,8 @@ extern int exec_cmds_count;
extern int exec_search_color (const char *color);
extern struct t_exec_cmd *exec_search_by_id (const char *id);
extern struct t_exec_cmd *exec_add ();
-extern int exec_process_cb (void *data, const char *command, int return_code,
+extern int exec_process_cb (const void *pointer, void *data,
+ const char *command, int return_code,
const char *out, const char *err);
extern void exec_free (struct t_exec_cmd *exec_cmd);
extern void exec_free_all ();
diff --git a/src/plugins/fifo/fifo-command.c b/src/plugins/fifo/fifo-command.c
index ece6ea646..19ea553a5 100644
--- a/src/plugins/fifo/fifo-command.c
+++ b/src/plugins/fifo/fifo-command.c
@@ -30,10 +30,12 @@
*/
int
-fifo_command_fifo (void *data, struct t_gui_buffer *buffer, int argc,
+fifo_command_fifo (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) argv_eol;
@@ -113,5 +115,5 @@ fifo_command_init ()
"Examples:\n"
" /fifo toggle"),
"enable|disable|toggle",
- &fifo_command_fifo, NULL);
+ &fifo_command_fifo, NULL, NULL);
}
diff --git a/src/plugins/fifo/fifo-info.c b/src/plugins/fifo/fifo-info.c
index dd709fb9f..8be53ff9c 100644
--- a/src/plugins/fifo/fifo-info.c
+++ b/src/plugins/fifo/fifo-info.c
@@ -30,10 +30,12 @@
*/
const char *
-fifo_info_info_fifo_filename_cb (void *data, const char *info_name,
+fifo_info_info_fifo_filename_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -49,5 +51,5 @@ void
fifo_info_init ()
{
weechat_hook_info ("fifo_filename", N_("name of FIFO pipe"), NULL,
- &fifo_info_info_fifo_filename_cb, NULL);
+ &fifo_info_info_fifo_filename_cb, NULL, NULL);
}
diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c
index 4331eeafa..e438fc4a1 100644
--- a/src/plugins/fifo/fifo.c
+++ b/src/plugins/fifo/fifo.c
@@ -55,7 +55,7 @@ char *fifo_filename;
char *fifo_unterminated = NULL;
-int fifo_read();
+int fifo_fd_cb ();
/*
@@ -164,7 +164,7 @@ fifo_create ()
fifo_filename);
}
fifo_fd_hook = weechat_hook_fd (fifo_fd, 1, 0, 0,
- &fifo_read, NULL);
+ &fifo_fd_cb, NULL, NULL);
}
else
weechat_printf (NULL,
@@ -290,13 +290,14 @@ fifo_exec (const char *text)
*/
int
-fifo_read (void *data, int fd)
+fifo_fd_cb (const void *pointer, void *data, int fd)
{
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
int num_read;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) fd;
@@ -386,8 +387,10 @@ fifo_read (void *data, int fd)
fifo_remove ();
}
else
+ {
fifo_fd_hook = weechat_hook_fd (fifo_fd, 1, 0, 0,
- &fifo_read, NULL);
+ &fifo_fd_cb, NULL, NULL);
+ }
}
}
@@ -399,9 +402,11 @@ fifo_read (void *data, int fd)
*/
int
-fifo_config_cb (void *data, const char *option, const char *value)
+fifo_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -440,7 +445,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
snprintf (str_option, sizeof (str_option),
"plugins.var.fifo.%s", FIFO_OPTION_NAME);
- weechat_hook_config (str_option, &fifo_config_cb, NULL);
+ weechat_hook_config (str_option, &fifo_config_cb, NULL, NULL);
fifo_command_init ();
fifo_info_init ();
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index 3ac2b766a..3b475d7be 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -28,7 +28,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-guile.h"
@@ -773,24 +772,26 @@ weechat_guile_api_list_free (SCM weelist)
}
int
-weechat_guile_api_config_reload_cb (void *data,
+weechat_guile_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -831,29 +832,31 @@ weechat_guile_api_config_new (SCM name, SCM function, SCM data)
}
int
-weechat_guile_api_config_read_cb (void *data,
+weechat_guile_api_config_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -875,26 +878,28 @@ weechat_guile_api_config_read_cb (void *data,
}
int
-weechat_guile_api_config_section_write_cb (void *data,
+weechat_guile_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -914,26 +919,28 @@ weechat_guile_api_config_section_write_cb (void *data,
}
int
-weechat_guile_api_config_section_write_default_cb (void *data,
+weechat_guile_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -953,30 +960,32 @@ weechat_guile_api_config_section_write_default_cb (void *data,
}
int
-weechat_guile_api_config_section_create_option_cb (void *data,
+weechat_guile_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -998,28 +1007,30 @@ weechat_guile_api_config_section_create_option_cb (void *data,
}
int
-weechat_guile_api_config_section_delete_option_cb (void *data,
+weechat_guile_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1080,27 +1091,29 @@ weechat_guile_api_config_new_section (SCM args)
|| !scm_is_string (function_delete_option) || !scm_is_string (data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(config_file)),
- API_SCM_TO_STRING(name),
- scm_to_int (user_can_add_options),
- scm_to_int (user_can_delete_options),
- &weechat_guile_api_config_read_cb,
- API_SCM_TO_STRING(function_read),
- API_SCM_TO_STRING(data_read),
- &weechat_guile_api_config_section_write_cb,
- API_SCM_TO_STRING(function_write),
- API_SCM_TO_STRING(data_write),
- &weechat_guile_api_config_section_write_default_cb,
- API_SCM_TO_STRING(function_write_default),
- API_SCM_TO_STRING(data_write_default),
- &weechat_guile_api_config_section_create_option_cb,
- API_SCM_TO_STRING(function_create_option),
- API_SCM_TO_STRING(data_create_option),
- &weechat_guile_api_config_section_delete_option_cb,
- API_SCM_TO_STRING(function_delete_option),
- API_SCM_TO_STRING(data_delete_option)));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_guile_plugin,
+ guile_current_script,
+ API_STR2PTR(API_SCM_TO_STRING(config_file)),
+ API_SCM_TO_STRING(name),
+ scm_to_int (user_can_add_options),
+ scm_to_int (user_can_delete_options),
+ &weechat_guile_api_config_read_cb,
+ API_SCM_TO_STRING(function_read),
+ API_SCM_TO_STRING(data_read),
+ &weechat_guile_api_config_section_write_cb,
+ API_SCM_TO_STRING(function_write),
+ API_SCM_TO_STRING(data_write),
+ &weechat_guile_api_config_section_write_default_cb,
+ API_SCM_TO_STRING(function_write_default),
+ API_SCM_TO_STRING(data_write_default),
+ &weechat_guile_api_config_section_create_option_cb,
+ API_SCM_TO_STRING(function_create_option),
+ API_SCM_TO_STRING(data_create_option),
+ &weechat_guile_api_config_section_delete_option_cb,
+ API_SCM_TO_STRING(function_delete_option),
+ API_SCM_TO_STRING(data_delete_option)));
API_RETURN_STRING_FREE(result);
}
@@ -1122,26 +1135,28 @@ weechat_guile_api_config_search_section (SCM config_file, SCM section_name)
}
int
-weechat_guile_api_config_option_check_value_cb (void *data,
+weechat_guile_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1161,24 +1176,26 @@ weechat_guile_api_config_option_check_value_cb (void *data,
}
void
-weechat_guile_api_config_option_change_cb (void *data,
+weechat_guile_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1190,24 +1207,26 @@ weechat_guile_api_config_option_change_cb (void *data,
}
void
-weechat_guile_api_config_option_delete_cb (void *data,
+weechat_guile_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1614,9 +1633,7 @@ weechat_guile_api_config_option_free (SCM option)
if (!scm_is_string (option))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_option_free (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(option)));
+ weechat_config_option_free (API_STR2PTR(API_SCM_TO_STRING(option)));
API_RETURN_OK;
}
@@ -1628,9 +1645,8 @@ weechat_guile_api_config_section_free_options (SCM section)
if (!scm_is_string (section))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free_options (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(section)));
+ weechat_config_section_free_options (
+ API_STR2PTR(API_SCM_TO_STRING(section)));
API_RETURN_OK;
}
@@ -1642,9 +1658,7 @@ weechat_guile_api_config_section_free (SCM section)
if (!scm_is_string (section))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(section)));
+ weechat_config_section_free (API_STR2PTR(API_SCM_TO_STRING(section)));
API_RETURN_OK;
}
@@ -1656,9 +1670,7 @@ weechat_guile_api_config_free (SCM config_file)
if (!scm_is_string (config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_free (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(config_file)));
+ weechat_config_free (API_STR2PTR(API_SCM_TO_STRING(config_file)));
API_RETURN_OK;
}
@@ -1889,28 +1901,31 @@ weechat_guile_api_log_print (SCM message)
}
int
-weechat_guile_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_guile_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1959,25 +1974,28 @@ weechat_guile_api_hook_command (SCM command, SCM description, SCM args,
}
int
-weechat_guile_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_guile_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2018,26 +2036,29 @@ weechat_guile_api_hook_command_run (SCM command, SCM function, SCM data)
}
int
-weechat_guile_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_guile_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2080,25 +2101,27 @@ weechat_guile_api_hook_timer (SCM interval, SCM align_second, SCM max_calls,
}
int
-weechat_guile_api_hook_fd_cb (void *data, int fd)
+weechat_guile_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2142,28 +2165,30 @@ weechat_guile_api_hook_fd (SCM fd, SCM read, SCM write, SCM exception,
}
int
-weechat_guile_api_hook_process_cb (void *data,
+weechat_guile_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssiss", func_argv);
if (!rc)
@@ -2238,34 +2263,37 @@ weechat_guile_api_hook_process_hashtable (SCM command, SCM options, SCM timeout,
}
int
-weechat_guile_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_guile_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2317,28 +2345,31 @@ weechat_guile_api_hook_connect (SCM proxy, SCM address, SCM port, SCM ipv6,
}
int
-weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_guile_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2349,9 +2380,9 @@ weechat_guile_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssiiss", func_argv);
if (!rc)
@@ -2399,20 +2430,23 @@ weechat_guile_api_hook_print (SCM buffer, SCM tags, SCM message,
}
int
-weechat_guile_api_hook_signal_cb (void *data, const char *signal,
+weechat_guile_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2437,9 +2471,9 @@ weechat_guile_api_hook_signal_cb (void *data, const char *signal,
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2521,25 +2555,28 @@ weechat_guile_api_hook_signal_send (SCM signal, SCM type_data,
}
int
-weechat_guile_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_guile_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
if (!rc)
@@ -2601,24 +2638,27 @@ weechat_guile_api_hook_hsignal_send (SCM signal, SCM hashtable)
}
int
-weechat_guile_api_hook_config_cb (void *data, const char *option, const char *value)
+weechat_guile_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2657,27 +2697,30 @@ weechat_guile_api_hook_config (SCM option, SCM function, SCM data)
}
int
-weechat_guile_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_guile_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -2755,25 +2798,29 @@ weechat_guile_api_hook_completion_list_add (SCM completion, SCM word,
}
char *
-weechat_guile_api_hook_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+weechat_guile_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_guile_exec (script_callback->script,
+ return (char *)weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -2821,24 +2868,27 @@ weechat_guile_api_hook_modifier_exec (SCM modifier, SCM modifier_data,
}
const char *
-weechat_guile_api_hook_info_cb (void *data, const char *info_name,
+weechat_guile_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_guile_exec (script_callback->script,
+ return (const char *)weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -2871,25 +2921,29 @@ weechat_guile_api_hook_info (SCM info_name, SCM description,
}
struct t_hashtable *
-weechat_guile_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_guile_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
- return (struct t_hashtable *)weechat_guile_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "ssh", func_argv);
+ return (struct t_hashtable *)weechat_guile_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "ssh", func_argv);
}
return NULL;
@@ -2924,27 +2978,31 @@ weechat_guile_api_hook_info_hashtable (SCM info_name, SCM description,
}
struct t_infolist *
-weechat_guile_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_guile_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_guile_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_guile_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -2983,23 +3041,27 @@ weechat_guile_api_hook_infolist (SCM infolist_name, SCM description,
}
struct t_hashtable *
-weechat_guile_api_hook_focus_cb (void *data, struct t_hashtable *info)
+weechat_guile_api_hook_focus_cb (const void *pointer, void *data,
+ struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
- return (struct t_hashtable *)weechat_guile_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", func_argv);
+ return (struct t_hashtable *)weechat_guile_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "sh", func_argv);
}
return NULL;
@@ -3048,9 +3110,7 @@ weechat_guile_api_unhook (SCM hook)
if (!scm_is_string (hook))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_unhook (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(hook)));
+ weechat_unhook (API_STR2PTR(API_SCM_TO_STRING(hook)));
API_RETURN_OK;
}
@@ -3060,31 +3120,34 @@ weechat_guile_api_unhook_all ()
{
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_guile_plugin, guile_current_script);
+ weechat_unhook_all_plugin (guile_current_script->name);
API_RETURN_OK;
}
int
-weechat_guile_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_guile_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -3104,23 +3167,26 @@ weechat_guile_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_guile_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_guile_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -3226,9 +3292,7 @@ weechat_guile_api_buffer_close (SCM buffer)
if (!scm_is_string (buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_buffer_close (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(buffer)));
+ weechat_buffer_close (API_STR2PTR(API_SCM_TO_STRING(buffer)));
API_RETURN_OK;
}
@@ -3715,31 +3779,34 @@ weechat_guile_api_bar_item_search (SCM name)
}
char *
-weechat_guile_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_guile_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_guile_exec (script_callback->script,
+ ret = (char *)weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssh", func_argv);
if (func_argv[1])
@@ -3752,13 +3819,13 @@ weechat_guile_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_guile_exec (script_callback->script,
+ ret = (char *)weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -3813,9 +3880,7 @@ weechat_guile_api_bar_item_remove (SCM item)
if (!scm_is_string (item))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_bar_item_remove (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(item)));
+ weechat_bar_item_remove (API_STR2PTR(API_SCM_TO_STRING(item)));
API_RETURN_OK;
}
@@ -4587,65 +4652,33 @@ weechat_guile_api_hdata_get_string (SCM hdata, SCM property)
API_RETURN_STRING(result);
}
-SCM
-weechat_guile_api_upgrade_new (SCM filename, SCM write)
-{
- char *result;
- SCM return_value;
-
- API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- if (!scm_is_string (filename) || !scm_is_integer (write))
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- result = API_PTR2STR(weechat_upgrade_new (API_SCM_TO_STRING(filename),
- scm_to_int (write)));
-
- API_RETURN_STRING_FREE(result);
-}
-
-SCM
-weechat_guile_api_upgrade_write_object (SCM upgrade_file, SCM object_id,
- SCM infolist)
-{
- int rc;
-
- API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
- if (!scm_is_string (upgrade_file) || !scm_is_integer (object_id)
- || !scm_is_string (infolist))
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- rc = weechat_upgrade_write_object (API_STR2PTR(API_SCM_TO_STRING(upgrade_file)),
- scm_to_int (object_id),
- API_STR2PTR(API_SCM_TO_STRING(infolist)));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_guile_api_upgrade_read_cb (void *data,
+weechat_guile_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *) weechat_guile_exec (script_callback->script,
+ rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -4667,21 +4700,56 @@ weechat_guile_api_upgrade_read_cb (void *data,
}
SCM
-weechat_guile_api_upgrade_read (SCM upgrade_file, SCM function, SCM data)
+weechat_guile_api_upgrade_new (SCM filename, SCM function, SCM data)
+{
+ char *result;
+ SCM return_value;
+
+ API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ if (!scm_is_string (filename) || !scm_is_string (function)
+ || !scm_is_string (data))
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_guile_plugin,
+ guile_current_script,
+ API_SCM_TO_STRING(filename),
+ &weechat_guile_api_upgrade_read_cb,
+ API_SCM_TO_STRING(function),
+ API_SCM_TO_STRING(data)));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+SCM
+weechat_guile_api_upgrade_write_object (SCM upgrade_file, SCM object_id,
+ SCM infolist)
+{
+ int rc;
+
+ API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ if (!scm_is_string (upgrade_file) || !scm_is_integer (object_id)
+ || !scm_is_string (infolist))
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ rc = weechat_upgrade_write_object (API_STR2PTR(API_SCM_TO_STRING(upgrade_file)),
+ scm_to_int (object_id),
+ API_STR2PTR(API_SCM_TO_STRING(infolist)));
+
+ API_RETURN_INT(rc);
+}
+
+SCM
+weechat_guile_api_upgrade_read (SCM upgrade_file)
{
int rc;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
- if (!scm_is_string (upgrade_file) || !scm_is_string (function)
- || !scm_is_string (data))
+ if (!scm_is_string (upgrade_file))
API_WRONG_ARGS(API_RETURN_INT(0));
- rc = plugin_script_api_upgrade_read (weechat_guile_plugin,
- guile_current_script,
- API_STR2PTR(API_SCM_TO_STRING(upgrade_file)),
- &weechat_guile_api_upgrade_read_cb,
- API_SCM_TO_STRING(function),
- API_SCM_TO_STRING(data));
+ rc = weechat_upgrade_read (API_STR2PTR(API_SCM_TO_STRING(upgrade_file)));
API_RETURN_INT(rc);
}
@@ -4906,9 +4974,9 @@ weechat_guile_api_module_init (void *data)
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_new, 3);
API_DEF_FUNC(upgrade_write_object, 3);
- API_DEF_FUNC(upgrade_read, 3);
+ API_DEF_FUNC(upgrade_read, 1);
API_DEF_FUNC(upgrade_close, 1);
/* interface constants */
diff --git a/src/plugins/guile/weechat-guile-api.h b/src/plugins/guile/weechat-guile-api.h
index 91d05b6d2..bb0972677 100644
--- a/src/plugins/guile/weechat-guile-api.h
+++ b/src/plugins/guile/weechat-guile-api.h
@@ -20,10 +20,12 @@
#ifndef WEECHAT_GUILE_API_H
#define WEECHAT_GUILE_API_H 1
-extern int weechat_guile_api_buffer_input_data_cb (void *data,
+extern int weechat_guile_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_guile_api_buffer_close_cb (void *data,
+extern int weechat_guile_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
extern void weechat_guile_api_module_init (void *data);
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c
index 85d49e76d..b24cf7203 100644
--- a/src/plugins/guile/weechat-guile.c
+++ b/src/plugins/guile/weechat-guile.c
@@ -587,13 +587,15 @@ weechat_guile_reload_name (const char *name)
*/
int
-weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_guile_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
SCM value;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -700,11 +702,13 @@ weechat_guile_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_guile_completion_cb (void *data, const char *completion_item,
+weechat_guile_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -719,9 +723,11 @@ weechat_guile_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_guile_hdata_cb (void *data, const char *hdata_name)
+weechat_guile_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -734,10 +740,12 @@ weechat_guile_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_guile_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_guile_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -746,7 +754,7 @@ weechat_guile_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "guile_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_guile_plugin,
- guile_scripts, pointer,
+ guile_scripts, obj_pointer,
arguments);
}
@@ -758,10 +766,12 @@ weechat_guile_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_guile_signal_debug_dump_cb (void *data, const char *signal,
+weechat_guile_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -780,10 +790,12 @@ weechat_guile_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_guile_signal_debug_libs_cb (void *data, const char *signal,
+weechat_guile_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -803,38 +815,20 @@ weechat_guile_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_guile_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data,
- void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (guile_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_guile_timer_action_cb (void *data, int remaining_calls)
+weechat_guile_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &guile_action_install_list)
+ if (pointer == &guile_action_install_list)
{
plugin_script_action_install (weechat_guile_plugin,
guile_scripts,
@@ -843,7 +837,7 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
&guile_quiet,
&guile_action_install_list);
}
- else if (data == &guile_action_remove_list)
+ else if (pointer == &guile_action_remove_list)
{
plugin_script_action_remove (weechat_guile_plugin,
guile_scripts,
@@ -851,7 +845,7 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
&guile_quiet,
&guile_action_remove_list);
}
- else if (data == &guile_action_autoload_list)
+ else if (pointer == &guile_action_autoload_list)
{
plugin_script_action_autoload (weechat_guile_plugin,
&guile_quiet,
@@ -867,11 +861,13 @@ weechat_guile_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_guile_signal_script_action_cb (void *data, const char *signal,
+weechat_guile_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -882,7 +878,7 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_guile_timer_action_cb,
- &guile_action_install_list);
+ &guile_action_install_list, NULL);
}
else if (strcmp (signal, "guile_script_remove") == 0)
{
@@ -890,7 +886,7 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_guile_timer_action_cb,
- &guile_action_remove_list);
+ &guile_action_remove_list, NULL);
}
else if (strcmp (signal, "guile_script_autoload") == 0)
{
@@ -898,7 +894,7 @@ weechat_guile_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_guile_timer_action_cb,
- &guile_action_autoload_list);
+ &guile_action_autoload_list, NULL);
}
}
@@ -996,7 +992,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_guile_infolist_cb;
init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_guile_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_guile_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_guile_signal_script_action_cb;
init.callback_load_file = &weechat_guile_load_cb;
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 4c8f96e2f..fb599fb02 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -38,7 +38,8 @@
*/
char *
-irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_plugin (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -50,6 +51,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -198,12 +200,14 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name)
*/
char *
-irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_name (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -218,12 +222,14 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_short_name (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -237,7 +243,8 @@ irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
+irc_bar_item_buffer_modes (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -249,6 +256,7 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -297,7 +305,8 @@ irc_bar_item_buffer_modes (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
+irc_bar_item_channel (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
@@ -308,6 +317,7 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
struct t_irc_channel *channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -374,7 +384,8 @@ irc_bar_item_channel (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
+irc_bar_item_lag (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window, struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
@@ -382,6 +393,7 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
struct t_irc_server *server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -413,7 +425,8 @@ irc_bar_item_lag (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
+irc_bar_item_input_prompt (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -425,6 +438,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
int length;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -494,7 +508,8 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
*/
char *
-irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
+irc_bar_item_nick_modes (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
@@ -504,6 +519,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
int length;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) item;
(void) window;
@@ -533,7 +549,7 @@ irc_bar_item_nick_modes (void *data, struct t_gui_bar_item *item,
*/
struct t_hashtable *
-irc_bar_item_focus_buffer_nicklist (void *data,
+irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data,
struct t_hashtable *info)
{
long unsigned int value;
@@ -555,6 +571,7 @@ irc_bar_item_focus_buffer_nicklist (void *data,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (ptr_server && ptr_channel)
@@ -579,10 +596,12 @@ irc_bar_item_focus_buffer_nicklist (void *data,
*/
int
-irc_bar_item_buffer_switch (void *data, const char *signal,
+irc_bar_item_buffer_switch (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -619,16 +638,26 @@ irc_bar_item_update_channel ()
void
irc_bar_item_init ()
{
- weechat_bar_item_new ("buffer_plugin", &irc_bar_item_buffer_plugin, NULL);
- weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL);
- weechat_bar_item_new ("buffer_short_name", &irc_bar_item_buffer_short_name, NULL);
- weechat_bar_item_new ("buffer_modes", &irc_bar_item_buffer_modes, NULL);
- weechat_bar_item_new ("irc_channel", &irc_bar_item_channel, NULL);
- weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL);
- weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL);
- weechat_bar_item_new ("irc_nick_modes", &irc_bar_item_nick_modes, NULL);
+ weechat_bar_item_new ("buffer_plugin",
+ &irc_bar_item_buffer_plugin, NULL, NULL);
+ weechat_bar_item_new ("buffer_name",
+ &irc_bar_item_buffer_name, NULL, NULL);
+ weechat_bar_item_new ("buffer_short_name",
+ &irc_bar_item_buffer_short_name, NULL, NULL);
+ weechat_bar_item_new ("buffer_modes",
+ &irc_bar_item_buffer_modes, NULL, NULL);
+ weechat_bar_item_new ("irc_channel",
+ &irc_bar_item_channel, NULL, NULL);
+ weechat_bar_item_new ("lag",
+ &irc_bar_item_lag, NULL, NULL);
+ weechat_bar_item_new ("input_prompt",
+ &irc_bar_item_input_prompt, NULL, NULL);
+ weechat_bar_item_new ("irc_nick_modes",
+ &irc_bar_item_nick_modes, NULL, NULL);
+
weechat_hook_focus ("buffer_nicklist",
- &irc_bar_item_focus_buffer_nicklist, NULL);
+ &irc_bar_item_focus_buffer_nicklist, NULL, NULL);
+
weechat_hook_signal ("buffer_switch",
- &irc_bar_item_buffer_switch, NULL);
+ &irc_bar_item_buffer_switch, NULL, NULL);
}
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index f7df9d267..bee87ed56 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -112,13 +112,15 @@ irc_buffer_build_name (const char *server, const char *channel)
*/
int
-irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+irc_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
struct t_irc_channel *next_channel;
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (buffer == irc_raw_buffer)
@@ -175,15 +177,18 @@ irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
*/
int
-irc_buffer_nickcmp_cb (void *data,
+irc_buffer_nickcmp_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
const char *nick1,
const char *nick2)
{
struct t_irc_server *server;
- if (data)
- server = (struct t_irc_server *)data;
+ /* make C compiler happy */
+ (void) data;
+
+ if (pointer)
+ server = (struct t_irc_server *)pointer;
else
irc_buffer_get_server_and_channel (buffer, &server, NULL);
diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h
index b31a5c2bb..c58dfe73e 100644
--- a/src/plugins/irc/irc-buffer.h
+++ b/src/plugins/irc/irc-buffer.h
@@ -53,11 +53,11 @@ extern void irc_buffer_get_server_and_channel (struct t_gui_buffer *buffer,
struct t_irc_channel **channel);
extern const char *irc_buffer_build_name (const char *server,
const char *channel);
-extern int irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
-extern int irc_buffer_nickcmp_cb (void *data,
+extern int irc_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer);
+extern int irc_buffer_nickcmp_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
- const char *nick1,
- const char *nick2);
+ const char *nick1, const char *nick2);
extern struct t_gui_buffer *irc_buffer_search_server_lowest_number ();
extern struct t_gui_buffer *irc_buffer_search_private_lowest_number (struct t_irc_server *server);
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index fe7b92863..20c912360 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -270,8 +270,8 @@ irc_channel_create_buffer (struct t_irc_server *server,
weechat_current_buffer (), "number");
ptr_buffer = weechat_buffer_new (buffer_name,
- &irc_input_data_cb, NULL,
- &irc_buffer_close_cb, NULL);
+ &irc_input_data_cb, NULL, NULL,
+ &irc_buffer_close_cb, NULL, NULL);
if (!ptr_buffer)
return NULL;
@@ -351,7 +351,7 @@ irc_channel_create_buffer (struct t_irc_server *server,
weechat_buffer_set (ptr_buffer, "nicklist_display_groups", "0");
weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback",
&irc_buffer_nickcmp_cb);
- weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback_data",
+ weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback_pointer",
server);
}
@@ -463,8 +463,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
new_channel->checking_whox = 0;
new_channel->away_message = NULL;
new_channel->has_quit_server = 0;
@@ -1024,8 +1023,7 @@ irc_channel_join_smart_filtered_add (struct t_irc_channel *channel,
64,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_TIME,
- NULL,
- NULL);
+ NULL, NULL);
}
if (!channel->join_smart_filtered)
return;
@@ -1224,8 +1222,7 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
hashtable = weechat_hashtable_new (4,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hashtable)
{
/* update tags in line (remove tag "irc_smart_filter") */
@@ -1280,15 +1277,17 @@ irc_channel_rejoin (struct t_irc_server *server, struct t_irc_channel *channel)
*/
int
-irc_channel_autorejoin_cb (void *data, int remaining_calls)
+irc_channel_autorejoin_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_irc_server *ptr_server, *ptr_server_found;
struct t_irc_channel *ptr_channel_arg, *ptr_channel;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- ptr_channel_arg = (struct t_irc_channel *)data;
+ ptr_channel_arg = (struct t_irc_channel *)pointer;
ptr_server_found = NULL;
for (ptr_server = irc_servers; ptr_server;
@@ -1435,11 +1434,13 @@ irc_channel_free_all (struct t_irc_server *server)
*/
struct t_hdata *
-irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
+irc_channel_hdata_channel_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel",
@@ -1481,11 +1482,13 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
*/
struct t_hdata *
-irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
+irc_channel_hdata_channel_speaking_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 479dbba45..5c8dd6a9e 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -151,13 +151,16 @@ extern void irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channe
const char *nick);
extern void irc_channel_rejoin (struct t_irc_server *server,
struct t_irc_channel *channel);
-extern int irc_channel_autorejoin_cb (void *data, int remaining_calls);
+extern int irc_channel_autorejoin_cb (const void *pointer, void *data,
+ int remaining_calls);
extern void irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
struct t_irc_nick *nick,
const char *nickname);
-extern struct t_hdata *irc_channel_hdata_channel_cb (void *data,
+extern struct t_hdata *irc_channel_hdata_channel_cb (const void *pointer,
+ void *data,
const char *hdata_name);
-extern struct t_hdata *irc_channel_hdata_channel_speaking_cb (void *data,
+extern struct t_hdata *irc_channel_hdata_channel_speaking_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_channel_add_to_infolist (struct t_infolist *infolist,
struct t_irc_channel *channel);
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index 194a32ac3..5f9c1e52e 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -767,12 +767,14 @@ irc_color_decode_ansi (const char *string, int keep_colors)
*/
char *
-irc_color_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+irc_color_modifier_cb (const void *pointer, void *data,
+ const char *modifier, const char *modifier_data,
+ const char *string)
{
int keep_colors;
/* make C compiler happy */
+ (void) pointer;
(void) data;
keep_colors = (modifier_data && (strcmp (modifier_data, "1") == 0)) ? 1 : 0;
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index 9425db0ac..4bc9ffb8f 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -106,7 +106,8 @@ struct t_irc_color_ansi_state
extern char *irc_color_decode (const char *string, int keep_colors);
extern char *irc_color_encode (const char *string, int keep_colors);
-extern char *irc_color_modifier_cb (void *data, const char *modifier,
+extern char *irc_color_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
const char *modifier_data,
const char *string);
extern char *irc_color_for_tags (const char *color);
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index d3fa3becf..5fa524513 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -142,8 +142,7 @@ irc_command_mode_nicks (struct t_irc_server *server,
nicks_sent = weechat_hashtable_new (128,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!nicks_sent)
return;
@@ -241,14 +240,13 @@ irc_command_mode_nicks (struct t_irc_server *server,
* the server.
*/
-int
-irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(admin)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("admin", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -390,9 +388,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
* connected servers.
*/
-int
-irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(allchan)
{
int i, current_server;
const char *ptr_exclude_channels, *ptr_command;
@@ -400,6 +396,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -441,9 +438,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc,
* connected servers.
*/
-int
-irc_command_allpv (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(allpv)
{
int i, current_server;
const char *ptr_exclude_channels, *ptr_command;
@@ -451,6 +446,7 @@ irc_command_allpv (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -593,14 +589,13 @@ irc_command_exec_all_servers (const char *exclude_servers, const char *command)
* Callback for command "/allserv": executes a command on all connected servers.
*/
-int
-irc_command_allserv (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(allserv)
{
int i;
const char *ptr_exclude_servers, *ptr_command;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -889,13 +884,12 @@ irc_command_away_server (struct t_irc_server *server, const char *arguments,
* Callback for command "/away": toggles away status.
*/
-int
-irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(away)
{
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if ((argc >= 2) && (weechat_strcasecmp (argv[1], "-all") == 0))
@@ -928,7 +922,8 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
-irc_command_run_away (void *data, struct t_gui_buffer *buffer,
+irc_command_run_away (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
int argc;
@@ -939,7 +934,7 @@ irc_command_run_away (void *data, struct t_gui_buffer *buffer,
if (argv && argv_eol)
{
- irc_command_away (data, buffer, argc, argv, argv_eol);
+ irc_command_away (pointer, data, buffer, argc, argv, argv_eol);
}
if (argv)
@@ -993,9 +988,7 @@ irc_command_send_ban (struct t_irc_server *server,
* Callback for command "/ban": bans nicks or hosts.
*/
-int
-irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(ban)
{
char *pos_channel;
int pos_args;
@@ -1004,6 +997,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("ban", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -1080,14 +1074,13 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
* http://ircv3.net/specs/core/capability-negotiation-3.2.html
*/
-int
-irc_command_cap (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(cap)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("cap", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc > 1)
@@ -1165,9 +1158,7 @@ irc_command_connect_one_server (struct t_irc_server *server,
* Callback for command "/connect": connects to server(s).
*/
-int
-irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(connect)
{
int i, nb_connect, connect_ok, all_servers, all_opened, switch_address;
int no_join, autoconnect;
@@ -1176,6 +1167,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -1362,9 +1354,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/ctcp": sends a CTCP message.
*/
-int
-irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(ctcp)
{
char **targets, *ctcp_type, str_time[512];
const char *ctcp_target, *ctcp_args;
@@ -1374,6 +1364,7 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -1474,9 +1465,7 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/cycle": leaves and rejoins a channel.
*/
-int
-irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(cycle)
{
char *channel_name, *pos_args, *buf;
const char *version, *ptr_arg, *msg_part;
@@ -1487,6 +1476,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("cycle", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -1579,9 +1569,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/dcc": DCC control (file or chat).
*/
-int
-irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(dcc)
{
struct sockaddr_storage addr;
socklen_t length;
@@ -1594,6 +1582,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("dcc", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -1678,14 +1667,13 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc,
* nickname(s).
*/
-int
-irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(dehalfop)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("dehalfop", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -1718,14 +1706,13 @@ irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/deop": removes operator privileges from nickname(s).
*/
-int
-irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(deop)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("deop", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -1758,14 +1745,13 @@ irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/devoice": removes voice from nickname(s).
*/
-int
-irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(devoice)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("devoice", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -1798,14 +1784,13 @@ irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/die": shutdowns the server.
*/
-int
-irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(die)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("die", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -1900,9 +1885,7 @@ irc_command_disconnect_one_server (struct t_irc_server *server,
* Callback for command "/disconnect": disconnects from server(s).
*/
-int
-irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(disconnect)
{
int disconnect_ok;
const char *reason;
@@ -1910,6 +1893,7 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
reason = (argc > 2) ? argv_eol[2] : NULL;
@@ -1976,14 +1960,13 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc,
* nickname(s).
*/
-int
-irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(halfop)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("halfop", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -2043,9 +2026,7 @@ irc_command_ignore_display (struct t_irc_ignore *ignore)
* Callback for command "/ignore": adds or removes ignore.
*/
-int
-irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(ignore)
{
struct t_irc_ignore *ptr_ignore;
char *mask, *regex, *regex2, *ptr_regex, *server, *channel, *error;
@@ -2053,6 +2034,7 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
long number;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) argv_eol;
@@ -2205,14 +2187,13 @@ irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/info": gets information describing the server.
*/
-int
-irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(info)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("info", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -2234,9 +2215,7 @@ irc_command_info (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/invite": invites a nick on a channel.
*/
-int
-irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(invite)
{
int i, arg_last_nick;
char *ptr_channel_name;
@@ -2245,6 +2224,7 @@ irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("invite", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -2299,14 +2279,13 @@ error:
* Callback for command "/ison": checks if a nickname is currently on IRC.
*/
-int
-irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(ison)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ison", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -2463,9 +2442,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
* Callback for command "/join": joins a new channel.
*/
-int
-irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(join)
{
int i, arg_channels, noswitch;
const char *ptr_type, *ptr_server_name, *ptr_channel_name;
@@ -2473,6 +2450,7 @@ irc_command_join (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
noswitch = 0;
@@ -2589,9 +2567,7 @@ irc_command_kick_channel (struct t_irc_server *server,
* Callback for command "/kick": forcibly removes a user from a channel.
*/
-int
-irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(kick)
{
char *pos_channel, *pos_nick, *pos_comment;
@@ -2599,6 +2575,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("kick", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -2637,9 +2614,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
* bans it.
*/
-int
-irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(kickban)
{
char *pos_channel, *pos_nick, *nick_only, *pos_comment, *pos, *mask;
int length;
@@ -2648,6 +2623,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("kickban", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -2732,14 +2708,13 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/kill": closes client-server connection.
*/
-int
-irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(kill)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("kill", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -2763,14 +2738,13 @@ irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc,
* server answering the query.
*/
-int
-irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(links)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("links", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -2792,9 +2766,7 @@ irc_command_links (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/list": lists channels and their topic.
*/
-int
-irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(list)
{
char buf[512], *ptr_channel_name, *ptr_server_name, *ptr_regex;
int i, ret;
@@ -2803,6 +2775,7 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("list", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (ptr_server->cmd_list_regexp)
@@ -2896,14 +2869,13 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc,
* network.
*/
-int
-irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(lusers)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("lusers", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -2925,14 +2897,13 @@ irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/map": shows a graphical map of the IRC network.
*/
-int
-irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(map)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("map", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -2954,14 +2925,13 @@ irc_command_map (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/me": sends a ctcp action to the current channel.
*/
-int
-irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
- char **argv_eol)
+IRC_COMMAND_CALLBACK(me)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("me", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3013,14 +2983,13 @@ irc_command_mode_server (struct t_irc_server *server,
* Callback for command "/mode": changes mode for channel/nickname.
*/
-int
-irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(mode)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("mode", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc > 1)
@@ -3070,14 +3039,13 @@ irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/motd": gets the "Message Of The Day".
*/
-int
-irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(motd)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("motd", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3099,9 +3067,7 @@ irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/msg": sends a message to a nick or channel.
*/
-int
-irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(msg)
{
char **targets, *msg_pwd_hidden, *string;
int num_targets, i, j, arg_target, arg_text, is_channel, status_msg;
@@ -3111,6 +3077,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -3319,14 +3286,13 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/names": lists nicknames on channels.
*/
-int
-irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(names)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("names", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3376,14 +3342,13 @@ irc_send_nick_server (struct t_irc_server *server, const char *nickname)
* Callback for command "/nick": changes nickname.
*/
-int
-irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(nick)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("nick", 0);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -3409,9 +3374,7 @@ irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/notice": sends notice message.
*/
-int
-irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(notice)
{
char *string, hash_key[32], *str_args;
int arg_target, arg_text, number, is_channel;
@@ -3421,6 +3384,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -3495,9 +3459,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/notify": adds or removes notify.
*/
-int
-irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(notify)
{
struct t_irc_notify *ptr_notify;
int i, check_away;
@@ -3505,6 +3467,7 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) argv_eol;
@@ -3682,14 +3645,13 @@ irc_command_notify (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/op": gives operator privileges to nickname(s).
*/
-int
-irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
- char **argv_eol)
+IRC_COMMAND_CALLBACK(op)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("op", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -3722,14 +3684,13 @@ irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
* Callback for command "/oper": gets oper privileges.
*/
-int
-irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(oper)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("oper", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3779,9 +3740,7 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
* Callback for command "/part": leaves a channel or close a private window.
*/
-int
-irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(part)
{
char *channel_name, *pos_args;
@@ -3789,6 +3748,7 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("part", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc > 1)
@@ -3848,14 +3808,13 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/ping": pings a server.
*/
-int
-irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(ping)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("ping", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3871,14 +3830,13 @@ irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/pong": sends pong answer to a daemon.
*/
-int
-irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(pong)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("pong", 0);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -3894,9 +3852,7 @@ irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/query": starts private conversation with a nick.
*/
-int
-irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(query)
{
char *string, **nicks;
int i, arg_nick, arg_text, num_nicks, noswitch;
@@ -3904,6 +3860,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -4012,9 +3969,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/quiet": quiets nicks or hosts.
*/
-int
-irc_command_quiet (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(quiet)
{
char *pos_channel;
int pos_args;
@@ -4023,6 +3978,7 @@ irc_command_quiet (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("quiet", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -4095,13 +4051,12 @@ irc_command_quiet (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/quote": sends raw data to server.
*/
-int
-irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(quote)
{
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -4172,15 +4127,14 @@ irc_command_reconnect_one_server (struct t_irc_server *server,
* Callback for command "/reconnect": reconnects to server(s).
*/
-int
-irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(reconnect)
{
int i, nb_reconnect, reconnect_ok, all_servers, switch_address, no_join;
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -4261,14 +4215,13 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/rehash": tells the server to reload its config file.
*/
-int
-irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(rehash)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("rehash", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -4290,9 +4243,7 @@ irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/remove": remove a user from a channel.
*/
-int
-irc_command_remove (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(remove)
{
const char *ptr_channel_name;
char *msg_vars_replaced;
@@ -4302,6 +4253,7 @@ irc_command_remove (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("remove", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -4353,14 +4305,13 @@ irc_command_remove (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/restart": tells the server to restart itself.
*/
-int
-irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(restart)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("restart", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -4382,14 +4333,13 @@ irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/sajoin": forces a user to join channel(s).
*/
-int
-irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(sajoin)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sajoin", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -4405,14 +4355,13 @@ irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc,
* operator status.
*/
-int
-irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(samode)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("samode", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc > 1)
@@ -4465,14 +4414,13 @@ irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/sanick": forces a user to use another nick.
*/
-int
-irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(sanick)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sanick", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -4487,14 +4435,13 @@ irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/sapart": forces a user to leave channel(s).
*/
-int
-irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(sapart)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("sapart", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -4509,14 +4456,13 @@ irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/saquit": forces a user to quit server with a reason.
*/
-int
-irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(saquit)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("saquit", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(3, "");
@@ -4947,9 +4893,7 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
* Callback for command "/server": manages IRC servers.
*/
-int
-irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(server)
{
int i, detailed_list, one_server_found, length, count;
struct t_irc_server *ptr_server2, *server_found, *new_server;
@@ -4958,6 +4902,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -5313,14 +5258,13 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/service": registers a new service.
*/
-int
-irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(service)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("service", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5337,14 +5281,13 @@ irc_command_service (void *data, struct t_gui_buffer *buffer, int argc,
* network.
*/
-int
-irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(servlist)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("servlist", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5366,14 +5309,13 @@ irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/squery": delivers a message to a service.
*/
-int
-irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(squery)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squery", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -5396,14 +5338,13 @@ irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/squit": disconnects server links.
*/
-int
-irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(squit)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("squit", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5418,14 +5359,13 @@ irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/stats": queries statistics about server.
*/
-int
-irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(stats)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("stats", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5448,14 +5388,13 @@ irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc,
* server a message asking them to please join IRC.
*/
-int
-irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(summon)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("summon", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5471,14 +5410,13 @@ irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/time": queries local time from server.
*/
-int
-irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(time)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("time", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5500,9 +5438,7 @@ irc_command_time (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/topic": gets/sets topic for a channel.
*/
-int
-irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(topic)
{
char *channel_name, *new_topic, *new_topic_color;
@@ -5510,6 +5446,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("topic", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5578,14 +5515,13 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/trace": finds the route to specific server.
*/
-int
-irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(trace)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("trace", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5607,9 +5543,7 @@ irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/unban": unbans nicks or hosts.
*/
-int
-irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(unban)
{
char *pos_channel;
int pos_args;
@@ -5618,6 +5552,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("unban", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -5665,9 +5600,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/unquiet": unquiets nicks or hosts.
*/
-int
-irc_command_unquiet (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(unquiet)
{
char *pos_channel;
int pos_args;
@@ -5676,6 +5609,7 @@ irc_command_unquiet (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("unquiet", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -5734,14 +5668,13 @@ irc_command_unquiet (void *data, struct t_gui_buffer *buffer, int argc,
* nicknames.
*/
-int
-irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(userhost)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("userhost", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5757,14 +5690,13 @@ irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/users": list of users logged into the server.
*/
-int
-irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(users)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("users", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -5787,14 +5719,13 @@ irc_command_users (void *data, struct t_gui_buffer *buffer, int argc,
* (current or specified).
*/
-int
-irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(version)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("version", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -5825,14 +5756,13 @@ irc_command_version (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/voice": gives voice to nickname(s).
*/
-int
-irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(voice)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
IRC_COMMAND_CHECK_SERVER("voice", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -5865,9 +5795,7 @@ irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/wallchops": sends a notice to channel ops.
*/
-int
-irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(wallchops)
{
char *pos_channel;
int pos_args;
@@ -5878,6 +5806,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("wallchops", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
WEECHAT_COMMAND_MIN_ARGS(2, "");
@@ -5977,14 +5906,13 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
* users who have set the 'w' user mode for themselves.
*/
-int
-irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(wallops)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("wallops", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -6001,14 +5929,13 @@ irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc,
* information.
*/
-int
-irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(who)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("who", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -6030,9 +5957,7 @@ irc_command_who (void *data, struct t_gui_buffer *buffer, int argc,
* Callback for command "/whois": queries information about user(s).
*/
-int
-irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(whois)
{
int double_nick;
const char *ptr_nick;
@@ -6041,6 +5966,7 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("whois", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
double_nick = weechat_config_boolean (irc_config_network_whois_double_nick);
@@ -6082,14 +6008,13 @@ irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc,
* no longer exists.
*/
-int
-irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc,
- char **argv, char **argv_eol)
+IRC_COMMAND_CALLBACK(whowas)
{
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("whowas", 1);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv;
@@ -6113,7 +6038,7 @@ irc_command_init ()
N_("find information about the administrator of the server"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_admin, NULL);
+ NULL, &irc_command_admin, NULL, NULL);
weechat_hook_command (
"allchan",
N_("execute a command on all channels of all connected servers"),
@@ -6133,7 +6058,7 @@ irc_command_init ()
" say 'hello' everywhere but not on #weechat and channels beginning "
"with #linux:\n"
" /allchan -exclude=#weechat,#linux* msg * hello"),
- "-current", &irc_command_allchan, NULL);
+ "-current", &irc_command_allchan, NULL, NULL);
weechat_hook_command (
"allpv",
N_("execute a command on all private buffers of all connected servers"),
@@ -6156,7 +6081,7 @@ irc_command_init ()
" /allpv -exclude=foo,bar* msg * hello\n"
" close all private buffers:\n"
" /allpv close"),
- "-current", &irc_command_allpv, NULL);
+ "-current", &irc_command_allpv, NULL, NULL);
weechat_hook_command (
"allserv",
N_("execute a command on all connected servers"),
@@ -6174,8 +6099,8 @@ irc_command_init ()
" /allserv away I'm away\n"
" do a whois on my nick on all servers:\n"
" /allserv whois $nick"),
- NULL, &irc_command_allserv, NULL);
- weechat_hook_command_run ("/away", &irc_command_run_away, NULL);
+ NULL, &irc_command_allserv, NULL, NULL);
+ weechat_hook_command_run ("/away", &irc_command_run_away, NULL, NULL);
weechat_hook_command (
"ban",
N_("ban nicks or hosts"),
@@ -6185,7 +6110,7 @@ irc_command_init ()
"\n"
"Without argument, this command displays the ban list for current "
"channel."),
- "%(irc_channel_nicks_hosts)", &irc_command_ban, NULL);
+ "%(irc_channel_nicks_hosts)", &irc_command_ban, NULL, NULL);
weechat_hook_command (
"cap",
N_("client capability negotiation"),
@@ -6216,7 +6141,7 @@ irc_command_init ()
" || req " IRC_COMMAND_CAP_SUPPORTED_COMPLETION
" || ack " IRC_COMMAND_CAP_SUPPORTED_COMPLETION
" || end",
- &irc_command_cap, NULL);
+ &irc_command_cap, NULL, NULL);
weechat_hook_command (
"connect",
N_("connect to IRC server(s)"),
@@ -6254,7 +6179,7 @@ irc_command_init ()
" /connect irc://nick@irc.oftc.net/#channel\n"
" /connect -switch"),
"%(irc_servers)|-all|-auto|-open|-nojoin|-switch|%*",
- &irc_command_connect, NULL);
+ &irc_command_connect, NULL, NULL);
weechat_hook_command (
"ctcp",
N_("send a CTCP message (Client-To-Client Protocol)"),
@@ -6272,14 +6197,14 @@ irc_command_init ()
IRC_COMMAND_CTCP_SUPPORTED_COMPLETION
" || %(irc_channel)|%(nicks)|* "
IRC_COMMAND_CTCP_SUPPORTED_COMPLETION,
- &irc_command_ctcp, NULL);
+ &irc_command_ctcp, NULL, NULL);
weechat_hook_command (
"cycle",
N_("leave and rejoin a channel"),
N_("[<channel>[,<channel>...]] [<message>]"),
N_("channel: channel name\n"
"message: part message (displayed to other users)"),
- "%(irc_msg_part)", &irc_command_cycle, NULL);
+ "%(irc_msg_part)", &irc_command_cycle, NULL, NULL);
weechat_hook_command (
"dcc",
N_("start a DCC (file transfer or direct chat)"),
@@ -6294,7 +6219,7 @@ irc_command_init ()
" /dcc send toto /home/foo/bar.txt"),
"chat %(nicks)"
" || send %(nicks) %(filename)",
- &irc_command_dcc, NULL);
+ &irc_command_dcc, NULL, NULL);
weechat_hook_command (
"dehalfop",
N_("remove channel half-operator status from nick(s)"),
@@ -6302,7 +6227,7 @@ irc_command_init ()
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: remove channel half-operator status from everybody on channel "
"except yourself"),
- "%(nicks)", &irc_command_dehalfop, NULL);
+ "%(nicks)", &irc_command_dehalfop, NULL, NULL);
weechat_hook_command (
"deop",
N_("remove channel operator status from nick(s)"),
@@ -6310,20 +6235,20 @@ irc_command_init ()
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: remove channel operator status from everybody on channel "
"except yourself"),
- "%(nicks)|%*", &irc_command_deop, NULL);
+ "%(nicks)|%*", &irc_command_deop, NULL, NULL);
weechat_hook_command (
"devoice",
N_("remove voice from nick(s)"),
N_("<nick> [<nick>...] || * -yes"),
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: remove voice from everybody on channel"),
- "%(nicks)|%*", &irc_command_devoice, NULL);
+ "%(nicks)|%*", &irc_command_devoice, NULL, NULL);
weechat_hook_command (
"die",
N_("shutdown the server"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_die, NULL);
+ NULL, &irc_command_die, NULL, NULL);
weechat_hook_command (
"disconnect",
N_("disconnect from one or all IRC servers"),
@@ -6334,14 +6259,14 @@ irc_command_init ()
"reconnecting\n"
" reason: reason for the \"quit\""),
"%(irc_servers)|-all|-pending",
- &irc_command_disconnect, NULL);
+ &irc_command_disconnect, NULL, NULL);
weechat_hook_command (
"halfop",
N_("give channel half-operator status to nick(s)"),
N_("<nick> [<nick>...] || * -yes"),
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: give channel half-operator status to everybody on channel"),
- "%(nicks)", &irc_command_halfop, NULL);
+ "%(nicks)", &irc_command_halfop, NULL, NULL);
weechat_hook_command (
"ignore",
N_("ignore nicks/hosts from servers or channels"),
@@ -6372,26 +6297,26 @@ irc_command_init ()
"list"
" || add %(irc_channel_nicks_hosts) %(irc_servers) %(irc_channels) %-"
" || del -all|%(irc_ignores_numbers) %-",
- &irc_command_ignore, NULL);
+ &irc_command_ignore, NULL, NULL);
weechat_hook_command (
"info",
N_("get information describing the server"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_info, NULL);
+ NULL, &irc_command_info, NULL, NULL);
weechat_hook_command (
"invite",
N_("invite a nick on a channel"),
N_("<nick> [<nick>...] [<channel>]"),
N_(" nick: nick\n"
"channel: channel name"),
- "%(nicks) %(irc_server_channels)", &irc_command_invite, NULL);
+ "%(nicks) %(irc_server_channels)", &irc_command_invite, NULL, NULL);
weechat_hook_command (
"ison",
N_("check if a nick is currently on IRC"),
N_("<nick> [<nick>...]"),
N_("nick: nick"),
- "%(nicks)|%*", &irc_command_ison, NULL);
+ "%(nicks)|%*", &irc_command_ison, NULL, NULL);
weechat_hook_command (
"join",
N_("join a channel"),
@@ -6409,7 +6334,7 @@ irc_command_init ()
" /join -server freenode #weechat\n"
" /join -noswitch #weechat"),
"%(irc_channels)|-noswitch|-server|%(irc_servers)|%*",
- &irc_command_join, NULL);
+ &irc_command_join, NULL, NULL);
weechat_hook_command (
"kick",
N_("kick a user out of a channel"),
@@ -6418,7 +6343,7 @@ irc_command_init ()
" nick: nick\n"
" reason: reason (special variables $nick, $channel and $server are "
"replaced by their value)"),
- "%(nicks) %(irc_msg_kick) %-", &irc_command_kick, NULL);
+ "%(nicks) %(irc_msg_kick) %-", &irc_command_kick, NULL, NULL);
weechat_hook_command (
"kickban",
N_("kick a user out of a channel and ban the host"),
@@ -6435,14 +6360,14 @@ irc_command_init ()
" ban \"*!*@host.com\" and then kick \"toto\":\n"
" /kickban toto!*@host.com"),
"%(irc_channel_nicks_hosts) %(irc_msg_kick) %-",
- &irc_command_kickban, NULL);
+ &irc_command_kickban, NULL, NULL);
weechat_hook_command (
"kill",
N_("close client-server connection"),
N_("<nick> [<reason>]"),
N_(" nick: nick\n"
"reason: reason"),
- "%(nicks) %-", &irc_command_kill, NULL);
+ "%(nicks) %-", &irc_command_kill, NULL, NULL);
weechat_hook_command (
"links",
N_("list all servernames which are known by the server answering the "
@@ -6450,7 +6375,7 @@ irc_command_init ()
N_("[[<server>] <server_mask>]"),
N_(" server: this server should answer the query\n"
"server_mask: list of servers must match this mask"),
- NULL, &irc_command_links, NULL);
+ NULL, &irc_command_links, NULL, NULL);
weechat_hook_command (
"list",
N_("list channels and their topic"),
@@ -6470,26 +6395,26 @@ irc_command_init ()
" list all channels beginning with \"#weechat\" (can be very slow "
"on large networks):\n"
" /list -re #weechat.*"),
- NULL, &irc_command_list, NULL);
+ NULL, &irc_command_list, NULL, NULL);
weechat_hook_command (
"lusers",
N_("get statistics about the size of the IRC network"),
N_("[<mask> [<target>]]"),
N_(" mask: servers matching the mask only\n"
"target: server for forwarding request"),
- NULL, &irc_command_lusers, NULL);
+ NULL, &irc_command_lusers, NULL, NULL);
weechat_hook_command (
"map",
N_("show a graphical map of the IRC network"),
"",
"",
- NULL, &irc_command_map, NULL);
+ NULL, &irc_command_map, NULL, NULL);
weechat_hook_command (
"me",
N_("send a CTCP action to the current channel"),
N_("<message>"),
N_("message: message to send"),
- NULL, &irc_command_me, NULL);
+ NULL, &irc_command_me, NULL, NULL);
weechat_hook_command (
"mode",
N_("change channel or user mode"),
@@ -6524,13 +6449,13 @@ irc_command_init ()
" /mode #weechat +t\n"
" become invisible on server:\n"
" /mode nick +i"),
- "%(irc_channel)|%(irc_server_nick)", &irc_command_mode, NULL);
+ "%(irc_channel)|%(irc_server_nick)", &irc_command_mode, NULL, NULL);
weechat_hook_command (
"motd",
N_("get the \"Message Of The Day\""),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_motd, NULL);
+ NULL, &irc_command_motd, NULL, NULL);
weechat_hook_command (
"msg",
N_("send message to a nick or channel"),
@@ -6540,13 +6465,13 @@ irc_command_init ()
" text: text to send"),
"-server %(irc_servers) %(nicks)|*"
" || %(nicks)|*",
- &irc_command_msg, NULL);
+ &irc_command_msg, NULL, NULL);
weechat_hook_command (
"names",
N_("list nicks on channels"),
N_("[<channel>[,<channel>...]]"),
N_("channel: channel name"),
- "%(irc_channels)", &irc_command_names, NULL);
+ "%(irc_channels)", &irc_command_names, NULL, NULL);
weechat_hook_command (
"nick",
N_("change current nick"),
@@ -6555,7 +6480,7 @@ irc_command_init ()
"nick: new nick"),
"-all %(irc_server_nick)"
" || %(irc_server_nick)",
- &irc_command_nick, NULL);
+ &irc_command_nick, NULL, NULL);
weechat_hook_command (
"notice",
N_("send notice message to user"),
@@ -6565,7 +6490,7 @@ irc_command_init ()
" text: text to send"),
"-server %(irc_servers) %(nicks)"
" || %(nicks)",
- &irc_command_notice, NULL);
+ &irc_command_notice, NULL, NULL);
weechat_hook_command (
"notify",
N_("add a notification for presence or away status of nicks on servers"),
@@ -6591,42 +6516,42 @@ irc_command_init ()
" /notify add toto freenode -away"),
"add %(irc_channel_nicks) %(irc_servers) -away %-"
" || del -all|%(irc_notify_nicks) %(irc_servers) %-",
- &irc_command_notify, NULL);
+ &irc_command_notify, NULL, NULL);
weechat_hook_command (
"op",
N_("give channel operator status to nick(s)"),
N_("<nick> [<nick>...] || * -yes"),
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: give channel operator status to everybody on channel"),
- "%(nicks)|%*", &irc_command_op, NULL);
+ "%(nicks)|%*", &irc_command_op, NULL, NULL);
weechat_hook_command (
"oper",
N_("get operator privileges"),
N_("<user> <password>"),
N_(" user: user\n"
"password: password"),
- NULL, &irc_command_oper, NULL);
+ NULL, &irc_command_oper, NULL, NULL);
weechat_hook_command (
"part",
N_("leave a channel"),
N_("[<channel>[,<channel>...]] [<message>]"),
N_("channel: channel name to leave\n"
"message: part message (displayed to other users)"),
- "%(irc_msg_part)", &irc_command_part, NULL);
+ "%(irc_msg_part)", &irc_command_part, NULL, NULL);
weechat_hook_command (
"ping",
N_("send a ping to server"),
N_("<server1> [<server2>]"),
N_("server1: server\n"
"server2: forward ping to this server"),
- NULL, &irc_command_ping, NULL);
+ NULL, &irc_command_ping, NULL, NULL);
weechat_hook_command (
"pong",
N_("answer to a ping message"),
N_("<daemon> [<daemon2>]"),
N_(" daemon: daemon who has responded to Ping message\n"
"daemon2: forward message to this daemon"),
- NULL, &irc_command_pong, NULL);
+ NULL, &irc_command_pong, NULL, NULL);
weechat_hook_command (
"query",
N_("send a private message to a nick"),
@@ -6637,7 +6562,7 @@ irc_command_init ()
" text: text to send"),
"-noswitch|-server %(irc_servers) %(nicks)"
" || %(nicks)",
- &irc_command_query, NULL);
+ &irc_command_query, NULL, NULL);
weechat_hook_command (
"quiet",
N_("quiet nicks or hosts"),
@@ -6647,14 +6572,14 @@ irc_command_init ()
"\n"
"Without argument, this command displays the quiet list for "
"current channel."),
- "%(irc_channel_nicks_hosts)", &irc_command_quiet, NULL);
+ "%(irc_channel_nicks_hosts)", &irc_command_quiet, NULL, NULL);
weechat_hook_command (
"quote",
N_("send raw data to server without parsing"),
N_("[-server <server>] <data>"),
N_("server: send to this server (internal name)\n"
" data: raw data to send"),
- "-server %(irc_servers)", &irc_command_quote, NULL);
+ "-server %(irc_servers)", &irc_command_quote, NULL, NULL);
weechat_hook_command (
"reconnect",
N_("reconnect to server(s)"),
@@ -6666,13 +6591,13 @@ irc_command_init ()
"server)\n"
"-switch: switch to next server address"),
"%(irc_servers)|-all|-nojoin|-switch|%*",
- &irc_command_reconnect, NULL);
+ &irc_command_reconnect, NULL, NULL);
weechat_hook_command (
"rehash",
N_("tell the server to reload its config file"),
N_("[<option>]"),
N_("option: extra option, for some servers"),
- NULL, &irc_command_rehash, NULL);
+ NULL, &irc_command_rehash, NULL, NULL);
weechat_hook_command (
"remove",
N_("force a user to leave a channel"),
@@ -6681,55 +6606,55 @@ irc_command_init ()
" nick: nick\n"
" reason: reason (special variables $nick, $channel and $server are "
"replaced by their value)"),
- "%(irc_channel)|%(nicks) %(nicks)", &irc_command_remove, NULL);
+ "%(irc_channel)|%(nicks) %(nicks)", &irc_command_remove, NULL, NULL);
weechat_hook_command (
"restart",
N_("tell the server to restart itself"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_restart, NULL);
+ NULL, &irc_command_restart, NULL, NULL);
weechat_hook_command (
"sajoin",
N_("force a user to join channel(s)"),
N_("<nick> <channel>[,<channel>...]"),
N_(" nick: nick\n"
"channel: channel name"),
- "%(nicks) %(irc_server_channels)", &irc_command_sajoin, NULL);
+ "%(nicks) %(irc_server_channels)", &irc_command_sajoin, NULL, NULL);
weechat_hook_command (
"samode",
N_("change mode on channel, without having operator status"),
N_("[<channel>] <mode>"),
N_("channel: channel name\n"
" mode: mode for channel"),
- "%(irc_server_channels)", &irc_command_samode, NULL);
+ "%(irc_server_channels)", &irc_command_samode, NULL, NULL);
weechat_hook_command (
"sanick",
N_("force a user to use another nick"),
N_("<nick> <new_nick>"),
N_(" nick: nick\n"
"new_nick: new nick"),
- "%(nicks) %(nicks)", &irc_command_sanick, NULL);
+ "%(nicks) %(nicks)", &irc_command_sanick, NULL, NULL);
weechat_hook_command (
"sapart",
N_("force a user to leave channel(s)"),
N_("<nick> <channel>[,<channel>...]"),
N_(" nick: nick\n"
"channel: channel name"),
- "%(nicks) %(irc_server_channels)", &irc_command_sapart, NULL);
+ "%(nicks) %(irc_server_channels)", &irc_command_sapart, NULL, NULL);
weechat_hook_command (
"saquit",
N_("force a user to quit server with a reason"),
N_("<nick> <reason>"),
N_(" nick: nick\n"
"reason: reason"),
- "%(nicks)", &irc_command_saquit, NULL);
+ "%(nicks)", &irc_command_saquit, NULL, NULL);
weechat_hook_command (
"service",
N_("register a new service"),
N_("<nick> <reserved> <distribution> <type> <reserved> <info>"),
N_("distribution: visibility of service\n"
" type: reserved for future usage"),
- NULL, &irc_command_service, NULL);
+ NULL, &irc_command_service, NULL, NULL);
weechat_hook_command (
"server",
N_("list, add or remove IRC servers"),
@@ -6782,35 +6707,35 @@ irc_command_init ()
" || deloutq"
" || jump"
" || raw",
- &irc_command_server, NULL);
+ &irc_command_server, NULL, NULL);
weechat_hook_command (
"servlist",
N_("list services currently connected to the network"),
N_("[<mask> [<type>]]"),
N_("mask: list only services matching this mask\n"
"type: list only services of this type"),
- NULL, &irc_command_servlist, NULL);
+ NULL, &irc_command_servlist, NULL, NULL);
weechat_hook_command (
"squery",
N_("deliver a message to a service"),
N_("<service> <text>"),
N_("service: name of service\n"
" text: text to send"),
- NULL, &irc_command_squery, NULL);
+ NULL, &irc_command_squery, NULL, NULL);
weechat_hook_command (
"squit",
N_("disconnect server links"),
N_("<server> <comment>"),
N_( " server: server name\n"
"comment: comment"),
- NULL, &irc_command_squit, NULL);
+ NULL, &irc_command_squit, NULL, NULL);
weechat_hook_command (
"stats",
N_("query statistics about server"),
N_("[<query> [<server>]]"),
N_(" query: c/h/i/k/l/m/o/y/u (see RFC1459)\n"
"server: server name"),
- NULL, &irc_command_stats, NULL);
+ NULL, &irc_command_stats, NULL, NULL);
weechat_hook_command (
"summon",
N_("give users who are on a host running an IRC "
@@ -6820,13 +6745,13 @@ irc_command_init ()
N_(" user: username\n"
" target: server name\n"
"channel: channel name"),
- NULL, &irc_command_summon, NULL);
+ NULL, &irc_command_summon, NULL, NULL);
weechat_hook_command (
"time",
N_("query local time from server"),
N_("[<target>]"),
N_("target: query time from specified server"),
- NULL, &irc_command_time, NULL);
+ NULL, &irc_command_time, NULL, NULL);
weechat_hook_command (
"topic",
N_("get/set channel topic"),
@@ -6834,74 +6759,74 @@ irc_command_init ()
N_("channel: channel name\n"
" topic: new topic\n"
"-delete: delete channel topic"),
- "%(irc_channel_topic)|-delete", &irc_command_topic, NULL);
+ "%(irc_channel_topic)|-delete", &irc_command_topic, NULL, NULL);
weechat_hook_command (
"trace",
N_("find the route to specific server"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_trace, NULL);
+ NULL, &irc_command_trace, NULL, NULL);
weechat_hook_command (
"unban",
N_("unban nicks or hosts"),
N_("[<channel>] <nick> [<nick>...]"),
N_("channel: channel name\n"
" nick: nick or host"),
- NULL, &irc_command_unban, NULL);
+ NULL, &irc_command_unban, NULL, NULL);
weechat_hook_command (
"unquiet",
N_("unquiet nicks or hosts"),
N_("[<channel>] <nick> [<nick>...]"),
N_("channel: channel name\n"
" nick: nick or host"),
- "%(irc_channel_nicks_hosts)", &irc_command_unquiet, NULL);
+ "%(irc_channel_nicks_hosts)", &irc_command_unquiet, NULL, NULL);
weechat_hook_command (
"userhost",
N_("return a list of information about nicks"),
N_("<nick> [<nick>...]"),
N_("nick: nick"),
- "%(nicks)", &irc_command_userhost, NULL);
+ "%(nicks)", &irc_command_userhost, NULL, NULL);
weechat_hook_command (
"users",
N_("list of users logged into the server"),
N_("[<target>]"),
N_("target: server name"),
- NULL, &irc_command_users, NULL);
+ NULL, &irc_command_users, NULL, NULL);
weechat_hook_command (
"version",
N_("give the version info of nick or server (current or specified)"),
N_("[<server>|<nick>]"),
N_("server: server name\n"
" nick: nick"),
- "%(nicks)", &irc_command_version, NULL);
+ "%(nicks)", &irc_command_version, NULL, NULL);
weechat_hook_command (
"voice",
N_("give voice to nick(s)"),
N_("<nick> [<nick>...]"),
N_("nick: nick or mask (wildcard \"*\" is allowed)\n"
" *: give voice to everybody on channel"),
- "%(nicks)|%*", &irc_command_voice, NULL);
+ "%(nicks)|%*", &irc_command_voice, NULL, NULL);
weechat_hook_command (
"wallchops",
N_("send a notice to channel ops"),
N_("[<channel>] <text>"),
N_("channel: channel name\n"
" text: text to send"),
- NULL, &irc_command_wallchops, NULL);
+ NULL, &irc_command_wallchops, NULL, NULL);
weechat_hook_command (
"wallops",
N_("send a message to all currently connected users who have set the "
"'w' user mode for themselves"),
N_("<text>"),
N_("text: text to send"),
- NULL, &irc_command_wallops, NULL);
+ NULL, &irc_command_wallops, NULL, NULL);
weechat_hook_command (
"who",
N_("generate a query which returns a list of information"),
N_("[<mask> [o]]"),
N_("mask: only information which match this mask\n"
" o: only operators are returned according to the mask supplied"),
- "%(irc_channels)", &irc_command_who, NULL);
+ "%(irc_channels)", &irc_command_who, NULL, NULL);
weechat_hook_command (
"whois",
N_("query information about user(s)"),
@@ -6915,7 +6840,7 @@ irc_command_init ()
"\n"
"If option irc.network.whois_double_nick is enabled, two nicks are "
"sent (if only one nick is given), to get idle time in answer."),
- "%(nicks)", &irc_command_whois, NULL);
+ "%(nicks)", &irc_command_whois, NULL, NULL);
weechat_hook_command (
"whowas",
N_("ask for information about a nick which no longer exists"),
@@ -6924,5 +6849,5 @@ irc_command_init ()
" count: number of replies to return (full search if negative "
"number)\n"
"target: reply should match this mask"),
- "%(nicks)", &irc_command_whowas, NULL);
+ "%(nicks)", &irc_command_whowas, NULL, NULL);
}
diff --git a/src/plugins/irc/irc-command.h b/src/plugins/irc/irc-command.h
index ac48c941f..196394755 100644
--- a/src/plugins/irc/irc-command.h
+++ b/src/plugins/irc/irc-command.h
@@ -23,6 +23,12 @@
struct t_irc_server;
struct t_irc_channel;
+#define IRC_COMMAND_CALLBACK(__command) \
+ int \
+ irc_command_##__command (const void *pointer, void *data, \
+ struct t_gui_buffer *buffer, \
+ int argc, char **argv, char **argv_eol)
+
#define IRC_COMMAND_CHECK_SERVER(__command, __check_connection) \
if (!ptr_server) \
{ \
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index 153bad8d6..b0140496e 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -41,13 +41,15 @@
*/
int
-irc_completion_server_cb (void *data, const char *completion_item,
+irc_completion_server_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -65,13 +67,15 @@ irc_completion_server_cb (void *data, const char *completion_item,
*/
int
-irc_completion_server_nick_cb (void *data, const char *completion_item,
+irc_completion_server_nick_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -89,7 +93,8 @@ irc_completion_server_nick_cb (void *data, const char *completion_item,
*/
int
-irc_completion_server_channels_cb (void *data, const char *completion_item,
+irc_completion_server_channels_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -98,6 +103,7 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -129,7 +135,8 @@ irc_completion_server_channels_cb (void *data, const char *completion_item,
*/
int
-irc_completion_server_privates_cb (void *data, const char *completion_item,
+irc_completion_server_privates_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -138,6 +145,7 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -162,7 +170,8 @@ irc_completion_server_privates_cb (void *data, const char *completion_item,
*/
int
-irc_completion_server_nicks_cb (void *data, const char *completion_item,
+irc_completion_server_nicks_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -172,6 +181,7 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -204,13 +214,15 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item,
*/
int
-irc_completion_servers_cb (void *data, const char *completion_item,
+irc_completion_servers_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -230,13 +242,15 @@ irc_completion_servers_cb (void *data, const char *completion_item,
*/
int
-irc_completion_channel_cb (void *data, const char *completion_item,
+irc_completion_channel_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -285,7 +299,8 @@ irc_completion_channel_nicks_add_speakers (struct t_gui_completion *completion,
*/
int
-irc_completion_channel_nicks_cb (void *data, const char *completion_item,
+irc_completion_channel_nicks_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -294,6 +309,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -350,7 +366,8 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
*/
int
-irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
+irc_completion_channel_nicks_hosts_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -361,6 +378,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -407,7 +425,8 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item,
*/
int
-irc_completion_channel_topic_cb (void *data, const char *completion_item,
+irc_completion_channel_topic_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -417,6 +436,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -459,7 +479,8 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
*/
int
-irc_completion_channels_cb (void *data, const char *completion_item,
+irc_completion_channels_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -471,6 +492,7 @@ irc_completion_channels_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -530,7 +552,8 @@ irc_completion_channels_cb (void *data, const char *completion_item,
*/
int
-irc_completion_privates_cb (void *data, const char *completion_item,
+irc_completion_privates_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -538,6 +561,7 @@ irc_completion_privates_cb (void *data, const char *completion_item,
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -564,7 +588,8 @@ irc_completion_privates_cb (void *data, const char *completion_item,
*/
int
-irc_completion_msg_kick_cb (void *data, const char *completion_item,
+irc_completion_msg_kick_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -573,6 +598,7 @@ irc_completion_msg_kick_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -595,7 +621,8 @@ irc_completion_msg_kick_cb (void *data, const char *completion_item,
*/
int
-irc_completion_msg_part_cb (void *data, const char *completion_item,
+irc_completion_msg_part_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -604,6 +631,7 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -626,7 +654,8 @@ irc_completion_msg_part_cb (void *data, const char *completion_item,
*/
int
-irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
+irc_completion_ignores_numbers_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -634,6 +663,7 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
char str_number[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -654,7 +684,8 @@ irc_completion_ignores_numbers_cb (void *data, const char *completion_item,
*/
int
-irc_completion_notify_nicks_cb (void *data, const char *completion_item,
+irc_completion_notify_nicks_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -663,6 +694,7 @@ irc_completion_notify_nicks_cb (void *data, const char *completion_item,
IRC_BUFFER_GET_SERVER(buffer);
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -701,50 +733,50 @@ irc_completion_init ()
{
weechat_hook_completion ("irc_server",
N_("current IRC server"),
- &irc_completion_server_cb, NULL);
+ &irc_completion_server_cb, NULL, NULL);
weechat_hook_completion ("irc_server_nick",
N_("nick on current IRC server"),
- &irc_completion_server_nick_cb, NULL);
+ &irc_completion_server_nick_cb, NULL, NULL);
weechat_hook_completion ("irc_server_channels",
N_("channels on current IRC server"),
- &irc_completion_server_channels_cb, NULL);
+ &irc_completion_server_channels_cb, NULL, NULL);
weechat_hook_completion ("irc_server_privates",
N_("privates on current IRC server"),
- &irc_completion_server_privates_cb, NULL);
+ &irc_completion_server_privates_cb, NULL, NULL);
weechat_hook_completion ("irc_server_nicks",
N_("nicks on all channels of current IRC server"),
- &irc_completion_server_nicks_cb, NULL);
+ &irc_completion_server_nicks_cb, NULL, NULL);
weechat_hook_completion ("irc_servers",
N_("IRC servers (internal names)"),
- &irc_completion_servers_cb, NULL);
+ &irc_completion_servers_cb, NULL, NULL);
weechat_hook_completion ("irc_channel",
N_("current IRC channel"),
- &irc_completion_channel_cb, NULL);
+ &irc_completion_channel_cb, NULL, NULL);
weechat_hook_completion ("nick",
N_("nicks of current IRC channel"),
- &irc_completion_channel_nicks_cb, NULL);
+ &irc_completion_channel_nicks_cb, NULL, NULL);
weechat_hook_completion ("irc_channel_nicks_hosts",
N_("nicks and hostnames of current IRC channel"),
- &irc_completion_channel_nicks_hosts_cb, NULL);
+ &irc_completion_channel_nicks_hosts_cb, NULL, NULL);
weechat_hook_completion ("irc_channel_topic",
N_("topic of current IRC channel"),
- &irc_completion_channel_topic_cb, NULL);
+ &irc_completion_channel_topic_cb, NULL, NULL);
weechat_hook_completion ("irc_channels",
N_("channels on all IRC servers"),
- &irc_completion_channels_cb, NULL);
+ &irc_completion_channels_cb, NULL, NULL);
weechat_hook_completion ("irc_privates",
N_("privates on all IRC servers"),
- &irc_completion_privates_cb, NULL);
+ &irc_completion_privates_cb, NULL, NULL);
weechat_hook_completion ("irc_msg_kick",
N_("default kick message"),
- &irc_completion_msg_kick_cb, NULL);
+ &irc_completion_msg_kick_cb, NULL, NULL);
weechat_hook_completion ("irc_msg_part",
N_("default part message for IRC channel"),
- &irc_completion_msg_part_cb, NULL);
+ &irc_completion_msg_part_cb, NULL, NULL);
weechat_hook_completion ("irc_ignores_numbers",
N_("numbers for defined ignores"),
- &irc_completion_ignores_numbers_cb, NULL);
+ &irc_completion_ignores_numbers_cb, NULL, NULL);
weechat_hook_completion ("irc_notify_nicks",
N_("nicks in notify list"),
- &irc_completion_notify_nicks_cb, NULL);
+ &irc_completion_notify_nicks_cb, NULL, NULL);
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 3c590fedd..5365bfe9e 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -299,10 +299,11 @@ irc_config_display_channel_modes_arguments (const char *modes)
*/
int
-irc_config_change_nick_colors_cb (void *data, const char *option,
- const char *value)
+irc_config_change_nick_colors_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
(void) value;
@@ -318,10 +319,12 @@ irc_config_change_nick_colors_cb (void *data, const char *option,
*/
void
-irc_config_change_look_color_nicks_in_nicklist (void *data,
+irc_config_change_look_color_nicks_in_nicklist (const void *pointer,
+ void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -333,10 +336,11 @@ irc_config_change_look_color_nicks_in_nicklist (void *data,
*/
void
-irc_config_change_look_display_away (void *data,
+irc_config_change_look_display_away (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -358,13 +362,14 @@ irc_config_change_look_display_away (void *data,
*/
void
-irc_config_change_look_display_join_message (void *data,
+irc_config_change_look_display_join_message (const void *pointer, void *data,
struct t_config_option *option)
{
char **items;
int num_items, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -374,8 +379,7 @@ irc_config_change_look_display_join_message (void *data,
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_display_join_message);
@@ -399,13 +403,14 @@ irc_config_change_look_display_join_message (void *data,
*/
void
-irc_config_change_look_server_buffer (void *data,
+irc_config_change_look_server_buffer (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_irc_server *ptr_server;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -445,7 +450,7 @@ irc_config_change_look_server_buffer (void *data,
*/
void
-irc_config_change_look_pv_buffer (void *data,
+irc_config_change_look_pv_buffer (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_irc_server *ptr_server;
@@ -453,6 +458,7 @@ irc_config_change_look_pv_buffer (void *data,
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -509,10 +515,12 @@ irc_config_change_look_pv_buffer (void *data,
*/
void
-irc_config_change_look_item_channel_modes_hide_args (void *data,
+irc_config_change_look_item_channel_modes_hide_args (const void *pointer,
+ void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -524,13 +532,14 @@ irc_config_change_look_item_channel_modes_hide_args (void *data,
*/
void
-irc_config_change_look_highlight_tags_restrict (void *data,
+irc_config_change_look_highlight_tags_restrict (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -561,13 +570,14 @@ irc_config_change_look_highlight_tags_restrict (void *data,
*/
void
-irc_config_change_look_nick_color_force (void *data,
+irc_config_change_look_nick_color_force (const void *pointer, void *data,
struct t_config_option *option)
{
char **items, *pos;
int num_items, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -577,8 +587,7 @@ irc_config_change_look_nick_color_force (void *data,
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_color_force);
@@ -610,10 +619,11 @@ irc_config_change_look_nick_color_force (void *data,
*/
void
-irc_config_change_look_nick_colors (void *data,
+irc_config_change_look_nick_colors (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -625,10 +635,11 @@ irc_config_change_look_nick_colors (void *data,
*/
void
-irc_config_change_look_item_display_server (void *data,
+irc_config_change_look_item_display_server (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -642,12 +653,13 @@ irc_config_change_look_item_display_server (void *data,
*/
void
-irc_config_change_look_nicks_hide_password (void *data,
+irc_config_change_look_nicks_hide_password (const void *pointer, void *data,
struct t_config_option *option)
{
const char *nicks_hide_password;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -672,13 +684,14 @@ irc_config_change_look_nicks_hide_password (void *data,
*/
void
-irc_config_change_look_topic_strip_colors (void *data,
+irc_config_change_look_topic_strip_colors (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -699,10 +712,11 @@ irc_config_change_look_topic_strip_colors (void *data,
*/
void
-irc_config_change_bar_item_input_prompt (void *data,
+irc_config_change_bar_item_input_prompt (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -714,10 +728,11 @@ irc_config_change_bar_item_input_prompt (void *data,
*/
void
-irc_config_change_color_item_channel_modes (void *data,
+irc_config_change_color_item_channel_modes (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -730,10 +745,11 @@ irc_config_change_color_item_channel_modes (void *data,
*/
void
-irc_config_change_color_item_lag (void *data,
+irc_config_change_color_item_lag (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -745,10 +761,11 @@ irc_config_change_color_item_lag (void *data,
*/
void
-irc_config_change_color_item_nick_modes (void *data,
+irc_config_change_color_item_nick_modes (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -761,12 +778,14 @@ irc_config_change_color_item_nick_modes (void *data,
*/
void
-irc_config_change_color_mirc_remap (void *data, struct t_config_option *option)
+irc_config_change_color_mirc_remap (const void *pointer, void *data,
+ struct t_config_option *option)
{
char **items, *pos;
int num_items, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -776,8 +795,7 @@ irc_config_change_color_mirc_remap (void *data, struct t_config_option *option)
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_color_mirc_remap);
@@ -807,13 +825,14 @@ irc_config_change_color_mirc_remap (void *data, struct t_config_option *option)
*/
void
-irc_config_change_color_nick_prefixes (void *data,
+irc_config_change_color_nick_prefixes (const void *pointer, void *data,
struct t_config_option *option)
{
char **items, *pos;
int num_items, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -823,8 +842,7 @@ irc_config_change_color_nick_prefixes (void *data,
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (irc_config_hashtable_nick_prefixes);
@@ -858,13 +876,14 @@ irc_config_change_color_nick_prefixes (void *data,
*/
void
-irc_config_change_network_lag_check (void *data,
+irc_config_change_network_lag_check (const void *pointer, void *data,
struct t_config_option *option)
{
time_t time_next_check;
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -884,10 +903,11 @@ irc_config_change_network_lag_check (void *data,
*/
void
-irc_config_change_network_lag_min_show (void *data,
+irc_config_change_network_lag_min_show (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -899,10 +919,11 @@ irc_config_change_network_lag_min_show (void *data,
*/
void
-irc_config_change_network_notify_check_ison (void *data,
+irc_config_change_network_notify_check_ison (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -914,10 +935,11 @@ irc_config_change_network_notify_check_ison (void *data,
*/
void
-irc_config_change_network_notify_check_whois (void *data,
- struct t_config_option *option)
+irc_config_change_network_notify_check_whois (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -929,7 +951,8 @@ irc_config_change_network_notify_check_whois (void *data,
*/
void
-irc_config_change_network_send_unknown_commands (void *data,
+irc_config_change_network_send_unknown_commands (const void *pointer,
+ void *data,
struct t_config_option *option)
{
char value[2];
@@ -937,6 +960,7 @@ irc_config_change_network_send_unknown_commands (void *data,
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -974,12 +998,16 @@ irc_config_change_network_send_unknown_commands (void *data,
*/
void
-irc_config_server_default_change_cb (void *data, struct t_config_option *option)
+irc_config_server_default_change_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
int index_option;
struct t_irc_server *ptr_server;
- index_option = irc_server_search_option (data);
+ /* make C compiler happy */
+ (void) data;
+
+ index_option = irc_server_search_option (pointer);
if (index_option >= 0)
{
for (ptr_server = irc_servers; ptr_server;
@@ -1054,7 +1082,7 @@ irc_config_check_gnutls_priorities (const char *priorities)
*/
int
-irc_config_server_check_value_cb (void *data,
+irc_config_server_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
@@ -1067,9 +1095,10 @@ irc_config_server_check_value_cb (void *data,
#endif /* HAVE_GNUTLS */
/* make C compiler happy */
+ (void) data;
(void) option;
- index_option = irc_server_search_option (data);
+ index_option = irc_server_search_option (pointer);
if (index_option >= 0)
{
switch (index_option)
@@ -1185,13 +1214,17 @@ irc_config_server_check_value_cb (void *data,
*/
void
-irc_config_server_change_cb (void *data, struct t_config_option *option)
+irc_config_server_change_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
int index_option;
char *name;
struct t_irc_server *ptr_server;
- index_option = irc_server_search_option (data);
+ /* make C compiler happy */
+ (void) data;
+
+ index_option = irc_server_search_option (pointer);
if (index_option >= 0)
{
name = weechat_config_option_get_pointer (option, "name");
@@ -1240,11 +1273,12 @@ irc_config_server_change_cb (void *data, struct t_config_option *option)
*/
int
-irc_config_server_default_check_notify (void *data,
+irc_config_server_default_check_notify (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -1259,12 +1293,14 @@ irc_config_server_default_check_notify (void *data,
*/
int
-irc_config_reload (void *data, struct t_config_file *config_file)
+irc_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
int rc;
struct t_irc_server *ptr_server, *next_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
for (ptr_server = irc_servers; ptr_server;
@@ -1318,7 +1354,7 @@ irc_config_reload (void *data, struct t_config_file *config_file)
*/
int
-irc_config_msgbuffer_create_option (void *data,
+irc_config_msgbuffer_create_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
@@ -1327,6 +1363,7 @@ irc_config_msgbuffer_create_option (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1355,7 +1392,7 @@ irc_config_msgbuffer_create_option (void *data,
_("buffer used to display message received from IRC "
"server"),
"weechat|server|current|private", 0, 0, value, value, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1381,7 +1418,8 @@ irc_config_msgbuffer_create_option (void *data,
*/
int
-irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
+irc_config_ctcp_create_option (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
@@ -1392,6 +1430,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
const char *pos_name;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1435,7 +1474,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
"$username (username on server), "
"$realname (realname on server)"),
NULL, 0, 0, default_value, value, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE :
WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1465,7 +1504,7 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
*/
int
-irc_config_ignore_read_cb (void *data,
+irc_config_ignore_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
@@ -1474,6 +1513,7 @@ irc_config_ignore_read_cb (void *data,
int argc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -1503,12 +1543,14 @@ irc_config_ignore_read_cb (void *data,
*/
int
-irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
+irc_config_ignore_write_cb (const void *pointer, void *data,
+ struct t_config_file *config_file,
const char *section_name)
{
struct t_irc_ignore *ptr_ignore;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!weechat_config_write_line (config_file, section_name, NULL))
@@ -1543,12 +1585,16 @@ irc_config_server_new_option (struct t_config_file *config_file,
const char *default_value,
const char *value,
int null_value_allowed,
- int (*callback_check_value)(void *data,
+ int (*callback_check_value)(const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value),
+ const void *callback_check_value_pointer,
void *callback_check_value_data,
- void (*callback_change)(void *data,
+ void (*callback_change)(const void *pointer,
+ void *data,
struct t_config_option *option),
+ const void *callback_change_pointer,
void *callback_change_data)
{
struct t_config_option *new_option;
@@ -1567,9 +1613,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_PROXY:
new_option = weechat_config_new_option (
@@ -1580,9 +1630,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_IPV6:
new_option = weechat_config_new_option (
@@ -1593,9 +1647,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL:
new_option = weechat_config_new_option (
@@ -1605,9 +1663,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL_CERT:
new_option = weechat_config_new_option (
@@ -1619,9 +1681,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL_PRIORITIES:
new_option = weechat_config_new_option (
@@ -1634,9 +1700,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL_DHKEY_SIZE:
new_option = weechat_config_new_option (
@@ -1647,9 +1717,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, INT_MAX,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL_FINGERPRINT:
new_option = weechat_config_new_option (
@@ -1665,9 +1739,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SSL_VERIFY:
new_option = weechat_config_new_option (
@@ -1677,9 +1755,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_PASSWORD:
new_option = weechat_config_new_option (
@@ -1690,9 +1772,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_CAPABILITIES:
new_option = weechat_config_new_option (
@@ -1706,9 +1792,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_MECHANISM:
new_option = weechat_config_new_option (
@@ -1728,9 +1818,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_USERNAME:
new_option = weechat_config_new_option (
@@ -1742,9 +1836,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_PASSWORD:
new_option = weechat_config_new_option (
@@ -1757,9 +1855,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_KEY:
new_option = weechat_config_new_option (
@@ -1772,9 +1874,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_TIMEOUT:
new_option = weechat_config_new_option (
@@ -1785,9 +1891,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 3600,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_SASL_FAIL:
new_option = weechat_config_new_option (
@@ -1801,9 +1911,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
"continue|reconnect|disconnect", 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTOCONNECT:
new_option = weechat_config_new_option (
@@ -1813,9 +1927,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTORECONNECT:
new_option = weechat_config_new_option (
@@ -1825,9 +1943,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTORECONNECT_DELAY:
new_option = weechat_config_new_option (
@@ -1838,9 +1960,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 65535,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_NICKS:
new_option = weechat_config_new_option (
@@ -1851,9 +1977,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_NICKS_ALTERNATE:
new_option = weechat_config_new_option (
@@ -1867,9 +1997,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_USERNAME:
new_option = weechat_config_new_option (
@@ -1880,9 +2014,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_REALNAME:
new_option = weechat_config_new_option (
@@ -1893,9 +2031,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_LOCAL_HOSTNAME:
new_option = weechat_config_new_option (
@@ -1906,9 +2048,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_COMMAND:
new_option = weechat_config_new_option (
@@ -1922,9 +2068,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_COMMAND_DELAY:
new_option = weechat_config_new_option (
@@ -1936,9 +2086,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 3600,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTOJOIN:
new_option = weechat_config_new_option (
@@ -1955,9 +2109,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTOREJOIN:
new_option = weechat_config_new_option (
@@ -1970,9 +2128,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AUTOREJOIN_DELAY:
new_option = weechat_config_new_option (
@@ -1982,9 +2144,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 3600*24,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_CONNECTION_TIMEOUT:
new_option = weechat_config_new_option (
@@ -1997,9 +2163,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 1, 3600,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH:
new_option = weechat_config_new_option (
@@ -2011,9 +2181,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW:
new_option = weechat_config_new_option (
@@ -2025,9 +2199,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AWAY_CHECK:
new_option = weechat_config_new_option (
@@ -2038,9 +2216,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 60 * 24 * 7,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS:
new_option = weechat_config_new_option (
@@ -2051,9 +2233,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 1000000,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_DEFAULT_MSG_KICK:
new_option = weechat_config_new_option (
@@ -2065,9 +2251,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_DEFAULT_MSG_PART:
new_option = weechat_config_new_option (
@@ -2078,9 +2268,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_DEFAULT_MSG_QUIT:
new_option = weechat_config_new_option (
@@ -2091,9 +2285,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
NULL, 0, 0,
default_value, value,
null_value_allowed,
- callback_check_value, callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_OPTION_NOTIFY:
new_option = weechat_config_new_option (
@@ -2106,9 +2304,12 @@ irc_config_server_new_option (struct t_config_file *config_file,
null_value_allowed,
(section == irc_config_section_server_default) ?
&irc_config_server_default_check_notify : callback_check_value,
+ callback_check_value_pointer,
callback_check_value_data,
- callback_change, callback_change_data,
- NULL, NULL);
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
break;
case IRC_SERVER_NUM_OPTIONS:
break;
@@ -2122,7 +2323,8 @@ irc_config_server_new_option (struct t_config_file *config_file,
*/
int
-irc_config_server_read_cb (void *data, struct t_config_file *config_file,
+irc_config_server_read_cb (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
@@ -2131,6 +2333,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
char *pos_option, *server_name;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -2198,13 +2401,15 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
*/
int
-irc_config_server_write_cb (void *data, struct t_config_file *config_file,
+irc_config_server_write_cb (const void *pointer, void *data,
+ struct t_config_file *config_file,
const char *section_name)
{
struct t_irc_server *ptr_server;
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!weechat_config_write_line (config_file, section_name, NULL))
@@ -2293,8 +2498,10 @@ irc_config_server_create_default_options (struct t_config_section *section)
0,
&irc_config_server_check_value_cb,
irc_server_options[i][0],
+ NULL,
&irc_config_server_default_change_cb,
- irc_server_options[i][0]);
+ irc_server_options[i][0],
+ NULL);
}
if (nicks)
@@ -2322,38 +2529,36 @@ irc_config_init ()
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
irc_config_hashtable_nick_prefixes = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
irc_config_file = weechat_config_new (IRC_CONFIG_NAME,
- &irc_config_reload, NULL);
+ &irc_config_reload, NULL, NULL);
if (!irc_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (irc_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -2367,104 +2572,108 @@ irc_config_init ()
"when it is auto joined (with server option \"autojoin\"); "
"this is useful to open channels with always the same buffer "
"numbers on startup"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_buffer_open_before_join = weechat_config_new_option (
irc_config_file, ptr_section,
"buffer_open_before_join", "boolean",
N_("open channel buffer before the JOIN is received from server "
"when it is manually joined (with /join command)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_buffer_switch_autojoin = weechat_config_new_option (
irc_config_file, ptr_section,
"buffer_switch_autojoin", "boolean",
N_("auto switch to channel buffer when it is auto joined (with "
"server option \"autojoin\")"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_buffer_switch_join = weechat_config_new_option (
irc_config_file, ptr_section,
"buffer_switch_join", "boolean",
N_("auto switch to channel buffer when it is manually joined "
"(with /join command)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_color_nicks_in_names = weechat_config_new_option (
irc_config_file, ptr_section,
"color_nicks_in_names", "boolean",
N_("use nick color in output of /names (or list of nicks displayed "
"when joining a channel)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_color_nicks_in_nicklist = weechat_config_new_option (
irc_config_file, ptr_section,
"color_nicks_in_nicklist", "boolean",
N_("use nick color in nicklist"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- &irc_config_change_look_color_nicks_in_nicklist, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_color_nicks_in_nicklist, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_color_nicks_in_server_messages = weechat_config_new_option (
irc_config_file, ptr_section,
"color_nicks_in_server_messages", "boolean",
N_("use nick color in messages from server"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_color_pv_nick_like_channel = weechat_config_new_option (
irc_config_file, ptr_section,
"color_pv_nick_like_channel", "boolean",
N_("use same nick color for channel and private"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_ctcp_time_format = weechat_config_new_option (
irc_config_file, ptr_section,
"ctcp_time_format", "string",
N_("time format used in answer to message CTCP TIME (see man strftime "
"for date/time specifiers)"),
- NULL, 0, 0, "%a, %d %b %Y %T %z", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "%a, %d %b %Y %T %z", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_away = weechat_config_new_option (
irc_config_file, ptr_section,
"display_away", "integer",
N_("display message when (un)marking as away (off: do not display/send "
"anything, local: display locally, channel: send action to channels)"),
- "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL,
- &irc_config_change_look_display_away, NULL,
- NULL, NULL);
+ "off|local|channel", 0, 0, "local", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_display_away, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_display_ctcp_blocked = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_blocked", "boolean",
N_("display CTCP message even if it is blocked"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_ctcp_reply = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_reply", "boolean",
N_("display CTCP reply sent by WeeChat"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_ctcp_unknown = weechat_config_new_option (
irc_config_file, ptr_section,
"display_ctcp_unknown", "boolean",
N_("display CTCP message even if it is unknown CTCP"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_host_join = weechat_config_new_option (
irc_config_file, ptr_section,
"display_host_join", "boolean",
N_("display host in join messages"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_host_join_local = weechat_config_new_option (
irc_config_file, ptr_section,
"display_host_join_local", "boolean",
N_("display host in join messages from local client"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_host_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"display_host_quit", "boolean",
N_("display host in part/quit messages"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_join_message = weechat_config_new_option (
irc_config_file, ptr_section,
"display_join_message", "string",
@@ -2472,25 +2681,29 @@ irc_config_init ()
"channel: 324 = channel modes, 329 = channel creation date, "
"332 = topic, 333 = nick/date for topic, 353 = names on channel, "
"366 = names count"),
- NULL, 0, 0, "329,332,333,366", NULL, 0, NULL, NULL,
- &irc_config_change_look_display_join_message, NULL, NULL, NULL);
+ NULL, 0, 0, "329,332,333,366", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_display_join_message, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_display_old_topic = weechat_config_new_option (
irc_config_file, ptr_section,
"display_old_topic", "boolean",
N_("display old topic when channel topic is changed"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_pv_away_once = weechat_config_new_option (
irc_config_file, ptr_section,
"display_pv_away_once", "boolean",
N_("display remote away message only once in private"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_display_pv_back = weechat_config_new_option (
irc_config_file, ptr_section,
"display_pv_back", "boolean",
N_("display a message in private when user is back (after quit on "
"server)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_channel = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_channel", "string",
@@ -2501,7 +2714,8 @@ irc_config_init ()
"buffer property \"highlight_words\" only when buffer is created "
"(it does not affect current buffers), an empty string disables "
"default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""),
- NULL, 0, 0, "$nick", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "$nick", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_pv = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_pv", "string",
@@ -2512,7 +2726,8 @@ irc_config_init ()
"buffer property \"highlight_words\" only when buffer is created "
"(it does not affect current buffers), an empty string disables "
"default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""),
- NULL, 0, 0, "$nick", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "$nick", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_server = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_server", "string",
@@ -2523,7 +2738,8 @@ irc_config_init ()
"buffer property \"highlight_words\" only when buffer is created "
"(it does not affect current buffers), an empty string disables "
"default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""),
- NULL, 0, 0, "$nick", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "$nick", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_tags_restrict = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_tags_restrict", "string",
@@ -2532,8 +2748,10 @@ irc_config_init ()
"must be separated by a comma and \"+\" can be used to make a "
"logical \"and\" between tags; wildcard \"*\" is allowed in tags; "
"an empty value allows highlight on any tag"),
- NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0, NULL, NULL,
- &irc_config_change_look_highlight_tags_restrict, NULL, NULL, NULL);
+ NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_highlight_tags_restrict, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_item_channel_modes_hide_args = weechat_config_new_option (
irc_config_file, ptr_section,
"item_channel_modes_hide_args", "string",
@@ -2541,26 +2759,34 @@ irc_config_init ()
"channel modes (\"*\" to always hide all arguments, empty value to "
"never hide arguments); example: \"kf\" to hide arguments if \"k\" "
"or \"f\" are in channel modes"),
- NULL, 0, 0, "k", NULL, 0, NULL, NULL,
- &irc_config_change_look_item_channel_modes_hide_args, NULL, NULL, NULL);
+ NULL, 0, 0, "k", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_item_channel_modes_hide_args, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_item_display_server = weechat_config_new_option (
irc_config_file, ptr_section,
"item_display_server", "integer",
N_("name of bar item where IRC server is displayed (for status bar)"),
- "buffer_plugin|buffer_name", 0, 0, "buffer_plugin", NULL, 0, NULL, NULL,
- &irc_config_change_look_item_display_server, NULL, NULL, NULL);
+ "buffer_plugin|buffer_name", 0, 0, "buffer_plugin", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_item_display_server, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_item_nick_modes = weechat_config_new_option (
irc_config_file, ptr_section,
"item_nick_modes", "boolean",
N_("display nick modes in bar item \"input_prompt\""),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- &irc_config_change_bar_item_input_prompt, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_bar_item_input_prompt, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_item_nick_prefix = weechat_config_new_option (
irc_config_file, ptr_section,
"item_nick_prefix", "boolean",
N_("display nick prefix in bar item \"input_prompt\""),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- &irc_config_change_bar_item_input_prompt, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_bar_item_input_prompt, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_join_auto_add_chantype = weechat_config_new_option (
irc_config_file, ptr_section,
"join_auto_add_chantype", "boolean",
@@ -2568,15 +2794,15 @@ irc_config_init ()
"command /join if the channel name does not start with a valid "
"channel type for the server; for example: \"/join weechat\" will "
"in fact send: \"/join #weechat\""),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_msgbuffer_fallback = weechat_config_new_option (
irc_config_file, ptr_section,
"msgbuffer_fallback", "integer",
N_("default target buffer for msgbuffer options when target is "
"private and that private buffer is not found"),
- "current|server", 0, 0, "current", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ "current|server", 0, 0, "current", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_new_channel_position = weechat_config_new_option (
irc_config_file, ptr_section,
"new_channel_position", "integer",
@@ -2584,8 +2810,8 @@ irc_config_init ()
"(none = default position (should be last buffer), "
"next = current buffer + 1, near_server = after last channel/pv "
"of server)"),
- "none|next|near_server", 0, 0, "none",
- NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ "none|next|near_server", 0, 0, "none", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_new_pv_position = weechat_config_new_option (
irc_config_file, ptr_section,
"new_pv_position", "integer",
@@ -2593,8 +2819,8 @@ irc_config_init ()
"(none = default position (should be last buffer), "
"next = current buffer + 1, near_server = after last channel/pv "
"of server)"),
- "none|next|near_server", 0, 0, "none",
- NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ "none|next|near_server", 0, 0, "none", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_color_force = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_color_force", "string",
@@ -2603,16 +2829,20 @@ irc_config_init ()
"\"nick1:color1;nick2:color2\"); look up for nicks is with "
"exact case then lower case, so it's possible to use only lower "
"case for nicks in this option"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &irc_config_change_look_nick_color_force, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_nick_color_force, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_nick_color_hash = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_color_hash", "integer",
N_("hash algorithm used to find the color for a nick: djb2 = variant "
"of djb2 (position of letters matters: anagrams of a nick have "
"different color), sum = sum of letters"),
- "djb2|sum", 0, 0, "sum", NULL, 0, NULL, NULL,
- &irc_config_change_look_nick_colors, NULL, NULL, NULL);
+ "djb2|sum", 0, 0, "sum", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_nick_colors, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_nick_color_stop_chars = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_color_stop_chars", "string",
@@ -2620,31 +2850,35 @@ irc_config_init ()
"nick (at least one char outside this list must be in string before "
"stopping) (example: nick \"|nick|away\" with \"|\" in chars will "
"return color of nick \"|nick\")"),
- NULL, 0, 0, "_|[", NULL, 0, NULL, NULL,
- &irc_config_change_look_nick_colors, NULL, NULL, NULL);
+ NULL, 0, 0, "_|[", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_nick_colors, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_nick_completion_smart = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_completion_smart", "integer",
N_("smart completion for nicks (completes first with last speakers): "
"speakers = all speakers (including highlights), "
"speakers_highlights = only speakers with highlight"),
- "off|speakers|speakers_highlights", 0, 0, "speakers", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ "off|speakers|speakers_highlights", 0, 0, "speakers", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_mode = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_mode", "integer",
N_("display nick mode (op, voice, ...) before nick (none = never, "
"prefix = in prefix only (default), action = in action messages "
"only, both = prefix + action messages)"),
- "none|prefix|action|both", 0, 0, "prefix",
- NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ "none|prefix|action|both", 0, 0, "prefix", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_nick_mode_empty = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_mode_empty", "boolean",
N_("display a space if nick mode is enabled but nick has no mode (not "
"op, voice, ...)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- &irc_config_change_bar_item_input_prompt, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_bar_item_input_prompt, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_nicks_hide_password = weechat_config_new_option (
irc_config_file, ptr_section,
"nicks_hide_password", "string",
@@ -2652,14 +2886,17 @@ irc_config_init ()
"when a message is sent, for example to hide password in message "
"displayed by \"/msg nickserv identify password\", example: "
"\"nickserv,nickbot\""),
- NULL, 0, 0, "nickserv", NULL, 0, NULL, NULL,
- &irc_config_change_look_nicks_hide_password, NULL, NULL, NULL);
+ NULL, 0, 0, "nickserv", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_nicks_hide_password, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_notice_as_pv = weechat_config_new_option (
irc_config_file, ptr_section,
"notice_as_pv", "integer",
N_("display notices as private messages (if auto, use private buffer "
"if found)"),
- "auto|never|always", 0, 0, "auto", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ "auto|never|always", 0, 0, "auto", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notice_welcome_redirect = weechat_config_new_option (
irc_config_file, ptr_section,
"notice_welcome_redirect", "boolean",
@@ -2667,14 +2904,15 @@ irc_config_init ()
"buffer; such notices have the nick as target but a channel name in "
"beginning of notice message, for example notices sent by freenode "
"server which look like: \"[#channel] Welcome to this channel...\""),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notice_welcome_tags = weechat_config_new_option (
irc_config_file, ptr_section,
"notice_welcome_tags", "string",
N_("comma separated list of tags used in a welcome notices redirected "
"to a channel, for example: \"notify_private\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notify_tags_ison = weechat_config_new_option (
irc_config_file, ptr_section,
"notify_tags_ison", "string",
@@ -2682,8 +2920,8 @@ irc_config_init ()
"when a nick joins or quits server (result of command ison or "
"monitor), for example: \"notify_message\", \"notify_private\" or "
"\"notify_highlight\""),
- NULL, 0, 0, "notify_message", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "notify_message", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_notify_tags_whois = weechat_config_new_option (
irc_config_file, ptr_section,
"notify_tags_whois", "string",
@@ -2691,60 +2929,68 @@ irc_config_init ()
"when a nick away status changes (result of command whois), "
"for example: \"notify_message\", \"notify_private\" or "
"\"notify_highlight\""),
- NULL, 0, 0, "notify_message", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "notify_message", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_part_closes_buffer = weechat_config_new_option (
irc_config_file, ptr_section,
"part_closes_buffer", "boolean",
N_("close buffer when /part is issued on a channel"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_pv_buffer = weechat_config_new_option (
irc_config_file, ptr_section,
"pv_buffer", "integer",
N_("merge private buffers"),
- "independent|merge_by_server|merge_all", 0, 0, "independent",
- NULL, 0, NULL, NULL,
- &irc_config_change_look_pv_buffer, NULL, NULL, NULL);
+ "independent|merge_by_server|merge_all", 0, 0, "independent", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_pv_buffer, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_pv_tags = weechat_config_new_option (
irc_config_file, ptr_section,
"pv_tags", "string",
N_("comma separated list of tags used in private messages, for example: "
"\"notify_message\", \"notify_private\" or \"notify_highlight\""),
- NULL, 0, 0, "notify_private", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "notify_private", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_raw_messages = weechat_config_new_option (
irc_config_file, ptr_section,
"raw_messages", "integer",
N_("number of raw messages to save in memory when raw data buffer is "
"closed (messages will be displayed when opening raw data buffer)"),
- NULL, 0, 65535, "256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 65535, "256", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_server_buffer = weechat_config_new_option (
irc_config_file, ptr_section,
"server_buffer", "integer",
N_("merge server buffers"),
"merge_with_core|merge_without_core|independent", 0, 0, "merge_with_core",
- NULL, 0, NULL, NULL,
- &irc_config_change_look_server_buffer, NULL, NULL, NULL);
+ NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_server_buffer, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_look_smart_filter = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter", "boolean",
N_("filter join/part/quit/nick messages for a nick if not speaking "
"for some minutes on channel (you must create a filter on tag "
"\"irc_smart_filter\")"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_delay = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_delay", "integer",
N_("delay for filtering join/part/quit messages (in minutes): if the "
"nick did not speak during the last N minutes, the join/part/quit is "
"filtered"),
- NULL, 1, 60*24*7, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 1, 60*24*7, "5", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_join = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_join", "boolean",
/* TRANSLATORS: please do not translate "join" */
N_("enable smart filter for \"join\" messages"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_join_unmask = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_join_unmask", "integer",
@@ -2753,7 +2999,8 @@ irc_config_init ()
"minutes ago and then says something on channel (message, notice or "
"update on topic), the join is unmasked, as well as nick changes "
"after this join (0 = disable: never unmask a join)"),
- NULL, 0, 60*24*7, "30", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 60*24*7, "30", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_mode = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_mode", "string",
@@ -2763,38 +3010,46 @@ irc_config_init ()
"\"ovh\"), \"xyz\" to filter only modes x/y/z, \"-xyz\" to filter "
"all modes but not x/y/z; examples: \"ovh\": filter modes o/v/h, "
"\"-bkl\": filter all modes but not b/k/l"),
- NULL, 0, 0, "+", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "+", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_nick = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_nick", "boolean",
/* TRANSLATORS: please do not translate "nick" */
N_("enable smart filter for \"nick\" messages (nick changes)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_smart_filter_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"smart_filter_quit", "boolean",
/* TRANSLATORS: please do not translate "part" and "quit" */
N_("enable smart filter for \"part\" and \"quit\" messages"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_temporary_servers = weechat_config_new_option (
irc_config_file, ptr_section,
"temporary_servers", "boolean",
N_("enable automatic addition of temporary servers with command "
"/connect"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_topic_strip_colors = weechat_config_new_option (
irc_config_file, ptr_section,
"topic_strip_colors", "boolean",
N_("strip colors in topic (used only when displaying buffer title)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- &irc_config_change_look_topic_strip_colors, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_look_topic_strip_colors, NULL, NULL,
+ NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (irc_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -2805,45 +3060,55 @@ irc_config_init ()
irc_config_file, ptr_section,
"input_nick", "color",
N_("color for nick in input bar"),
- NULL, -1, 0, "lightcyan", NULL, 0, NULL, NULL,
- &irc_config_change_bar_item_input_prompt, NULL, NULL, NULL);
+ NULL, -1, 0, "lightcyan", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_bar_item_input_prompt, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_item_channel_modes = weechat_config_new_option (
irc_config_file, ptr_section,
"item_channel_modes", "color",
N_("color for channel modes, near channel name"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- &irc_config_change_color_item_channel_modes, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_item_channel_modes, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_item_lag_counting = weechat_config_new_option (
irc_config_file, ptr_section,
"item_lag_counting", "color",
N_("color for lag indicator, when counting (pong not received from "
"server, lag is increasing)"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- &irc_config_change_color_item_lag, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_item_lag, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_item_lag_finished = weechat_config_new_option (
irc_config_file, ptr_section,
"item_lag_finished", "color",
N_("color for lag indicator, when pong has been received from server"),
- NULL, -1, 0, "yellow", NULL, 0, NULL, NULL,
- &irc_config_change_color_item_lag, NULL, NULL, NULL);
+ NULL, -1, 0, "yellow", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_item_lag, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_item_nick_modes = weechat_config_new_option (
irc_config_file, ptr_section,
"item_nick_modes", "color",
N_("color for nick modes in bar item \"input_prompt\""),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- &irc_config_change_color_item_nick_modes, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_item_nick_modes, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_message_join = weechat_config_new_option (
irc_config_file, ptr_section,
"message_join", "color",
N_("color for text in join messages"),
- NULL, -1, 0, "green", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "green", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_message_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"message_quit", "color",
N_("color for text in part/quit messages"),
- NULL, -1, 0, "red", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "red", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_mirc_remap = weechat_config_new_option (
irc_config_file, ptr_section,
"mirc_remap", "string",
@@ -2857,8 +3122,10 @@ irc_config_init ()
"4=lightred, 5=red, 6=magenta, 7=brown, 8=yellow, 9=lightgreen, "
"10=cyan, 11=lightcyan, 12=lightblue, 13=lightmagenta, 14=gray, "
"15=white"),
- NULL, 0, 0, "1,-1:darkgray", NULL, 0, NULL, NULL,
- &irc_config_change_color_mirc_remap, NULL, NULL, NULL);
+ NULL, 0, 0, "1,-1:darkgray", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_mirc_remap, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_nick_prefixes = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefixes", "string",
@@ -2868,46 +3135,50 @@ irc_config_init ()
"(\"PREFIX\"); a special mode \"*\" can be used as default color "
"if no mode has been found in list)"),
NULL, 0, 0, "y:lightred;q:lightred;a:lightcyan;o:lightgreen;"
- "h:lightmagenta;v:yellow;*:lightblue", NULL, 0, NULL, NULL,
- &irc_config_change_color_nick_prefixes, NULL, NULL, NULL);
+ "h:lightmagenta;v:yellow;*:lightblue", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_color_nick_prefixes, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_color_notice = weechat_config_new_option (
irc_config_file, ptr_section,
"notice", "color",
N_("color for text \"Notice\" in notices"),
- NULL, -1, 0, "green", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "green", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_reason_quit = weechat_config_new_option (
irc_config_file, ptr_section,
"reason_quit", "color",
N_("color for reason in part/quit messages"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_topic_current = weechat_config_new_option (
irc_config_file, ptr_section,
"topic_current", "color",
N_("color for current channel topic (when joining a channel or "
"using /topic)"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_topic_new = weechat_config_new_option (
irc_config_file, ptr_section,
"topic_new", "color",
N_("color for new channel topic (when topic is changed)"),
- NULL, -1, 0, "white", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "white", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_color_topic_old = weechat_config_new_option (
irc_config_file, ptr_section,
"topic_old", "color",
N_("color for old channel topic (when topic is changed)"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -2919,14 +3190,14 @@ irc_config_init ()
"autoreconnect_delay_growing", "integer",
N_("growing factor for autoreconnect delay to server (1 = always same "
"delay, 2 = delay*2 for each retry, ..)"),
- NULL, 1, 100, "2", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 1, 100, "2", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_autoreconnect_delay_max = weechat_config_new_option (
irc_config_file, ptr_section,
"autoreconnect_delay_max", "integer",
N_("maximum autoreconnect delay to server (in seconds, 0 = no maximum)"),
- NULL, 0, 3600 * 24 * 7, "600", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 3600 * 24 * 7, "600", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_ban_mask_default = weechat_config_new_option (
irc_config_file, ptr_section,
"ban_mask_default", "string",
@@ -2935,8 +3206,8 @@ irc_config_init ()
"(extracted from \"nick!user@host\"); $ident is the same as $user if "
"$user does not start with \"~\", otherwise it is set to \"*\"; this "
"default mask is used only if WeeChat knows the host for the nick"),
- NULL, 0, 0, "*!$ident@$host", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "*!$ident@$host", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_channel_encode = weechat_config_new_option (
irc_config_file, ptr_section,
"channel_encode", "boolean",
@@ -2944,68 +3215,80 @@ irc_config_init ()
"it is recommended to keep that off if you use only UTF-8 in "
"channel names; you can enable this option if you are using an "
"exotic charset like ISO in channel names"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_colors_receive = weechat_config_new_option (
irc_config_file, ptr_section,
"colors_receive", "boolean",
N_("when off, colors codes are ignored in incoming messages"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_colors_send = weechat_config_new_option (
irc_config_file, ptr_section,
"colors_send", "boolean",
N_("allow user to send colors with special codes (ctrl-c + a code and "
"optional color: b=bold, cxx=color, cxx,yy=color+background, "
"i=italic, o=disable color/attributes, r=reverse, u=underline)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_lag_check = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_check", "integer",
N_("interval between two checks for lag (in seconds, 0 = never "
"check)"),
- NULL, 0, 3600 * 24 * 7, "60", NULL, 0, NULL, NULL,
- &irc_config_change_network_lag_check, NULL, NULL, NULL);
+ NULL, 0, 3600 * 24 * 7, "60", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_network_lag_check, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_network_lag_max = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_max", "integer",
N_("maximum lag (in seconds): if this lag is reached, WeeChat will "
"consider that the answer from server (pong) will never be received "
"and will give up counting the lag (0 = never give up)"),
- NULL, 0, 3600 * 24 * 7, "1800", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 3600 * 24 * 7, "1800", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_lag_min_show = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_min_show", "integer",
N_("minimum lag to show (in milliseconds)"),
- NULL, 0, 1000 * 3600 * 24, "500", NULL, 0, NULL, NULL,
- &irc_config_change_network_lag_min_show, NULL, NULL, NULL);
+ NULL, 0, 1000 * 3600 * 24, "500", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_network_lag_min_show, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_network_lag_reconnect = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_reconnect", "integer",
N_("reconnect to server if lag is greater than or equal to this value "
"(in seconds, 0 = never reconnect); this value must be less than or "
"equal to irc.network.lag_max"),
- NULL, 0, 3600 * 24 * 7, "0", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 3600 * 24 * 7, "0", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_lag_refresh_interval = weechat_config_new_option (
irc_config_file, ptr_section,
"lag_refresh_interval", "integer",
N_("interval between two refreshs of lag item, when lag is increasing "
"(in seconds)"),
- NULL, 1, 3600, "1", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 1, 3600, "1", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_notify_check_ison = weechat_config_new_option (
irc_config_file, ptr_section,
"notify_check_ison", "integer",
N_("interval between two checks for notify with IRC command \"ison\" "
"(in minutes)"),
- NULL, 1, 60 * 24 * 7, "1", NULL, 0, NULL, NULL,
- &irc_config_change_network_notify_check_ison, NULL, NULL, NULL);
+ NULL, 1, 60 * 24 * 7, "1", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_network_notify_check_ison, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_network_notify_check_whois = weechat_config_new_option (
irc_config_file, ptr_section,
"notify_check_whois", "integer",
N_("interval between two checks for notify with IRC command \"whois\" "
"(in minutes)"),
- NULL, 1, 60 * 24 * 7, "5", NULL, 0, NULL, NULL,
- &irc_config_change_network_notify_check_whois, NULL, NULL, NULL);
+ NULL, 1, 60 * 24 * 7, "5", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_network_notify_check_whois, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_network_sasl_fail_unavailable = weechat_config_new_option (
irc_config_file, ptr_section,
"sasl_fail_unavailable", "boolean",
@@ -3013,28 +3296,34 @@ irc_config_init ()
"unavailable on the server; when this option is enabled, it has "
"effect only if option \"sasl_fail\" is set to \"reconnect\" or "
"\"disconnect\" in the server"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_send_unknown_commands = weechat_config_new_option (
irc_config_file, ptr_section,
"send_unknown_commands", "boolean",
N_("send unknown commands to server"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- &irc_config_change_network_send_unknown_commands, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL,
+ &irc_config_change_network_send_unknown_commands, NULL, NULL,
+ NULL, NULL, NULL);
irc_config_network_whois_double_nick = weechat_config_new_option (
irc_config_file, ptr_section,
"whois_double_nick", "boolean",
N_("double the nick in /whois command (if only one nick is given), to "
"get idle time in answer; for example: \"/whois nick\" will send "
"\"whois nick nick\""),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* msgbuffer */
- ptr_section = weechat_config_new_section (irc_config_file, "msgbuffer",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &irc_config_msgbuffer_create_option, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ irc_config_file, "msgbuffer",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &irc_config_msgbuffer_create_option, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -3043,12 +3332,14 @@ irc_config_init ()
irc_config_section_msgbuffer = ptr_section;
/* CTCP */
- ptr_section = weechat_config_new_section (irc_config_file, "ctcp",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &irc_config_ctcp_create_option, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ irc_config_file, "ctcp",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &irc_config_ctcp_create_option, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -3057,12 +3348,14 @@ irc_config_init ()
irc_config_section_ctcp = ptr_section;
/* ignore */
- ptr_section = weechat_config_new_section (irc_config_file, "ignore",
- 0, 0,
- &irc_config_ignore_read_cb, NULL,
- &irc_config_ignore_write_cb, NULL,
- &irc_config_ignore_write_cb, NULL,
- NULL, NULL, NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ irc_config_file, "ignore",
+ 0, 0,
+ &irc_config_ignore_read_cb, NULL, NULL,
+ &irc_config_ignore_write_cb, NULL, NULL,
+ &irc_config_ignore_write_cb, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -3070,11 +3363,14 @@ irc_config_init ()
}
/* server_default */
- ptr_section = weechat_config_new_section (irc_config_file, "server_default",
- 0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ irc_config_file, "server_default",
+ 0, 0,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -3085,13 +3381,14 @@ irc_config_init ()
irc_config_server_create_default_options (ptr_section);
/* server */
- ptr_section = weechat_config_new_section (irc_config_file, "server",
- 0, 0,
- &irc_config_server_read_cb, NULL,
- &irc_config_server_write_cb, NULL,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ irc_config_file, "server",
+ 0, 0,
+ &irc_config_server_read_cb, NULL, NULL,
+ &irc_config_server_write_cb, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (irc_config_file);
@@ -3101,7 +3398,7 @@ irc_config_init ()
irc_config_hook_config_nick_colors = weechat_hook_config (
"weechat.color.chat_nick_colors",
- &irc_config_change_nick_colors_cb, NULL);
+ &irc_config_change_nick_colors_cb, NULL, NULL);
return 1;
}
@@ -3122,13 +3419,13 @@ irc_config_read ()
if (rc == WEECHAT_CONFIG_READ_OK)
{
irc_notify_new_for_all_servers ();
- irc_config_change_look_display_join_message (NULL, NULL);
- irc_config_change_look_nick_color_force (NULL, NULL);
- irc_config_change_look_nicks_hide_password (NULL, NULL);
- irc_config_change_color_nick_prefixes (NULL, NULL);
- irc_config_change_color_mirc_remap (NULL, NULL);
- irc_config_change_network_notify_check_ison (NULL, NULL);
- irc_config_change_network_notify_check_whois (NULL, NULL);
+ irc_config_change_look_display_join_message (NULL, NULL, NULL);
+ irc_config_change_look_nick_color_force (NULL, NULL, NULL);
+ irc_config_change_look_nicks_hide_password (NULL, NULL, NULL);
+ irc_config_change_color_nick_prefixes (NULL, NULL, NULL);
+ irc_config_change_color_mirc_remap (NULL, NULL, NULL);
+ irc_config_change_network_notify_check_ison (NULL, NULL, NULL);
+ irc_config_change_network_notify_check_whois (NULL, NULL, NULL);
}
return rc;
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 91d9b6bfe..dc75af49e 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -201,10 +201,10 @@ extern int irc_config_num_nicks_hide_password;
extern void irc_config_set_nick_colors ();
extern int irc_config_display_channel_modes_arguments (const char *modes);
-extern int irc_config_server_check_value_cb (void *data,
+extern int irc_config_server_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value);
-extern void irc_config_server_change_cb (void *data,
+extern void irc_config_server_change_cb (const void *pointer, void *data,
struct t_config_option *option);
struct t_config_option *irc_config_server_new_option (struct t_config_file *config_file,
struct t_config_section *section,
@@ -213,12 +213,16 @@ struct t_config_option *irc_config_server_new_option (struct t_config_file *conf
const char *default_value,
const char *value,
int null_value_allowed,
- int (*callback_check_value)(void *data,
+ int (*callback_check_value)(const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value),
+ const void *callback_check_value_pointer,
void *callback_check_value_data,
- void (*callback_change)(void *data,
+ void (*callback_change)(const void *pointer,
+ void *data,
struct t_config_option *option),
+ const void *callback_change_pointer,
void *callback_change_data);
extern int irc_config_init ();
extern int irc_config_read ();
diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c
index 9e8ffca6d..22e1c255c 100644
--- a/src/plugins/irc/irc-debug.c
+++ b/src/plugins/irc/irc-debug.c
@@ -35,10 +35,12 @@
*/
int
-irc_debug_signal_debug_dump_cb (void *data, const char *signal,
+irc_debug_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -69,5 +71,6 @@ irc_debug_signal_debug_dump_cb (void *data, const char *signal,
void
irc_debug_init ()
{
- weechat_hook_signal ("debug_dump", &irc_debug_signal_debug_dump_cb, NULL);
+ weechat_hook_signal ("debug_dump",
+ &irc_debug_signal_debug_dump_cb, NULL, NULL);
}
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index 4ef33d3ad..0d69a9dfc 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -308,11 +308,13 @@ irc_ignore_free_all ()
*/
struct t_hdata *
-irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
+irc_ignore_hdata_ignore_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore",
diff --git a/src/plugins/irc/irc-ignore.h b/src/plugins/irc/irc-ignore.h
index 9a8284903..0c6335e49 100644
--- a/src/plugins/irc/irc-ignore.h
+++ b/src/plugins/irc/irc-ignore.h
@@ -51,7 +51,8 @@ extern int irc_ignore_check (struct t_irc_server *server,
const char *host);
extern void irc_ignore_free (struct t_irc_ignore *ignore);
extern void irc_ignore_free_all ();
-extern struct t_hdata *irc_ignore_hdata_ignore_cb (void *data,
+extern struct t_hdata *irc_ignore_hdata_ignore_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore);
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c
index 46c9c1a8f..7133b21a1 100644
--- a/src/plugins/irc/irc-info.c
+++ b/src/plugins/irc/irc-info.c
@@ -64,7 +64,8 @@ irc_info_create_string_with_pointer (char **string, void *pointer)
*/
const char *
-irc_info_info_irc_is_channel_cb (void *data, const char *info_name,
+irc_info_info_irc_is_channel_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
@@ -73,6 +74,7 @@ irc_info_info_irc_is_channel_cb (void *data, const char *info_name,
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -99,12 +101,14 @@ irc_info_info_irc_is_channel_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_is_nick_cb (void *data, const char *info_name,
+irc_info_info_irc_is_nick_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char str_true[2] = "1";
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -118,12 +122,14 @@ irc_info_info_irc_is_nick_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_nick_cb (void *data, const char *info_name,
+irc_info_info_irc_nick_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -142,10 +148,12 @@ irc_info_info_irc_nick_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_nick_from_host_cb (void *data, const char *info_name,
+irc_info_info_irc_nick_from_host_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -158,10 +166,12 @@ irc_info_info_irc_nick_from_host_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_nick_color_cb (void *data, const char *info_name,
+irc_info_info_irc_nick_color_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -174,10 +184,12 @@ irc_info_info_irc_nick_color_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_nick_color_name_cb (void *data, const char *info_name,
+irc_info_info_irc_nick_color_name_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -190,7 +202,8 @@ irc_info_info_irc_nick_color_name_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_buffer_cb (void *data, const char *info_name,
+irc_info_info_irc_buffer_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
char *pos_comma, *pos_comma2, *server, *channel, *host;
@@ -199,6 +212,7 @@ irc_info_info_irc_buffer_cb (void *data, const char *info_name,
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -282,7 +296,8 @@ irc_info_info_irc_buffer_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_server_isupport_cb (void *data, const char *info_name,
+irc_info_info_irc_server_isupport_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
@@ -291,6 +306,7 @@ irc_info_info_irc_server_isupport_cb (void *data, const char *info_name,
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -317,7 +333,8 @@ irc_info_info_irc_server_isupport_cb (void *data, const char *info_name,
*/
const char *
-irc_info_info_irc_server_isupport_value_cb (void *data, const char *info_name,
+irc_info_info_irc_server_isupport_value_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
@@ -325,6 +342,7 @@ irc_info_info_irc_server_isupport_value_cb (void *data, const char *info_name,
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -351,7 +369,7 @@ irc_info_info_irc_server_isupport_value_cb (void *data, const char *info_name,
*/
struct t_hashtable *
-irc_info_info_hashtable_irc_message_parse_cb (void *data,
+irc_info_info_hashtable_irc_message_parse_cb (const void *pointer, void *data,
const char *info_name,
struct t_hashtable *hashtable)
{
@@ -360,6 +378,7 @@ irc_info_info_hashtable_irc_message_parse_cb (void *data,
struct t_hashtable *value;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -383,7 +402,7 @@ irc_info_info_hashtable_irc_message_parse_cb (void *data,
*/
struct t_hashtable *
-irc_info_info_hashtable_irc_message_split_cb (void *data,
+irc_info_info_hashtable_irc_message_split_cb (const void *pointer, void *data,
const char *info_name,
struct t_hashtable *hashtable)
{
@@ -392,6 +411,7 @@ irc_info_info_hashtable_irc_message_split_cb (void *data,
struct t_hashtable *value;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -415,27 +435,29 @@ irc_info_info_hashtable_irc_message_split_cb (void *data,
*/
struct t_infolist *
-irc_info_infolist_irc_server_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_server_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- if (pointer && !irc_server_valid (pointer))
+ if (obj_pointer && !irc_server_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one server */
- if (!irc_server_add_to_infolist (ptr_infolist, pointer))
+ if (!irc_server_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -469,8 +491,9 @@ irc_info_infolist_irc_server_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-irc_info_infolist_irc_channel_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_channel_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_server *ptr_server;
@@ -479,6 +502,7 @@ irc_info_infolist_irc_channel_cb (void *data, const char *infolist_name,
int argc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
@@ -499,10 +523,10 @@ irc_info_infolist_irc_channel_cb (void *data, const char *infolist_name,
weechat_string_free_split (argv);
return NULL;
}
- if (!pointer && (argc >= 2))
+ if (!obj_pointer && (argc >= 2))
{
- pointer = irc_channel_search (ptr_server, argv[1]);
- if (!pointer)
+ obj_pointer = irc_channel_search (ptr_server, argv[1]);
+ if (!obj_pointer)
{
weechat_string_free_split (argv);
return NULL;
@@ -514,17 +538,17 @@ irc_info_infolist_irc_channel_cb (void *data, const char *infolist_name,
if (!ptr_server)
return NULL;
- if (pointer && !irc_channel_valid (ptr_server, pointer))
+ if (obj_pointer && !irc_channel_valid (ptr_server, obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one channel */
- if (!irc_channel_add_to_infolist (ptr_infolist, pointer))
+ if (!irc_channel_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -554,8 +578,9 @@ irc_info_infolist_irc_channel_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-irc_info_infolist_irc_nick_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_nick_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_server *ptr_server;
@@ -565,6 +590,7 @@ irc_info_infolist_irc_nick_cb (void *data, const char *infolist_name,
int argc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
@@ -591,11 +617,11 @@ irc_info_infolist_irc_nick_cb (void *data, const char *infolist_name,
weechat_string_free_split (argv);
return NULL;
}
- if (!pointer && (argc >= 3))
+ if (!obj_pointer && (argc >= 3))
{
- pointer = irc_nick_search (ptr_server, ptr_channel,
+ obj_pointer = irc_nick_search (ptr_server, ptr_channel,
argv[2]);
- if (!pointer)
+ if (!obj_pointer)
{
weechat_string_free_split (argv);
return NULL;
@@ -607,18 +633,18 @@ irc_info_infolist_irc_nick_cb (void *data, const char *infolist_name,
if (!ptr_server || !ptr_channel)
return NULL;
- if (pointer && !irc_nick_valid (ptr_channel, pointer))
+ if (obj_pointer && !irc_nick_valid (ptr_channel, obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one nick */
if (!irc_nick_add_to_infolist (ptr_infolist,
- pointer))
+ obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -649,28 +675,30 @@ irc_info_infolist_irc_nick_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-irc_info_infolist_irc_ignore_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_ignore_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_ignore *ptr_ignore;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (pointer && !irc_ignore_valid (pointer))
+ if (obj_pointer && !irc_ignore_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one ignore */
- if (!irc_ignore_add_to_infolist (ptr_infolist, pointer))
+ if (!irc_ignore_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -700,28 +728,30 @@ irc_info_infolist_irc_ignore_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-irc_info_infolist_irc_notify_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_notify_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- if (pointer && !irc_notify_valid (NULL, pointer))
+ if (obj_pointer && !irc_notify_valid (NULL, obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one notify */
- if (!irc_notify_add_to_infolist (ptr_infolist, pointer))
+ if (!irc_notify_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -760,15 +790,18 @@ irc_info_infolist_irc_notify_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-irc_info_infolist_irc_color_weechat_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+irc_info_infolist_irc_color_weechat_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer,
+ const char *arguments)
{
struct t_infolist *ptr_infolist;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
(void) arguments;
ptr_infolist = weechat_infolist_new ();
@@ -796,47 +829,47 @@ irc_info_init ()
"irc_is_channel",
N_("1 if string is a valid IRC channel name for server"),
N_("server,channel (server is optional)"),
- &irc_info_info_irc_is_channel_cb, NULL);
+ &irc_info_info_irc_is_channel_cb, NULL, NULL);
weechat_hook_info (
"irc_is_nick",
N_("1 if string is a valid IRC nick name"),
N_("nickname"),
- &irc_info_info_irc_is_nick_cb, NULL);
+ &irc_info_info_irc_is_nick_cb, NULL, NULL);
weechat_hook_info (
"irc_nick",
N_("get current nick on a server"),
N_("server name"),
- &irc_info_info_irc_nick_cb, NULL);
+ &irc_info_info_irc_nick_cb, NULL, NULL);
weechat_hook_info (
"irc_nick_from_host",
N_("get nick from IRC host"),
N_("IRC host (like `:nick!name@server.com`)"),
- &irc_info_info_irc_nick_from_host_cb, NULL);
+ &irc_info_info_irc_nick_from_host_cb, NULL, NULL);
weechat_hook_info (
"irc_nick_color",
N_("get nick color code"),
N_("nickname"),
- &irc_info_info_irc_nick_color_cb, NULL);
+ &irc_info_info_irc_nick_color_cb, NULL, NULL);
weechat_hook_info (
"irc_nick_color_name",
N_("get nick color name"),
N_("nickname"),
- &irc_info_info_irc_nick_color_name_cb, NULL);
+ &irc_info_info_irc_nick_color_name_cb, NULL, NULL);
weechat_hook_info (
"irc_buffer",
N_("get buffer pointer for an IRC server/channel/nick"),
N_("server,channel,nick (channel and nicks are optional)"),
- &irc_info_info_irc_buffer_cb, NULL);
+ &irc_info_info_irc_buffer_cb, NULL, NULL);
weechat_hook_info (
"irc_server_isupport",
N_("1 if server supports this feature (from IRC message 005)"),
N_("server,feature"),
- &irc_info_info_irc_server_isupport_cb, NULL);
+ &irc_info_info_irc_server_isupport_cb, NULL, NULL);
weechat_hook_info (
"irc_server_isupport_value",
N_("value of feature, if supported by server (from IRC message 005)"),
N_("server,feature"),
- &irc_info_info_irc_server_isupport_value_cb, NULL);
+ &irc_info_info_irc_server_isupport_value_cb, NULL, NULL);
/* info_hashtable hooks */
weechat_hook_info_hashtable (
@@ -860,7 +893,7 @@ irc_info_init ()
"\"channel\" was not found), "
"\"pos_text\": index of \"text\" message (\"-1\" if "
"\"text\" was not found)"),
- &irc_info_info_hashtable_irc_message_parse_cb, NULL);
+ &irc_info_info_hashtable_irc_message_parse_cb, NULL, NULL);
weechat_hook_info_hashtable (
"irc_message_split",
N_("split an IRC message (to fit in 512 bytes)"),
@@ -869,7 +902,7 @@ irc_info_init ()
N_("\"msg1\" ... \"msgN\": messages to send (without final \"\\r\\n\"), "
"\"args1\" ... \"argsN\": arguments of messages, \"count\": number "
"of messages"),
- &irc_info_info_hashtable_irc_message_split_cb, NULL);
+ &irc_info_info_hashtable_irc_message_split_cb, NULL, NULL);
/* infolist hooks */
weechat_hook_infolist (
@@ -877,61 +910,61 @@ irc_info_init ()
N_("list of IRC servers"),
N_("server pointer (optional)"),
N_("server name (wildcard \"*\" is allowed) (optional)"),
- &irc_info_infolist_irc_server_cb, NULL);
+ &irc_info_infolist_irc_server_cb, NULL, NULL);
weechat_hook_infolist (
"irc_channel",
N_("list of channels for an IRC server"),
N_("channel pointer (optional)"),
N_("server,channel (channel is optional)"),
- &irc_info_infolist_irc_channel_cb, NULL);
+ &irc_info_infolist_irc_channel_cb, NULL, NULL);
weechat_hook_infolist (
"irc_nick",
N_("list of nicks for an IRC channel"),
N_("nick pointer (optional)"),
N_("server,channel,nick (nick is optional)"),
- &irc_info_infolist_irc_nick_cb, NULL);
+ &irc_info_infolist_irc_nick_cb, NULL, NULL);
weechat_hook_infolist (
"irc_ignore",
N_("list of IRC ignores"),
N_("ignore pointer (optional)"),
NULL,
- &irc_info_infolist_irc_ignore_cb, NULL);
+ &irc_info_infolist_irc_ignore_cb, NULL, NULL);
weechat_hook_infolist (
"irc_notify",
N_("list of notify"),
N_("notify pointer (optional)"),
N_("server name (wildcard \"*\" is allowed) (optional)"),
- &irc_info_infolist_irc_notify_cb, NULL);
+ &irc_info_infolist_irc_notify_cb, NULL, NULL);
weechat_hook_infolist (
"irc_color_weechat",
N_("mapping between IRC color codes and WeeChat color names"),
NULL,
NULL,
- &irc_info_infolist_irc_color_weechat_cb, NULL);
+ &irc_info_infolist_irc_color_weechat_cb, NULL, NULL);
/* hdata hooks */
weechat_hook_hdata (
"irc_nick", N_("irc nick"),
- &irc_nick_hdata_nick_cb, NULL);
+ &irc_nick_hdata_nick_cb, NULL, NULL);
weechat_hook_hdata (
"irc_channel", N_("irc channel"),
- &irc_channel_hdata_channel_cb, NULL);
+ &irc_channel_hdata_channel_cb, NULL, NULL);
weechat_hook_hdata (
"irc_channel_speaking", N_("irc channel_speaking"),
- &irc_channel_hdata_channel_speaking_cb, NULL);
+ &irc_channel_hdata_channel_speaking_cb, NULL, NULL);
weechat_hook_hdata (
"irc_ignore", N_("irc ignore"),
- &irc_ignore_hdata_ignore_cb, NULL);
+ &irc_ignore_hdata_ignore_cb, NULL, NULL);
weechat_hook_hdata (
"irc_notify", N_("irc notify"),
- &irc_notify_hdata_notify_cb, NULL);
+ &irc_notify_hdata_notify_cb, NULL, NULL);
weechat_hook_hdata (
"irc_redirect_pattern", N_("pattern for irc redirect"),
- &irc_redirect_hdata_redirect_pattern_cb, NULL);
+ &irc_redirect_hdata_redirect_pattern_cb, NULL, NULL);
weechat_hook_hdata (
"irc_redirect", N_("irc redirect"),
- &irc_redirect_hdata_redirect_cb, NULL);
+ &irc_redirect_hdata_redirect_cb, NULL, NULL);
weechat_hook_hdata (
"irc_server", N_("irc server"),
- &irc_server_hdata_server_cb, NULL);
+ &irc_server_hdata_server_cb, NULL, NULL);
}
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index caa330474..bd6e2c655 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -259,10 +259,12 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags,
*/
int
-irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
+irc_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return irc_input_data (buffer, input_data,
@@ -287,7 +289,8 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-irc_input_send_cb (void *data, const char *signal,
+irc_input_send_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
const char *ptr_string, *ptr_message;
@@ -299,6 +302,7 @@ irc_input_send_cb (void *data, const char *signal,
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
diff --git a/src/plugins/irc/irc-input.h b/src/plugins/irc/irc-input.h
index 9a7988102..4d8315992 100644
--- a/src/plugins/irc/irc-input.h
+++ b/src/plugins/irc/irc-input.h
@@ -24,9 +24,11 @@ struct t_gui_buffer;
extern void irc_input_user_message_display (struct t_gui_buffer *buffer,
int action, const char *text);
-extern int irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
+extern int irc_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data);
-extern int irc_input_send_cb (void *data, const char *signal,
- const char *type_data, void *signal_data);
+extern int irc_input_send_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
+ void *signal_data);
#endif /* WEECHAT_IRC_INPUT_H */
diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c
index 1524a9f3b..5e1e1b604 100644
--- a/src/plugins/irc/irc-message.c
+++ b/src/plugins/irc/irc-message.c
@@ -362,8 +362,7 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!hashtable)
return NULL;
@@ -1008,8 +1007,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!hashtable)
return NULL;
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 98b470641..308181c76 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -1128,11 +1128,13 @@ irc_nick_default_ban_mask (struct t_irc_nick *nick)
*/
struct t_hdata *
-irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
+irc_nick_hdata_nick_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index d723db180..b8109a7cc 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -48,8 +48,6 @@ struct t_irc_nick
extern int irc_nick_valid (struct t_irc_channel *channel,
struct t_irc_nick *nick);
extern int irc_nick_is_nick (const char *string);
-extern int irc_nick_config_colors_cb (void *data, const char *option,
- const char *value);
extern const char *irc_nick_find_color (const char *nickname);
extern const char *irc_nick_find_color_name (const char *nickname);
extern int irc_nick_is_op (struct t_irc_server *server,
@@ -104,7 +102,8 @@ extern const char *irc_nick_color_for_msg (struct t_irc_server *server,
extern const char * irc_nick_color_for_pv (struct t_irc_channel *channel,
const char *nickname);
extern char *irc_nick_default_ban_mask (struct t_irc_nick *nick);
-extern struct t_hdata *irc_nick_hdata_nick_cb (void *data,
+extern struct t_hdata *irc_nick_hdata_nick_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_nick_add_to_infolist (struct t_infolist *infolist,
struct t_irc_nick *nick);
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index 2d39250ca..3ca5b9e25 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -769,7 +769,7 @@ irc_notify_set_away_message (struct t_irc_notify *notify,
*/
int
-irc_notify_hsignal_cb (void *data, const char *signal,
+irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
struct t_hashtable *hashtable)
{
const char *error, *server, *pattern, *command, *output;
@@ -781,6 +781,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
struct t_irc_notify *ptr_notify;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
@@ -962,7 +963,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
*/
int
-irc_notify_timer_ison_cb (void *data, int remaining_calls)
+irc_notify_timer_ison_cb (const void *pointer, void *data, int remaining_calls)
{
char *message, hash_key[32];
const char *str_message;
@@ -971,6 +972,7 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
struct t_hashtable *hashtable;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) remaining_calls;
@@ -1021,12 +1023,14 @@ irc_notify_timer_ison_cb (void *data, int remaining_calls)
*/
int
-irc_notify_timer_whois_cb (void *data, int remaining_calls)
+irc_notify_timer_whois_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_irc_server *ptr_server;
struct t_irc_notify *ptr_notify, *ptr_next_notify;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) remaining_calls;
@@ -1067,11 +1071,13 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
*/
struct t_hdata *
-irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
+irc_notify_hdata_notify_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify",
@@ -1164,7 +1170,7 @@ irc_notify_hook_timer_ison ()
irc_notify_timer_ison = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_ison),
- 0, 0, &irc_notify_timer_ison_cb, NULL);
+ 0, 0, &irc_notify_timer_ison_cb, NULL, NULL);
}
/*
@@ -1179,7 +1185,7 @@ irc_notify_hook_timer_whois ()
irc_notify_timer_whois = weechat_hook_timer (
60 * 1000 * weechat_config_integer (irc_config_network_notify_check_whois),
- 0, 0, &irc_notify_timer_whois_cb, NULL);
+ 0, 0, &irc_notify_timer_whois_cb, NULL, NULL);
}
/*
@@ -1194,7 +1200,7 @@ irc_notify_init ()
irc_notify_hsignal = weechat_hook_hsignal ("irc_redirection_notify_*",
&irc_notify_hsignal_cb,
- NULL);
+ NULL, NULL);
}
/*
diff --git a/src/plugins/irc/irc-notify.h b/src/plugins/irc/irc-notify.h
index 63bd96347..f290cd0b0 100644
--- a/src/plugins/irc/irc-notify.h
+++ b/src/plugins/irc/irc-notify.h
@@ -60,9 +60,12 @@ extern void irc_notify_set_is_on_server (struct t_irc_notify *notify,
extern void irc_notify_free_all (struct t_irc_server *server);
extern void irc_notify_display_list (struct t_irc_server *server);
extern void irc_notify_send_monitor (struct t_irc_server *server);
-extern int irc_notify_timer_ison_cb (void *data, int remaining_calls);
-extern int irc_notify_timer_whois_cb (void *data, int remaining_calls);
-extern struct t_hdata *irc_notify_hdata_notify_cb (void *data,
+extern int irc_notify_timer_ison_cb (const void *pointer, void *data,
+ int remaining_calls);
+extern int irc_notify_timer_whois_cb (const void *pointer, void *data,
+ int remaining_calls);
+extern struct t_hdata *irc_notify_hdata_notify_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_notify_add_to_infolist (struct t_infolist *infolist,
struct t_irc_notify *notify);
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 23afad170..b6a9cae24 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -518,7 +518,7 @@ IRC_PROTOCOL_CALLBACK(cap)
timeout * 1000,
0, 1,
&irc_server_timer_sasl_cb,
- server);
+ server, NULL);
}
}
}
@@ -1035,7 +1035,7 @@ IRC_PROTOCOL_CALLBACK(kick)
IRC_SERVER_OPTION_AUTOREJOIN_DELAY) * 1000,
0, 1,
&irc_channel_autorejoin_cb,
- ptr_channel);
+ ptr_channel, NULL);
}
}
@@ -5531,8 +5531,7 @@ irc_protocol_get_message_tags (const char *tags)
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!hashtable)
return NULL;
diff --git a/src/plugins/irc/irc-raw.c b/src/plugins/irc/irc-raw.c
index 4e5155090..fb560eea6 100644
--- a/src/plugins/irc/irc-raw.c
+++ b/src/plugins/irc/irc-raw.c
@@ -72,9 +72,10 @@ irc_raw_open (int switch_to_buffer)
IRC_RAW_BUFFER_NAME);
if (!irc_raw_buffer)
{
- irc_raw_buffer = weechat_buffer_new (IRC_RAW_BUFFER_NAME,
- &irc_input_data_cb, NULL,
- &irc_buffer_close_cb, NULL);
+ irc_raw_buffer = weechat_buffer_new (
+ IRC_RAW_BUFFER_NAME,
+ &irc_input_data_cb, NULL, NULL,
+ &irc_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then return */
if (!irc_raw_buffer)
diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c
index de1c71ee5..ab88a4469 100644
--- a/src/plugins/irc/irc-redirect.c
+++ b/src/plugins/irc/irc-redirect.c
@@ -436,8 +436,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
hash_cmd[i] = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
- NULL,
- NULL);
+ NULL, NULL);
for (j = 0; j < num_items[i]; j++)
{
if (i < 3)
@@ -732,8 +731,7 @@ irc_redirect_stop (struct t_irc_redirect *redirect, const char *error)
hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hashtable)
{
/* set error and output (main fields) */
@@ -993,11 +991,13 @@ irc_redirect_free_all (struct t_irc_server *server)
*/
struct t_hdata *
-irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
+irc_redirect_hdata_redirect_pattern_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
@@ -1023,11 +1023,13 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
*/
struct t_hdata *
-irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
+irc_redirect_hdata_redirect_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
@@ -1237,7 +1239,8 @@ irc_redirect_print_log (struct t_irc_server *server)
*/
int
-irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
+irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra;
@@ -1245,6 +1248,7 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
int number, timeout;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
@@ -1301,7 +1305,8 @@ irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
*/
int
-irc_redirect_command_hsignal_cb (void *data, const char *signal,
+irc_redirect_command_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
const char *server, *pattern, *redirect_signal, *str_count, *string;
@@ -1311,6 +1316,7 @@ irc_redirect_command_hsignal_cb (void *data, const char *signal,
int number, count, timeout;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
diff --git a/src/plugins/irc/irc-redirect.h b/src/plugins/irc/irc-redirect.h
index 7fd841621..632e4e840 100644
--- a/src/plugins/irc/irc-redirect.h
+++ b/src/plugins/irc/irc-redirect.h
@@ -109,9 +109,11 @@ extern int irc_redirect_message (struct t_irc_server *server,
const char *arguments);
extern void irc_redirect_free (struct t_irc_redirect *redirect);
extern void irc_redirect_free_all (struct t_irc_server *server);
-extern struct t_hdata *irc_redirect_hdata_redirect_pattern_cb (void *data,
+extern struct t_hdata *irc_redirect_hdata_redirect_pattern_cb (const void *pointer,
+ void *data,
const char *hdata_name);
-extern struct t_hdata *irc_redirect_hdata_redirect_cb (void *data,
+extern struct t_hdata *irc_redirect_hdata_redirect_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect_pattern *redirect_pattern);
@@ -119,9 +121,11 @@ extern int irc_redirect_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect *redirect);
extern void irc_redirect_pattern_print_log ();
extern void irc_redirect_print_log (struct t_irc_server *server);
-extern int irc_redirect_pattern_hsignal_cb (void *data, const char *signal,
+extern int irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable);
-extern int irc_redirect_command_hsignal_cb (void *data, const char *signal,
+extern int irc_redirect_command_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable);
extern void irc_redirect_init ();
extern void irc_redirect_end ();
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 6f7b4fc33..cd18494a1 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1056,21 +1056,21 @@ irc_server_alloc (const char *name)
new_server->notify_list = NULL;
new_server->last_notify = NULL;
new_server->notify_count = 0;
- new_server->join_manual = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_TIME,
- NULL,
- NULL);
- new_server->join_channel_key = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
- new_server->join_noswitch = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_TIME,
- NULL,
- NULL);
+ new_server->join_manual = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_TIME,
+ NULL, NULL);
+ new_server->join_channel_key = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
+ new_server->join_noswitch = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_TIME,
+ NULL, NULL);
new_server->buffer = NULL;
new_server->buffer_as_string = NULL;
new_server->channels = NULL;
@@ -1100,9 +1100,11 @@ irc_server_alloc (const char *name)
1,
&irc_config_server_check_value_cb,
irc_server_options[i][0],
+ NULL,
&irc_config_server_change_cb,
- irc_server_options[i][0]);
- irc_config_server_change_cb (irc_server_options[i][0],
+ irc_server_options[i][0],
+ NULL);
+ irc_config_server_change_cb (irc_server_options[i][0], NULL,
new_server->options[i]);
free (option_name);
}
@@ -2289,8 +2291,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
ret_hashtable = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
rc = 1;
@@ -2762,16 +2763,17 @@ irc_server_msgq_flush ()
*/
int
-irc_server_recv_cb (void *data, int fd)
+irc_server_recv_cb (const void *pointer, void *data, int fd)
{
struct t_irc_server *server;
static char buffer[4096 + 2];
int num_read, msgq_flush, end_recv;
/* make C compiler happy */
+ (void) data;
(void) fd;
- server = (struct t_irc_server *)data;
+ server = (struct t_irc_server *)pointer;
if (!server)
return WEECHAT_RC_ERROR;
@@ -2865,14 +2867,16 @@ irc_server_recv_cb (void *data, int fd)
*/
int
-irc_server_timer_connection_cb (void *data, int remaining_calls)
+irc_server_timer_connection_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_irc_server *server;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- server = (struct t_irc_server *)data;
+ server = (struct t_irc_server *)pointer;
if (!server)
return WEECHAT_RC_ERROR;
@@ -2898,15 +2902,16 @@ irc_server_timer_connection_cb (void *data, int remaining_calls)
*/
int
-irc_server_timer_sasl_cb (void *data, int remaining_calls)
+irc_server_timer_sasl_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_irc_server *server;
int sasl_fail;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- server = (struct t_irc_server *)data;
+ server = (struct t_irc_server *)pointer;
if (!server)
return WEECHAT_RC_ERROR;
@@ -2940,7 +2945,8 @@ irc_server_timer_sasl_cb (void *data, int remaining_calls)
*/
void
-irc_server_check_join_manual_cb (void *data, struct t_hashtable *hashtable,
+irc_server_check_join_manual_cb (void *data,
+ struct t_hashtable *hashtable,
const void *key, const void *value)
{
/* make C compiler happy */
@@ -2956,7 +2962,8 @@ irc_server_check_join_manual_cb (void *data, struct t_hashtable *hashtable,
*/
void
-irc_server_check_join_noswitch_cb (void *data, struct t_hashtable *hashtable,
+irc_server_check_join_noswitch_cb (void *data,
+ struct t_hashtable *hashtable,
const void *key, const void *value)
{
/* make C compiler happy */
@@ -2994,7 +3001,7 @@ irc_server_check_join_smart_filtered_cb (void *data,
*/
int
-irc_server_timer_cb (void *data, int remaining_calls)
+irc_server_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -3004,6 +3011,7 @@ irc_server_timer_cb (void *data, int remaining_calls)
int away_check;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) remaining_calls;
@@ -3381,7 +3389,7 @@ irc_server_login (struct t_irc_server *server)
IRC_SERVER_OPTION_INTEGER (server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT) * 1000,
0, 1,
&irc_server_timer_connection_cb,
- server);
+ server, NULL);
if (password)
free (password);
@@ -3431,13 +3439,17 @@ irc_server_switch_address (struct t_irc_server *server, int connection)
*/
int
-irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock,
+irc_server_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc, int sock,
const char *error, const char *ip_address)
{
struct t_irc_server *server;
const char *proxy;
- server = (struct t_irc_server *)data;
+ /* make C compiler happy */
+ (void) data;
+
+ server = (struct t_irc_server *)pointer;
proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY);
@@ -3462,7 +3474,7 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock,
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
&irc_server_recv_cb,
- server);
+ server, NULL);
/* login to server */
irc_server_login (server);
break;
@@ -3719,8 +3731,8 @@ irc_server_create_buffer (struct t_irc_server *server)
snprintf (buffer_name, sizeof (buffer_name),
"server.%s", server->name);
server->buffer = weechat_buffer_new (buffer_name,
- &irc_input_data_cb, NULL,
- &irc_buffer_close_cb, NULL);
+ &irc_input_data_cb, NULL, NULL,
+ &irc_buffer_close_cb, NULL, NULL);
if (!server->buffer)
return NULL;
@@ -4549,7 +4561,8 @@ irc_server_connect (struct t_irc_server *server)
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_PRIORITIES),
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
&irc_server_connect_cb,
- server);
+ server,
+ NULL);
#else
server->hook_connect = weechat_hook_connect (
proxy,
@@ -4560,7 +4573,8 @@ irc_server_connect (struct t_irc_server *server)
NULL, NULL, 0, NULL,
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
&irc_server_connect_cb,
- server);
+ server,
+ NULL);
#endif /* HAVE_GNUTLS */
/* send signal "irc_server_connecting" with server name */
@@ -4595,15 +4609,17 @@ irc_server_reconnect (struct t_irc_server *server)
*/
int
-irc_server_auto_connect_timer_cb (void *data, int remaining_calls)
+irc_server_auto_connect_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_irc_server *ptr_server;
- void *auto_connect;
+ int auto_connect;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- auto_connect = data;
+ auto_connect = (pointer) ? 1 : 0;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -4629,8 +4645,10 @@ irc_server_auto_connect_timer_cb (void *data, int remaining_calls)
void
irc_server_auto_connect (int auto_connect)
{
- weechat_hook_timer (1, 0, 1, &irc_server_auto_connect_timer_cb,
- (auto_connect) ? (void *)1 : (void *)0);
+ weechat_hook_timer (1, 0, 1,
+ &irc_server_auto_connect_timer_cb,
+ (auto_connect) ? (void *)1 : (void *)0,
+ NULL);
}
/*
@@ -5026,7 +5044,8 @@ irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
*/
int
-irc_server_xfer_send_ready_cb (void *data, const char *signal,
+irc_server_xfer_send_ready_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
struct t_infolist *infolist;
@@ -5038,6 +5057,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
int spaces_in_name, rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -5127,7 +5147,8 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
*/
int
-irc_server_xfer_resume_ready_cb (void *data, const char *signal,
+irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
struct t_infolist *infolist;
@@ -5136,6 +5157,7 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
int spaces_in_name;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -5180,7 +5202,8 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
*/
int
-irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
+irc_server_xfer_send_accept_resume_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
@@ -5190,6 +5213,7 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
int spaces_in_name;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -5231,11 +5255,13 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
*/
struct t_hdata *
-irc_server_hdata_server_cb (void *data, const char *hdata_name)
+irc_server_hdata_server_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server",
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 8ba3d96e6..1d14957d8 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -330,9 +330,11 @@ char *irc_server_fingerprint_str_sizes ();
extern int irc_server_connect (struct t_irc_server *server);
extern void irc_server_auto_connect (int auto_connect);
extern void irc_server_autojoin_channels ();
-extern int irc_server_recv_cb (void *data, int fd);
-extern int irc_server_timer_sasl_cb (void *data, int remaining_calls);
-extern int irc_server_timer_cb (void *data, int remaining_calls);
+extern int irc_server_recv_cb (const void *pointer, void *data, int fd);
+extern int irc_server_timer_sasl_cb (const void *pointer, void *data,
+ int remaining_calls);
+extern int irc_server_timer_cb (const void *pointer, void *data,
+ int remaining_calls);
extern void irc_server_outqueue_free_all (struct t_irc_server *server,
int priority);
extern int irc_server_get_channel_count (struct t_irc_server *server);
@@ -347,14 +349,21 @@ extern void irc_server_disconnect (struct t_irc_server *server,
int switch_address, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_free (struct t_irc_server *server);
-extern int irc_server_xfer_send_ready_cb (void *data, const char *signal,
- const char *type_data, void *signal_data);
-extern int irc_server_xfer_resume_ready_cb (void *data, const char *signal,
- const char *type_data, void *signal_data);
-extern int irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
+extern int irc_server_xfer_send_ready_cb (const void *pointer, void *data,
+ const char *signal,
+ const char *type_data,
+ void *signal_data);
+extern int irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
+ const char *signal,
+ const char *type_data,
+ void *signal_data);
+extern int irc_server_xfer_send_accept_resume_cb (const void *pointer,
+ void *data,
+ const char *signal,
const char *type_data,
void *signal_data);
-extern struct t_hdata *irc_server_hdata_server_cb (void *data,
+extern struct t_hdata *irc_server_hdata_server_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int irc_server_add_to_infolist (struct t_infolist *infolist,
struct t_irc_server *server);
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 458bf0204..e5623eccf 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -224,7 +224,8 @@ irc_upgrade_save ()
int rc;
struct t_upgrade_file *upgrade_file;
- upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 1);
+ upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME,
+ NULL, NULL, NULL);
if (!upgrade_file)
return 0;
@@ -269,7 +270,7 @@ irc_upgrade_set_buffer_callbacks ()
if (ptr_server)
{
weechat_buffer_set_pointer (ptr_buffer,
- "nickcmp_callback_data",
+ "nickcmp_callback_pointer",
ptr_server);
}
}
@@ -289,7 +290,7 @@ irc_upgrade_set_buffer_callbacks ()
*/
int
-irc_upgrade_read_cb (void *data,
+irc_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
@@ -306,6 +307,7 @@ irc_upgrade_read_cb (void *data,
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) upgrade_file;
@@ -354,10 +356,12 @@ irc_upgrade_read_cb (void *data,
if (sock >= 0)
{
irc_upgrade_current_server->sock = sock;
- irc_upgrade_current_server->hook_fd = weechat_hook_fd (irc_upgrade_current_server->sock,
- 1, 0, 0,
- &irc_server_recv_cb,
- irc_upgrade_current_server);
+ irc_upgrade_current_server->hook_fd = weechat_hook_fd (
+ irc_upgrade_current_server->sock,
+ 1, 0, 0,
+ &irc_server_recv_cb,
+ irc_upgrade_current_server,
+ NULL);
}
irc_upgrade_current_server->is_connected = weechat_infolist_integer (infolist, "is_connected");
irc_upgrade_current_server->ssl_connected = weechat_infolist_integer (infolist, "ssl_connected");
@@ -734,10 +738,13 @@ irc_upgrade_load ()
irc_upgrade_set_buffer_callbacks ();
- upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME, 0);
+ upgrade_file = weechat_upgrade_new (IRC_UPGRADE_FILENAME,
+ &irc_upgrade_read_cb, NULL, NULL);
if (!upgrade_file)
return 0;
- rc = weechat_upgrade_read (upgrade_file, &irc_upgrade_read_cb, NULL);
+
+ rc = weechat_upgrade_read (upgrade_file);
+
weechat_upgrade_close (upgrade_file);
return rc;
diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c
index 934df21ce..a75c9b48a 100644
--- a/src/plugins/irc/irc.c
+++ b/src/plugins/irc/irc.c
@@ -64,12 +64,14 @@ int irc_signal_upgrade_received = 0; /* signal "upgrade" received ? */
*/
int
-irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
+irc_signal_quit_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
@@ -92,13 +94,15 @@ irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
*/
int
-irc_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
+irc_signal_upgrade_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;
int quit, ssl_disconnected;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -179,21 +183,32 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* hook some signals */
irc_debug_init ();
- weechat_hook_signal ("quit", &irc_signal_quit_cb, NULL);
- weechat_hook_signal ("upgrade", &irc_signal_upgrade_cb, NULL);
- weechat_hook_signal ("xfer_send_ready", &irc_server_xfer_send_ready_cb, NULL);
- weechat_hook_signal ("xfer_resume_ready", &irc_server_xfer_resume_ready_cb, NULL);
- weechat_hook_signal ("xfer_send_accept_resume", &irc_server_xfer_send_accept_resume_cb, NULL);
- weechat_hook_signal ("irc_input_send", &irc_input_send_cb, NULL);
+ weechat_hook_signal ("quit",
+ &irc_signal_quit_cb, NULL, NULL);
+ weechat_hook_signal ("upgrade",
+ &irc_signal_upgrade_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_send_ready",
+ &irc_server_xfer_send_ready_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_resume_ready",
+ &irc_server_xfer_resume_ready_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_send_accept_resume",
+ &irc_server_xfer_send_accept_resume_cb, NULL, NULL);
+ weechat_hook_signal ("irc_input_send",
+ &irc_input_send_cb, NULL, NULL);
/* hook hsignals for redirection */
- weechat_hook_hsignal ("irc_redirect_pattern", &irc_redirect_pattern_hsignal_cb, NULL);
- weechat_hook_hsignal ("irc_redirect_command", &irc_redirect_command_hsignal_cb, NULL);
+ weechat_hook_hsignal ("irc_redirect_pattern",
+ &irc_redirect_pattern_hsignal_cb, NULL, NULL);
+ weechat_hook_hsignal ("irc_redirect_command",
+ &irc_redirect_command_hsignal_cb, NULL, NULL);
/* modifiers */
- weechat_hook_modifier ("irc_color_decode", &irc_color_modifier_cb, NULL);
- weechat_hook_modifier ("irc_color_encode", &irc_color_modifier_cb, NULL);
- weechat_hook_modifier ("irc_color_decode_ansi", &irc_color_modifier_cb, NULL);
+ weechat_hook_modifier ("irc_color_decode",
+ &irc_color_modifier_cb, NULL, NULL);
+ weechat_hook_modifier ("irc_color_encode",
+ &irc_color_modifier_cb, NULL, NULL);
+ weechat_hook_modifier ("irc_color_decode_ansi",
+ &irc_color_modifier_cb, NULL, NULL);
/* hook completions */
irc_completion_init ();
@@ -245,7 +260,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
}
irc_hook_timer = weechat_hook_timer (1 * 1000, 0, 0,
- &irc_server_timer_cb, NULL);
+ &irc_server_timer_cb,
+ NULL, NULL);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index 67f4471b3..a95259ff1 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -32,7 +32,6 @@ extern "C"
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
}
#include "weechat-js.h"
@@ -719,25 +718,27 @@ API_FUNC(list_free)
}
int
-weechat_js_api_config_reload_cb (void *data, struct t_config_file *config_file)
+weechat_js_api_config_reload_cb (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
@@ -777,31 +778,32 @@ API_FUNC(config_new)
}
int
-weechat_js_api_config_read_cb (void *data,
+weechat_js_api_config_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -822,28 +824,29 @@ weechat_js_api_config_read_cb (void *data,
}
int
-weechat_js_api_config_section_write_cb (void *data,
+weechat_js_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -862,28 +865,29 @@ weechat_js_api_config_section_write_cb (void *data,
}
int
-weechat_js_api_config_section_write_default_cb (void *data,
+weechat_js_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_WRITE_ERROR;
@@ -902,32 +906,33 @@ weechat_js_api_config_section_write_default_cb (void *data,
}
int
-weechat_js_api_config_section_create_option_cb (void *data,
+weechat_js_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -948,30 +953,31 @@ weechat_js_api_config_section_create_option_cb (void *data,
}
int
-weechat_js_api_config_section_delete_option_cb (void *data,
+weechat_js_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1060,28 +1066,29 @@ API_FUNC(config_search_section)
}
int
-weechat_js_api_config_option_check_value_cb (void *data,
+weechat_js_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = 0;
@@ -1100,26 +1107,27 @@ weechat_js_api_config_option_check_value_cb (void *data,
}
void
-weechat_js_api_config_option_change_cb (void *data,
+weechat_js_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (func_argv[1])
free (func_argv[1]);
@@ -1130,26 +1138,27 @@ weechat_js_api_config_option_change_cb (void *data,
}
void
-weechat_js_api_config_option_delete_cb (void *data,
+weechat_js_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (func_argv[1])
free (func_argv[1]);
@@ -1536,9 +1545,7 @@ API_FUNC(config_option_free)
v8::String::Utf8Value option(args[0]);
- plugin_script_api_config_option_free (
- weechat_js_plugin,
- js_current_script,
+ weechat_config_option_free (
(struct t_config_option *)API_STR2PTR(*option));
API_RETURN_OK;
@@ -1550,9 +1557,7 @@ API_FUNC(config_section_free_options)
v8::String::Utf8Value section(args[0]);
- plugin_script_api_config_section_free_options (
- weechat_js_plugin,
- js_current_script,
+ weechat_config_section_free_options (
(struct t_config_section *)API_STR2PTR(*section));
API_RETURN_OK;
@@ -1564,9 +1569,7 @@ API_FUNC(config_section_free)
v8::String::Utf8Value section(args[0]);
- plugin_script_api_config_section_free (
- weechat_js_plugin,
- js_current_script,
+ weechat_config_section_free (
(struct t_config_section *)API_STR2PTR(*section));
API_RETURN_OK;
@@ -1578,10 +1581,7 @@ API_FUNC(config_free)
v8::String::Utf8Value config_file(args[0]);
- plugin_script_api_config_free (
- weechat_js_plugin,
- js_current_script,
- (struct t_config_file *)API_STR2PTR(*config_file));
+ weechat_config_free ((struct t_config_file *)API_STR2PTR(*config_file));
API_RETURN_OK;
}
@@ -1809,30 +1809,32 @@ API_FUNC(log_print)
}
int
-weechat_js_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_js_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C++ compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -1880,27 +1882,29 @@ API_FUNC(hook_command)
}
int
-weechat_js_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_js_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -1941,28 +1945,30 @@ API_FUNC(hook_command_run)
}
int
-weechat_js_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_js_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2006,27 +2012,28 @@ API_FUNC(hook_timer)
}
int
-weechat_js_api_hook_fd_cb (void *data, int fd)
+weechat_js_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2072,30 +2079,31 @@ API_FUNC(hook_fd)
}
int
-weechat_js_api_hook_process_cb (void *data,
+weechat_js_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssiss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2172,36 +2180,38 @@ API_FUNC(hook_process_hashtable)
}
int
-weechat_js_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_js_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2255,28 +2265,31 @@ API_FUNC(hook_connect)
}
int
-weechat_js_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_js_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2287,11 +2300,10 @@ weechat_js_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssssiiss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssssiiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2341,20 +2353,23 @@ API_FUNC(hook_print)
}
int
-weechat_js_api_hook_signal_cb (void *data, const char *signal,
+weechat_js_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2379,11 +2394,10 @@ weechat_js_api_hook_signal_cb (void *data, const char *signal,
else
func_argv[2] = empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2460,27 +2474,29 @@ API_FUNC(hook_signal_send)
}
int
-weechat_js_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_js_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssh", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssh", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2541,27 +2557,28 @@ API_FUNC(hook_hsignal_send)
}
int
-weechat_js_api_hook_config_cb (void *data, const char *option,
- const char *value)
+weechat_js_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2600,29 +2617,31 @@ API_FUNC(hook_config)
}
int
-weechat_js_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_js_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -2703,27 +2722,29 @@ API_FUNC(hook_completion_list_add)
}
char *
-weechat_js_api_hook_modifier_cb (void *data, const char *modifier,
+weechat_js_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
const char *modifier_data, const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ return (char *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
}
return NULL;
@@ -2767,26 +2788,28 @@ API_FUNC(hook_modifier_exec)
}
const char *
-weechat_js_api_hook_info_cb (void *data, const char *info_name,
+weechat_js_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "sss", func_argv);
+ return (const char *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "sss", func_argv);
}
return NULL;
@@ -2819,26 +2842,29 @@ API_FUNC(hook_info)
}
struct t_hashtable *
-weechat_js_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_js_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_hashtable *ret_hashtable;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
ret_hashtable = (struct t_hashtable *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
+ script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
return ret_hashtable;
@@ -2876,27 +2902,30 @@ API_FUNC(hook_info_hashtable)
}
struct t_infolist *
-weechat_js_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_js_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
result = (struct t_infolist *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
+ script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (func_argv[2])
@@ -2937,25 +2966,27 @@ API_FUNC(hook_infolist)
}
struct t_hashtable *
-weechat_js_api_hook_focus_cb (void *data,
+weechat_js_api_hook_focus_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_hashtable *ret_hashtable;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
ret_hashtable = (struct t_hashtable *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
+ script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
+ ptr_function,
"sh", func_argv);
return ret_hashtable;
@@ -3005,9 +3036,7 @@ API_FUNC(unhook)
v8::String::Utf8Value hook(args[0]);
- plugin_script_api_unhook (weechat_js_plugin,
- js_current_script,
- (struct t_hook *)API_STR2PTR(*hook));
+ weechat_unhook ((struct t_hook *)API_STR2PTR(*hook));
API_RETURN_OK;
}
@@ -3018,33 +3047,35 @@ API_FUNC(unhook_all)
v8::String::Utf8Value hook(args[0]);
- plugin_script_api_unhook_all (weechat_js_plugin, js_current_script);
+ weechat_unhook_all_plugin (js_current_script->name);
API_RETURN_OK;
}
int
-weechat_js_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_js_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "sss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3064,25 +3095,27 @@ weechat_js_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_js_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_js_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3181,10 +3214,7 @@ API_FUNC(buffer_close)
v8::String::Utf8Value buffer(args[0]);
- plugin_script_api_buffer_close (
- weechat_js_plugin,
- js_current_script,
- (struct t_gui_buffer *)API_STR2PTR(*buffer));
+ weechat_buffer_close ((struct t_gui_buffer *)API_STR2PTR(*buffer));
API_RETURN_OK;
}
@@ -3689,33 +3719,35 @@ API_FUNC(bar_item_search)
}
char *
-weechat_js_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_js_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
- "ssssh", func_argv);
+ ret = (char *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function + 7,
+ "ssssh", func_argv);
if (func_argv[1])
free (func_argv[1]);
@@ -3727,15 +3759,14 @@ weechat_js_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "sss", func_argv);
+ ret = (char *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "sss", func_argv);
if (func_argv[1])
free (func_argv[1]);
@@ -3788,10 +3819,7 @@ API_FUNC(bar_item_remove)
v8::String::Utf8Value item(args[0]);
- plugin_script_api_bar_item_remove (
- weechat_js_plugin,
- js_current_script,
- (struct t_gui_bar_item *)API_STR2PTR(*item));
+ weechat_bar_item_remove ((struct t_gui_bar_item *)API_STR2PTR(*item));
API_RETURN_OK;
}
@@ -4567,66 +4595,34 @@ API_FUNC(hdata_get_string)
API_RETURN_STRING(result);
}
-API_FUNC(upgrade_new)
-{
- int write;
- char *result;
-
- API_INIT_FUNC(1, "upgrade_new", "si", API_RETURN_EMPTY);
-
- v8::String::Utf8Value filename(args[0]);
- write = args[1]->IntegerValue();
-
- result = API_PTR2STR(weechat_upgrade_new (*filename, write));
-
- API_RETURN_STRING_FREE(result);
-}
-
-API_FUNC(upgrade_write_object)
-{
- int object_id, rc;
-
- API_INIT_FUNC(1, "upgrade_write_object", "sis", API_RETURN_INT(0));
-
- v8::String::Utf8Value upgrade_file(args[0]);
- object_id = args[1]->IntegerValue();
- v8::String::Utf8Value infolist(args[2]);
-
- rc = weechat_upgrade_write_object (
- (struct t_upgrade_file *)API_STR2PTR(*upgrade_file),
- object_id,
- (struct t_infolist *)API_STR2PTR(*infolist));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_js_api_upgrade_read_cb (void *data,
+weechat_js_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *)weechat_js_exec (
- (struct t_plugin_script *)script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssss", func_argv);
+ rc = (int *)weechat_js_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -4646,23 +4642,56 @@ weechat_js_api_upgrade_read_cb (void *data,
return WEECHAT_RC_ERROR;
}
+API_FUNC(upgrade_new)
+{
+ char *result;
+
+ API_INIT_FUNC(1, "upgrade_new", "sss", API_RETURN_EMPTY);
+
+ v8::String::Utf8Value filename(args[0]);
+ v8::String::Utf8Value function(args[0]);
+ v8::String::Utf8Value data(args[0]);
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_js_plugin,
+ js_current_script,
+ *filename,
+ &weechat_js_api_upgrade_read_cb,
+ *function,
+ *data));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+API_FUNC(upgrade_write_object)
+{
+ int object_id, rc;
+
+ API_INIT_FUNC(1, "upgrade_write_object", "sis", API_RETURN_INT(0));
+
+ v8::String::Utf8Value upgrade_file(args[0]);
+ object_id = args[1]->IntegerValue();
+ v8::String::Utf8Value infolist(args[2]);
+
+ rc = weechat_upgrade_write_object (
+ (struct t_upgrade_file *)API_STR2PTR(*upgrade_file),
+ object_id,
+ (struct t_infolist *)API_STR2PTR(*infolist));
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(upgrade_read)
{
int rc;
- API_INIT_FUNC(1, "upgrade_read", "sss", API_RETURN_INT(0));
+ API_INIT_FUNC(1, "upgrade_read", "s", API_RETURN_INT(0));
v8::String::Utf8Value upgrade_file(args[0]);
- v8::String::Utf8Value function(args[1]);
- v8::String::Utf8Value data(args[2]);
- rc = plugin_script_api_upgrade_read (
- weechat_js_plugin,
- js_current_script,
- (struct t_upgrade_file *)API_STR2PTR(*upgrade_file),
- &weechat_js_api_upgrade_read_cb,
- *function,
- *data);
+ rc = weechat_upgrade_read (
+ (struct t_upgrade_file *)API_STR2PTR(*upgrade_file));
API_RETURN_INT(rc);
}
diff --git a/src/plugins/javascript/weechat-js-api.h b/src/plugins/javascript/weechat-js-api.h
index 199296234..61e240362 100644
--- a/src/plugins/javascript/weechat-js-api.h
+++ b/src/plugins/javascript/weechat-js-api.h
@@ -21,10 +21,12 @@
#ifndef WEECHAT_JS_API_H
#define WEECHAT_JS_API_H 1
-extern int weechat_js_api_buffer_input_data_cb (void *data,
+extern int weechat_js_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_js_api_buffer_close_cb (void *data,
+extern int weechat_js_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
#endif /* WEECHAT_JS_API_H */
diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp
index 927f76cb8..904d75b7a 100644
--- a/src/plugins/javascript/weechat-js.cpp
+++ b/src/plugins/javascript/weechat-js.cpp
@@ -516,12 +516,14 @@ weechat_js_reload_name (const char *name)
*/
int
-weechat_js_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_js_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -615,11 +617,13 @@ weechat_js_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_js_completion_cb (void *data, const char *completion_item,
+weechat_js_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -634,9 +638,11 @@ weechat_js_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_js_hdata_cb (void *data, const char *hdata_name)
+weechat_js_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -649,10 +655,12 @@ weechat_js_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_js_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_js_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -661,7 +669,7 @@ weechat_js_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "javascript_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_js_plugin,
- js_scripts, pointer,
+ js_scripts, obj_pointer,
arguments);
}
@@ -673,10 +681,12 @@ weechat_js_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_js_signal_debug_dump_cb (void *data, const char *signal,
+weechat_js_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -695,10 +705,12 @@ weechat_js_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_js_signal_debug_libs_cb (void *data, const char *signal,
+weechat_js_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -711,40 +723,20 @@ weechat_js_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_js_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
-{
- /* make C++ compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- {
- plugin_script_remove_buffer_callbacks (js_scripts,
- (struct t_gui_buffer *)signal_data);
- }
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_js_timer_action_cb (void *data, int remaining_calls)
+weechat_js_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C++ compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &js_action_install_list)
+ if (pointer == &js_action_install_list)
{
plugin_script_action_install (weechat_js_plugin,
js_scripts,
@@ -753,7 +745,7 @@ weechat_js_timer_action_cb (void *data, int remaining_calls)
&js_quiet,
&js_action_install_list);
}
- else if (data == &js_action_remove_list)
+ else if (pointer == &js_action_remove_list)
{
plugin_script_action_remove (weechat_js_plugin,
js_scripts,
@@ -761,7 +753,7 @@ weechat_js_timer_action_cb (void *data, int remaining_calls)
&js_quiet,
&js_action_remove_list);
}
- else if (data == &js_action_autoload_list)
+ else if (pointer == &js_action_autoload_list)
{
plugin_script_action_autoload (weechat_js_plugin,
&js_quiet,
@@ -778,11 +770,13 @@ weechat_js_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_js_signal_script_action_cb (void *data, const char *signal,
+weechat_js_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C++ compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -793,7 +787,7 @@ weechat_js_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_js_timer_action_cb,
- &js_action_install_list);
+ &js_action_install_list, NULL);
}
else if (strcmp (signal, "javascript_script_remove") == 0)
{
@@ -801,7 +795,7 @@ weechat_js_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_js_timer_action_cb,
- &js_action_remove_list);
+ &js_action_remove_list, NULL);
}
else if (strcmp (signal, "javascript_script_autoload") == 0)
{
@@ -809,7 +803,7 @@ weechat_js_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_js_timer_action_cb,
- &js_action_autoload_list);
+ &js_action_autoload_list, NULL);
}
}
@@ -833,7 +827,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_js_infolist_cb;
init.callback_signal_debug_dump = &weechat_js_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_js_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_js_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_js_signal_script_action_cb;
init.callback_load_file = &weechat_js_load_cb;
diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c
index f91f7887b..478201d15 100644
--- a/src/plugins/logger/logger-config.c
+++ b/src/plugins/logger/logger-config.c
@@ -62,10 +62,11 @@ struct t_config_option *logger_config_file_time_format;
*/
void
-logger_config_change_file_option_restart_log (void *data,
+logger_config_change_file_option_restart_log (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -78,10 +79,11 @@ logger_config_change_file_option_restart_log (void *data,
*/
void
-logger_config_flush_delay_change (void *data,
+logger_config_flush_delay_change (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -112,7 +114,7 @@ logger_config_flush_delay_change (void *data,
}
logger_timer = weechat_hook_timer (weechat_config_integer (logger_config_file_flush_delay) * 1000,
0, 0,
- &logger_timer_cb, NULL);
+ &logger_timer_cb, NULL, NULL);
}
}
@@ -121,10 +123,11 @@ logger_config_flush_delay_change (void *data,
*/
void
-logger_config_level_change (void *data,
+logger_config_level_change (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -137,12 +140,13 @@ logger_config_level_change (void *data,
*/
int
-logger_config_level_delete_option (void *data,
+logger_config_level_delete_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -159,7 +163,7 @@ logger_config_level_delete_option (void *data,
*/
int
-logger_config_level_create_option (void *data,
+logger_config_level_create_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -169,6 +173,7 @@ logger_config_level_create_option (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -196,9 +201,10 @@ logger_config_level_create_option (void *data,
option_name, "integer",
_("logging level for this buffer (0 = logging disabled, "
"1 = a few messages (most important) .. 9 = all messages)"),
- NULL, 0, 9, "9", value, 0, NULL, NULL,
- &logger_config_level_change, NULL,
- NULL, NULL);
+ NULL, 0, 9, "9", value, 0,
+ NULL, NULL, NULL,
+ &logger_config_level_change, NULL, NULL,
+ NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -232,7 +238,7 @@ logger_config_get_level (const char *name)
int
logger_config_set_level (const char *name, const char *value)
{
- return logger_config_level_create_option (NULL,
+ return logger_config_level_create_option (NULL, NULL,
logger_config_file,
logger_config_section_level,
name,
@@ -244,10 +250,11 @@ logger_config_set_level (const char *name, const char *value)
*/
void
-logger_config_mask_change (void *data,
+logger_config_mask_change (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -260,12 +267,13 @@ logger_config_mask_change (void *data,
*/
int
-logger_config_mask_delete_option (void *data,
+logger_config_mask_delete_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -282,7 +290,7 @@ logger_config_mask_delete_option (void *data,
*/
int
-logger_config_mask_create_option (void *data,
+logger_config_mask_create_option (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -292,6 +300,7 @@ logger_config_mask_create_option (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -319,9 +328,10 @@ logger_config_mask_create_option (void *data,
option_name, "string",
_("file mask for log file; local buffer variables are "
"permitted"),
- NULL, 0, 0, "", value, 0, NULL, NULL,
- &logger_config_mask_change, NULL,
- NULL, NULL);
+ NULL, 0, 0, "", value, 0,
+ NULL, NULL, NULL,
+ &logger_config_mask_change, NULL, NULL,
+ NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -362,16 +372,18 @@ logger_config_init ()
struct t_config_section *ptr_section;
logger_config_file = weechat_config_new (LOGGER_CONFIG_NAME,
- NULL, NULL);
+ NULL, NULL, NULL);
if (!logger_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (logger_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -383,14 +395,17 @@ logger_config_init ()
"backlog", "integer",
N_("maximum number of lines to display from log file when creating "
"new buffer (0 = no backlog)"),
- NULL, 0, INT_MAX, "20", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, INT_MAX, "20", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (logger_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -401,19 +416,23 @@ logger_config_init ()
logger_config_file, ptr_section,
"backlog_end", "color",
N_("color for line ending the backlog"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_color_backlog_line = weechat_config_new_option (
logger_config_file, ptr_section,
"backlog_line", "color",
N_("color for backlog lines"),
- NULL, -1, 0, "default", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, -1, 0, "default", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* file */
ptr_section = weechat_config_new_section (logger_config_file, "file",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -425,20 +444,24 @@ logger_config_init ()
"auto_log", "boolean",
N_("automatically save content of buffers to files (unless a buffer "
"disables log)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_flush_delay = weechat_config_new_option (
logger_config_file, ptr_section,
"flush_delay", "integer",
N_("number of seconds between flush of log files (0 = write in log "
"files immediately for each line printed)"),
- NULL, 0, 3600, "120", NULL, 0, NULL, NULL,
- &logger_config_flush_delay_change, NULL, NULL, NULL);
+ NULL, 0, 3600, "120", NULL, 0,
+ NULL, NULL, NULL,
+ &logger_config_flush_delay_change, NULL, NULL,
+ NULL, NULL, NULL);
logger_config_file_info_lines = weechat_config_new_option (
logger_config_file, ptr_section,
"info_lines", "boolean",
N_("write information line in log file when log starts or ends for a "
"buffer"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_mask = weechat_config_new_option (
logger_config_file, ptr_section,
"mask", "string",
@@ -449,24 +472,30 @@ logger_config_init ()
"that are defined on all buffers, so for example you should NOT "
"use $server nor $channel); date specifiers are permitted "
"(see man strftime)"),
- NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, NULL, NULL,
- &logger_config_change_file_option_restart_log, NULL, NULL, NULL);
+ NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0,
+ NULL, NULL, NULL,
+ &logger_config_change_file_option_restart_log, NULL, NULL,
+ NULL, NULL, NULL);
logger_config_file_name_lower_case = weechat_config_new_option (
logger_config_file, ptr_section,
"name_lower_case", "boolean",
N_("use only lower case for log filenames"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- &logger_config_change_file_option_restart_log, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &logger_config_change_file_option_restart_log, NULL, NULL,
+ NULL, NULL, NULL);
logger_config_file_nick_prefix = weechat_config_new_option (
logger_config_file, ptr_section,
"nick_prefix", "string",
N_("text to write before nick in prefix of message, example: \"<\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_nick_suffix = weechat_config_new_option (
logger_config_file, ptr_section,
"nick_suffix", "string",
N_("text to write after nick in prefix of message, example: \">\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
logger_config_file_path = weechat_config_new_option (
logger_config_file, ptr_section,
"path", "string",
@@ -474,29 +503,36 @@ logger_config_init ()
"replaced by WeeChat home (\"~/.weechat\" by default); date "
"specifiers are permitted (see man strftime) "
"(note: content is evaluated, see /help eval)"),
- NULL, 0, 0, "%h/logs/", NULL, 0, NULL, NULL,
- &logger_config_change_file_option_restart_log, NULL, NULL, NULL);
+ NULL, 0, 0, "%h/logs/", NULL, 0,
+ NULL, NULL, NULL,
+ &logger_config_change_file_option_restart_log, NULL, NULL,
+ NULL, NULL, NULL);
logger_config_file_replacement_char = weechat_config_new_option (
logger_config_file, ptr_section,
"replacement_char", "string",
N_("replacement char for special chars in filename built with mask "
"(like directory delimiter)"),
- NULL, 0, 0, "_", NULL, 0, NULL, NULL,
- &logger_config_change_file_option_restart_log, NULL, NULL, NULL);
+ NULL, 0, 0, "_", NULL, 0,
+ NULL, NULL, NULL,
+ &logger_config_change_file_option_restart_log, NULL, NULL,
+ NULL, NULL, NULL);
logger_config_file_time_format = weechat_config_new_option (
logger_config_file, ptr_section,
"time_format", "string",
N_("timestamp used in log files (see man strftime for date/time "
"specifiers)"),
- NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* level */
- ptr_section = weechat_config_new_section (logger_config_file, "level",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &logger_config_level_create_option, NULL,
- &logger_config_level_delete_option, NULL);
+ ptr_section = weechat_config_new_section (
+ logger_config_file, "level",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &logger_config_level_create_option, NULL, NULL,
+ &logger_config_level_delete_option, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -506,12 +542,14 @@ logger_config_init ()
logger_config_section_level = ptr_section;
/* mask */
- ptr_section = weechat_config_new_section (logger_config_file, "mask",
- 1, 1,
- NULL, NULL, NULL, NULL,
- NULL, NULL,
- &logger_config_mask_create_option, NULL,
- &logger_config_mask_delete_option, NULL);
+ ptr_section = weechat_config_new_section (
+ logger_config_file, "mask",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &logger_config_mask_create_option, NULL, NULL,
+ &logger_config_mask_delete_option, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (logger_config_file);
@@ -536,7 +574,7 @@ logger_config_read ()
rc = weechat_config_read (logger_config_file);
logger_config_loading = 0;
- logger_config_flush_delay_change (NULL, NULL);
+ logger_config_flush_delay_change (NULL, NULL, NULL);
return rc;
}
diff --git a/src/plugins/logger/logger-info.c b/src/plugins/logger/logger-info.c
index dd0f3ae60..4eb0a0202 100644
--- a/src/plugins/logger/logger-info.c
+++ b/src/plugins/logger/logger-info.c
@@ -32,28 +32,31 @@
*/
struct t_infolist *
-logger_info_infolist_logger_buffer_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+logger_info_infolist_logger_buffer_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer,
+ const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_logger_buffer *ptr_logger_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (pointer && !logger_buffer_valid (pointer))
+ if (obj_pointer && !logger_buffer_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one logger buffer */
- if (!logger_buffer_add_to_infolist (ptr_infolist, pointer))
+ if (!logger_buffer_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -90,5 +93,5 @@ logger_info_init ()
"logger_buffer", N_("list of logger buffers"),
N_("logger pointer (optional)"),
NULL,
- &logger_info_infolist_logger_buffer_cb, NULL);
+ &logger_info_infolist_logger_buffer_cb, NULL, NULL);
}
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index 8b698470a..71378c1e3 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -856,10 +856,12 @@ logger_flush ()
*/
int
-logger_command_cb (void *data, struct t_gui_buffer *buffer,
+logger_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argv_eol;
@@ -897,10 +899,12 @@ logger_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-logger_buffer_opened_signal_cb (void *data, const char *signal,
+logger_buffer_opened_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -915,10 +919,12 @@ logger_buffer_opened_signal_cb (void *data, const char *signal,
*/
int
-logger_buffer_closing_signal_cb (void *data, const char *signal,
+logger_buffer_closing_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -933,10 +939,12 @@ logger_buffer_closing_signal_cb (void *data, const char *signal,
*/
int
-logger_buffer_renamed_signal_cb (void *data, const char *signal,
+logger_buffer_renamed_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1035,12 +1043,14 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines)
*/
int
-logger_backlog_signal_cb (void *data, const char *signal,
+logger_backlog_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1074,10 +1084,12 @@ logger_backlog_signal_cb (void *data, const char *signal,
*/
int
-logger_start_signal_cb (void *data, const char *signal, const char *type_data,
+logger_start_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1092,12 +1104,14 @@ logger_start_signal_cb (void *data, const char *signal, const char *type_data,
*/
int
-logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
+logger_stop_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1158,10 +1172,12 @@ logger_adjust_log_filenames ()
*/
int
-logger_day_changed_signal_cb (void *data, const char *signal,
+logger_day_changed_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1226,7 +1242,8 @@ logger_get_line_tag_info (int tags_count, const char **tags,
*/
int
-logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
+logger_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
@@ -1237,6 +1254,7 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
int line_log_level, prefix_is_nick;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) displayed;
(void) highlight;
@@ -1278,9 +1296,10 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
*/
int
-logger_timer_cb (void *data, int remaining_calls)
+logger_timer_cb (const void *pointer, void *data, int remaining_calls)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) remaining_calls;
@@ -1347,19 +1366,26 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
" || set 1|2|3|4|5|6|7|8|9"
" || flush"
" || disable",
- &logger_command_cb, NULL);
+ &logger_command_cb, NULL, NULL);
logger_start_buffer_all (1);
- weechat_hook_signal ("buffer_opened", &logger_buffer_opened_signal_cb, NULL);
- weechat_hook_signal ("buffer_closing", &logger_buffer_closing_signal_cb, NULL);
- weechat_hook_signal ("buffer_renamed", &logger_buffer_renamed_signal_cb, NULL);
- weechat_hook_signal ("logger_backlog", &logger_backlog_signal_cb, NULL);
- weechat_hook_signal ("logger_start", &logger_start_signal_cb, NULL);
- weechat_hook_signal ("logger_stop", &logger_stop_signal_cb, NULL);
- weechat_hook_signal ("day_changed", &logger_day_changed_signal_cb, NULL);
-
- weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL);
+ weechat_hook_signal ("buffer_opened",
+ &logger_buffer_opened_signal_cb, NULL, NULL);
+ weechat_hook_signal ("buffer_closing",
+ &logger_buffer_closing_signal_cb, NULL, NULL);
+ weechat_hook_signal ("buffer_renamed",
+ &logger_buffer_renamed_signal_cb, NULL, NULL);
+ weechat_hook_signal ("logger_backlog",
+ &logger_backlog_signal_cb, NULL, NULL);
+ weechat_hook_signal ("logger_start",
+ &logger_start_signal_cb, NULL, NULL);
+ weechat_hook_signal ("logger_stop",
+ &logger_stop_signal_cb, NULL, NULL);
+ weechat_hook_signal ("day_changed",
+ &logger_day_changed_signal_cb, NULL, NULL);
+
+ weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL, NULL);
logger_info_init ();
diff --git a/src/plugins/logger/logger.h b/src/plugins/logger/logger.h
index df3e0d8e0..195f7d8da 100644
--- a/src/plugins/logger/logger.h
+++ b/src/plugins/logger/logger.h
@@ -32,6 +32,7 @@ extern struct t_hook *logger_timer;
extern void logger_start_buffer_all (int write_info_line);
extern void logger_stop_all (int write_info_line);
extern void logger_adjust_log_filenames ();
-extern int logger_timer_cb (void *data, int remaining_calls);
+extern int logger_timer_cb (const void *pointer, void *data,
+ int remaining_calls);
#endif /* WEECHAT_LOGGER_H */
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index ac9ad7397..1900aed0b 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -33,7 +33,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-lua.h"
@@ -782,24 +781,26 @@ API_FUNC(list_free)
}
int
-weechat_lua_api_config_reload_cb (void *data,
+weechat_lua_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -842,29 +843,31 @@ API_FUNC(config_new)
}
int
-weechat_lua_api_config_read_cb (void *data,
+weechat_lua_api_config_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -886,26 +889,28 @@ weechat_lua_api_config_read_cb (void *data,
}
int
-weechat_lua_api_config_section_write_cb (void *data,
+weechat_lua_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -925,26 +930,28 @@ weechat_lua_api_config_section_write_cb (void *data,
}
int
-weechat_lua_api_config_section_write_default_cb (void *data,
+weechat_lua_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -964,30 +971,32 @@ weechat_lua_api_config_section_write_default_cb (void *data,
}
int
-weechat_lua_api_config_section_create_option_cb (void *data,
+weechat_lua_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -1009,28 +1018,30 @@ weechat_lua_api_config_section_create_option_cb (void *data,
}
int
-weechat_lua_api_config_section_delete_option_cb (void *data,
+weechat_lua_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1082,27 +1093,29 @@ API_FUNC(config_new_section)
function_delete_option = lua_tostring (L, -2);
data_delete_option = lua_tostring (L, -1);
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(config_file),
- name,
- user_can_add_options,
- user_can_delete_options,
- &weechat_lua_api_config_read_cb,
- function_read,
- data_read,
- &weechat_lua_api_config_section_write_cb,
- function_write,
- data_write,
- &weechat_lua_api_config_section_write_default_cb,
- function_write_default,
- data_write_default,
- &weechat_lua_api_config_section_create_option_cb,
- function_create_option,
- data_create_option,
- &weechat_lua_api_config_section_delete_option_cb,
- function_delete_option,
- data_delete_option));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_lua_plugin,
+ lua_current_script,
+ API_STR2PTR(config_file),
+ name,
+ user_can_add_options,
+ user_can_delete_options,
+ &weechat_lua_api_config_read_cb,
+ function_read,
+ data_read,
+ &weechat_lua_api_config_section_write_cb,
+ function_write,
+ data_write,
+ &weechat_lua_api_config_section_write_default_cb,
+ function_write_default,
+ data_write_default,
+ &weechat_lua_api_config_section_create_option_cb,
+ function_create_option,
+ data_create_option,
+ &weechat_lua_api_config_section_delete_option_cb,
+ function_delete_option,
+ data_delete_option));
API_RETURN_STRING_FREE(result);
}
@@ -1126,26 +1139,28 @@ API_FUNC(config_search_section)
}
int
-weechat_lua_api_config_option_check_value_cb (void *data,
+weechat_lua_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1165,24 +1180,26 @@ weechat_lua_api_config_option_check_value_cb (void *data,
}
void
-weechat_lua_api_config_option_change_cb (void *data,
+weechat_lua_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1194,24 +1211,26 @@ weechat_lua_api_config_option_change_cb (void *data,
}
void
-weechat_lua_api_config_option_delete_cb (void *data,
+weechat_lua_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1655,9 +1674,7 @@ API_FUNC(config_option_free)
option = lua_tostring (L, -1);
- plugin_script_api_config_option_free (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(option));
+ weechat_config_option_free (API_STR2PTR(option));
API_RETURN_OK;
}
@@ -1672,9 +1689,7 @@ API_FUNC(config_section_free_options)
section = lua_tostring (L, -1);
- plugin_script_api_config_section_free_options (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(section));
+ weechat_config_section_free_options (API_STR2PTR(section));
API_RETURN_OK;
}
@@ -1689,9 +1704,7 @@ API_FUNC(config_section_free)
section = lua_tostring (L, -1);
- plugin_script_api_config_section_free (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(section));
+ weechat_config_section_free (API_STR2PTR(section));
API_RETURN_OK;
}
@@ -1706,9 +1719,7 @@ API_FUNC(config_free)
config_file = lua_tostring (L, -1);
- plugin_script_api_config_free (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(config_file));
+ weechat_config_free (API_STR2PTR(config_file));
API_RETURN_OK;
}
@@ -1975,28 +1986,31 @@ API_FUNC(log_print)
}
int
-weechat_lua_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_lua_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2048,25 +2062,28 @@ API_FUNC(hook_command)
}
int
-weechat_lua_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_lua_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2109,26 +2126,29 @@ API_FUNC(hook_command_run)
}
int
-weechat_lua_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_lua_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2174,25 +2194,27 @@ API_FUNC(hook_timer)
}
int
-weechat_lua_api_hook_fd_cb (void *data, int fd)
+weechat_lua_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2240,28 +2262,30 @@ API_FUNC(hook_fd)
}
int
-weechat_lua_api_hook_process_cb (void *data,
+weechat_lua_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssiss", func_argv);
if (!rc)
@@ -2340,34 +2364,37 @@ API_FUNC(hook_process_hashtable)
}
int
-weechat_lua_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_lua_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2423,28 +2450,31 @@ API_FUNC(hook_connect)
}
int
-weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_lua_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2455,9 +2485,9 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssiiss", func_argv);
if (!rc)
@@ -2509,20 +2539,23 @@ API_FUNC(hook_print)
}
int
-weechat_lua_api_hook_signal_cb (void *data, const char *signal,
+weechat_lua_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2547,9 +2580,9 @@ weechat_lua_api_hook_signal_cb (void *data, const char *signal,
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2629,25 +2662,28 @@ API_FUNC(hook_signal_send)
}
int
-weechat_lua_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_lua_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
if (!rc)
@@ -2712,25 +2748,27 @@ API_FUNC(hook_hsignal_send)
}
int
-weechat_lua_api_hook_config_cb (void *data, const char *option,
- const char *value)
+weechat_lua_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2771,27 +2809,30 @@ API_FUNC(hook_config)
}
int
-weechat_lua_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_lua_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -2877,26 +2918,29 @@ API_FUNC(hook_completion_list_add)
}
char *
-weechat_lua_api_hook_modifier_cb (void *data, const char *modifier,
+weechat_lua_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
const char *modifier_data,
const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_lua_exec (script_callback->script,
+ return (char *)weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -2945,24 +2989,27 @@ API_FUNC(hook_modifier_exec)
}
const char *
-weechat_lua_api_hook_info_cb (void *data, const char *info_name,
+weechat_lua_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_lua_exec (script_callback->script,
+ return (const char *)weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -2997,25 +3044,29 @@ API_FUNC(hook_info)
}
struct t_hashtable *
-weechat_lua_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_lua_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
- return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "ssh", func_argv);
+ return (struct t_hashtable *)weechat_lua_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "ssh", func_argv);
}
return NULL;
@@ -3052,27 +3103,31 @@ API_FUNC(hook_info_hashtable)
}
struct t_infolist *
-weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
- void *pointer, const char *arguments)
+weechat_lua_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *info_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_lua_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_lua_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -3114,24 +3169,27 @@ API_FUNC(hook_infolist)
}
struct t_hashtable *
-weechat_lua_api_hook_focus_cb (void *data,
+weechat_lua_api_hook_focus_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
- return (struct t_hashtable *)weechat_lua_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", func_argv);
+ return (struct t_hashtable *)weechat_lua_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "sh", func_argv);
}
return NULL;
@@ -3187,9 +3245,7 @@ API_FUNC(unhook)
hook = lua_tostring (L, -1);
- plugin_script_api_unhook (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(hook));
+ weechat_unhook (API_STR2PTR(hook));
API_RETURN_OK;
}
@@ -3198,31 +3254,34 @@ API_FUNC(unhook_all)
{
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_lua_plugin, lua_current_script);
+ weechat_unhook_all_plugin (lua_current_script->name);
API_RETURN_OK;
}
int
-weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_lua_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -3242,23 +3301,26 @@ weechat_lua_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_lua_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -3370,9 +3432,7 @@ API_FUNC(buffer_close)
buffer = lua_tostring (L, -1);
- plugin_script_api_buffer_close (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(buffer));
+ weechat_buffer_close (API_STR2PTR(buffer));
API_RETURN_OK;
}
@@ -3931,31 +3991,34 @@ API_FUNC(bar_item_search)
}
char *
-weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_lua_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_lua_exec (script_callback->script,
+ ret = (char *)weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssh", func_argv);
if (func_argv[1])
@@ -3968,13 +4031,13 @@ weechat_lua_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_lua_exec (script_callback->script,
+ ret = (char *)weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -4037,9 +4100,7 @@ API_FUNC(bar_item_remove)
item = lua_tostring (L, -1);
- plugin_script_api_bar_item_remove (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(item));
+ weechat_bar_item_remove (API_STR2PTR(item));
API_RETURN_OK;
}
@@ -4887,69 +4948,33 @@ API_FUNC(hdata_get_string)
API_RETURN_STRING(result);
}
-API_FUNC(upgrade_new)
-{
- const char *filename;
- char *result;
- int write;
-
- API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- if (lua_gettop (L) < 2)
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- filename = lua_tostring (L, -2);
- write = lua_tonumber (L, -1);
-
- result = API_PTR2STR(weechat_upgrade_new (filename, write));
-
- API_RETURN_STRING_FREE(result);
-}
-
-API_FUNC(upgrade_write_object)
-{
- const char *upgrade_file, *infolist;
- int object_id, rc;
-
- API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
- if (lua_gettop (L) < 3)
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- upgrade_file = lua_tostring (L, -3);
- object_id = lua_tonumber (L, -2);
- infolist = lua_tostring (L, -1);
-
- rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
- object_id,
- API_STR2PTR(infolist));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_lua_api_upgrade_read_cb (void *data,
+weechat_lua_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *) weechat_lua_exec (script_callback->script,
+ rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -4970,25 +4995,63 @@ weechat_lua_api_upgrade_read_cb (void *data,
return WEECHAT_RC_ERROR;
}
+API_FUNC(upgrade_new)
+{
+ const char *filename, *function, *data;
+ char *result;
+
+ API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ if (lua_gettop (L) < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ filename = lua_tostring (L, -3);
+ function = lua_tostring (L, -2);
+ data = lua_tostring (L, -1);
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_lua_plugin,
+ lua_current_script,
+ filename,
+ &weechat_lua_api_upgrade_read_cb,
+ function,
+ data));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+API_FUNC(upgrade_write_object)
+{
+ const char *upgrade_file, *infolist;
+ int object_id, rc;
+
+ API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ if (lua_gettop (L) < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ upgrade_file = lua_tostring (L, -3);
+ object_id = lua_tonumber (L, -2);
+ infolist = lua_tostring (L, -1);
+
+ rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
+ object_id,
+ API_STR2PTR(infolist));
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(upgrade_read)
{
- const char *upgrade_file, *function, *data;
+ const char *upgrade_file;
int rc;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
- if (lua_gettop (L) < 3)
+ if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
- upgrade_file = lua_tostring (L, -3);
- function = lua_tostring (L, -2);
- data = lua_tostring (L, -1);
+ upgrade_file = lua_tostring (L, -1);
- rc = plugin_script_api_upgrade_read (weechat_lua_plugin,
- lua_current_script,
- API_STR2PTR(upgrade_file),
- &weechat_lua_api_upgrade_read_cb,
- function,
- data);
+ rc = weechat_upgrade_read (API_STR2PTR(upgrade_file));
API_RETURN_INT(rc);
}
diff --git a/src/plugins/lua/weechat-lua-api.h b/src/plugins/lua/weechat-lua-api.h
index 3227967dd..5143a5041 100644
--- a/src/plugins/lua/weechat-lua-api.h
+++ b/src/plugins/lua/weechat-lua-api.h
@@ -24,10 +24,12 @@
extern struct luaL_Reg weechat_lua_api_funcs[];
extern struct t_lua_const weechat_lua_api_consts[];
-extern int weechat_lua_api_buffer_input_data_cb (void *data,
+extern int weechat_lua_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_lua_api_buffer_close_cb (void *data,
+extern int weechat_lua_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
#endif /* WEECHAT_LUA_API_H */
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index e20eaa912..321d69c83 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -606,12 +606,14 @@ weechat_lua_unload_all ()
*/
int
-weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_lua_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -707,11 +709,13 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_lua_completion_cb (void *data, const char *completion_item,
+weechat_lua_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -726,9 +730,11 @@ weechat_lua_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_lua_hdata_cb (void *data, const char *hdata_name)
+weechat_lua_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -741,10 +747,12 @@ weechat_lua_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_lua_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_lua_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -753,7 +761,7 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "lua_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_lua_plugin,
- lua_scripts, pointer,
+ lua_scripts, obj_pointer,
arguments);
}
@@ -765,10 +773,12 @@ weechat_lua_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_lua_signal_debug_dump_cb (void *data, const char *signal,
+weechat_lua_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -787,10 +797,12 @@ weechat_lua_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_lua_signal_debug_libs_cb (void *data, const char *signal,
+weechat_lua_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -806,37 +818,20 @@ weechat_lua_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_lua_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (lua_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_lua_timer_action_cb (void *data, int remaining_calls)
+weechat_lua_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &lua_action_install_list)
+ if (pointer == &lua_action_install_list)
{
plugin_script_action_install (weechat_lua_plugin,
lua_scripts,
@@ -845,7 +840,7 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
&lua_quiet,
&lua_action_install_list);
}
- else if (data == &lua_action_remove_list)
+ else if (pointer == &lua_action_remove_list)
{
plugin_script_action_remove (weechat_lua_plugin,
lua_scripts,
@@ -853,7 +848,7 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
&lua_quiet,
&lua_action_remove_list);
}
- else if (data == &lua_action_autoload_list)
+ else if (pointer == &lua_action_autoload_list)
{
plugin_script_action_autoload (weechat_lua_plugin,
&lua_quiet,
@@ -869,11 +864,13 @@ weechat_lua_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_lua_signal_script_action_cb (void *data, const char *signal,
+weechat_lua_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -884,7 +881,7 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_lua_timer_action_cb,
- &lua_action_install_list);
+ &lua_action_install_list, NULL);
}
else if (strcmp (signal, "lua_script_remove") == 0)
{
@@ -892,7 +889,7 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_lua_timer_action_cb,
- &lua_action_remove_list);
+ &lua_action_remove_list, NULL);
}
else if (strcmp (signal, "lua_script_autoload") == 0)
{
@@ -900,7 +897,7 @@ weechat_lua_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_lua_timer_action_cb,
- &lua_action_autoload_list);
+ &lua_action_autoload_list, NULL);
}
}
@@ -924,7 +921,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_lua_infolist_cb;
init.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_lua_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_lua_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_lua_signal_script_action_cb;
init.callback_load_file = &weechat_lua_load_cb;
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index c4cc5f303..ccfa4997b 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -31,7 +31,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-perl.h"
@@ -762,24 +761,26 @@ API_FUNC(list_free)
}
int
-weechat_perl_api_config_reload_cb (void *data,
+weechat_perl_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -822,30 +823,32 @@ API_FUNC(config_new)
}
int
-weechat_perl_api_config_section_read_cb (void *data,
+weechat_perl_api_config_section_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -867,26 +870,28 @@ weechat_perl_api_config_section_read_cb (void *data,
}
int
-weechat_perl_api_config_section_write_cb (void *data,
+weechat_perl_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -906,26 +911,28 @@ weechat_perl_api_config_section_write_cb (void *data,
}
int
-weechat_perl_api_config_section_write_default_cb (void *data,
+weechat_perl_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -945,30 +952,32 @@ weechat_perl_api_config_section_write_default_cb (void *data,
}
int
-weechat_perl_api_config_section_create_option_cb (void *data,
+weechat_perl_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -990,28 +999,30 @@ weechat_perl_api_config_section_create_option_cb (void *data,
}
int
-weechat_perl_api_config_section_delete_option_cb (void *data,
+weechat_perl_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1060,27 +1071,29 @@ API_FUNC(config_new_section)
function_delete_option = SvPV_nolen (ST (12));
data_delete_option = SvPV_nolen (ST (13));
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(cfg_file),
- name,
- SvIV (ST (2)), /* user_can_add_options */
- SvIV (ST (3)), /* user_can_delete_options */
- &weechat_perl_api_config_section_read_cb,
- function_read,
- data_read,
- &weechat_perl_api_config_section_write_cb,
- function_write,
- data_write,
- &weechat_perl_api_config_section_write_default_cb,
- function_write_default,
- data_write_default,
- &weechat_perl_api_config_section_create_option_cb,
- function_create_option,
- data_create_option,
- &weechat_perl_api_config_section_delete_option_cb,
- function_delete_option,
- data_delete_option));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_perl_plugin,
+ perl_current_script,
+ API_STR2PTR(cfg_file),
+ name,
+ SvIV (ST (2)), /* user_can_add_options */
+ SvIV (ST (3)), /* user_can_delete_options */
+ &weechat_perl_api_config_section_read_cb,
+ function_read,
+ data_read,
+ &weechat_perl_api_config_section_write_cb,
+ function_write,
+ data_write,
+ &weechat_perl_api_config_section_write_default_cb,
+ function_write_default,
+ data_write_default,
+ &weechat_perl_api_config_section_create_option_cb,
+ function_create_option,
+ data_create_option,
+ &weechat_perl_api_config_section_delete_option_cb,
+ function_delete_option,
+ data_delete_option));
API_RETURN_STRING_FREE(result);
}
@@ -1104,26 +1117,28 @@ API_FUNC(config_search_section)
}
int
-weechat_perl_api_config_option_check_value_cb (void *data,
+weechat_perl_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1143,24 +1158,26 @@ weechat_perl_api_config_option_check_value_cb (void *data,
}
void
-weechat_perl_api_config_option_change_cb (void *data,
+weechat_perl_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1172,24 +1189,26 @@ weechat_perl_api_config_option_change_cb (void *data,
}
void
-weechat_perl_api_config_option_delete_cb (void *data,
+weechat_perl_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1605,9 +1624,7 @@ API_FUNC(config_option_free)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_option_free (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* option */
+ weechat_config_option_free (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */
API_RETURN_OK;
}
@@ -1620,9 +1637,8 @@ API_FUNC(config_section_free_options)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free_options (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* section */
+ weechat_config_section_free_options (
+ API_STR2PTR(SvPV_nolen (ST (0)))); /* section */
API_RETURN_OK;
}
@@ -1635,9 +1651,8 @@ API_FUNC(config_section_free)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* section */
+ weechat_config_section_free (
+ API_STR2PTR(SvPV_nolen (ST (0)))); /* section */
API_RETURN_OK;
}
@@ -1650,9 +1665,7 @@ API_FUNC(config_free)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_free (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */
+ weechat_config_free (API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */
API_RETURN_OK;
}
@@ -1918,28 +1931,31 @@ API_FUNC(log_print)
}
int
-weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_perl_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1991,25 +2007,28 @@ API_FUNC(hook_command)
}
int
-weechat_perl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_perl_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2052,26 +2071,29 @@ API_FUNC(hook_command_run)
}
int
-weechat_perl_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_perl_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2110,25 +2132,27 @@ API_FUNC(hook_timer)
}
int
-weechat_perl_api_hook_fd_cb (void *data, int fd)
+weechat_perl_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2168,28 +2192,30 @@ API_FUNC(hook_fd)
}
int
-weechat_perl_api_hook_process_cb (void *data,
+weechat_perl_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssiss", func_argv);
if (!rc)
@@ -2264,34 +2290,37 @@ API_FUNC(hook_process_hashtable)
}
int
-weechat_perl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_perl_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2343,28 +2372,31 @@ API_FUNC(hook_connect)
}
int
-weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_perl_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2375,9 +2407,9 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssiiss", func_argv);
if (!rc)
@@ -2427,20 +2459,23 @@ API_FUNC(hook_print)
}
int
-weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
+weechat_perl_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2465,9 +2500,9 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2548,25 +2583,28 @@ API_FUNC(hook_signal_send)
}
int
-weechat_perl_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_perl_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
if (!rc)
@@ -2632,24 +2670,27 @@ API_FUNC(hook_hsignal_send)
}
int
-weechat_perl_api_hook_config_cb (void *data, const char *option, const char *value)
+weechat_perl_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2690,27 +2731,30 @@ API_FUNC(hook_config)
}
int
-weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_perl_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -2797,25 +2841,29 @@ API_FUNC(hook_completion_list_add)
}
char *
-weechat_perl_api_hook_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+weechat_perl_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_perl_exec (script_callback->script,
+ return (char *)weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -2864,24 +2912,27 @@ API_FUNC(hook_modifier_exec)
}
const char *
-weechat_perl_api_hook_info_cb (void *data, const char *info_name,
+weechat_perl_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_perl_exec (script_callback->script,
+ return (const char *)weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -2916,25 +2967,29 @@ API_FUNC(hook_info)
}
struct t_hashtable *
-weechat_perl_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_perl_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
- return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "ssh", func_argv);
+ return (struct t_hashtable *)weechat_perl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "ssh", func_argv);
}
return NULL;
@@ -2971,27 +3026,31 @@ API_FUNC(hook_info_hashtable)
}
struct t_infolist *
-weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_perl_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_perl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_perl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -3033,24 +3092,27 @@ API_FUNC(hook_infolist)
}
struct t_hashtable *
-weechat_perl_api_hook_focus_cb (void *data,
+weechat_perl_api_hook_focus_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
- return (struct t_hashtable *)weechat_perl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", func_argv);
+ return (struct t_hashtable *)weechat_perl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "sh", func_argv);
}
return NULL;
@@ -3105,9 +3167,7 @@ API_FUNC(unhook)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_unhook (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* hook */
+ weechat_unhook (API_STR2PTR(SvPV_nolen (ST (0)))); /* hook */
API_RETURN_OK;
}
@@ -3122,31 +3182,34 @@ API_FUNC(unhook_all)
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_perl_plugin, perl_current_script);
+ weechat_unhook_all_plugin (perl_current_script->name);
API_RETURN_OK;
}
int
-weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_perl_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3165,23 +3228,26 @@ weechat_perl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_perl_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3298,9 +3364,7 @@ API_FUNC(buffer_close)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_buffer_close (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* buffer */
+ weechat_buffer_close (API_STR2PTR(SvPV_nolen (ST (0)))); /* buffer */
API_RETURN_OK;
}
@@ -3860,31 +3924,34 @@ API_FUNC(bar_item_search)
}
char *
-weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_perl_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_perl_exec (script_callback->script,
+ ret = (char *)weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssh", func_argv);
if (func_argv[1])
@@ -3897,13 +3964,13 @@ weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_perl_exec (script_callback->script,
+ ret = (char *)weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -3962,9 +4029,7 @@ API_FUNC(bar_item_remove)
if (items < 1)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_bar_item_remove (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(SvPV_nolen (ST (0)))); /* item */
+ weechat_bar_item_remove (API_STR2PTR(SvPV_nolen (ST (0)))); /* item */
API_RETURN_OK;
}
@@ -4823,68 +4888,33 @@ API_FUNC(hdata_get_string)
API_RETURN_STRING(result);
}
-API_FUNC(upgrade_new)
-{
- char *result, *filename;
- dXSARGS;
-
- API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- if (items < 2)
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- filename = SvPV_nolen (ST (0));
-
- result = API_PTR2STR(weechat_upgrade_new (filename,
- SvIV (ST (1)))); /* write */
-
- API_RETURN_STRING_FREE(result);
-}
-
-API_FUNC(upgrade_write_object)
-{
- char *upgrade_file, *infolist;
- int rc;
- dXSARGS;
-
- API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
- if (items < 3)
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- upgrade_file = SvPV_nolen (ST (0));
- infolist = SvPV_nolen (ST (2));
-
- rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
- SvIV (ST (1)), /* object_id */
- API_STR2PTR(infolist));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_perl_api_upgrade_read_cb (void *data,
+weechat_perl_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *) weechat_perl_exec (script_callback->script,
+ rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -4905,26 +4935,64 @@ weechat_perl_api_upgrade_read_cb (void *data,
return WEECHAT_RC_ERROR;
}
+API_FUNC(upgrade_new)
+{
+ char *result, *filename, *function, *data;
+ dXSARGS;
+
+ API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ if (items < 3)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ filename = SvPV_nolen (ST (0));
+ function = SvPV_nolen (ST (1));
+ data = SvPV_nolen (ST (2));
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_perl_plugin,
+ perl_current_script,
+ filename,
+ &weechat_perl_api_upgrade_read_cb,
+ function,
+ data));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+API_FUNC(upgrade_write_object)
+{
+ char *upgrade_file, *infolist;
+ int rc;
+ dXSARGS;
+
+ API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ if (items < 3)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ upgrade_file = SvPV_nolen (ST (0));
+ infolist = SvPV_nolen (ST (2));
+
+ rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
+ SvIV (ST (1)), /* object_id */
+ API_STR2PTR(infolist));
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(upgrade_read)
{
- char *upgrade_file, *function, *data;
+ char *upgrade_file;
int rc;
dXSARGS;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
- if (items < 3)
+ if (items < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = SvPV_nolen (ST (0));
- function = SvPV_nolen (ST (1));
- data = SvPV_nolen (ST (2));
- rc = plugin_script_api_upgrade_read (weechat_perl_plugin,
- perl_current_script,
- API_STR2PTR(upgrade_file),
- &weechat_perl_api_upgrade_read_cb,
- function,
- data);
+ rc = weechat_upgrade_read (API_STR2PTR(upgrade_file));
API_RETURN_INT(rc);
}
diff --git a/src/plugins/perl/weechat-perl-api.h b/src/plugins/perl/weechat-perl-api.h
index 48d06f9d4..9d8a72c79 100644
--- a/src/plugins/perl/weechat-perl-api.h
+++ b/src/plugins/perl/weechat-perl-api.h
@@ -20,10 +20,12 @@
#ifndef WEECHAT_PERL_API_H
#define WEECHAT_PERL_API_H 1
-extern int weechat_perl_api_buffer_input_data_cb (void *data,
+extern int weechat_perl_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_perl_api_buffer_close_cb (void *data,
+extern int weechat_perl_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
extern void weechat_perl_api_init (pTHX);
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index 70182885b..2692df598 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -132,8 +132,7 @@ weechat_perl_hashtable_to_hash (struct t_hashtable *hashtable)
if (!hash)
return NULL;
- weechat_hashtable_map_string (hashtable,
- &weechat_perl_hashtable_map_cb,
+ weechat_hashtable_map_string (hashtable, &weechat_perl_hashtable_map_cb,
hash);
return hash;
@@ -638,12 +637,14 @@ weechat_perl_reload_name (const char *name)
*/
int
-weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_perl_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -739,11 +740,13 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_perl_completion_cb (void *data, const char *completion_item,
+weechat_perl_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -758,9 +761,11 @@ weechat_perl_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_perl_hdata_cb (void *data, const char *hdata_name)
+weechat_perl_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -773,10 +778,12 @@ weechat_perl_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_perl_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_perl_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -785,7 +792,7 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "perl_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_perl_plugin,
- perl_scripts, pointer,
+ perl_scripts, obj_pointer,
arguments);
}
@@ -797,10 +804,12 @@ weechat_perl_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_perl_signal_debug_dump_cb (void *data, const char *signal,
+weechat_perl_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -819,10 +828,12 @@ weechat_perl_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_perl_signal_debug_libs_cb (void *data, const char *signal,
+weechat_perl_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -838,37 +849,20 @@ weechat_perl_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_perl_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (perl_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_perl_timer_action_cb (void *data, int remaining_calls)
+weechat_perl_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &perl_action_install_list)
+ if (pointer == &perl_action_install_list)
{
plugin_script_action_install (weechat_perl_plugin,
perl_scripts,
@@ -877,7 +871,7 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
&perl_quiet,
&perl_action_install_list);
}
- else if (data == &perl_action_remove_list)
+ else if (pointer == &perl_action_remove_list)
{
plugin_script_action_remove (weechat_perl_plugin,
perl_scripts,
@@ -885,7 +879,7 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
&perl_quiet,
&perl_action_remove_list);
}
- else if (data == &perl_action_autoload_list)
+ else if (pointer == &perl_action_autoload_list)
{
plugin_script_action_autoload (weechat_perl_plugin,
&perl_quiet,
@@ -901,11 +895,13 @@ weechat_perl_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_perl_signal_script_action_cb (void *data, const char *signal,
+weechat_perl_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -916,7 +912,7 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_perl_timer_action_cb,
- &perl_action_install_list);
+ &perl_action_install_list, NULL);
}
else if (strcmp (signal, "perl_script_remove") == 0)
{
@@ -924,7 +920,7 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_perl_timer_action_cb,
- &perl_action_remove_list);
+ &perl_action_remove_list, NULL);
}
else if (strcmp (signal, "perl_script_autoload") == 0)
{
@@ -932,7 +928,7 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_perl_timer_action_cb,
- &perl_action_autoload_list);
+ &perl_action_autoload_list, NULL);
}
}
@@ -944,11 +940,13 @@ weechat_perl_signal_script_action_cb (void *data, const char *signal,
*/
int
-weechat_perl_signal_quit_upgrade_cb (void *data, const char *signal,
+weechat_perl_signal_quit_upgrade_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1002,7 +1000,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_perl_infolist_cb;
init.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_perl_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_perl_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_perl_signal_script_action_cb;
init.callback_load_file = &weechat_perl_load_cb;
@@ -1013,8 +1010,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
plugin_script_display_short_list (weechat_perl_plugin,
perl_scripts);
- weechat_hook_signal ("quit", &weechat_perl_signal_quit_upgrade_cb, NULL);
- weechat_hook_signal ("upgrade", &weechat_perl_signal_quit_upgrade_cb, NULL);
+ weechat_hook_signal ("quit",
+ &weechat_perl_signal_quit_upgrade_cb, NULL, NULL);
+ weechat_hook_signal ("upgrade",
+ &weechat_perl_signal_quit_upgrade_cb, NULL, NULL);
/* init OK */
return WEECHAT_RC_OK;
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 455e46041..4be88b077 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -285,12 +285,13 @@ plugin_api_command (struct t_weechat_plugin *plugin,
*/
char *
-plugin_api_modifier_color_decode_ansi_cb (void *data,
+plugin_api_modifier_color_decode_ansi_cb (const void *pointer, void *data,
const char *modifier,
const char *modifier_data,
const char *string)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) modifier;
@@ -305,10 +306,12 @@ plugin_api_modifier_color_decode_ansi_cb (void *data,
*/
const char *
-plugin_api_info_version_cb (void *data, const char *info_name,
+plugin_api_info_version_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -321,12 +324,14 @@ plugin_api_info_version_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_version_number_cb (void *data, const char *info_name,
+plugin_api_info_version_number_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char version_number[32] = { '\0' };
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -344,10 +349,12 @@ plugin_api_info_version_number_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_version_git_cb (void *data, const char *info_name,
+plugin_api_info_version_git_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -360,10 +367,12 @@ plugin_api_info_version_git_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_date_cb (void *data, const char *info_name,
+plugin_api_info_date_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -376,10 +385,12 @@ plugin_api_info_date_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_dir_separator_cb (void *data, const char *info_name,
+plugin_api_info_dir_separator_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -392,12 +403,14 @@ plugin_api_info_dir_separator_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_dir_cb (void *data, const char *info_name,
+plugin_api_info_weechat_dir_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char weechat_dir_absolute_path[PATH_MAX] = { '\0' };
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -416,10 +429,12 @@ plugin_api_info_weechat_dir_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_libdir_cb (void *data, const char *info_name,
+plugin_api_info_weechat_libdir_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -432,10 +447,12 @@ plugin_api_info_weechat_libdir_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_sharedir_cb (void *data, const char *info_name,
+plugin_api_info_weechat_sharedir_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -448,10 +465,12 @@ plugin_api_info_weechat_sharedir_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_localedir_cb (void *data, const char *info_name,
+plugin_api_info_weechat_localedir_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -464,10 +483,12 @@ plugin_api_info_weechat_localedir_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_site_cb (void *data, const char *info_name,
+plugin_api_info_weechat_site_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -480,10 +501,12 @@ plugin_api_info_weechat_site_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_site_download_cb (void *data, const char *info_name,
+plugin_api_info_weechat_site_download_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -496,12 +519,14 @@ plugin_api_info_weechat_site_download_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_weechat_upgrading_cb (void *data, const char *info_name,
+plugin_api_info_weechat_upgrading_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -515,10 +540,12 @@ plugin_api_info_weechat_upgrading_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_charset_terminal_cb (void *data, const char *info_name,
+plugin_api_info_charset_terminal_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -531,10 +558,12 @@ plugin_api_info_charset_terminal_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_charset_internal_cb (void *data, const char *info_name,
+plugin_api_info_charset_internal_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -547,10 +576,12 @@ plugin_api_info_charset_internal_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_locale_cb (void *data, const char *info_name,
+plugin_api_info_locale_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -563,13 +594,15 @@ plugin_api_info_locale_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_inactivity_cb (void *data, const char *info_name,
+plugin_api_info_inactivity_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
time_t inactivity;
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -587,12 +620,14 @@ plugin_api_info_inactivity_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_filters_enabled_cb (void *data, const char *info_name,
+plugin_api_info_filters_enabled_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -606,12 +641,14 @@ plugin_api_info_filters_enabled_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_cursor_mode_cb (void *data, const char *info_name,
+plugin_api_info_cursor_mode_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -625,12 +662,14 @@ plugin_api_info_cursor_mode_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_term_width_cb (void *data, const char *info_name,
+plugin_api_info_term_width_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -644,12 +683,14 @@ plugin_api_info_term_width_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_term_height_cb (void *data, const char *info_name,
+plugin_api_info_term_height_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -663,10 +704,12 @@ plugin_api_info_term_height_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_color_ansi_regex_cb (void *data, const char *info_name,
+plugin_api_info_color_ansi_regex_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
(void) arguments;
@@ -679,12 +722,14 @@ plugin_api_info_color_ansi_regex_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_color_term2rgb_cb (void *data, const char *info_name,
+plugin_api_info_color_term2rgb_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -702,7 +747,8 @@ plugin_api_info_color_term2rgb_cb (void *data, const char *info_name,
*/
const char *
-plugin_api_info_color_rgb2term_cb (void *data, const char *info_name,
+plugin_api_info_color_rgb2term_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char value[32];
@@ -710,6 +756,7 @@ plugin_api_info_color_rgb2term_cb (void *data, const char *info_name,
char *pos, *color;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -745,28 +792,30 @@ plugin_api_info_color_rgb2term_cb (void *data, const char *info_name,
*/
struct t_infolist *
-plugin_api_infolist_bar_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_bar_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_bar *ptr_bar;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid bar pointer ? */
- if (pointer && (!gui_bar_valid (pointer)))
+ if (obj_pointer && (!gui_bar_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one bar */
- if (!gui_bar_add_to_infolist (ptr_infolist, pointer))
+ if (!gui_bar_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -801,28 +850,30 @@ plugin_api_infolist_bar_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_bar_item_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_bar_item_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_bar_item *ptr_bar_item;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid bar item pointer ? */
- if (pointer && (!gui_bar_item_valid (pointer)))
+ if (obj_pointer && (!gui_bar_item_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one bar item */
- if (!gui_bar_item_add_to_infolist (ptr_infolist, pointer))
+ if (!gui_bar_item_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -858,8 +909,9 @@ plugin_api_infolist_bar_item_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_bar_window_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_bar_window_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_bar *ptr_bar;
@@ -867,22 +919,23 @@ plugin_api_infolist_bar_window_cb (void *data, const char *infolist_name,
struct t_gui_window *ptr_window;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
/* invalid bar window pointer ? */
- if (pointer && (!gui_bar_window_valid (pointer)))
+ if (obj_pointer && (!gui_bar_window_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one bar window */
- if (!gui_bar_window_add_to_infolist (ptr_infolist, pointer))
+ if (!gui_bar_window_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -930,28 +983,30 @@ plugin_api_infolist_bar_window_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_buffer_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_buffer_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid buffer pointer ? */
- if (pointer && (!gui_buffer_valid (pointer)))
+ if (obj_pointer && (!gui_buffer_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one buffer */
- if (!gui_buffer_add_to_infolist (ptr_infolist, pointer))
+ if (!gui_buffer_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -987,23 +1042,25 @@ plugin_api_infolist_buffer_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_buffer_lines_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_buffer_lines_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_line *ptr_line;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (!pointer)
- pointer = gui_buffers;
+ if (!obj_pointer)
+ obj_pointer = gui_buffers;
else
{
/* invalid buffer pointer ? */
- if (!gui_buffer_valid (pointer))
+ if (!gui_buffer_valid (obj_pointer))
return NULL;
}
@@ -1011,11 +1068,11 @@ plugin_api_infolist_buffer_lines_cb (void *data, const char *infolist_name,
if (!ptr_infolist)
return NULL;
- for (ptr_line = ((struct t_gui_buffer *)pointer)->own_lines->first_line;
+ for (ptr_line = ((struct t_gui_buffer *)obj_pointer)->own_lines->first_line;
ptr_line; ptr_line = ptr_line->next_line)
{
if (!gui_line_add_to_infolist (ptr_infolist,
- ((struct t_gui_buffer *)pointer)->own_lines,
+ ((struct t_gui_buffer *)obj_pointer)->own_lines,
ptr_line))
{
infolist_free (ptr_infolist);
@@ -1032,16 +1089,18 @@ plugin_api_infolist_buffer_lines_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_filter_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_filter_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_filter *ptr_filter;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
@@ -1070,27 +1129,29 @@ plugin_api_infolist_filter_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_history_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_history_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_history *ptr_history;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
/* invalid buffer pointer ? */
- if (pointer && (!gui_buffer_valid (pointer)))
+ if (obj_pointer && (!gui_buffer_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- for (ptr_history = (pointer) ?
- ((struct t_gui_buffer *)pointer)->history : gui_history;
+ for (ptr_history = (obj_pointer) ?
+ ((struct t_gui_buffer *)obj_pointer)->history : gui_history;
ptr_history; ptr_history = ptr_history->next_history)
{
if (!gui_history_add_to_infolist (ptr_infolist, ptr_history))
@@ -1109,24 +1170,26 @@ plugin_api_infolist_history_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_hook_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_hook_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid hook pointer ? */
- if (pointer && !hook_valid (pointer))
+ if (obj_pointer && !hook_valid (obj_pointer))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (!hook_add_to_infolist (ptr_infolist, pointer, arguments))
+ if (!hook_add_to_infolist (ptr_infolist, obj_pointer, arguments))
{
infolist_free (ptr_infolist);
return NULL;
@@ -1141,16 +1204,18 @@ plugin_api_infolist_hook_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_hotlist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_hotlist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_hotlist *ptr_hotlist;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
(void) arguments;
ptr_infolist = infolist_new (NULL);
@@ -1176,17 +1241,19 @@ plugin_api_infolist_hotlist_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_key_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_key_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_key *ptr_key;
int context;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
@@ -1218,16 +1285,18 @@ plugin_api_infolist_key_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_layout_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_layout_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_layout *ptr_layout;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
(void) arguments;
ptr_infolist = infolist_new (NULL);
@@ -1253,24 +1322,26 @@ plugin_api_infolist_layout_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_nicklist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_nicklist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid buffer pointer ? */
- if (!pointer || (!gui_buffer_valid (pointer)))
+ if (!obj_pointer || (!gui_buffer_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (!gui_nicklist_add_to_infolist (ptr_infolist, pointer, arguments))
+ if (!gui_nicklist_add_to_infolist (ptr_infolist, obj_pointer, arguments))
{
infolist_free (ptr_infolist);
return NULL;
@@ -1285,15 +1356,17 @@ plugin_api_infolist_nicklist_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_option_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_option_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
@@ -1314,28 +1387,30 @@ plugin_api_infolist_option_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_plugin_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_plugin_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_weechat_plugin *ptr_plugin;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid plugin pointer ? */
- if (pointer && (!plugin_valid (pointer)))
+ if (obj_pointer && (!plugin_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one plugin */
- if (!plugin_add_to_infolist (ptr_infolist, pointer))
+ if (!plugin_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -1371,28 +1446,30 @@ plugin_api_infolist_plugin_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_proxy_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_proxy_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_proxy *ptr_proxy;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid proxy pointer ? */
- if (pointer && (!proxy_valid (pointer)))
+ if (obj_pointer && (!proxy_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one proxy */
- if (!proxy_add_to_infolist (ptr_infolist, pointer))
+ if (!proxy_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -1428,16 +1505,18 @@ plugin_api_infolist_proxy_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_url_options_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_url_options_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- (void) pointer;
+ (void) obj_pointer;
(void) arguments;
ptr_infolist = infolist_new (NULL);
@@ -1462,8 +1541,9 @@ plugin_api_infolist_url_options_cb (void *data, const char *infolist_name,
*/
struct t_infolist *
-plugin_api_infolist_window_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+plugin_api_infolist_window_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_window *ptr_window;
@@ -1471,21 +1551,22 @@ plugin_api_infolist_window_cb (void *data, const char *infolist_name,
char *error;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
/* invalid window pointer ? */
- if (pointer && (!gui_window_valid (pointer)))
+ if (obj_pointer && (!gui_window_valid (obj_pointer)))
return NULL;
ptr_infolist = infolist_new (NULL);
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one window */
- if (!gui_window_add_to_infolist (ptr_infolist, pointer))
+ if (!gui_window_add_to_infolist (ptr_infolist, obj_pointer))
{
infolist_free (ptr_infolist);
return NULL;
@@ -1697,228 +1778,228 @@ plugin_api_init ()
{
/* WeeChat core modifiers */
hook_modifier (NULL, "color_decode_ansi",
- &plugin_api_modifier_color_decode_ansi_cb, NULL);
+ &plugin_api_modifier_color_decode_ansi_cb, NULL, NULL);
/* WeeChat core info hooks */
hook_info (NULL, "version",
N_("WeeChat version"),
- NULL, &plugin_api_info_version_cb, NULL);
+ NULL, &plugin_api_info_version_cb, NULL, NULL);
hook_info (NULL, "version_number",
N_("WeeChat version (as number)"),
- NULL, &plugin_api_info_version_number_cb, NULL);
+ NULL, &plugin_api_info_version_number_cb, NULL, NULL);
hook_info (NULL, "version_git",
N_("WeeChat git version (output of command \"git describe\" "
"for a development version only, empty for a stable "
"release)"),
- NULL, &plugin_api_info_version_git_cb, NULL);
+ NULL, &plugin_api_info_version_git_cb, NULL, NULL);
hook_info (NULL, "date",
N_("WeeChat compilation date"),
- NULL, &plugin_api_info_date_cb, NULL);
+ NULL, &plugin_api_info_date_cb, NULL, NULL);
hook_info (NULL, "dir_separator",
N_("directory separator"),
- NULL, &plugin_api_info_dir_separator_cb, NULL);
+ NULL, &plugin_api_info_dir_separator_cb, NULL, NULL);
hook_info (NULL, "weechat_dir",
N_("WeeChat directory"),
- NULL, &plugin_api_info_weechat_dir_cb, NULL);
+ NULL, &plugin_api_info_weechat_dir_cb, NULL, NULL);
hook_info (NULL, "weechat_libdir",
N_("WeeChat \"lib\" directory"),
- NULL, &plugin_api_info_weechat_libdir_cb, NULL);
+ NULL, &plugin_api_info_weechat_libdir_cb, NULL, NULL);
hook_info (NULL, "weechat_sharedir",
N_("WeeChat \"share\" directory"),
- NULL, &plugin_api_info_weechat_sharedir_cb, NULL);
+ NULL, &plugin_api_info_weechat_sharedir_cb, NULL, NULL);
hook_info (NULL, "weechat_localedir",
N_("WeeChat \"locale\" directory"),
- NULL, &plugin_api_info_weechat_localedir_cb, NULL);
+ NULL, &plugin_api_info_weechat_localedir_cb, NULL, NULL);
hook_info (NULL, "weechat_site",
N_("WeeChat site"),
- NULL, &plugin_api_info_weechat_site_cb, NULL);
+ NULL, &plugin_api_info_weechat_site_cb, NULL, NULL);
hook_info (NULL, "weechat_site_download",
N_("WeeChat site, download page"),
- NULL, &plugin_api_info_weechat_site_download_cb, NULL);
+ NULL, &plugin_api_info_weechat_site_download_cb, NULL, NULL);
hook_info (NULL, "weechat_upgrading",
N_("1 if WeeChat is upgrading (command `/upgrade`)"),
- NULL, &plugin_api_info_weechat_upgrading_cb, NULL);
+ NULL, &plugin_api_info_weechat_upgrading_cb, NULL, NULL);
hook_info (NULL, "charset_terminal",
N_("terminal charset"),
- NULL, &plugin_api_info_charset_terminal_cb, NULL);
+ NULL, &plugin_api_info_charset_terminal_cb, NULL, NULL);
hook_info (NULL, "charset_internal",
N_("WeeChat internal charset"),
- NULL, &plugin_api_info_charset_internal_cb, NULL);
+ NULL, &plugin_api_info_charset_internal_cb, NULL, NULL);
hook_info (NULL, "locale",
N_("locale used for translating messages"),
- NULL, &plugin_api_info_locale_cb, NULL);
+ NULL, &plugin_api_info_locale_cb, NULL, NULL);
hook_info (NULL, "inactivity",
N_("keyboard inactivity (seconds)"),
- NULL, &plugin_api_info_inactivity_cb, NULL);
+ NULL, &plugin_api_info_inactivity_cb, NULL, NULL);
hook_info (NULL, "filters_enabled",
N_("1 if filters are enabled"),
- NULL, &plugin_api_info_filters_enabled_cb, NULL);
+ NULL, &plugin_api_info_filters_enabled_cb, NULL, NULL);
hook_info (NULL, "cursor_mode",
N_("1 if cursor mode is enabled"),
- NULL, &plugin_api_info_cursor_mode_cb, NULL);
+ NULL, &plugin_api_info_cursor_mode_cb, NULL, NULL);
hook_info (NULL, "term_width",
N_("width of terminal"),
- NULL, &plugin_api_info_term_width_cb, NULL);
+ NULL, &plugin_api_info_term_width_cb, NULL, NULL);
hook_info (NULL, "term_height",
N_("height of terminal"),
- NULL, &plugin_api_info_term_height_cb, NULL);
+ NULL, &plugin_api_info_term_height_cb, NULL, NULL);
hook_info (NULL, "color_ansi_regex",
N_("POSIX extended regular expression to search ANSI escape "
"codes"),
- NULL, &plugin_api_info_color_ansi_regex_cb, NULL);
+ NULL, &plugin_api_info_color_ansi_regex_cb, NULL, NULL);
hook_info (NULL, "color_term2rgb",
N_("terminal color (0-255) converted to RGB color"),
N_("color (terminal color: 0-255)"),
- &plugin_api_info_color_term2rgb_cb, NULL);
+ &plugin_api_info_color_term2rgb_cb, NULL, NULL);
hook_info (NULL, "color_rgb2term",
N_("RGB color converted to terminal color (0-255)"),
N_("rgb,limit (limit is optional and is set to 256 by default)"),
- &plugin_api_info_color_rgb2term_cb, NULL);
+ &plugin_api_info_color_rgb2term_cb, NULL, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "bar",
N_("list of bars"),
N_("bar pointer (optional)"),
N_("bar name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_bar_cb, NULL);
+ &plugin_api_infolist_bar_cb, NULL, NULL);
hook_infolist (NULL, "bar_item",
N_("list of bar items"),
N_("bar item pointer (optional)"),
N_("bar item name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_bar_item_cb, NULL);
+ &plugin_api_infolist_bar_item_cb, NULL, NULL);
hook_infolist (NULL, "bar_window",
N_("list of bar windows"),
N_("bar window pointer (optional)"),
NULL,
- &plugin_api_infolist_bar_window_cb, NULL);
+ &plugin_api_infolist_bar_window_cb, NULL, NULL);
hook_infolist (NULL, "buffer",
N_("list of buffers"),
N_("buffer pointer (optional)"),
N_("buffer name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_buffer_cb, NULL);
+ &plugin_api_infolist_buffer_cb, NULL, NULL);
hook_infolist (NULL, "buffer_lines",
N_("lines of a buffer"),
N_("buffer pointer"),
NULL,
- &plugin_api_infolist_buffer_lines_cb, NULL);
+ &plugin_api_infolist_buffer_lines_cb, NULL, NULL);
hook_infolist (NULL, "filter",
N_("list of filters"),
NULL,
N_("filter name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_filter_cb, NULL);
+ &plugin_api_infolist_filter_cb, NULL, NULL);
hook_infolist (NULL, "history",
N_("history of commands"),
N_("buffer pointer (if not set, return global history) (optional)"),
NULL,
- &plugin_api_infolist_history_cb, NULL);
+ &plugin_api_infolist_history_cb, NULL, NULL);
hook_infolist (NULL, "hook",
N_("list of hooks"),
N_("hook pointer (optional)"),
N_("type,arguments (type is command/timer/.., arguments to "
"get only some hooks (wildcard \"*\" is allowed), "
"both are optional)"),
- &plugin_api_infolist_hook_cb, NULL);
+ &plugin_api_infolist_hook_cb, NULL, NULL);
hook_infolist (NULL, "hotlist",
N_("list of buffers in hotlist"),
NULL,
NULL,
- &plugin_api_infolist_hotlist_cb, NULL);
+ &plugin_api_infolist_hotlist_cb, NULL, NULL);
hook_infolist (NULL, "key",
N_("list of key bindings"),
NULL,
N_("context (\"default\", \"search\", \"cursor\" or "
"\"mouse\") (optional)"),
- &plugin_api_infolist_key_cb, NULL);
+ &plugin_api_infolist_key_cb, NULL, NULL);
hook_infolist (NULL, "layout",
N_("list of layouts"),
NULL,
NULL,
- &plugin_api_infolist_layout_cb, NULL);
+ &plugin_api_infolist_layout_cb, NULL, NULL);
hook_infolist (NULL, "nicklist",
N_("nicks in nicklist for a buffer"),
N_("buffer pointer"),
N_("nick_xxx or group_xxx to get only nick/group xxx "
"(optional)"),
- &plugin_api_infolist_nicklist_cb, NULL);
+ &plugin_api_infolist_nicklist_cb, NULL, NULL);
hook_infolist (NULL, "option",
N_("list of options"),
NULL,
N_("option name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_option_cb, NULL);
+ &plugin_api_infolist_option_cb, NULL, NULL);
hook_infolist (NULL, "plugin",
N_("list of plugins"),
N_("plugin pointer (optional)"),
N_("plugin name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_plugin_cb, NULL);
+ &plugin_api_infolist_plugin_cb, NULL, NULL);
hook_infolist (NULL, "proxy",
N_("list of proxies"),
N_("proxy pointer (optional)"),
N_("proxy name (wildcard \"*\" is allowed) (optional)"),
- &plugin_api_infolist_proxy_cb, NULL);
+ &plugin_api_infolist_proxy_cb, NULL, NULL);
hook_infolist (NULL, "url_options",
N_("options for URL"),
NULL,
NULL,
- &plugin_api_infolist_url_options_cb, NULL);
+ &plugin_api_infolist_url_options_cb, NULL, NULL);
hook_infolist (NULL, "window",
N_("list of windows"),
N_("window pointer (optional)"),
N_("\"current\" for current window or a window number (optional)"),
- &plugin_api_infolist_window_cb, NULL);
+ &plugin_api_infolist_window_cb, NULL, NULL);
/* WeeChat core hdata */
hook_hdata (NULL, "bar", N_("bar"),
- &gui_bar_hdata_bar_cb, NULL);
+ &gui_bar_hdata_bar_cb, NULL, NULL);
hook_hdata (NULL, "bar_item", N_("bar item"),
- &gui_bar_item_hdata_bar_item_cb, NULL);
+ &gui_bar_item_hdata_bar_item_cb, NULL, NULL);
hook_hdata (NULL, "bar_window", N_("bar window"),
- &gui_bar_window_hdata_bar_window_cb, NULL);
+ &gui_bar_window_hdata_bar_window_cb, NULL, NULL);
hook_hdata (NULL, "buffer", N_("buffer"),
- &gui_buffer_hdata_buffer_cb, NULL);
+ &gui_buffer_hdata_buffer_cb, NULL, NULL);
hook_hdata (NULL, "buffer_visited", N_("visited buffer"),
- &gui_buffer_hdata_buffer_visited_cb, NULL);
+ &gui_buffer_hdata_buffer_visited_cb, NULL, NULL);
hook_hdata (NULL, "completion", N_("structure with completion"),
- &gui_completion_hdata_completion_cb, NULL);
+ &gui_completion_hdata_completion_cb, NULL, NULL);
hook_hdata (NULL, "config_file", N_("config file"),
- &config_file_hdata_config_file_cb, NULL);
+ &config_file_hdata_config_file_cb, NULL, NULL);
hook_hdata (NULL, "config_section", N_("config section"),
- &config_file_hdata_config_section_cb, NULL);
+ &config_file_hdata_config_section_cb, NULL, NULL);
hook_hdata (NULL, "config_option", N_("config option"),
- &config_file_hdata_config_option_cb, NULL);
+ &config_file_hdata_config_option_cb, NULL, NULL);
hook_hdata (NULL, "filter", N_("filter"),
- &gui_filter_hdata_filter_cb, NULL);
+ &gui_filter_hdata_filter_cb, NULL, NULL);
hook_hdata (NULL, "history", N_("history of commands in buffer"),
- &gui_history_hdata_history_cb, NULL);
+ &gui_history_hdata_history_cb, NULL, NULL);
hook_hdata (NULL, "hotlist", N_("hotlist"),
- &gui_hotlist_hdata_hotlist_cb, NULL);
+ &gui_hotlist_hdata_hotlist_cb, NULL, NULL);
hook_hdata (NULL, "input_undo", N_("structure with undo for input line"),
- &gui_buffer_hdata_input_undo_cb, NULL);
+ &gui_buffer_hdata_input_undo_cb, NULL, NULL);
hook_hdata (NULL, "key", N_("a key (keyboard shortcut)"),
- &gui_key_hdata_key_cb, NULL);
+ &gui_key_hdata_key_cb, NULL, NULL);
hook_hdata (NULL, "layout", N_("layout"),
- &gui_layout_hdata_layout_cb, NULL);
+ &gui_layout_hdata_layout_cb, NULL, NULL);
hook_hdata (NULL, "layout_buffer", N_("buffer layout"),
- &gui_layout_hdata_layout_buffer_cb, NULL);
+ &gui_layout_hdata_layout_buffer_cb, NULL, NULL);
hook_hdata (NULL, "layout_window", N_("window layout"),
- &gui_layout_hdata_layout_window_cb, NULL);
+ &gui_layout_hdata_layout_window_cb, NULL, NULL);
hook_hdata (NULL, "lines", N_("structure with lines"),
- &gui_line_hdata_lines_cb, NULL);
+ &gui_line_hdata_lines_cb, NULL, NULL);
hook_hdata (NULL, "line", N_("structure with one line"),
- &gui_line_hdata_line_cb, NULL);
+ &gui_line_hdata_line_cb, NULL, NULL);
hook_hdata (NULL, "line_data", N_("structure with one line data"),
- &gui_line_hdata_line_data_cb, NULL);
+ &gui_line_hdata_line_data_cb, NULL, NULL);
hook_hdata (NULL, "nick_group", N_("group in nicklist"),
- &gui_nicklist_hdata_nick_group_cb, NULL);
+ &gui_nicklist_hdata_nick_group_cb, NULL, NULL);
hook_hdata (NULL, "nick", N_("nick in nicklist"),
- &gui_nicklist_hdata_nick_cb, NULL);
+ &gui_nicklist_hdata_nick_cb, NULL, NULL);
hook_hdata (NULL, "plugin", N_("plugin"),
- &plugin_hdata_plugin_cb, NULL);
+ &plugin_hdata_plugin_cb, NULL, NULL);
hook_hdata (NULL, "proxy", N_("proxy"),
- &proxy_hdata_proxy_cb, NULL);
+ &proxy_hdata_proxy_cb, NULL, NULL);
hook_hdata (NULL, "window", N_("window"),
- &gui_window_hdata_window_cb, NULL);
+ &gui_window_hdata_window_cb, NULL, NULL);
hook_hdata (NULL, "window_scroll", N_("scroll info in window"),
- &gui_window_hdata_window_scroll_cb, NULL);
+ &gui_window_hdata_window_scroll_cb, NULL, NULL);
hook_hdata (NULL, "window_tree", N_("tree of windows"),
- &gui_window_hdata_window_tree_cb, NULL);
+ &gui_window_hdata_window_tree_cb, NULL, NULL);
}
diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c
index dab7798e8..8ba100a75 100644
--- a/src/plugins/plugin-config.c
+++ b/src/plugins/plugin-config.c
@@ -94,7 +94,8 @@ plugin_config_set_internal (const char *option, const char *value)
ptr_option = config_file_new_option (
plugin_config_file, plugin_config_section_var,
option, "string", NULL,
- NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", value, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
}
@@ -133,11 +134,13 @@ plugin_config_set (const char *plugin_name, const char *option_name,
*/
void
-plugin_config_desc_changed_cb (void *data, struct t_config_option *option)
+plugin_config_desc_changed_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_config_option *ptr_option;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_option = config_file_search_option (plugin_config_file,
@@ -177,12 +180,14 @@ plugin_config_set_desc_internal (const char *option, const char *value)
ptr_option = config_file_new_option (
plugin_config_file, plugin_config_section_desc,
option, "string", _("description of plugin option"),
- NULL, 0, 0, "", value, 0, NULL, NULL,
- &plugin_config_desc_changed_cb, NULL, NULL, NULL);
+ NULL, 0, 0, "", value, 0,
+ NULL, NULL, NULL,
+ &plugin_config_desc_changed_cb, NULL, NULL,
+ NULL, NULL, NULL);
}
if (ptr_option)
- plugin_config_desc_changed_cb (NULL, ptr_option);
+ plugin_config_desc_changed_cb (NULL, NULL, ptr_option);
}
/*
@@ -213,9 +218,11 @@ plugin_config_set_desc (const char *plugin_name, const char *option_name,
*/
int
-plugin_config_reload (void *data, struct t_config_file *config_file)
+plugin_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* remove all plugin options and descriptions */
@@ -231,13 +238,15 @@ plugin_config_reload (void *data, struct t_config_file *config_file)
*/
int
-plugin_config_create_option (void *data, struct t_config_file *config_file,
+plugin_config_create_option (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
struct t_config_option *ptr_option_desc, *ptr_option;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_option_desc = config_file_search_option (config_file,
@@ -248,7 +257,8 @@ plugin_config_create_option (void *data, struct t_config_file *config_file,
config_file, section,
option_name, "string",
(ptr_option_desc) ? CONFIG_STRING(ptr_option_desc) : NULL,
- NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", value, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -259,13 +269,15 @@ plugin_config_create_option (void *data, struct t_config_file *config_file,
*/
int
-plugin_config_create_desc (void *data, struct t_config_file *config_file,
+plugin_config_create_desc (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
struct t_config_option *ptr_option_var, *ptr_option;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_option_var = config_file_search_option (config_file,
@@ -285,8 +297,10 @@ plugin_config_create_desc (void *data, struct t_config_file *config_file,
ptr_option = config_file_new_option (
config_file, section,
option_name, "string", _("description of plugin option"),
- NULL, 0, 0, "", value, 0, NULL, NULL,
- &plugin_config_desc_changed_cb, NULL, NULL, NULL);
+ NULL, 0, 0, "", value, 0,
+ NULL, NULL, NULL,
+ &plugin_config_desc_changed_cb, NULL, NULL,
+ NULL, NULL, NULL);
return (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -297,13 +311,15 @@ plugin_config_create_desc (void *data, struct t_config_file *config_file,
*/
int
-plugin_config_delete_desc (void *data, struct t_config_file *config_file,
+plugin_config_delete_desc (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
struct t_config_option *ptr_option_var;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) section;
@@ -332,23 +348,23 @@ void
plugin_config_init ()
{
plugin_config_file = config_file_new (NULL, PLUGIN_CONFIG_NAME,
- &plugin_config_reload, NULL);
+ &plugin_config_reload, NULL, NULL);
if (plugin_config_file)
{
plugin_config_section_var = config_file_new_section (
plugin_config_file, "var", 1, 1,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL,
- &plugin_config_create_option, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &plugin_config_create_option, NULL, NULL,
+ NULL, NULL, NULL);
plugin_config_section_desc = config_file_new_section (
plugin_config_file, "desc", 1, 1,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL,
- &plugin_config_create_desc, NULL,
- &plugin_config_delete_desc, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &plugin_config_create_desc, NULL, NULL,
+ &plugin_config_delete_desc, NULL, NULL);
}
else
{
diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c
index b46e236f3..1354042b9 100644
--- a/src/plugins/plugin-script-api.c
+++ b/src/plugins/plugin-script-api.c
@@ -28,7 +28,6 @@
#include "weechat-plugin.h"
#include "plugin-script.h"
#include "plugin-script-api.h"
-#include "plugin-script-callback.h"
/*
@@ -55,24 +54,25 @@ struct t_config_file *
plugin_script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- int (*callback_reload)(void *data,
+ int (*callback_reload)(const void *pointer,
+ void *data,
struct t_config_file *config_file),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_config_file *new_config_file;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
- return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
- new_config_file = weechat_config_new (name, callback_reload,
- (function && function[0]) ? script_cb : NULL);
- if (new_config_file)
- script_cb->config_file = new_config_file;
- else
- plugin_script_callback_remove (script, script_cb);
+ new_config_file = weechat_config_new
+ (name,
+ (function_and_data) ? callback_reload : NULL,
+ script,
+ function_and_data);
+
+ if (!new_config_file && function_and_data)
+ free (function_and_data);
return new_config_file;
}
@@ -90,97 +90,91 @@ plugin_script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
const char *name,
int user_can_add_options,
int user_can_delete_options,
- int (*callback_read)(void *data,
+ int (*callback_read)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_read,
const char *data_read,
- int (*callback_write)(void *data,
+ int (*callback_write)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write,
const char *data_write,
- int (*callback_write_default)(void *data,
+ int (*callback_write_default)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write_default,
const char *data_write_default,
- int (*callback_create_option)(void *data,
+ int (*callback_create_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_create_option,
const char *data_create_option,
- int (*callback_delete_option)(void *data,
+ int (*callback_delete_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const char *function_delete_option,
const char *data_delete_option)
{
- struct t_plugin_script_cb *script_cb_read, *script_cb_write;
- struct t_plugin_script_cb *script_cb_write_default, *script_cb_create_option;
- struct t_plugin_script_cb *script_cb_delete_option;
+ char *function_and_data_read, *function_and_data_write;
+ char *function_and_data_write_default, *function_and_data_create_option;
+ char *function_and_data_delete_option;
struct t_config_section *new_section;
- script_cb_read = plugin_script_callback_add (script, function_read, data_read);
- script_cb_write = plugin_script_callback_add (script, function_write, data_write);
- script_cb_write_default = plugin_script_callback_add (script, function_write_default, data_write_default);
- script_cb_create_option = plugin_script_callback_add (script, function_create_option, data_create_option);
- script_cb_delete_option = plugin_script_callback_add (script, function_delete_option, data_delete_option);
- if (!script_cb_read || !script_cb_write || !script_cb_write_default
- || !script_cb_create_option || !script_cb_delete_option)
- {
- if (script_cb_read)
- plugin_script_callback_remove (script, script_cb_read);
- if (script_cb_write)
- plugin_script_callback_remove (script, script_cb_write);
- if (script_cb_write_default)
- plugin_script_callback_remove (script, script_cb_write_default);
- if (script_cb_create_option)
- plugin_script_callback_remove (script, script_cb_create_option);
- if (script_cb_delete_option)
- plugin_script_callback_remove (script, script_cb_delete_option);
- return NULL;
- }
-
- new_section = weechat_config_new_section (config_file,
- name,
- user_can_add_options,
- user_can_delete_options,
- (function_read && function_read[0]) ? callback_read : NULL,
- (function_read && function_read[0]) ? script_cb_read : NULL,
- (function_write && function_write[0]) ? callback_write : NULL,
- (function_write && function_write[0]) ? script_cb_write : NULL,
- (function_write_default && function_write_default[0]) ? callback_write_default : NULL,
- (function_write_default && function_write_default[0]) ? script_cb_write_default : NULL,
- (function_create_option && function_create_option[0]) ? callback_create_option : NULL,
- (function_create_option && function_create_option[0]) ? script_cb_create_option : NULL,
- (function_delete_option && function_delete_option[0]) ? callback_delete_option : NULL,
- (function_delete_option && function_delete_option[0]) ? script_cb_delete_option : NULL);
- if (new_section)
- {
- script_cb_read->config_file = config_file;
- script_cb_read->config_section = new_section;
- script_cb_write->config_file = config_file;
- script_cb_write->config_section = new_section;
- script_cb_write_default->config_file = config_file;
- script_cb_write_default->config_section = new_section;
- script_cb_create_option->config_file = config_file;
- script_cb_create_option->config_section = new_section;
- script_cb_delete_option->config_file = config_file;
- script_cb_delete_option->config_section = new_section;
- }
- else
+ function_and_data_read = plugin_script_build_function_and_data (
+ function_read, data_read);
+ function_and_data_write = plugin_script_build_function_and_data (
+ function_write, data_write);
+ function_and_data_write_default = plugin_script_build_function_and_data (
+ function_write_default, data_write_default);
+ function_and_data_create_option = plugin_script_build_function_and_data (
+ function_create_option, data_create_option);
+ function_and_data_delete_option = plugin_script_build_function_and_data (
+ function_delete_option, data_delete_option);
+
+ new_section = weechat_config_new_section (
+ config_file,
+ name,
+ user_can_add_options,
+ user_can_delete_options,
+ (function_and_data_read) ? callback_read : NULL,
+ script,
+ function_and_data_read,
+ (function_and_data_write) ? callback_write : NULL,
+ script,
+ function_and_data_write,
+ (function_and_data_write_default) ? callback_write_default : NULL,
+ script,
+ function_and_data_write_default,
+ (function_and_data_create_option) ? callback_create_option : NULL,
+ script,
+ function_and_data_create_option,
+ (function_and_data_delete_option) ? callback_delete_option : NULL,
+ script,
+ function_and_data_delete_option);;
+
+ if (!new_section)
{
- plugin_script_callback_remove (script, script_cb_read);
- plugin_script_callback_remove (script, script_cb_write);
- plugin_script_callback_remove (script, script_cb_write_default);
- plugin_script_callback_remove (script, script_cb_create_option);
- plugin_script_callback_remove (script, script_cb_delete_option);
+ if (function_and_data_read)
+ free (function_and_data_read);
+ if (function_and_data_write)
+ free (function_and_data_write);
+ if (function_and_data_write_default)
+ free (function_and_data_write_default);
+ if (function_and_data_create_option)
+ free (function_and_data_create_option);
+ if (function_and_data_delete_option)
+ free (function_and_data_delete_option);
}
return new_section;
@@ -203,184 +197,63 @@ plugin_script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
const char *default_value,
const char *value,
int null_value_allowed,
- int (*callback_check_value)(void *data,
+ int (*callback_check_value)(const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value),
const char *function_check_value,
const char *data_check_value,
- void (*callback_change)(void *data,
+ void (*callback_change)(const void *pointer,
+ void *data,
struct t_config_option *option),
const char *function_change,
const char *data_change,
- void (*callback_delete)(void *data,
+ void (*callback_delete)(const void *pointer,
+ void *data,
struct t_config_option *option),
const char *function_delete,
const char *data_delete)
{
- struct t_plugin_script_cb *script_cb_check_value, *script_cb_change;
- struct t_plugin_script_cb *script_cb_delete;
+ char *function_and_data_check_value, *function_and_data_change;
+ char *function_and_data_delete;
struct t_config_option *new_option;
- script_cb_check_value = plugin_script_callback_add (script, function_check_value, data_check_value);
- script_cb_change = plugin_script_callback_add (script, function_change, data_change);
- script_cb_delete = plugin_script_callback_add (script, function_delete, data_delete);
- if (!script_cb_check_value || !script_cb_change || !script_cb_delete)
+ function_and_data_check_value = plugin_script_build_function_and_data (
+ function_check_value, data_check_value);
+ function_and_data_change = plugin_script_build_function_and_data (
+ function_change, data_change);
+ function_and_data_delete = plugin_script_build_function_and_data (
+ function_delete, data_delete);
+
+ new_option = weechat_config_new_option (
+ config_file, section, name, type,
+ description, string_values, min,
+ max, default_value, value,
+ null_value_allowed,
+ (function_and_data_check_value) ? callback_check_value : NULL,
+ script,
+ function_and_data_check_value,
+ (function_and_data_change) ? callback_change : NULL,
+ script,
+ function_and_data_change,
+ (function_and_data_delete) ? callback_delete : NULL,
+ script,
+ function_and_data_delete);
+
+ if (!new_option)
{
- if (script_cb_check_value)
- plugin_script_callback_remove (script, script_cb_check_value);
- if (script_cb_change)
- plugin_script_callback_remove (script, script_cb_change);
- if (script_cb_delete)
- plugin_script_callback_remove (script, script_cb_delete);
- return NULL;
- }
-
- new_option = weechat_config_new_option (config_file, section, name, type,
- description, string_values, min,
- max, default_value, value,
- null_value_allowed,
- (function_check_value && function_check_value[0]) ? callback_check_value : NULL,
- (function_check_value && function_check_value[0]) ? script_cb_check_value : NULL,
- (function_change && function_change[0]) ? callback_change : NULL,
- (function_change && function_change[0]) ? script_cb_change : NULL,
- (function_delete && function_delete[0]) ? callback_delete : NULL,
- (function_delete && function_delete[0]) ? script_cb_delete : NULL);
- if (new_option)
- {
- script_cb_check_value->config_file = config_file;
- script_cb_check_value->config_section = section;
- script_cb_check_value->config_option = new_option;
- script_cb_change->config_file = config_file;
- script_cb_change->config_section = section;
- script_cb_change->config_option = new_option;
- script_cb_delete->config_file = config_file;
- script_cb_delete->config_section = section;
- script_cb_delete->config_option = new_option;
- }
- else
- {
- plugin_script_callback_remove (script, script_cb_check_value);
- plugin_script_callback_remove (script, script_cb_change);
- plugin_script_callback_remove (script, script_cb_delete);
+ if (function_and_data_check_value)
+ free (function_and_data_check_value);
+ if (function_and_data_change)
+ free (function_and_data_change);
+ if (function_and_data_delete)
+ free (function_and_data_delete);
}
return new_option;
}
/*
- * Frees an option in configuration file.
- */
-
-void
-plugin_script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_option *option)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !option)
- return;
-
- weechat_config_option_free (option);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->config_option == option)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
-}
-
-/*
- * Frees all option of a section in configuration file.
- */
-
-void
-plugin_script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_section *section)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !section)
- return;
-
- weechat_config_section_free_options (section);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if ((ptr_script_cb->config_section == section)
- && ptr_script_cb->config_option)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
-}
-
-/*
- * Frees a section in configuration file.
- */
-
-void
-plugin_script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_section *section)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !section)
- return;
-
- weechat_config_section_free (section);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->config_section == section)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
-}
-
-/*
- * Frees a configuration file.
- */
-
-void
-plugin_script_api_config_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_file *config_file)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !config_file)
- return;
-
- weechat_config_free (config_file);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->config_file == config_file)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
-}
-
-/*
* Prints a message.
*/
@@ -492,30 +365,35 @@ plugin_script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
const char *command, const char *description,
const char *args, const char *args_description,
const char *completion,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_command (command, description, args,
args_description, completion,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -530,28 +408,33 @@ struct t_hook *
plugin_script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *command,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *command),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_command_run (command,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -566,27 +449,32 @@ struct t_hook *
plugin_script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int interval, int align_second, int max_calls,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
int remaining_calls),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_timer (interval, align_second, max_calls,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -602,26 +490,32 @@ plugin_script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int fd, int flag_read, int flag_write,
int flag_exception,
- int (*callback)(void *data, int fd),
+ int (*callback)(const void *pointer,
+ void *data,
+ int fd),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_fd (fd, flag_read, flag_write, flag_exception,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -638,7 +532,8 @@ plugin_script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugi
const char *command,
struct t_hashtable *options,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
@@ -646,22 +541,27 @@ plugin_script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugi
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_process_hashtable (command, options, timeout,
- callback, script_cb);
+ callback, script,
+ function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -677,7 +577,8 @@ plugin_script_api_hook_process (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *command,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
@@ -699,37 +600,44 @@ plugin_script_api_hook_process (struct t_weechat_plugin *weechat_plugin,
struct t_hook *
plugin_script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- const char *proxy, const char *address, int port,
+ const char *proxy,
+ const char *address, int port,
int ipv6, int retry,
void *gnutls_sess, void *gnutls_cb,
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
- int (*callback)(void *data, int status,
- int gnutls_rc, int sock,
+ int (*callback)(const void *pointer,
+ void *data,
+ int status, int gnutls_rc,
+ int sock,
const char *error,
const char *ip_address),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_connect (proxy, address, port, ipv6, retry,
gnutls_sess, gnutls_cb, gnutls_dhkey_size,
gnutls_priorities, local_hostname,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -746,32 +654,38 @@ plugin_script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_gui_buffer *buffer,
const char *tags, const char *message,
int strip_colors,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
time_t date,
- int tags_count, const char **tags,
+ int tags_count,
+ const char **tags,
int displayed, int highlight,
const char *prefix,
const char *message),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_print (buffer, tags, message, strip_colors,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -786,27 +700,34 @@ struct t_hook *
plugin_script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *signal,
- int (*callback)(void *data, const char *signal,
+ int (*callback)(const void *pointer,
+ void *data,
+ const char *signal,
const char *type_data,
void *signal_data),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
- new_hook = weechat_hook_signal (signal, callback, script_cb);
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
+ new_hook = weechat_hook_signal (signal, callback, script,
+ function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -821,26 +742,33 @@ struct t_hook *
plugin_script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *signal,
- int (*callback)(void *data, const char *signal,
+ int (*callback)(const void *pointer,
+ void *data,
+ const char *signal,
struct t_hashtable *hashtable),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
- new_hook = weechat_hook_hsignal (signal, callback, script_cb);
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
+ new_hook = weechat_hook_hsignal (signal, callback, script,
+ function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -855,26 +783,33 @@ struct t_hook *
plugin_script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option,
- int (*callback)(void *data, const char *option,
+ int (*callback)(const void *pointer,
+ void *data,
+ const char *option,
const char *value),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
- new_hook = weechat_hook_config (option, callback, script_cb);
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
+ new_hook = weechat_hook_config (option, callback, script,
+ function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -890,29 +825,34 @@ plugin_script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *completion,
const char *description,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_completion (completion, description,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -927,27 +867,34 @@ struct t_hook *
plugin_script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *modifier,
- char *(*callback)(void *data, const char *modifier,
+ char *(*callback)(const void *pointer,
+ void *data,
+ const char *modifier,
const char *modifier_data,
const char *string),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
- new_hook = weechat_hook_modifier (modifier, callback, script_cb);
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
+ new_hook = weechat_hook_modifier (modifier,
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -964,28 +911,33 @@ plugin_script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
const char *info_name,
const char *description,
const char *args_description,
- const char *(*callback)(void *data,
+ const char *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
const char *arguments),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_info (info_name, description, args_description,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -1003,30 +955,36 @@ plugin_script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin,
const char *description,
const char *args_description,
const char *output_description,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
struct t_hashtable *hashtable),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_info_hashtable (info_name, description,
args_description,
output_description,
- callback, script_cb);
+ callback, script,
+ function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -1044,30 +1002,35 @@ plugin_script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
const char *description,
const char *pointer_description,
const char *args_description,
- struct t_infolist *(*callback)(void *data,
+ struct t_infolist *(*callback)(const void *pointer,
+ void *data,
const char *infolist_name,
- void *pointer,
+ void *obj_pointer,
const char *arguments),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
new_hook = weechat_hook_infolist (infolist_name, description,
pointer_description, args_description,
- callback, script_cb);
+ callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
+ {
+ if (function_and_data)
+ free (function_and_data);
+ }
return new_hook;
}
@@ -1082,81 +1045,33 @@ struct t_hook *
plugin_script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *area,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
struct t_hashtable *info),
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
+ char *function_and_data;
struct t_hook *new_hook;
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
+ if (!function || !function[0])
return NULL;
- new_hook = weechat_hook_focus (area, callback, script_cb);
+ function_and_data = plugin_script_build_function_and_data (function, data);
+
+ new_hook = weechat_hook_focus (area, callback, script, function_and_data);
+
if (new_hook)
{
weechat_hook_set (new_hook, "subplugin", script->name);
- script_cb->hook = new_hook;
}
else
- plugin_script_callback_remove (script, script_cb);
-
- return new_hook;
-}
-
-/*
- * Unhooks something.
- */
-
-void
-plugin_script_api_unhook (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_hook *hook)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !hook)
- return;
-
- weechat_unhook (hook);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
{
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->hook == hook)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
+ if (function_and_data)
+ free (function_and_data);
}
-}
-
-/*
- * Unhooks everything for a script.
- */
-
-void
-plugin_script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
- if (ptr_script_cb->hook)
- {
- weechat_unhook (ptr_script_cb->hook);
- plugin_script_callback_remove (script, ptr_script_cb);
- }
-
- ptr_script_cb = next_callback;
- }
+ return new_hook;
}
/*
@@ -1167,86 +1082,61 @@ struct t_gui_buffer *
plugin_script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- int (*input_callback)(void *data,
+ int (*input_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data),
const char *function_input,
const char *data_input,
- int (*close_callback)(void *data,
+ int (*close_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer),
const char *function_close,
const char *data_close)
{
- struct t_plugin_script_cb *script_cb_input;
- struct t_plugin_script_cb *script_cb_close;
+ char *function_and_data_input, *function_and_data_close;
struct t_gui_buffer *new_buffer;
- script_cb_input = plugin_script_callback_add (script, function_input, data_input);
- script_cb_close = plugin_script_callback_add (script, function_close, data_close);
- if (!script_cb_input || !script_cb_close)
- {
- if (script_cb_input)
- plugin_script_callback_remove (script, script_cb_input);
- if (script_cb_close)
- plugin_script_callback_remove (script, script_cb_close);
- return NULL;
- }
+ function_and_data_input = plugin_script_build_function_and_data (
+ function_input, data_input);
+ function_and_data_close = plugin_script_build_function_and_data (
+ function_close, data_close);
+
+ new_buffer = weechat_buffer_new (
+ name,
+ (function_and_data_input) ? input_callback : NULL,
+ script,
+ function_and_data_input,
+ (function_and_data_close) ? close_callback : NULL,
+ script,
+ function_and_data_close);
- new_buffer = weechat_buffer_new (name,
- (function_input && function_input[0]) ? input_callback : NULL,
- (function_input && function_input[0]) ? script_cb_input : NULL,
- (function_close && function_close[0]) ? close_callback : NULL,
- (function_close && function_close[0]) ? script_cb_close : NULL);
if (new_buffer)
{
- script_cb_input->buffer = new_buffer;
- script_cb_close->buffer = new_buffer;
-
/* used when upgrading weechat, to set callbacks */
- weechat_buffer_set (new_buffer, "localvar_set_script_name", script->name);
- weechat_buffer_set (new_buffer, "localvar_set_script_input_cb", function_input);
- weechat_buffer_set (new_buffer, "localvar_set_script_input_cb_data", data_input);
- weechat_buffer_set (new_buffer, "localvar_set_script_close_cb", function_close);
- weechat_buffer_set (new_buffer, "localvar_set_script_close_cb_data", data_close);
+ weechat_buffer_set (new_buffer,
+ "localvar_set_script_name", script->name);
+ weechat_buffer_set (new_buffer,
+ "localvar_set_script_input_cb", function_input);
+ weechat_buffer_set (new_buffer,
+ "localvar_set_script_input_cb_data", data_input);
+ weechat_buffer_set (new_buffer,
+ "localvar_set_script_close_cb", function_close);
+ weechat_buffer_set (new_buffer,
+ "localvar_set_script_close_cb_data", data_close);
}
else
{
- plugin_script_callback_remove (script, script_cb_input);
- plugin_script_callback_remove (script, script_cb_close);
+ if (function_and_data_input)
+ free (function_and_data_input);
+ if (function_and_data_close)
+ free (function_and_data_close);
}
return new_buffer;
}
/*
- * Closes a buffer.
- */
-
-void
-plugin_script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_gui_buffer *buffer)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !buffer)
- return;
-
- weechat_buffer_close (buffer);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->buffer == buffer)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
-}
-
-/*
* Adds a new bar item.
*
* Returns pointer to new bar item, NULL if error.
@@ -1256,7 +1146,8 @@ struct t_gui_bar_item *
plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- char *(*build_callback)(void *data,
+ char *(*build_callback)(const void *pointer,
+ void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
@@ -1264,9 +1155,8 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
const char *function,
const char *data)
{
- struct t_plugin_script_cb *script_cb;
struct t_gui_bar_item *new_item;
- char str_function[1024];
+ char str_function[1024], *function_and_data;;
int new_callback;
new_callback = 0;
@@ -1284,47 +1174,16 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
function);
}
- script_cb = plugin_script_callback_add (script, str_function, data);
- if (!script_cb)
- return NULL;
+ function_and_data = plugin_script_build_function_and_data (str_function,
+ data);
- new_item = weechat_bar_item_new (name,
- (str_function[0]) ? build_callback : NULL,
- (str_function[0]) ? script_cb : NULL);
- if (new_item)
- script_cb->bar_item = new_item;
- else
- plugin_script_callback_remove (script, script_cb);
+ new_item = weechat_bar_item_new (name, build_callback, script,
+ function_and_data);
- return new_item;
-}
-
-/*
- * Removes a bar item.
- */
+ if (!new_item && function_and_data)
+ free (function_and_data);
-void
-plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_gui_bar_item *item)
-{
- struct t_plugin_script_cb *ptr_script_cb, *next_callback;
-
- if (!weechat_plugin || !script || !item)
- return;
-
- weechat_bar_item_remove (item);
-
- ptr_script_cb = script->callbacks;
- while (ptr_script_cb)
- {
- next_callback = ptr_script_cb->next_callback;
-
- if (ptr_script_cb->bar_item == item)
- plugin_script_callback_remove (script, ptr_script_cb);
-
- ptr_script_cb = next_callback;
- }
+ return new_item;
}
/*
@@ -1372,6 +1231,7 @@ plugin_script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
strcat (option_fullname, option);
return_value = weechat_config_get_plugin (option_fullname);
+
free (option_fullname);
return return_value;
@@ -1403,6 +1263,7 @@ plugin_script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plugin,
strcat (option_fullname, option);
return_code = weechat_config_is_set_plugin (option_fullname);
+
free (option_fullname);
return return_code;
@@ -1430,6 +1291,7 @@ plugin_script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
strcat (option_fullname, option);
return_code = weechat_config_set_plugin (option_fullname, value);
+
free (option_fullname);
return return_code;
@@ -1456,6 +1318,7 @@ plugin_script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugi
strcat (option_fullname, option);
weechat_config_set_desc_plugin (option_fullname, description);
+
free (option_fullname);
}
@@ -1481,46 +1344,45 @@ plugin_script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
strcat (option_fullname, option);
return_code = weechat_config_unset_plugin (option_fullname);
+
free (option_fullname);
return return_code;
}
/*
- * Reads upgrade file.
+ * Creates an upgrade file.
*
* Returns:
* 1: OK
* 0: error
*/
-int
-plugin_script_api_upgrade_read (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_upgrade_file *upgrade_file,
- int (*callback_read)(void *data,
- struct t_upgrade_file *upgrade_file,
- int object_id,
- struct t_infolist *infolist),
- const char *function,
- const char *data)
+struct t_upgrade_file *
+plugin_script_api_upgrade_new (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ const char *filename,
+ int (*callback_read)(const void *pointer,
+ void *data,
+ struct t_upgrade_file *upgrade_file,
+ int object_id,
+ struct t_infolist *infolist),
+ const char *function,
+ const char *data)
{
- struct t_plugin_script_cb *script_cb;
- int rc;
+ char *function_and_data;
+ struct t_upgrade_file *new_upgrade_file;
- if (!function || !function[0])
- return 0;
+ function_and_data = plugin_script_build_function_and_data (function, data);
- script_cb = plugin_script_callback_add (script, function, data);
- if (!script_cb)
- return 0;
- script_cb->upgrade_file = upgrade_file;
-
- rc = weechat_upgrade_read (upgrade_file,
- callback_read,
- script_cb);
+ new_upgrade_file = weechat_upgrade_new (
+ filename,
+ (function_and_data) ? callback_read : NULL,
+ script,
+ function_and_data);
- plugin_script_callback_remove (script, script_cb);
+ if (!new_upgrade_file && function_and_data)
+ free (function_and_data);
- return rc;
+ return new_upgrade_file;
}
diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h
index 8ad03e742..d6cfb68b8 100644
--- a/src/plugins/plugin-script-api.h
+++ b/src/plugins/plugin-script-api.h
@@ -26,7 +26,8 @@ extern void plugin_script_api_charset_set (struct t_plugin_script *script,
extern struct t_config_file *plugin_script_api_config_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- int (*callback_reload)(void *data,
+ int (*callback_reload)(const void *pointer,
+ void *data,
struct t_config_file *config_file),
const char *function,
const char *data);
@@ -36,31 +37,36 @@ extern struct t_config_section *plugin_script_api_config_new_section (struct t_w
const char *name,
int user_can_add_options,
int user_can_delete_options,
- int (*callback_read)(void *data,
+ int (*callback_read)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_read,
const char *data_read,
- int (*callback_write)(void *data,
+ int (*callback_write)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write,
const char *data_write,
- int (*callback_write_default)(void *data,
+ int (*callback_write_default)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write_default,
const char *data_write_default,
- int (*callback_create_option)(void *data,
+ int (*callback_create_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_create_option,
const char *data_create_option,
- int (*callback_delete_option)(void *data,
+ int (*callback_delete_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
@@ -78,31 +84,22 @@ extern struct t_config_option *plugin_script_api_config_new_option (struct t_wee
const char *default_value,
const char *value,
int null_value_allowed,
- int (*callback_check_value)(void *data,
+ int (*callback_check_value)(const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value),
const char *function_check_value,
const char *data_check_value,
- void (*callback_change)(void *data,
+ void (*callback_change)(const void *pointer,
+ void *data,
struct t_config_option *option),
const char *function_change,
const char *data_change,
- void (*callback_delete)(void *data,
+ void (*callback_delete)(const void *pointer,
+ void *data,
struct t_config_option *option),
const char *function_delete,
const char *data_delete);
-extern void plugin_script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_option *option);
-extern void plugin_script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_section *section);
-extern void plugin_script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_section *section);
-extern void plugin_script_api_config_free (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_config_file *config_file);
extern void plugin_script_api_printf (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
@@ -124,7 +121,8 @@ extern struct t_hook *plugin_script_api_hook_command (struct t_weechat_plugin *w
const char *command, const char *description,
const char *args, const char *args_description,
const char *completion,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
@@ -133,7 +131,8 @@ extern struct t_hook *plugin_script_api_hook_command (struct t_weechat_plugin *w
extern struct t_hook *plugin_script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *command,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *command),
const char *function,
@@ -142,7 +141,8 @@ extern struct t_hook *plugin_script_api_hook_timer (struct t_weechat_plugin *wee
struct t_plugin_script *script,
int interval, int align_second,
int max_calls,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
int remaining_calls),
const char *function,
const char *data);
@@ -150,7 +150,9 @@ extern struct t_hook *plugin_script_api_hook_fd (struct t_weechat_plugin *weecha
struct t_plugin_script *script,
int fd, int flag_read,
int flag_write, int flag_exception,
- int (*callback)(void *data, int fd),
+ int (*callback)(const void *pointer,
+ void *data,
+ int fd),
const char *function,
const char *data);
extern struct t_hook *plugin_script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugin,
@@ -158,7 +160,8 @@ extern struct t_hook *plugin_script_api_hook_process_hashtable (struct t_weechat
const char *command,
struct t_hashtable *options,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
@@ -169,7 +172,8 @@ extern struct t_hook *plugin_script_api_hook_process (struct t_weechat_plugin *w
struct t_plugin_script *script,
const char *command,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
@@ -188,7 +192,8 @@ extern struct t_hook *plugin_script_api_hook_connect (struct t_weechat_plugin *w
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
int status,
int gnutls_rc,
int sock,
@@ -202,7 +207,8 @@ extern struct t_hook *plugin_script_api_hook_print (struct t_weechat_plugin *wee
const char *tags,
const char *message,
int strip_colors,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@@ -216,7 +222,8 @@ extern struct t_hook *plugin_script_api_hook_print (struct t_weechat_plugin *wee
extern struct t_hook *plugin_script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *signal,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *signal,
const char *type_data,
void *signal_data),
@@ -225,7 +232,8 @@ extern struct t_hook *plugin_script_api_hook_signal (struct t_weechat_plugin *we
extern struct t_hook *plugin_script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *signal,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *signal,
struct t_hashtable *hashtable),
const char *function,
@@ -233,7 +241,8 @@ extern struct t_hook *plugin_script_api_hook_hsignal (struct t_weechat_plugin *w
extern struct t_hook *plugin_script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *option,
const char *value),
const char *function,
@@ -242,7 +251,8 @@ extern struct t_hook *plugin_script_api_hook_completion (struct t_weechat_plugin
struct t_plugin_script *script,
const char *completion,
const char *description,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
@@ -251,7 +261,8 @@ extern struct t_hook *plugin_script_api_hook_completion (struct t_weechat_plugin
extern struct t_hook *plugin_script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *modifier,
- char *(*callback)(void *data,
+ char *(*callback)(const void *pointer,
+ void *data,
const char *modifier,
const char *modifier_data,
const char *string),
@@ -262,7 +273,8 @@ extern struct t_hook *plugin_script_api_hook_info (struct t_weechat_plugin *weec
const char *info_name,
const char *description,
const char *args_description,
- const char *(*callback)(void *data,
+ const char *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
const char *arguments),
const char *function,
@@ -273,7 +285,8 @@ extern struct t_hook *plugin_script_api_hook_info_hashtable (struct t_weechat_pl
const char *description,
const char *args_description,
const char *output_description,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
struct t_hashtable *hashtable),
const char *function,
@@ -284,52 +297,46 @@ extern struct t_hook *plugin_script_api_hook_infolist (struct t_weechat_plugin *
const char *description,
const char *pointer_description,
const char *args_description,
- struct t_infolist *(*callback)(void *data,
+ struct t_infolist *(*callback)(const void *pointer,
+ void *data,
const char *infolist_name,
- void *pointer,
+ void *obj_pointer,
const char *arguments),
const char *function,
const char *data);
extern struct t_hook *plugin_script_api_hook_focus (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *area,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
struct t_hashtable *info),
const char *function,
const char *data);
-extern void plugin_script_api_unhook (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_hook *hook);
-extern void plugin_script_api_unhook_all (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script);
extern struct t_gui_buffer *plugin_script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- int (*input_callback)(void *data,
+ int (*input_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data),
const char *function_input,
const char *data_input,
- int (*close_callback)(void *data,
+ int (*close_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer),
const char *function_close,
const char *data_close);
-extern void plugin_script_api_buffer_close (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_gui_buffer *buffer);
extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *name,
- char *(*build_callback)(void *data,
+ char *(*build_callback)(const void *pointer,
+ void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
const char *function,
const char *data);
-extern void plugin_script_api_bar_item_remove (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_gui_bar_item *item);
extern int plugin_script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
@@ -350,14 +357,15 @@ extern void plugin_script_api_config_set_desc_plugin (struct t_weechat_plugin *w
extern int plugin_script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option);
-extern int plugin_script_api_upgrade_read (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- struct t_upgrade_file *upgrade_file,
- int (*callback_read)(void *data,
- struct t_upgrade_file *upgrade_file,
- int object_id,
- struct t_infolist *infolist),
- const char *function,
- const char *data);
+extern struct t_upgrade_file *plugin_script_api_upgrade_new (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ const char *filename,
+ int (*callback_read)(const void *pointer,
+ void *data,
+ struct t_upgrade_file *upgrade_file,
+ int object_id,
+ struct t_infolist *infolist),
+ const char *function,
+ const char *data);
#endif /* WEECHAT_PLUGIN_SCRIPT_API_H */
diff --git a/src/plugins/plugin-script-callback.c b/src/plugins/plugin-script-callback.c
deleted file mode 100644
index 7d734f77c..000000000
--- a/src/plugins/plugin-script-callback.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * script-callback.c - script callbacks management
- *
- * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
- *
- * This file is part of WeeChat, the extensible chat client.
- *
- * WeeChat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * WeeChat is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <stddef.h>
-
-#include "weechat-plugin.h"
-#include "plugin-script.h"
-#include "plugin-script-callback.h"
-
-
-/*
- * Allocates a new callback and initializes it.
- */
-
-struct t_plugin_script_cb *
-plugin_script_callback_alloc ()
-{
- struct t_plugin_script_cb *new_script_callback;
-
- new_script_callback = malloc (sizeof (*new_script_callback));
- if (new_script_callback)
- {
- new_script_callback->script = NULL;
- new_script_callback->function = NULL;
- new_script_callback->data = NULL;
- new_script_callback->config_file = NULL;
- new_script_callback->config_section = NULL;
- new_script_callback->config_option = NULL;
- new_script_callback->hook = NULL;
- new_script_callback->buffer = NULL;
- new_script_callback->bar_item = NULL;
- new_script_callback->upgrade_file = NULL;
- return new_script_callback;
- }
-
- return NULL;
-}
-
-/*
- * Adds a callback to list of callbacks.
- *
- * Returns pointer to new callback, NULL if error.
- */
-
-struct t_plugin_script_cb *
-plugin_script_callback_add (struct t_plugin_script *script,
- const char *function,
- const char *data)
-{
- struct t_plugin_script_cb *script_cb;
- if (!script)
- return NULL;
-
- script_cb = plugin_script_callback_alloc ();
- if (!script_cb)
- return NULL;
-
- /* initialize callback */
- script_cb->script = script;
- script_cb->function = (function) ? strdup (function) : NULL;
- script_cb->data = (data) ? strdup (data) : NULL;
-
- /* add callback to list */
- if (script->callbacks)
- script->callbacks->prev_callback = script_cb;
- script_cb->prev_callback = NULL;
- script_cb->next_callback = script->callbacks;
- script->callbacks = script_cb;
-
- return script_cb;
-}
-
-/*
- * Frees data of a script callback.
- */
-
-void
-plugin_script_callback_free_data (struct t_plugin_script_cb *script_callback)
-{
- if (script_callback->function)
- free (script_callback->function);
- if (script_callback->data)
- free (script_callback->data);
-}
-
-/*
- * Removes a callback from a script.
- */
-
-void
-plugin_script_callback_remove (struct t_plugin_script *script,
- struct t_plugin_script_cb *script_callback)
-{
- /* remove callback from list */
- if (script_callback->prev_callback)
- (script_callback->prev_callback)->next_callback =
- script_callback->next_callback;
- if (script_callback->next_callback)
- (script_callback->next_callback)->prev_callback =
- script_callback->prev_callback;
- if (script->callbacks == script_callback)
- script->callbacks = script_callback->next_callback;
-
- plugin_script_callback_free_data (script_callback);
-
- free (script_callback);
-}
-
-/*
- * Removes all callbacks from a script.
- */
-
-void
-plugin_script_callback_remove_all (struct t_plugin_script *script)
-{
- while (script->callbacks)
- {
- plugin_script_callback_remove (script, script->callbacks);
- }
-}
-
-/*
- * Gets hdata for script callback.
- */
-
-struct t_hdata *
-plugin_script_callback_hdata_callback_cb (void *data,
- const char *hdata_name)
-{
- struct t_weechat_plugin *weechat_plugin;
- struct t_hdata *hdata;
- char str_hdata_script[128];
-
- weechat_plugin = (struct t_weechat_plugin *)data;
-
- hdata = weechat_hdata_new (hdata_name, "prev_callback", "next_callback",
- 0, 0, NULL, NULL);
- if (hdata)
- {
- snprintf (str_hdata_script, sizeof (str_hdata_script),
- "%s_script", weechat_plugin->name);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, script, POINTER, 0, NULL, str_hdata_script);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, function, STRING, 0, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, data, STRING, 0, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, config_file, POINTER, 0, NULL, "config_file");
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, config_section, POINTER, 0, NULL, "config_section");
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, config_option, POINTER, 0, NULL, "config_option");
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, hook, POINTER, 0, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, buffer, POINTER, 0, NULL, "buffer");
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, bar_item, POINTER, 0, NULL, "bar_item");
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, upgrade_file, POINTER, 0, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, prev_callback, POINTER, 0, NULL, hdata_name);
- WEECHAT_HDATA_VAR(struct t_plugin_script_cb, next_callback, POINTER, 0, NULL, hdata_name);
- }
- return hdata;
-}
-
-/*
- * Prints callbacks in WeeChat log file (usually for crash dump).
- */
-
-void
-plugin_script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script_cb *script_callback)
-{
- weechat_log_printf ("");
- weechat_log_printf (" [callback (addr:0x%lx)]", script_callback);
- weechat_log_printf (" script. . . . . . . : 0x%lx", script_callback->script);
- weechat_log_printf (" function. . . . . . : '%s'", script_callback->function);
- weechat_log_printf (" data. . . . . . . . : '%s'", script_callback->data);
- weechat_log_printf (" config_file . . . . : 0x%lx", script_callback->config_file);
- weechat_log_printf (" config_section. . . : 0x%lx", script_callback->config_section);
- weechat_log_printf (" config_option . . . : 0x%lx", script_callback->config_option);
- weechat_log_printf (" hook. . . . . . . . : 0x%lx", script_callback->hook);
- weechat_log_printf (" buffer. . . . . . . : 0x%lx", script_callback->buffer);
- weechat_log_printf (" bar_item. . . . . . : 0x%lx", script_callback->bar_item);
- weechat_log_printf (" upgrade_file. . . . : 0x%lx", script_callback->upgrade_file);
- weechat_log_printf (" prev_callback . . . : 0x%lx", script_callback->prev_callback);
- weechat_log_printf (" next_callback . . . : 0x%lx", script_callback->next_callback);
-}
diff --git a/src/plugins/plugin-script-callback.h b/src/plugins/plugin-script-callback.h
deleted file mode 100644
index 0ff2fa1f1..000000000
--- a/src/plugins/plugin-script-callback.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2003-2016 Sébastien Helleu <flashcode@flashtux.org>
- *
- * This file is part of WeeChat, the extensible chat client.
- *
- * WeeChat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * WeeChat is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WEECHAT_PLUGIN_SCRIPT_CALLBACK_H
-#define WEECHAT_PLUGIN_SCRIPT_CALLBACK_H 1
-
-struct t_plugin_script_cb
-{
- void *script; /* pointer to script */
- char *function; /* script function called */
- char *data; /* data string for callback */
- struct t_config_file *config_file; /* not NULL for config file */
- struct t_config_section *config_section; /* not NULL for config section */
- struct t_config_option *config_option; /* not NULL for config option */
- struct t_hook *hook; /* not NULL for hook */
- struct t_gui_buffer *buffer; /* not NULL for buffer */
- struct t_gui_bar_item *bar_item; /* not NULL for bar item */
- struct t_upgrade_file *upgrade_file; /* not NULL for upgrade file */
- struct t_plugin_script_cb *prev_callback; /* link to next callback */
- struct t_plugin_script_cb *next_callback; /* link to previous callback */
-};
-
-extern struct t_plugin_script_cb *plugin_script_callback_add (struct t_plugin_script *script,
- const char *function,
- const char *data);
-extern void plugin_script_callback_remove (struct t_plugin_script *script,
- struct t_plugin_script_cb *script_callback);
-extern void plugin_script_callback_remove_all (struct t_plugin_script *script);
-extern struct t_hdata *plugin_script_callback_hdata_callback_cb (void *data,
- const char *hdata_name);
-extern void plugin_script_callback_print_log (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script_cb *script_callback);
-
-#endif /* WEECHAT_PLUGIN_SCRIPT_CALLBACK_H */
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 7a33b10e5..620ddba6d 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -33,7 +33,6 @@
#include "weechat-plugin.h"
#include "plugin-script.h"
-#include "plugin-script-callback.h"
#define SCRIPT_OPTION_CHECK_LICENSE "check_license"
@@ -67,13 +66,19 @@ plugin_script_config_read (struct t_weechat_plugin *weechat_plugin)
*/
int
-plugin_script_config_cb (void *data, const char *option, const char *value)
+plugin_script_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
+ struct t_weechat_plugin *plugin;
+
/* make C compiler happy */
+ (void) data;
(void) option;
(void) value;
- plugin_script_config_read (data);
+ plugin = (struct t_weechat_plugin *)pointer;
+
+ plugin_script_config_read (plugin);
return WEECHAT_RC_OK;
}
@@ -130,7 +135,8 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
{
snprintf (string, length, "plugins.var.%s.%s",
weechat_plugin->name, SCRIPT_OPTION_CHECK_LICENSE);
- weechat_hook_config (string, &plugin_script_config_cb, weechat_plugin);
+ weechat_hook_config (string,
+ &plugin_script_config_cb, weechat_plugin, NULL);
free (string);
}
@@ -175,7 +181,7 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
"\n"
"Without argument, this command lists all loaded scripts."),
completion,
- init->callback_command, NULL);
+ init->callback_command, NULL, NULL);
if (string)
free (string);
if (completion)
@@ -188,29 +194,24 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
{
snprintf (string, length, "%s_script", weechat_plugin->name);
weechat_hook_completion (string, N_("list of scripts"),
- init->callback_completion, NULL);
+ init->callback_completion, NULL, NULL);
weechat_hook_hdata (string, N_("list of scripts"),
- init->callback_hdata, weechat_plugin);
+ init->callback_hdata, weechat_plugin, NULL);
weechat_hook_infolist (string, N_("list of scripts"),
N_("script pointer (optional)"),
- N_("script name (wildcard \"*\" is allowed) (optional)"),
- init->callback_infolist, NULL);
- snprintf (string, length, "%s_callback", weechat_plugin->name);
- weechat_hook_hdata (string, N_("callback of a script"),
- &plugin_script_callback_hdata_callback_cb,
- weechat_plugin);
+ N_("script name (wildcard \"*\" is allowed) "
+ "(optional)"),
+ init->callback_infolist, NULL, NULL);
free (string);
}
/* add signal for "debug_dump" */
- weechat_hook_signal ("debug_dump", init->callback_signal_debug_dump, NULL);
+ weechat_hook_signal ("debug_dump",
+ init->callback_signal_debug_dump, NULL, NULL);
/* add signal for "debug_libs" */
- weechat_hook_signal ("debug_libs", init->callback_signal_debug_libs, NULL);
-
- /* add signal for "buffer_closed" */
- weechat_hook_signal ("buffer_closed",
- init->callback_signal_buffer_closed, NULL);
+ weechat_hook_signal ("debug_libs",
+ init->callback_signal_debug_libs, NULL, NULL);
/* add signals for script actions (install/remove/autoload) */
for (i = 0; action_signals[i]; i++)
@@ -219,7 +220,7 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
weechat_plugin->name,
action_signals[i]);
weechat_hook_signal (signal_name,
- init->callback_signal_script_action, NULL);
+ init->callback_signal_script_action, NULL, NULL);
}
/* parse arguments */
@@ -334,12 +335,74 @@ invalid:
}
/*
+ * Builds concatenated function name and data (both are strings).
+ * The result will be sent to callbacks.
+ */
+
+char *
+plugin_script_build_function_and_data (const char *function, const char *data)
+{
+ int length_function, length_data, length;
+ char *result;
+
+ if (!function || !function[0])
+ return NULL;
+
+ length_function = (function) ? strlen (function) : 0;
+ length_data = (data) ? strlen (data) : 0;
+ length = length_function + 1 + length_data + 1;
+
+ result = malloc (length);
+ if (!result)
+ return NULL;
+
+ if (function)
+ memcpy (result, function, length_function + 1);
+ else
+ result[0] = '\0';
+
+ if (data)
+ memcpy (result + length_function + 1, data, length_data + 1);
+ else
+ result[length_function + 1] = '\0';
+
+ return result;
+}
+
+/*
+ * Gets pointer on function name and data from a callback data pointer
+ * (which contains 2 strings separated by '\0').
+ */
+
+void
+plugin_script_get_function_and_data (void *callback_data,
+ const char **function, const char **data)
+{
+ const char *string, *ptr_data;
+
+ string = (const char *)callback_data;
+
+ if (string)
+ {
+ *function = string;
+ ptr_data = string + strlen (string) + 1;
+ *data = (ptr_data[0]) ? ptr_data : NULL;
+ }
+ else
+ {
+ *function = NULL;
+ *data = NULL;
+ }
+}
+
+/*
* Auto-loads all scripts in a directory.
*/
void
plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
- void (*callback)(void *data, const char *filename))
+ void (*callback)(void *data,
+ const char *filename))
{
const char *dir_home;
char *dir_name;
@@ -356,7 +419,7 @@ plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
snprintf (dir_name, dir_length,
"%s/%s/autoload", dir_home, weechat_plugin->name);
- weechat_exec_on_files (dir_name, 0, NULL, callback);
+ weechat_exec_on_files (dir_name, 0, callback, NULL);
free (dir_name);
}
@@ -605,7 +668,6 @@ plugin_script_add (struct t_weechat_plugin *weechat_plugin,
new_script->shutdown_func = (shutdown_func) ?
strdup (shutdown_func) : NULL;
new_script->charset = (charset) ? strdup (charset) : NULL;
- new_script->callbacks = NULL;
new_script->unloading = 0;
plugin_script_insert_sorted (weechat_plugin, scripts, last_script,
@@ -630,19 +692,21 @@ void
plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
struct t_plugin_script *script,
- int (*callback_buffer_input) (void *data,
+ int (*callback_buffer_input) (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data),
- int (*callback_buffer_close) (void *data,
+ int (*callback_buffer_close) (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer))
{
struct t_infolist *infolist;
struct t_gui_buffer *ptr_buffer;
- const char *script_name, *str_script_input_cb, *str_script_input_cb_data;
+ const char *script_name;
+ const char *str_script_input_cb, *str_script_input_cb_data;
const char *str_script_close_cb, *str_script_close_cb_data;
+ char *function_and_data;
struct t_plugin_script *ptr_script;
- struct t_plugin_script_cb *script_cb_input;
- struct t_plugin_script_cb *script_cb_close;
infolist = weechat_infolist_get ("buffer", NULL, NULL);
if (infolist)
@@ -659,46 +723,49 @@ plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
script_name);
if (ptr_script && (ptr_script == script))
{
- str_script_input_cb = weechat_buffer_get_string (ptr_buffer,
- "localvar_script_input_cb");
- str_script_input_cb_data = weechat_buffer_get_string (ptr_buffer,
- "localvar_script_input_cb_data");
- str_script_close_cb = weechat_buffer_get_string (ptr_buffer,
- "localvar_script_close_cb");
- str_script_close_cb_data = weechat_buffer_get_string (ptr_buffer,
- "localvar_script_close_cb_data");
-
- if (str_script_input_cb && str_script_input_cb[0])
+ str_script_input_cb = weechat_buffer_get_string (
+ ptr_buffer, "localvar_script_input_cb");
+ str_script_input_cb_data = weechat_buffer_get_string (
+ ptr_buffer, "localvar_script_input_cb_data");
+ str_script_close_cb = weechat_buffer_get_string (
+ ptr_buffer, "localvar_script_close_cb");
+ str_script_close_cb_data = weechat_buffer_get_string (
+ ptr_buffer, "localvar_script_close_cb_data");
+
+ function_and_data = plugin_script_build_function_and_data (
+ str_script_input_cb, str_script_input_cb_data);
+ if (function_and_data)
{
- script_cb_input = plugin_script_callback_add (ptr_script,
- str_script_input_cb,
- str_script_input_cb_data);
- if (script_cb_input)
- {
- script_cb_input->buffer = ptr_buffer;
- weechat_buffer_set_pointer (ptr_buffer,
- "input_callback",
- callback_buffer_input);
- weechat_buffer_set_pointer (ptr_buffer,
- "input_callback_data",
- script_cb_input);
- }
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "input_callback",
+ callback_buffer_input);
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "input_callback_pointer",
+ ptr_script);
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "input_callback_data",
+ function_and_data);
}
- if (str_script_close_cb && str_script_close_cb[0])
+
+ function_and_data = plugin_script_build_function_and_data (
+ str_script_close_cb, str_script_close_cb_data);
+ if (function_and_data)
{
- script_cb_close = plugin_script_callback_add (ptr_script,
- str_script_close_cb,
- str_script_close_cb_data);
- if (script_cb_close)
- {
- script_cb_close->buffer = ptr_buffer;
- weechat_buffer_set_pointer (ptr_buffer,
- "close_callback",
- callback_buffer_close);
- weechat_buffer_set_pointer (ptr_buffer,
- "close_callback_data",
- script_cb_close);
- }
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "close_callback",
+ callback_buffer_close);
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "close_callback_pointer",
+ ptr_script);
+ weechat_buffer_set_pointer (
+ ptr_buffer,
+ "close_callback_data",
+ function_and_data);
}
}
}
@@ -709,36 +776,136 @@ plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
}
/*
- * Removes callbacks for a buffer (called when a buffer is closed by user).
+ * Closes all buffers created by the script.
*/
void
-plugin_script_remove_buffer_callbacks (struct t_plugin_script *scripts,
- struct t_gui_buffer *buffer)
+plugin_script_close_buffers (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script)
{
- struct t_plugin_script *ptr_script;
- struct t_plugin_script_cb *ptr_script_cb, *next_script_cb;
+ struct t_hdata *hdata;
+ struct t_gui_buffer *ptr_buffer, *ptr_buffer_to_close;
+ const char *ptr_script_name;
- for (ptr_script = scripts; ptr_script;
- ptr_script = ptr_script->next_script)
+ hdata = weechat_hdata_get ("buffer");
+ while (1)
{
- /*
- * do not remove buffer callbacks if script is being unloaded
- * (because all callbacks will be removed anyway)
- */
- if (!ptr_script->unloading)
+ ptr_buffer = weechat_hdata_get_list (hdata, "gui_buffers");
+ ptr_buffer_to_close = NULL;
+ while (ptr_buffer)
{
- ptr_script_cb = ptr_script->callbacks;
- while (ptr_script_cb)
+ ptr_script_name = weechat_buffer_get_string (
+ ptr_buffer, "localvar_script_name");
+ if (ptr_script_name
+ && (strcmp (ptr_script_name, script->name) == 0))
{
- next_script_cb = ptr_script_cb->next_callback;
+ ptr_buffer_to_close = ptr_buffer;
+ break;
+ }
+ ptr_buffer = weechat_hdata_move (hdata, ptr_buffer, 1);
+ }
+ if (ptr_buffer_to_close)
+ {
+ weechat_buffer_close (ptr_buffer_to_close);
+ }
+ else
+ break;
+ }
+}
- if (ptr_script_cb->buffer == buffer)
- plugin_script_callback_remove (ptr_script, ptr_script_cb);
+/*
+ * Removes all bar items created by the script.
+ */
+
+void
+plugin_script_remove_bar_items (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script)
+{
+ struct t_hdata *hdata;
+ struct t_gui_bar_item *ptr_bar_item, *ptr_next_item;
+ void *callback_pointer;
- ptr_script_cb = next_script_cb;
+ hdata = weechat_hdata_get ("bar_item");
+ ptr_bar_item = weechat_hdata_get_list (hdata, "gui_bar_items");
+ while (ptr_bar_item)
+ {
+ ptr_next_item = weechat_hdata_pointer (hdata, ptr_bar_item,
+ "next_item");
+ callback_pointer = weechat_hdata_pointer (hdata, ptr_bar_item,
+ "build_callback_pointer");
+ if (callback_pointer == script)
+ weechat_bar_item_remove (ptr_bar_item);
+ ptr_bar_item = ptr_next_item;
+ }
+}
+
+/*
+ * Removes all configuration files/sections/options created by the script.
+ */
+
+void
+plugin_script_remove_configs (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script)
+{
+ struct t_hdata *hdata_config, *hdata_section, *hdata_option;
+ struct t_config_file *ptr_config, *ptr_next_config;
+ struct t_config_section *ptr_section, *ptr_next_section;
+ struct t_config_option *ptr_option, *ptr_next_option;
+ void *callback_pointer;
+
+ hdata_config = weechat_hdata_get ("config_file");
+ hdata_section = weechat_hdata_get ("config_section");
+ hdata_option = weechat_hdata_get ("config_option");
+ ptr_config = weechat_hdata_get_list (hdata_config, "config_files");
+ while (ptr_config)
+ {
+ ptr_next_config = weechat_hdata_pointer (hdata_config, ptr_config,
+ "next_config");
+ callback_pointer = weechat_hdata_pointer (
+ hdata_config, ptr_config, "callback_reload_pointer");
+ if (callback_pointer == script)
+ {
+ if (weechat_config_boolean (weechat_config_get ("weechat.plugin.save_config_on_unload")))
+ weechat_config_write (ptr_config);
+ weechat_config_free (ptr_config);
+ }
+ else
+ {
+ ptr_section = weechat_hdata_pointer (hdata_config, ptr_config,
+ "sections");
+ while (ptr_section)
+ {
+ ptr_next_section = weechat_hdata_pointer (hdata_section,
+ ptr_section,
+ "next_section");
+ callback_pointer = weechat_hdata_pointer (
+ hdata_section, ptr_section, "callback_read_pointer");
+ if (callback_pointer == script)
+ {
+ weechat_config_section_free (ptr_section);
+ }
+ else
+ {
+ ptr_option = weechat_hdata_pointer (hdata_section,
+ ptr_section,
+ "options");
+ while (ptr_option)
+ {
+ ptr_next_option = weechat_hdata_pointer (hdata_option,
+ ptr_option,
+ "next_option");
+ callback_pointer = weechat_hdata_pointer (
+ hdata_option, ptr_option,
+ "callback_check_value_pointer");
+ if (callback_pointer == script)
+ weechat_config_option_free (ptr_option);
+ ptr_option = ptr_next_option;
+ }
+ }
+ ptr_section = ptr_next_section;
}
}
+ ptr_config = ptr_next_config;
}
}
@@ -752,59 +919,16 @@ plugin_script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **last_script,
struct t_plugin_script *script)
{
- struct t_plugin_script_cb *ptr_script_cb, *ptr_script_cb2;
-
script->unloading = 1;
- for (ptr_script_cb = script->callbacks; ptr_script_cb;
- ptr_script_cb = ptr_script_cb->next_callback)
- {
- /* free configuration file */
- if (ptr_script_cb->config_file)
- {
- if (weechat_config_boolean (weechat_config_get ("weechat.plugin.save_config_on_unload")))
- weechat_config_write (ptr_script_cb->config_file);
- weechat_config_free (ptr_script_cb->config_file);
- }
-
- /* unhook */
- if (ptr_script_cb->hook)
- weechat_unhook (ptr_script_cb->hook);
+ plugin_script_close_buffers (weechat_plugin, script);
- /* close buffer */
- if (ptr_script_cb->buffer)
- weechat_buffer_close (ptr_script_cb->buffer);
+ plugin_script_remove_bar_items (weechat_plugin, script);
- /* remove bar item */
- if (ptr_script_cb->bar_item)
- weechat_bar_item_remove (ptr_script_cb->bar_item);
-
- /*
- * remove same pointers in other callbacks
- * (to not free two times the same pointer!)
- */
- for (ptr_script_cb2 = ptr_script_cb->next_callback; ptr_script_cb2;
- ptr_script_cb2 = ptr_script_cb2->next_callback)
- {
- if (ptr_script_cb2->config_file == ptr_script_cb->config_file)
- ptr_script_cb2->config_file = NULL;
- if (ptr_script_cb2->config_section == ptr_script_cb->config_section)
- ptr_script_cb2->config_section = NULL;
- if (ptr_script_cb2->config_option == ptr_script_cb->config_option)
- ptr_script_cb2->config_option = NULL;
- if (ptr_script_cb2->hook == ptr_script_cb->hook)
- ptr_script_cb2->hook = NULL;
- if (ptr_script_cb2->buffer == ptr_script_cb->buffer)
- ptr_script_cb2->buffer = NULL;
- if (ptr_script_cb2->bar_item == ptr_script_cb->bar_item)
- ptr_script_cb2->bar_item = NULL;
- if (ptr_script_cb2->upgrade_file == ptr_script_cb->upgrade_file)
- ptr_script_cb2->upgrade_file = NULL;
- }
- }
+ plugin_script_remove_configs (weechat_plugin, script);
- /* remove all callbacks created by this script */
- plugin_script_callback_remove_all (script);
+ /* remove all hooks created by this script */
+ weechat_unhook_all_plugin (script->name);
/* free data */
if (script->filename)
@@ -1385,7 +1509,6 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
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, str_hdata_callback);
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);
@@ -1529,7 +1652,6 @@ plugin_script_print_log (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts)
{
struct t_plugin_script *ptr_script;
- struct t_plugin_script_cb *ptr_script_cb;
weechat_log_printf ("");
weechat_log_printf ("***** \"%s\" plugin dump *****",
@@ -1549,16 +1671,9 @@ plugin_script_print_log (struct t_weechat_plugin *weechat_plugin,
weechat_log_printf (" description . . . . : '%s'", ptr_script->description);
weechat_log_printf (" shutdown_func . . . : '%s'", ptr_script->shutdown_func);
weechat_log_printf (" charset . . . . . . : '%s'", ptr_script->charset);
- weechat_log_printf (" callbacks . . . . . : 0x%lx", ptr_script->callbacks);
weechat_log_printf (" unloading . . . . . : %d", ptr_script->unloading);
weechat_log_printf (" prev_script . . . . : 0x%lx", ptr_script->prev_script);
weechat_log_printf (" next_script . . . . : 0x%lx", ptr_script->next_script);
-
- for (ptr_script_cb = ptr_script->callbacks; ptr_script_cb;
- ptr_script_cb = ptr_script_cb->next_callback)
- {
- plugin_script_callback_print_log (weechat_plugin, ptr_script_cb);
- }
}
weechat_log_printf ("");
diff --git a/src/plugins/plugin-script.h b/src/plugins/plugin-script.h
index d92b30d3b..11a93001d 100644
--- a/src/plugins/plugin-script.h
+++ b/src/plugins/plugin-script.h
@@ -61,7 +61,6 @@ struct t_plugin_script
char *description; /* plugin description */
char *shutdown_func; /* function when script is unloaded*/
char *charset; /* script charset */
- struct t_plugin_script_cb *callbacks; /* callbacks for script */
int unloading; /* script is being unloaded */
struct t_plugin_script *prev_script; /* link to previous script */
struct t_plugin_script *next_script; /* link to next script */
@@ -69,27 +68,31 @@ struct t_plugin_script
struct t_plugin_script_init
{
- int (*callback_command)(void *data, struct t_gui_buffer *buffer,
+ int (*callback_command)(const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol);
- int (*callback_completion)(void *data, const char *completion_item,
+ int (*callback_completion)(const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion);
- struct t_hdata *(*callback_hdata)(void *data,
+ struct t_hdata *(*callback_hdata)(const void *pointer,
+ void *data,
const char *hdata_name);
- struct t_infolist *(*callback_infolist)(void *data,
+ struct t_infolist *(*callback_infolist)(const void *pointer,
+ void *data,
const char *infolist_name,
- void *pointer,
+ void *obj_pointer,
const char *arguments);
- int (*callback_signal_debug_dump)(void *data, const char *signal,
+ int (*callback_signal_debug_dump)(const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data);
- int (*callback_signal_debug_libs)(void *data, const char *signal,
+ int (*callback_signal_debug_libs)(const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data);
- int (*callback_signal_buffer_closed)(void *data, const char *signal,
- const char *type_data,
- void *signal_data);
- int (*callback_signal_script_action)(void *data, const char *signal,
+ int (*callback_signal_script_action)(const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data);
void (*callback_load_file)(void *data, const char *filename);
@@ -105,8 +108,14 @@ extern void *plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
const char *script_name,
const char *function_name,
const char *pointer_str);
+extern char *plugin_script_build_function_and_data (const char *function,
+ const char *data);
+extern void plugin_script_get_function_and_data (void *callback_data,
+ const char **function,
+ const char **data);
extern void plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
- void (*callback)(void *data, const char *filename));
+ void (*callback)(void *data,
+ const char *filename));
extern struct t_plugin_script *plugin_script_search (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
const char *name);
@@ -122,13 +131,13 @@ extern struct t_plugin_script *plugin_script_add (struct t_weechat_plugin *weech
extern void plugin_script_set_buffer_callbacks (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts,
struct t_plugin_script *script,
- int (*callback_buffer_input) (void *data,
+ int (*callback_buffer_input) (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data),
- int (*callback_buffer_close) (void *data,
+ int (*callback_buffer_close) (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer));
-extern void plugin_script_remove_buffer_callbacks (struct t_plugin_script *scripts,
- struct t_gui_buffer *buffer);
extern void plugin_script_remove (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script **scripts,
struct t_plugin_script **last_script,
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 73c842656..979ea1ff0 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -775,7 +775,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
new_plugin->hook_focus = &hook_focus;
new_plugin->hook_set = &hook_set;
new_plugin->unhook = &unhook;
- new_plugin->unhook_all = &unhook_all_plugin;
+ new_plugin->unhook_all_plugin = &unhook_all_plugin;
new_plugin->buffer_new = &gui_buffer_new;
new_plugin->buffer_search = &gui_buffer_search_by_name;
@@ -939,11 +939,11 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
*/
void
-plugin_auto_load_file (void *args, const char *filename)
+plugin_auto_load_file (void *data, const char *filename)
{
struct t_plugin_args *plugin_args;
- plugin_args = (struct t_plugin_args *)args;
+ plugin_args = (struct t_plugin_args *)data;
if (plugin_check_extension_allowed (filename))
plugin_load (filename, 0, plugin_args->argc, plugin_args->argv);
@@ -954,7 +954,8 @@ plugin_auto_load_file (void *args, const char *filename)
*/
int
-plugin_arraylist_cmp_cb (void *data, struct t_arraylist *arraylist,
+plugin_arraylist_cmp_cb (void *data,
+ struct t_arraylist *arraylist,
void *pointer1, void *pointer2)
{
struct t_weechat_plugin *plugin1, *plugin2;
@@ -1009,8 +1010,7 @@ plugin_auto_load (int argc, char **argv)
plugin_path2 : ((plugin_path) ?
plugin_path : CONFIG_STRING(config_plugin_path)),
0,
- &plugin_args,
- &plugin_auto_load_file);
+ &plugin_auto_load_file, &plugin_args);
if (plugin_path)
free (plugin_path);
if (plugin_path2)
@@ -1023,7 +1023,8 @@ plugin_auto_load (int argc, char **argv)
if (dir_name)
{
snprintf (dir_name, length, "%s/plugins", WEECHAT_LIBDIR);
- util_exec_on_files (dir_name, 0, &plugin_args, &plugin_auto_load_file);
+ util_exec_on_files (dir_name, 0,
+ &plugin_auto_load_file, &plugin_args);
free (dir_name);
}
@@ -1106,7 +1107,7 @@ plugin_remove (struct t_weechat_plugin *plugin)
config_file_free_all_plugin (plugin);
/* remove all hooks */
- unhook_all_plugin (plugin);
+ unhook_all_plugin (plugin, NULL);
/* remove all infolists */
infolist_free_all_plugin (plugin);
@@ -1342,11 +1343,13 @@ plugin_end ()
*/
struct t_hdata *
-plugin_hdata_plugin_cb (void *data, const char *hdata_name)
+plugin_hdata_plugin_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin",
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index c605079f6..51ad43516 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -46,7 +46,8 @@ extern void plugin_unload_all ();
extern void plugin_reload_name (const char *name, int argc, char **argv);
extern void plugin_init (int auto_load, int argc, char *argv[]);
extern void plugin_end ();
-extern struct t_hdata *plugin_hdata_plugin_cb (void *data,
+extern struct t_hdata *plugin_hdata_plugin_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int plugin_add_to_infolist (struct t_infolist *infolist,
struct t_weechat_plugin *plugin);
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index cce3cd9ea..7f6634c8a 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -29,7 +29,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-python.h"
@@ -749,24 +748,26 @@ API_FUNC(list_free)
}
int
-weechat_python_api_config_reload_cb (void *data,
+weechat_python_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -808,29 +809,31 @@ API_FUNC(config_new)
}
int
-weechat_python_api_config_read_cb (void *data,
+weechat_python_api_config_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -852,26 +855,28 @@ weechat_python_api_config_read_cb (void *data,
}
int
-weechat_python_api_config_section_write_cb (void *data,
+weechat_python_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -891,26 +896,28 @@ weechat_python_api_config_section_write_cb (void *data,
}
int
-weechat_python_api_config_section_write_default_cb (void *data,
+weechat_python_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -930,30 +937,32 @@ weechat_python_api_config_section_write_default_cb (void *data,
}
int
-weechat_python_api_config_section_create_option_cb (void *data,
+weechat_python_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -975,28 +984,30 @@ weechat_python_api_config_section_create_option_cb (void *data,
}
int
-weechat_python_api_config_section_delete_option_cb (void *data,
+weechat_python_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1052,27 +1063,29 @@ API_FUNC(config_new_section)
&data_delete_option))
API_WRONG_ARGS(API_RETURN_EMPTY);
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(config_file),
- name,
- user_can_add_options,
- user_can_delete_options,
- &weechat_python_api_config_read_cb,
- function_read,
- data_read,
- &weechat_python_api_config_section_write_cb,
- function_write,
- data_write,
- &weechat_python_api_config_section_write_default_cb,
- function_write_default,
- data_write_default,
- &weechat_python_api_config_section_create_option_cb,
- function_create_option,
- data_create_option,
- &weechat_python_api_config_section_delete_option_cb,
- function_delete_option,
- data_delete_option));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_python_plugin,
+ python_current_script,
+ API_STR2PTR(config_file),
+ name,
+ user_can_add_options,
+ user_can_delete_options,
+ &weechat_python_api_config_read_cb,
+ function_read,
+ data_read,
+ &weechat_python_api_config_section_write_cb,
+ function_write,
+ data_write,
+ &weechat_python_api_config_section_write_default_cb,
+ function_write_default,
+ data_write_default,
+ &weechat_python_api_config_section_create_option_cb,
+ function_create_option,
+ data_create_option,
+ &weechat_python_api_config_section_delete_option_cb,
+ function_delete_option,
+ data_delete_option));
API_RETURN_STRING_FREE(result);
}
@@ -1095,26 +1108,29 @@ API_FUNC(config_search_section)
}
int
-weechat_python_api_config_option_check_value_cb (void *data,
+weechat_python_api_config_option_check_value_cb (const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1134,24 +1150,26 @@ weechat_python_api_config_option_check_value_cb (void *data,
}
void
-weechat_python_api_config_option_change_cb (void *data,
+weechat_python_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1163,24 +1181,26 @@ weechat_python_api_config_option_change_cb (void *data,
}
void
-weechat_python_api_config_option_delete_cb (void *data,
+weechat_python_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1606,9 +1626,7 @@ API_FUNC(config_option_free)
if (!PyArg_ParseTuple (args, "s", &option))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_option_free (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(option));
+ weechat_config_option_free (API_STR2PTR(option));
API_RETURN_OK;
}
@@ -1622,9 +1640,7 @@ API_FUNC(config_section_free_options)
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free_options (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(section));
+ weechat_config_section_free_options (API_STR2PTR(section));
API_RETURN_OK;
}
@@ -1638,9 +1654,7 @@ API_FUNC(config_section_free)
if (!PyArg_ParseTuple (args, "s", &section))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(section));
+ weechat_config_section_free (API_STR2PTR(section));
API_RETURN_OK;
}
@@ -1654,9 +1668,7 @@ API_FUNC(config_free)
if (!PyArg_ParseTuple (args, "s", &config_file))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_free (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(config_file));
+ weechat_config_free (API_STR2PTR(config_file));
API_RETURN_OK;
}
@@ -1915,28 +1927,31 @@ API_FUNC(log_print)
}
int
-weechat_python_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_python_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1988,25 +2003,28 @@ API_FUNC(hook_command)
}
int
-weechat_python_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_python_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2048,26 +2066,29 @@ API_FUNC(hook_command_run)
}
int
-weechat_python_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_python_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2113,25 +2134,27 @@ API_FUNC(hook_timer)
}
int
-weechat_python_api_hook_fd_cb (void *data, int fd)
+weechat_python_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2179,28 +2202,30 @@ API_FUNC(hook_fd)
}
int
-weechat_python_api_hook_process_cb (void *data,
+weechat_python_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = PyLong_FromLong((long)return_code);
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssOss", func_argv);
if (!rc)
@@ -2284,33 +2309,36 @@ API_FUNC(hook_process_hashtable)
}
int
-weechat_python_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_python_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2366,28 +2394,31 @@ API_FUNC(hook_connect)
}
int
-weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_python_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2398,9 +2429,9 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssOOss", func_argv);
if (!rc)
@@ -2460,20 +2491,23 @@ API_FUNC(hook_print)
}
int
-weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
+weechat_python_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2498,9 +2532,9 @@ weechat_python_api_hook_signal_cb (void *data, const char *signal, const char *t
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2579,25 +2613,28 @@ API_FUNC(hook_signal_send)
}
int
-weechat_python_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_python_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssO", func_argv);
if (!rc)
@@ -2667,24 +2704,27 @@ API_FUNC(hook_hsignal_send)
}
int
-weechat_python_api_hook_config_cb (void *data, const char *option, const char *value)
+weechat_python_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2724,27 +2764,30 @@ API_FUNC(hook_config)
}
int
-weechat_python_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_python_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -2830,25 +2873,29 @@ API_FUNC(hook_completion_list_add)
}
char *
-weechat_python_api_hook_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+weechat_python_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_python_exec (script_callback->script,
+ return (char *)weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -2895,24 +2942,27 @@ API_FUNC(hook_modifier_exec)
}
const char *
-weechat_python_api_hook_info_cb (void *data, const char *info_name,
+weechat_python_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_python_exec (script_callback->script,
+ return (const char *)weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -2947,25 +2997,28 @@ API_FUNC(hook_info)
}
struct t_hashtable *
-weechat_python_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_python_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_hashtable *ret_hashtable;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = weechat_python_hashtable_to_dict (hashtable);
- ret_hashtable = weechat_python_exec (script_callback->script,
+ ret_hashtable = weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
+ ptr_function,
"ssO", func_argv);
if (func_argv[2])
@@ -3011,27 +3064,31 @@ API_FUNC(hook_info_hashtable)
}
struct t_infolist *
-weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_python_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_python_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_python_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -3074,24 +3131,26 @@ API_FUNC(hook_infolist)
}
struct t_hashtable *
-weechat_python_api_hook_focus_cb (void *data,
+weechat_python_api_hook_focus_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_hashtable *ret_hashtable;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = weechat_python_hashtable_to_dict (info);
- ret_hashtable = weechat_python_exec (script_callback->script,
+ ret_hashtable = weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
+ ptr_function,
"sO", func_argv);
if (func_argv[1])
{
@@ -3153,9 +3212,7 @@ API_FUNC(unhook)
if (!PyArg_ParseTuple (args, "s", &hook))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_unhook (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(hook));
+ weechat_unhook (API_STR2PTR(hook));
API_RETURN_OK;
}
@@ -3167,31 +3224,34 @@ API_FUNC(unhook_all)
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_python_plugin, python_current_script);
+ weechat_unhook_all_plugin (python_current_script->name);
API_RETURN_OK;
}
int
-weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_python_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3210,23 +3270,26 @@ weechat_python_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer
}
int
-weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_python_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3343,9 +3406,7 @@ API_FUNC(buffer_close)
if (!PyArg_ParseTuple (args, "s", &buffer))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_buffer_close (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(buffer));
+ weechat_buffer_close (API_STR2PTR(buffer));
API_RETURN_OK;
}
@@ -3882,31 +3943,34 @@ API_FUNC(bar_item_search)
}
char *
-weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_python_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = weechat_python_hashtable_to_dict (extra_info);
- ret = (char *)weechat_python_exec (script_callback->script,
+ ret = (char *)weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssO", func_argv);
if (func_argv[1])
@@ -3923,13 +3987,13 @@ weechat_python_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_python_exec (script_callback->script,
+ ret = (char *)weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -3989,9 +4053,7 @@ API_FUNC(bar_item_remove)
if (!PyArg_ParseTuple (args, "s", &item))
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_bar_item_remove (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(item));
+ weechat_bar_item_remove (API_STR2PTR(item));
API_RETURN_OK;
}
@@ -4814,67 +4876,33 @@ API_FUNC(hdata_get_string)
API_RETURN_STRING(result);
}
-API_FUNC(upgrade_new)
-{
- char *filename, *result;
- int write;
- PyObject *return_value;
-
- API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- filename = NULL;
- write = 0;
- if (!PyArg_ParseTuple (args, "si", &filename, &write))
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- result = API_PTR2STR(weechat_upgrade_new (filename, write));
-
- API_RETURN_STRING_FREE(result);
-}
-
-API_FUNC(upgrade_write_object)
-{
- char *upgrade_file, *infolist;
- int object_id, rc;
-
- API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
- upgrade_file = NULL;
- object_id = 0;
- infolist = NULL;
- if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist))
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
- object_id,
- API_STR2PTR(infolist));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_python_api_upgrade_read_cb (void *data,
+weechat_python_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *) weechat_python_exec (script_callback->script,
+ rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -4895,24 +4923,60 @@ weechat_python_api_upgrade_read_cb (void *data,
return WEECHAT_RC_ERROR;
}
+API_FUNC(upgrade_new)
+{
+ char *filename, *function, *data, *result;
+ PyObject *return_value;
+
+ API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ filename = NULL;
+ function = NULL;
+ data = NULL;
+ if (!PyArg_ParseTuple (args, "sss", &filename, &function, &data))
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_python_plugin,
+ python_current_script,
+ filename,
+ &weechat_python_api_upgrade_read_cb,
+ function,
+ data));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+API_FUNC(upgrade_write_object)
+{
+ char *upgrade_file, *infolist;
+ int object_id, rc;
+
+ API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ upgrade_file = NULL;
+ object_id = 0;
+ infolist = NULL;
+ if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist))
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
+ object_id,
+ API_STR2PTR(infolist));
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(upgrade_read)
{
- char *upgrade_file, *function, *data;
+ char *upgrade_file;
int rc;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
upgrade_file = NULL;
- function = NULL;
- data = NULL;
- if (!PyArg_ParseTuple (args, "sss", &upgrade_file, &function, &data))
+ if (!PyArg_ParseTuple (args, "s", &upgrade_file))
API_WRONG_ARGS(API_RETURN_INT(0));
- rc = plugin_script_api_upgrade_read (weechat_python_plugin,
- python_current_script,
- API_STR2PTR(upgrade_file),
- &weechat_python_api_upgrade_read_cb,
- function,
- data);
+ rc = weechat_upgrade_read (API_STR2PTR(upgrade_file));
API_RETURN_INT(rc);
}
diff --git a/src/plugins/python/weechat-python-api.h b/src/plugins/python/weechat-python-api.h
index 68b434b33..131a4661c 100644
--- a/src/plugins/python/weechat-python-api.h
+++ b/src/plugins/python/weechat-python-api.h
@@ -23,10 +23,12 @@
extern PyMethodDef weechat_python_funcs[];
-extern int weechat_python_api_buffer_input_data_cb (void *data,
+extern int weechat_python_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_python_api_buffer_close_cb (void *data,
+extern int weechat_python_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
#endif /* WEECHAT_PYTHON_API_H */
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index de19aa3f8..5981df271 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -232,8 +232,7 @@ weechat_python_hashtable_to_dict (struct t_hashtable *hashtable)
return Py_None;
}
- weechat_hashtable_map_string (hashtable,
- &weechat_python_hashtable_map_cb,
+ weechat_hashtable_map_string (hashtable, &weechat_python_hashtable_map_cb,
dict);
return dict;
@@ -927,12 +926,14 @@ weechat_python_reload_name (const char *name)
*/
int
-weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_python_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -1028,11 +1029,13 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_python_completion_cb (void *data, const char *completion_item,
+weechat_python_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -1047,13 +1050,15 @@ weechat_python_completion_cb (void *data, const char *completion_item,
*/
const char *
-weechat_python_info_cb (void *data, const char *info_name,
+weechat_python_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
int rc;
struct stat stat_buf;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) arguments;
@@ -1079,9 +1084,11 @@ weechat_python_info_cb (void *data, const char *info_name,
*/
struct t_hdata *
-weechat_python_hdata_cb (void *data, const char *hdata_name)
+weechat_python_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -1094,10 +1101,12 @@ weechat_python_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_python_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_python_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -1106,7 +1115,8 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "python_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_python_plugin,
- python_scripts, pointer,
+ python_scripts,
+ obj_pointer,
arguments);
}
@@ -1118,10 +1128,12 @@ weechat_python_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_python_signal_debug_dump_cb (void *data, const char *signal,
+weechat_python_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1140,10 +1152,12 @@ weechat_python_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_python_signal_debug_libs_cb (void *data, const char *signal,
+weechat_python_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1159,38 +1173,20 @@ weechat_python_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_python_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data,
- void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (python_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_python_timer_action_cb (void *data, int remaining_calls)
+weechat_python_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &python_action_install_list)
+ if (pointer == &python_action_install_list)
{
plugin_script_action_install (weechat_python_plugin,
python_scripts,
@@ -1199,7 +1195,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
&python_quiet,
&python_action_install_list);
}
- else if (data == &python_action_remove_list)
+ else if (pointer == &python_action_remove_list)
{
plugin_script_action_remove (weechat_python_plugin,
python_scripts,
@@ -1207,7 +1203,7 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
&python_quiet,
&python_action_remove_list);
}
- else if (data == &python_action_autoload_list)
+ else if (pointer == &python_action_autoload_list)
{
plugin_script_action_autoload (weechat_python_plugin,
&python_quiet,
@@ -1224,11 +1220,13 @@ weechat_python_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_python_signal_script_action_cb (void *data, const char *signal,
+weechat_python_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -1239,7 +1237,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_python_timer_action_cb,
- &python_action_install_list);
+ &python_action_install_list, NULL);
}
else if (strcmp (signal, "python_script_remove") == 0)
{
@@ -1247,7 +1245,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_python_timer_action_cb,
- &python_action_remove_list);
+ &python_action_remove_list, NULL);
}
else if (strcmp (signal, "python_script_autoload") == 0)
{
@@ -1255,7 +1253,7 @@ weechat_python_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_python_timer_action_cb,
- &python_action_autoload_list);
+ &python_action_autoload_list, NULL);
}
}
@@ -1281,7 +1279,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hook_info ("python2_bin",
N_("path to python 2.x interpreter"),
NULL,
- &weechat_python_info_cb, NULL);
+ &weechat_python_info_cb, NULL, NULL);
/* init stdout/stderr buffer */
python_buffer_output[0] = '\0';
@@ -1319,7 +1317,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_python_infolist_cb;
init.callback_signal_debug_dump = &weechat_python_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_python_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_python_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_python_signal_script_action_cb;
init.callback_load_file = &weechat_python_load_cb;
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c
index 63c930bc8..502a7b6b9 100644
--- a/src/plugins/relay/irc/relay-irc.c
+++ b/src/plugins/relay/irc/relay-irc.c
@@ -158,8 +158,7 @@ relay_irc_message_parse (const char *message)
hash_msg = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (!hash_msg)
{
weechat_printf (NULL,
@@ -214,8 +213,7 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
hashtable_in = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hashtable_in)
{
weechat_hashtable_set (hashtable_in, "server", client->protocol_args);
@@ -258,7 +256,8 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
*/
int
-relay_irc_signal_irc_in2_cb (void *data, const char *signal,
+relay_irc_signal_irc_in2_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
struct t_relay_client *client;
@@ -266,10 +265,11 @@ relay_irc_signal_irc_in2_cb (void *data, const char *signal,
struct t_hashtable *hash_parsed;
/* make C compiler happy */
+ (void) data;
(void) signal;
(void) type_data;
- client = (struct t_relay_client *)data;
+ client = (struct t_relay_client *)pointer;
ptr_msg = (const char *)signal_data;
if (weechat_relay_plugin->debug >= 2)
@@ -368,7 +368,8 @@ relay_irc_tag_relay_client_id (const char *tags)
*/
int
-relay_irc_signal_irc_outtags_cb (void *data, const char *signal,
+relay_irc_signal_irc_outtags_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
@@ -380,10 +381,11 @@ relay_irc_signal_irc_outtags_cb (void *data, const char *signal,
char str_infolist_args[256];
/* make C compiler happy */
+ (void) data;
(void) signal;
(void) type_data;
- client = (struct t_relay_client *)data;
+ client = (struct t_relay_client *)pointer;
tags = NULL;
@@ -483,17 +485,19 @@ end:
*/
int
-relay_irc_signal_irc_disc_cb (void *data, const char *signal,
+relay_irc_signal_irc_disc_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
struct t_relay_client *client;
/* make C compiler happy */
+ (void) data;
(void) signal;
(void) type_data;
(void) signal_data;
- client = (struct t_relay_client *)data;
+ client = (struct t_relay_client *)pointer;
if (weechat_relay_plugin->debug >= 2)
{
@@ -516,7 +520,8 @@ relay_irc_signal_irc_disc_cb (void *data, const char *signal,
*/
int
-relay_irc_hsignal_irc_redir_cb (void *data, const char *signal,
+relay_irc_hsignal_irc_redir_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
struct t_relay_client *client;
@@ -524,7 +529,10 @@ relay_irc_hsignal_irc_redir_cb (void *data, const char *signal,
char pattern[128], **messages;
const char *output;
- client = (struct t_relay_client *)data;
+ /* make C compiler happy */
+ (void) data;
+
+ client = (struct t_relay_client *)pointer;
if (weechat_relay_plugin->debug >= 2)
{
@@ -1179,7 +1187,7 @@ relay_irc_hook_signals (struct t_relay_client *client)
RELAY_IRC_DATA(client, hook_signal_irc_in2) =
weechat_hook_signal (str_signal_name,
&relay_irc_signal_irc_in2_cb,
- client);
+ client, NULL);
/*
* hook signal "xxx,irc_outtags_*" to catch IRC data sent to
@@ -1191,7 +1199,7 @@ relay_irc_hook_signals (struct t_relay_client *client)
RELAY_IRC_DATA(client, hook_signal_irc_outtags) =
weechat_hook_signal (str_signal_name,
&relay_irc_signal_irc_outtags_cb,
- client);
+ client, NULL);
/*
* hook signal "irc_server_disconnected" to disconnect client if
@@ -1200,7 +1208,7 @@ relay_irc_hook_signals (struct t_relay_client *client)
RELAY_IRC_DATA(client, hook_signal_irc_disc) =
weechat_hook_signal ("irc_server_disconnected",
&relay_irc_signal_irc_disc_cb,
- client);
+ client, NULL);
/*
* hook hsignal "irc_redirection_*" to redirect some messages
@@ -1208,7 +1216,7 @@ relay_irc_hook_signals (struct t_relay_client *client)
RELAY_IRC_DATA(client, hook_hsignal_irc_redir) =
weechat_hook_hsignal ("irc_redirection_relay_*",
&relay_irc_hsignal_irc_redir_cb,
- client);
+ client, NULL);
}
/*
@@ -1609,8 +1617,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
hash_redirect = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hash_redirect)
{
redirect_msg = 0;
diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c
index 502384e4e..fe7751c48 100644
--- a/src/plugins/relay/relay-buffer.c
+++ b/src/plugins/relay/relay-buffer.c
@@ -152,12 +152,14 @@ relay_buffer_refresh (const char *hotlist)
*/
int
-relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+relay_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_relay_client *client, *ptr_client, *next_client;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (buffer == relay_raw_buffer)
@@ -215,9 +217,11 @@ relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+relay_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (buffer == relay_raw_buffer)
@@ -242,8 +246,8 @@ relay_buffer_open ()
if (!relay_buffer)
{
relay_buffer = weechat_buffer_new (RELAY_BUFFER_NAME,
- &relay_buffer_input_cb, NULL,
- &relay_buffer_close_cb, NULL);
+ &relay_buffer_input_cb, NULL, NULL,
+ &relay_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then exit */
if (!relay_buffer)
diff --git a/src/plugins/relay/relay-buffer.h b/src/plugins/relay/relay-buffer.h
index a377f4340..09f316a70 100644
--- a/src/plugins/relay/relay-buffer.h
+++ b/src/plugins/relay/relay-buffer.h
@@ -26,9 +26,11 @@ extern struct t_gui_buffer *relay_buffer;
extern int relay_buffer_selected_line;
extern void relay_buffer_refresh (const char *hotlist);
-extern int relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
- const char *input_data);
-extern int relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
+extern int relay_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
+ const char *input_data);
+extern int relay_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer);
extern void relay_buffer_open ();
#endif /* WEECHAT_RELAY_BUFFER_H */
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index 76d66d263..684a8dd10 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -231,12 +231,16 @@ relay_client_set_desc (struct t_relay_client *client)
#ifdef HAVE_GNUTLS
int
-relay_client_handshake_timer_cb (void *data, int remaining_calls)
+relay_client_handshake_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_relay_client *client;
int rc;
- client = (struct t_relay_client *)data;
+ /* make C compiler happy */
+ (void) data;
+
+ client = (struct t_relay_client *)pointer;
rc = gnutls_handshake (client->gnutls_sess);
@@ -528,7 +532,7 @@ relay_client_recv_text_buffer (struct t_relay_client *client,
*/
int
-relay_client_recv_cb (void *arg_client, int fd)
+relay_client_recv_cb (const void *pointer, void *data, int fd)
{
struct t_relay_client *client;
static char buffer[4096], decoded[8192 + 1];
@@ -537,9 +541,10 @@ relay_client_recv_cb (void *arg_client, int fd)
unsigned long long decoded_length, length_buffer;
/* make C compiler happy */
+ (void) data;
(void) fd;
- client = (struct t_relay_client *)arg_client;
+ client = (struct t_relay_client *)pointer;
if (client->status != RELAY_STATUS_CONNECTED)
return WEECHAT_RC_OK;
@@ -572,11 +577,11 @@ relay_client_recv_cb (void *arg_client, int fd)
* valid or not)
*/
client->websocket = 1;
- client->http_headers = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ client->http_headers = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
}
}
@@ -1003,7 +1008,7 @@ relay_client_send (struct t_relay_client *client,
*/
int
-relay_client_timer_cb (void *data, int remaining_calls)
+relay_client_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_relay_client *ptr_client, *ptr_next_client;
int num_sent, i, purge_delay;
@@ -1011,6 +1016,7 @@ relay_client_timer_cb (void *data, int remaining_calls)
time_t current_time;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) remaining_calls;
@@ -1275,7 +1281,8 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
(ptr_option) ?
weechat_config_integer (ptr_option) * 10 : 30 * 10,
&relay_client_handshake_timer_cb,
- new_client);
+ new_client,
+ NULL);
}
#endif /* HAVE_GNUTLS */
@@ -1314,7 +1321,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
new_client->hook_fd = weechat_hook_fd (new_client->sock,
1, 0, 0,
&relay_client_recv_cb,
- new_client);
+ new_client, NULL);
relay_client_count++;
@@ -1380,7 +1387,8 @@ relay_client_new_with_infolist (struct t_infolist *infolist)
new_client->hook_fd = weechat_hook_fd (new_client->sock,
1, 0, 0,
&relay_client_recv_cb,
- new_client);
+ new_client,
+ NULL);
}
else
new_client->hook_fd = NULL;
diff --git a/src/plugins/relay/relay-client.h b/src/plugins/relay/relay-client.h
index 89f3166cd..f76eaacd7 100644
--- a/src/plugins/relay/relay-client.h
+++ b/src/plugins/relay/relay-client.h
@@ -131,12 +131,13 @@ extern struct t_relay_client *relay_client_search_by_id (int id);
extern int relay_client_status_search (const char *name);
extern int relay_client_count_active_by_port (int server_port);
extern void relay_client_set_desc (struct t_relay_client *client);
-extern int relay_client_recv_cb (void *arg_client, int fd);
+extern int relay_client_recv_cb (const void *pointer, void *data, int fd);
extern int relay_client_send (struct t_relay_client *client,
enum t_relay_client_msg_type msg_type,
const char *data,
int data_size, const char *message_raw_buffer);
-extern int relay_client_timer_cb (void *data, int remaining_calls);
+extern int relay_client_timer_cb (const void *pointer, void *data,
+ int remaining_calls);
extern struct t_relay_client *relay_client_new (int sock, const char *address,
struct t_relay_server *server);
extern struct t_relay_client *relay_client_new_with_infolist (struct t_infolist *infolist);
diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c
index e795bdeaa..8774d3923 100644
--- a/src/plugins/relay/relay-command.c
+++ b/src/plugins/relay/relay-command.c
@@ -183,7 +183,8 @@ relay_command_server_list ()
*/
int
-relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
+relay_command_relay (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_relay_server *ptr_server;
@@ -191,6 +192,7 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
int port;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -217,11 +219,12 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc,
if (weechat_strcasecmp (argv[1], "add") == 0)
{
WEECHAT_COMMAND_MIN_ARGS(4, "add");
- if (relay_config_create_option_port (NULL,
- relay_config_file,
- relay_config_section_port,
- argv[2],
- argv_eol[3]) != WEECHAT_CONFIG_OPTION_SET_ERROR)
+ if (relay_config_create_option_port (
+ NULL, NULL,
+ relay_config_file,
+ relay_config_section_port,
+ argv[2],
+ argv_eol[3]) != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
weechat_printf (NULL,
_("%s: relay \"%s\" (port %s) added"),
@@ -420,5 +423,5 @@ relay_command_init ()
" || restart %(relay_relays)"
" || raw"
" || sslcertkey",
- &relay_command_relay, NULL);
+ &relay_command_relay, NULL, NULL);
}
diff --git a/src/plugins/relay/relay-completion.c b/src/plugins/relay/relay-completion.c
index b1fed1062..e5253714a 100644
--- a/src/plugins/relay/relay-completion.c
+++ b/src/plugins/relay/relay-completion.c
@@ -33,7 +33,8 @@
*/
int
-relay_completion_protocol_name_cb (void *data, const char *completion_item,
+relay_completion_protocol_name_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -41,6 +42,7 @@ relay_completion_protocol_name_cb (void *data, const char *completion_item,
char protocol_name[512];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) completion_item;
@@ -75,13 +77,15 @@ relay_completion_protocol_name_cb (void *data, const char *completion_item,
*/
int
-relay_completion_relays_cb (void *data, const char *completion_item,
+relay_completion_relays_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) completion_item;
@@ -102,7 +106,8 @@ relay_completion_relays_cb (void *data, const char *completion_item,
*/
int
-relay_completion_free_port_cb (void *data, const char *completion_item,
+relay_completion_free_port_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -111,6 +116,7 @@ relay_completion_free_port_cb (void *data, const char *completion_item,
int port_max;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) completion_item;
@@ -141,12 +147,12 @@ relay_completion_init ()
{
weechat_hook_completion ("relay_protocol_name",
N_("all possible protocol.name for relay plugin"),
- &relay_completion_protocol_name_cb, NULL);
+ &relay_completion_protocol_name_cb, NULL, NULL);
weechat_hook_completion ("relay_relays",
N_("protocol.name of current relays for relay "
"plugin"),
- &relay_completion_relays_cb, NULL);
+ &relay_completion_relays_cb, NULL, NULL);
weechat_hook_completion ("relay_free_port",
N_("first free port for relay plugin"),
- &relay_completion_free_port_cb, NULL);
+ &relay_completion_free_port_cb, NULL, NULL);
}
diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c
index 6d12a24d4..3d979ee01 100644
--- a/src/plugins/relay/relay-config.c
+++ b/src/plugins/relay/relay-config.c
@@ -84,9 +84,11 @@ struct t_hashtable *relay_config_hashtable_irc_backlog_tags = NULL;
*/
void
-relay_config_refresh_cb (void *data, struct t_config_option *option)
+relay_config_refresh_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -99,12 +101,13 @@ relay_config_refresh_cb (void *data, struct t_config_option *option)
*/
void
-relay_config_change_network_allowed_ips (void *data,
+relay_config_change_network_allowed_ips (const void *pointer, void *data,
struct t_config_option *option)
{
const char *allowed_ips;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -137,12 +140,13 @@ relay_config_change_network_allowed_ips (void *data,
*/
void
-relay_config_change_network_bind_address_cb (void *data,
+relay_config_change_network_bind_address_cb (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -159,11 +163,13 @@ relay_config_change_network_bind_address_cb (void *data,
*/
void
-relay_config_change_network_ipv6_cb (void *data, struct t_config_option *option)
+relay_config_change_network_ipv6_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -183,10 +189,11 @@ relay_config_change_network_ipv6_cb (void *data, struct t_config_option *option)
*/
void
-relay_config_change_network_ssl_cert_key (void *data,
+relay_config_change_network_ssl_cert_key (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -199,7 +206,7 @@ relay_config_change_network_ssl_cert_key (void *data,
*/
int
-relay_config_check_network_ssl_priorities (void *data,
+relay_config_check_network_ssl_priorities (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
@@ -209,6 +216,7 @@ relay_config_check_network_ssl_priorities (void *data,
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -246,10 +254,11 @@ relay_config_check_network_ssl_priorities (void *data,
*/
void
-relay_config_change_network_ssl_priorities (void *data,
+relay_config_change_network_ssl_priorities (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -267,12 +276,13 @@ relay_config_change_network_ssl_priorities (void *data,
*/
void
-relay_config_change_network_websocket_allowed_origins (void *data,
+relay_config_change_network_websocket_allowed_origins (const void *pointer, void *data,
struct t_config_option *option)
{
const char *allowed_origins;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -309,7 +319,7 @@ relay_config_change_network_websocket_allowed_origins (void *data,
*/
int
-relay_config_check_irc_backlog_tags (void *data,
+relay_config_check_irc_backlog_tags (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
@@ -317,6 +327,7 @@ relay_config_check_irc_backlog_tags (void *data,
int num_tags, i, rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -349,23 +360,24 @@ relay_config_check_irc_backlog_tags (void *data,
*/
void
-relay_config_change_irc_backlog_tags (void *data,
+relay_config_change_irc_backlog_tags (const void *pointer, void *data,
struct t_config_option *option)
{
char **items;
int num_items, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
if (!relay_config_hashtable_irc_backlog_tags)
{
- relay_config_hashtable_irc_backlog_tags = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ relay_config_hashtable_irc_backlog_tags = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (relay_config_hashtable_irc_backlog_tags);
@@ -393,7 +405,8 @@ relay_config_change_irc_backlog_tags (void *data,
*/
int
-relay_config_check_port_cb (void *data, struct t_config_option *option,
+relay_config_check_port_cb (const void *pointer, void *data,
+ struct t_config_option *option,
const char *value)
{
char *error;
@@ -401,6 +414,7 @@ relay_config_check_port_cb (void *data, struct t_config_option *option,
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -423,11 +437,13 @@ relay_config_check_port_cb (void *data, struct t_config_option *option,
*/
void
-relay_config_change_port_cb (void *data, struct t_config_option *option)
+relay_config_change_port_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
@@ -443,11 +459,13 @@ relay_config_change_port_cb (void *data, struct t_config_option *option)
*/
void
-relay_config_delete_port_cb (void *data, struct t_config_option *option)
+relay_config_delete_port_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_server = relay_server_search (weechat_config_option_get_pointer (option, "name"));
@@ -460,7 +478,7 @@ relay_config_delete_port_cb (void *data, struct t_config_option *option)
*/
int
-relay_config_create_option_port (void *data,
+relay_config_create_option_port (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
@@ -472,6 +490,7 @@ relay_config_create_option_port (void *data,
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
@@ -551,9 +570,9 @@ relay_config_create_option_port (void *data,
config_file, section,
option_name, "integer", NULL,
NULL, 0, 65535, "", value, 0,
- &relay_config_check_port_cb, NULL,
- &relay_config_change_port_cb, NULL,
- &relay_config_delete_port_cb, NULL);
+ &relay_config_check_port_cb, NULL, NULL,
+ &relay_config_change_port_cb, NULL, NULL,
+ &relay_config_delete_port_cb, NULL, NULL);
rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
else
@@ -573,9 +592,11 @@ relay_config_create_option_port (void *data,
*/
int
-relay_config_reload (void *data, struct t_config_file *config_file)
+relay_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
weechat_config_section_free_options (relay_config_section_port);
@@ -598,16 +619,18 @@ relay_config_init ()
struct t_config_section *ptr_section;
relay_config_file = weechat_config_new (RELAY_CONFIG_NAME,
- &relay_config_reload, NULL);
+ &relay_config_reload, NULL, NULL);
if (!relay_config_file)
return 0;
/* section look */
ptr_section = weechat_config_new_section (relay_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (relay_config_file);
@@ -618,20 +641,24 @@ relay_config_init ()
relay_config_file, ptr_section,
"auto_open_buffer", "boolean",
N_("auto open relay buffer when a new client is connecting"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_look_raw_messages = weechat_config_new_option (
relay_config_file, ptr_section,
"raw_messages", "integer",
N_("number of raw messages to save in memory when raw data buffer is "
"closed (messages will be displayed when opening raw data buffer)"),
- NULL, 0, 65535, "256", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 65535, "256", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* section color */
ptr_section = weechat_config_new_section (relay_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (relay_config_file);
@@ -643,62 +670,80 @@ relay_config_init ()
"client", "color",
N_("text color for client description"),
NULL, 0, 0, "cyan", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_connecting", "color",
N_("text color for \"connecting\" status"),
NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_waiting_auth", "color",
N_("text color for \"waiting authentication\" status"),
NULL, 0, 0, "brown", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_active", "color",
N_("text color for \"connected\" status"),
NULL, 0, 0, "lightblue", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_auth_failed", "color",
N_("text color for \"authentication failed\" status"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option (
relay_config_file, ptr_section,
"status_disconnected", "color",
N_("text color for \"disconnected\" status"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_text = weechat_config_new_option (
relay_config_file, ptr_section,
"text", "color",
N_("text color in relay buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_text_bg = weechat_config_new_option (
relay_config_file, ptr_section,
"text_bg", "color",
N_("background color in relay buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_color_text_selected = weechat_config_new_option (
relay_config_file, ptr_section,
"text_selected", "color",
N_("text color of selected line in relay buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &relay_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
/* section network */
ptr_section = weechat_config_new_section (relay_config_file, "network",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (relay_config_file);
@@ -712,23 +757,27 @@ relay_config_init ()
"(case insensitive, use \"(?-i)\" at beginning to make it case "
"sensitive), example: "
"\"^(123.45.67.89|192.160.*)$\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &relay_config_change_network_allowed_ips, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &relay_config_change_network_allowed_ips, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_network_bind_address = weechat_config_new_option (
relay_config_file, ptr_section,
"bind_address", "string",
N_("address for bind (if empty, connection is possible on all "
"interfaces, use \"127.0.0.1\" to allow connections from "
"local machine only)"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &relay_config_change_network_bind_address_cb, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &relay_config_change_network_bind_address_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_network_clients_purge_delay = weechat_config_new_option (
relay_config_file, ptr_section,
"clients_purge_delay", "integer",
N_("delay for purging disconnected clients (in minutes, 0 = purge "
"clients immediately, -1 = never purge)"),
NULL, -1, 60 * 24 * 30, "0", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_compression_level = weechat_config_new_option (
relay_config_file, ptr_section,
"compression_level", "integer",
@@ -736,35 +785,40 @@ relay_config_init ()
"(0 = disable compression, 1 = low compression ... 9 = best "
"compression)"),
NULL, 0, 9, "6", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_ipv6 = weechat_config_new_option (
relay_config_file, ptr_section,
"ipv6", "boolean",
N_("listen on IPv6 socket by default (in addition to IPv4 which is "
"default); protocols IPv4 and IPv6 can be forced (individually or "
"together) in the protocol name (see /help relay)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- &relay_config_change_network_ipv6_cb, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &relay_config_change_network_ipv6_cb, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_network_max_clients = weechat_config_new_option (
relay_config_file, ptr_section,
"max_clients", "integer",
N_("maximum number of clients connecting to a port (0 = no limit)"),
NULL, 0, INT_MAX, "5", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_password = weechat_config_new_option (
relay_config_file, ptr_section,
"password", "string",
N_("password required by clients to access this relay (empty value "
"means no password required) (note: content is evaluated, see "
"/help eval)"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_network_ssl_cert_key = weechat_config_new_option (
relay_config_file, ptr_section,
"ssl_cert_key", "string",
N_("file with SSL certificate and private key (for serving clients "
"with SSL)"),
- NULL, 0, 0, "%h/ssl/relay.pem", NULL, 0, NULL, NULL,
- &relay_config_change_network_ssl_cert_key, NULL, NULL, NULL);
+ NULL, 0, 0, "%h/ssl/relay.pem", NULL, 0,
+ NULL, NULL, NULL,
+ &relay_config_change_network_ssl_cert_key, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_network_ssl_priorities = weechat_config_new_option (
relay_config_file, ptr_section,
"ssl_priorities", "string",
@@ -773,8 +827,9 @@ relay_config_init ()
"manual, common strings are: \"PERFORMANCE\", \"NORMAL\", "
"\"SECURE128\", \"SECURE256\", \"EXPORT\", \"NONE\")"),
NULL, 0, 0, "NORMAL:-VERS-SSL3.0", NULL, 0,
- &relay_config_check_network_ssl_priorities, NULL,
- &relay_config_change_network_ssl_priorities, NULL, NULL, NULL);
+ &relay_config_check_network_ssl_priorities, NULL, NULL,
+ &relay_config_change_network_ssl_priorities, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_network_websocket_allowed_origins = weechat_config_new_option (
relay_config_file, ptr_section,
"websocket_allowed_origins", "string",
@@ -782,15 +837,19 @@ relay_config_init ()
"websockets (case insensitive, use \"(?-i)\" at beginning to make "
"it case sensitive), example: "
"\"^http://(www\\.)?example\\.(com|org)\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &relay_config_change_network_websocket_allowed_origins, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &relay_config_change_network_websocket_allowed_origins, NULL, NULL,
+ NULL, NULL, NULL);
/* section irc */
ptr_section = weechat_config_new_section (relay_config_file, "irc",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (relay_config_file);
@@ -804,24 +863,26 @@ relay_config_init ()
"(0 = unlimited, examples: 1440 = one day, 10080 = one week, "
"43200 = one month, 525600 = one year)"),
NULL, 0, INT_MAX, "1440", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_irc_backlog_max_number = weechat_config_new_option (
relay_config_file, ptr_section,
"backlog_max_number", "integer",
N_("maximum number of lines in backlog per IRC channel "
"(0 = unlimited)"),
NULL, 0, INT_MAX, "256", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_irc_backlog_since_last_disconnect = weechat_config_new_option (
relay_config_file, ptr_section,
"backlog_since_last_disconnect", "boolean",
N_("display backlog starting from last client disconnect"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_irc_backlog_since_last_message = weechat_config_new_option (
relay_config_file, ptr_section,
"backlog_since_last_message", "boolean",
N_("display backlog starting from your last message"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
relay_config_irc_backlog_tags = weechat_config_new_option (
relay_config_file, ptr_section,
"backlog_tags", "string",
@@ -830,8 +891,9 @@ relay_config_init ()
"\"irc_part\", \"irc_quit\", \"irc_nick\", \"irc_privmsg\"), "
"\"*\" = all supported tags"),
NULL, 0, 0, "irc_privmsg", NULL, 0,
- &relay_config_check_irc_backlog_tags, NULL,
- &relay_config_change_irc_backlog_tags, NULL, NULL, NULL);
+ &relay_config_check_irc_backlog_tags, NULL, NULL,
+ &relay_config_change_irc_backlog_tags, NULL, NULL,
+ NULL, NULL, NULL);
relay_config_irc_backlog_time_format = weechat_config_new_option (
relay_config_file, ptr_section,
"backlog_time_format", "string",
@@ -839,16 +901,18 @@ relay_config_init ()
"(not used if server capability \"server-time\" was enabled by "
"client, because time is sent as irc tag); empty string = disable "
"time in backlog messages"),
- NULL, 0, 0, "[%H:%M] ", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "[%H:%M] ", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* section port */
- ptr_section = weechat_config_new_section (relay_config_file, "port",
- 1, 1,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL,
- &relay_config_create_option_port, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ relay_config_file, "port",
+ 1, 1,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &relay_config_create_option_port, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (relay_config_file);
@@ -872,8 +936,8 @@ relay_config_read ()
rc = weechat_config_read (relay_config_file);
if (rc == WEECHAT_CONFIG_READ_OK)
{
- relay_config_change_network_allowed_ips (NULL, NULL);
- relay_config_change_irc_backlog_tags (NULL, NULL);
+ relay_config_change_network_allowed_ips (NULL, NULL, NULL);
+ relay_config_change_irc_backlog_tags (NULL, NULL, NULL);
}
return rc;
}
diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h
index 08597900c..329ffe2a4 100644
--- a/src/plugins/relay/relay-config.h
+++ b/src/plugins/relay/relay-config.h
@@ -58,7 +58,7 @@ extern regex_t *relay_config_regex_allowed_ips;
extern regex_t *relay_config_regex_websocket_allowed_origins;
extern struct t_hashtable *relay_config_hashtable_irc_backlog_tags;
-extern int relay_config_create_option_port (void *data,
+extern int relay_config_create_option_port (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c
index 123243fe7..7ec3f46cc 100644
--- a/src/plugins/relay/relay-info.c
+++ b/src/plugins/relay/relay-info.c
@@ -32,7 +32,8 @@
*/
const char *
-relay_info_info_relay_client_count_cb (void *data, const char *info_name,
+relay_info_info_relay_client_count_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
static char str_count[32];
@@ -40,6 +41,7 @@ relay_info_info_relay_client_count_cb (void *data, const char *info_name,
struct t_relay_client *ptr_client;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) info_name;
@@ -69,28 +71,30 @@ relay_info_info_relay_client_count_cb (void *data, const char *info_name,
*/
struct t_infolist *
-relay_info_infolist_relay_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+relay_info_infolist_relay_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_relay_client *ptr_client;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (pointer && !relay_client_valid (pointer))
+ if (obj_pointer && !relay_client_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one relay */
- if (!relay_client_add_to_infolist (ptr_infolist, pointer))
+ if (!relay_client_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -129,12 +133,12 @@ relay_info_init ()
/* TRANSLATORS: please do not translate the status names, they must be used in English */
N_("status name (optional): connecting, waiting_auth, "
"connected, auth_failed, disconnected"),
- &relay_info_info_relay_client_count_cb, NULL);
+ &relay_info_info_relay_client_count_cb, NULL, NULL);
/* infolist hooks */
weechat_hook_infolist (
"relay", N_("list of relay clients"),
N_("relay pointer (optional)"),
NULL,
- &relay_info_infolist_relay_cb, NULL);
+ &relay_info_infolist_relay_cb, NULL, NULL);
}
diff --git a/src/plugins/relay/relay-raw.c b/src/plugins/relay/relay-raw.c
index 5b8d32209..8f45a6ddd 100644
--- a/src/plugins/relay/relay-raw.c
+++ b/src/plugins/relay/relay-raw.c
@@ -72,9 +72,10 @@ relay_raw_open (int switch_to_buffer)
RELAY_RAW_BUFFER_NAME);
if (!relay_raw_buffer)
{
- relay_raw_buffer = weechat_buffer_new (RELAY_RAW_BUFFER_NAME,
- &relay_buffer_input_cb, NULL,
- &relay_buffer_close_cb, NULL);
+ relay_raw_buffer = weechat_buffer_new (
+ RELAY_RAW_BUFFER_NAME,
+ &relay_buffer_input_cb, NULL, NULL,
+ &relay_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then return */
if (!relay_raw_buffer)
diff --git a/src/plugins/relay/relay-server.c b/src/plugins/relay/relay-server.c
index c454a6250..b6e2cfc44 100644
--- a/src/plugins/relay/relay-server.c
+++ b/src/plugins/relay/relay-server.c
@@ -219,7 +219,7 @@ relay_server_close_socket (struct t_relay_server *server)
*/
int
-relay_server_sock_cb (void *data, int fd)
+relay_server_sock_cb (const void *pointer, void *data, int fd)
{
struct t_relay_server *server;
struct sockaddr_in client_addr;
@@ -231,9 +231,10 @@ relay_server_sock_cb (void *data, int fd)
char *ptr_ip_address;
/* make C compiler happy */
+ (void) data;
(void) fd;
- server = (struct t_relay_server *)data;
+ server = (struct t_relay_server *)pointer;
if (server->ipv6)
{
@@ -539,7 +540,7 @@ relay_server_create_socket (struct t_relay_server *server)
server->hook_fd = weechat_hook_fd (server->sock,
1, 0, 0,
&relay_server_sock_cb,
- server);
+ server, NULL);
server->start_time = time (NULL);
diff --git a/src/plugins/relay/relay-upgrade.c b/src/plugins/relay/relay-upgrade.c
index 773fabed7..5868d94a6 100644
--- a/src/plugins/relay/relay-upgrade.c
+++ b/src/plugins/relay/relay-upgrade.c
@@ -126,7 +126,8 @@ relay_upgrade_save ()
int rc;
struct t_upgrade_file *upgrade_file;
- upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME, 1);
+ upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME,
+ NULL, NULL, NULL);
if (!upgrade_file)
return 0;
@@ -179,7 +180,7 @@ relay_upgrade_set_buffer_callbacks ()
*/
int
-relay_upgrade_read_cb (void *data,
+relay_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
@@ -188,6 +189,7 @@ relay_upgrade_read_cb (void *data,
struct t_relay_server *ptr_server;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) upgrade_file;
@@ -239,10 +241,13 @@ relay_upgrade_load ()
relay_upgrade_set_buffer_callbacks ();
- upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME, 0);
+ upgrade_file = weechat_upgrade_new (RELAY_UPGRADE_FILENAME,
+ &relay_upgrade_read_cb, NULL, NULL);
if (!upgrade_file)
return 0;
- rc = weechat_upgrade_read (upgrade_file, &relay_upgrade_read_cb, NULL);
+
+ rc = weechat_upgrade_read (upgrade_file);
+
weechat_upgrade_close (upgrade_file);
return rc;
diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c
index e5b2e0482..06585ecd9 100644
--- a/src/plugins/relay/relay.c
+++ b/src/plugins/relay/relay.c
@@ -81,7 +81,8 @@ relay_protocol_search (const char *name)
*/
int
-relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
+relay_signal_upgrade_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_relay_server *ptr_server;
@@ -89,6 +90,7 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
int quit, ssl_disconnected;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -150,10 +152,12 @@ relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
*/
int
-relay_debug_dump_cb (void *data, const char *signal, const char *type_data,
+relay_debug_dump_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -203,8 +207,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
/* hook completions */
relay_completion_init ();
- weechat_hook_signal ("upgrade", &relay_signal_upgrade_cb, NULL);
- weechat_hook_signal ("debug_dump", &relay_debug_dump_cb, NULL);
+ weechat_hook_signal ("upgrade", &relay_signal_upgrade_cb, NULL, NULL);
+ weechat_hook_signal ("debug_dump", &relay_debug_dump_cb, NULL, NULL);
relay_info_init ();
@@ -222,7 +226,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
relay_upgrade_load ();
relay_hook_timer = weechat_hook_timer (1 * 1000, 0, 0,
- &relay_client_timer_cb, NULL);
+ &relay_client_timer_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c
index b84ec94d4..ff7aee795 100644
--- a/src/plugins/relay/weechat/relay-weechat-msg.c
+++ b/src/plugins/relay/weechat/relay-weechat-msg.c
@@ -253,7 +253,8 @@ relay_weechat_msg_add_time (struct t_relay_weechat_msg *msg, time_t time)
*/
void
-relay_weechat_msg_hashtable_map_cb (void *data, struct t_hashtable *hashtable,
+relay_weechat_msg_hashtable_map_cb (void *data,
+ struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_relay_weechat_msg *msg;
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c
index f216cb56f..34a59745d 100644
--- a/src/plugins/relay/weechat/relay-weechat-protocol.c
+++ b/src/plugins/relay/weechat/relay-weechat-protocol.c
@@ -359,7 +359,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(nicklist)
*/
int
-relay_weechat_protocol_input_timer_cb (void *data,
+relay_weechat_protocol_input_timer_cb (const void *pointer,
+ void *data,
int remaining_calls)
{
char **timer_args;
@@ -367,9 +368,10 @@ relay_weechat_protocol_input_timer_cb (void *data,
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- timer_args = (char **)data;
+ timer_args = (char **)pointer;
if (!timer_args)
return WEECHAT_RC_ERROR;
@@ -438,7 +440,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input)
timer_args[1] = strdup (pos + 1);
weechat_hook_timer (1, 0, 1,
&relay_weechat_protocol_input_timer_cb,
- timer_args);
+ timer_args,
+ NULL);
}
}
@@ -450,7 +453,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input)
*/
int
-relay_weechat_protocol_signal_buffer_cb (void *data, const char *signal,
+relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
@@ -463,9 +467,10 @@ relay_weechat_protocol_signal_buffer_cb (void *data, const char *signal,
char cmd_hdata[64], str_signal[128];
/* make C compiler happy */
+ (void) data;
(void) type_data;
- ptr_client = (struct t_relay_client *)data;
+ ptr_client = (struct t_relay_client *)pointer;
if (!ptr_client || !relay_client_valid (ptr_client))
return WEECHAT_RC_OK;
@@ -815,14 +820,16 @@ relay_weechat_protocol_nicklist_map_cb (void *data,
*/
int
-relay_weechat_protocol_timer_nicklist_cb (void *data, int remaining_calls)
+relay_weechat_protocol_timer_nicklist_cb (const void *pointer, void *data,
+ int remaining_calls)
{
struct t_relay_client *ptr_client;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- ptr_client = (struct t_relay_client *)data;
+ ptr_client = (struct t_relay_client *)pointer;
if (!ptr_client || !relay_client_valid (ptr_client))
return WEECHAT_RC_OK;
@@ -842,7 +849,8 @@ relay_weechat_protocol_timer_nicklist_cb (void *data, int remaining_calls)
*/
int
-relay_weechat_protocol_hsignal_nicklist_cb (void *data, const char *signal,
+relay_weechat_protocol_hsignal_nicklist_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
struct t_relay_client *ptr_client;
@@ -852,7 +860,10 @@ relay_weechat_protocol_hsignal_nicklist_cb (void *data, const char *signal,
struct t_relay_weechat_nicklist *ptr_nicklist;
char diff;
- ptr_client = (struct t_relay_client *)data;
+ /* make C compiler happy */
+ (void) data;
+
+ ptr_client = (struct t_relay_client *)pointer;
if (!ptr_client || !relay_client_valid (ptr_client))
return WEECHAT_RC_OK;
@@ -935,7 +946,8 @@ relay_weechat_protocol_hsignal_nicklist_cb (void *data, const char *signal,
*/
int
-relay_weechat_protocol_signal_upgrade_cb (void *data, const char *signal,
+relay_weechat_protocol_signal_upgrade_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
@@ -944,10 +956,11 @@ relay_weechat_protocol_signal_upgrade_cb (void *data, const char *signal,
char str_signal[128];
/* make C compiler happy */
+ (void) data;
(void) type_data;
(void) signal_data;
- ptr_client = (struct t_relay_client *)data;
+ ptr_client = (struct t_relay_client *)pointer;
if (!ptr_client || !relay_client_valid (ptr_client))
return WEECHAT_RC_OK;
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.h b/src/plugins/relay/weechat/relay-weechat-protocol.h
index 4de3aecb3..6f99d2e74 100644
--- a/src/plugins/relay/weechat/relay-weechat-protocol.h
+++ b/src/plugins/relay/weechat/relay-weechat-protocol.h
@@ -81,22 +81,27 @@ struct t_relay_weechat_protocol_cb
t_relay_weechat_cmd_func *cmd_function; /* callback */
};
-extern int relay_weechat_protocol_signal_buffer_cb (void *data,
+extern int relay_weechat_protocol_signal_buffer_cb (const void *pointer,
+ void *data,
const char *signal,
const char *type_data,
void *signal_data);
-extern int relay_weechat_protocol_signal_nicklist_cb (void *data,
+extern int relay_weechat_protocol_signal_nicklist_cb (const void *pointer,
+ void *data,
const char *signal,
const char *type_data,
void *signal_data);
-extern int relay_weechat_protocol_hsignal_nicklist_cb (void *data,
+extern int relay_weechat_protocol_hsignal_nicklist_cb (const void *pointer,
+ void *data,
const char *signal,
struct t_hashtable *hashtable);
-extern int relay_weechat_protocol_signal_upgrade_cb (void *data,
+extern int relay_weechat_protocol_signal_upgrade_cb (const void *pointer,
+ void *data,
const char *signal,
const char *type_data,
void *signal_data);
-extern int relay_weechat_protocol_timer_nicklist_cb (void *data,
+extern int relay_weechat_protocol_timer_nicklist_cb (const void *pointer,
+ void *data,
int remaining_calls);
extern void relay_weechat_protocol_recv (struct t_relay_client *client,
const char *data);
diff --git a/src/plugins/relay/weechat/relay-weechat.c b/src/plugins/relay/weechat/relay-weechat.c
index be0ac4400..2956f7a93 100644
--- a/src/plugins/relay/weechat/relay-weechat.c
+++ b/src/plugins/relay/weechat/relay-weechat.c
@@ -76,15 +76,15 @@ relay_weechat_hook_signals (struct t_relay_client *client)
RELAY_WEECHAT_DATA(client, hook_signal_buffer) =
weechat_hook_signal ("buffer_*",
&relay_weechat_protocol_signal_buffer_cb,
- client);
+ client, NULL);
RELAY_WEECHAT_DATA(client, hook_hsignal_nicklist) =
weechat_hook_hsignal ("nicklist_*",
&relay_weechat_protocol_hsignal_nicklist_cb,
- client);
+ client, NULL);
RELAY_WEECHAT_DATA(client, hook_signal_upgrade) =
weechat_hook_signal ("upgrade*",
&relay_weechat_protocol_signal_upgrade_cb,
- client);
+ client, NULL);
}
/*
@@ -121,7 +121,7 @@ relay_weechat_hook_timer_nicklist (struct t_relay_client *client)
RELAY_WEECHAT_DATA(client, hook_timer_nicklist) =
weechat_hook_timer (100, 0, 1,
&relay_weechat_protocol_timer_nicklist_cb,
- client);
+ client, NULL);
}
/*
@@ -181,8 +181,7 @@ relay_weechat_alloc (struct t_relay_client *client)
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
- NULL,
- NULL);
+ NULL, NULL);
RELAY_WEECHAT_DATA(client, hook_signal_buffer) = NULL;
RELAY_WEECHAT_DATA(client, hook_hsignal_nicklist) = NULL;
RELAY_WEECHAT_DATA(client, hook_signal_upgrade) = NULL;
@@ -190,8 +189,7 @@ relay_weechat_alloc (struct t_relay_client *client)
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_POINTER,
WEECHAT_HASHTABLE_POINTER,
- NULL,
- NULL);
+ NULL, NULL);
weechat_hashtable_set_pointer (RELAY_WEECHAT_DATA(client, buffers_nicklist),
"callback_free_value",
&relay_weechat_free_buffers_nicklist);
@@ -223,15 +221,17 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client,
if (client->protocol_data)
{
/* general stuff */
- RELAY_WEECHAT_DATA(client, password_ok) = weechat_infolist_integer (infolist, "password_ok");
- RELAY_WEECHAT_DATA(client, compression) = weechat_infolist_integer (infolist, "compression");
+ RELAY_WEECHAT_DATA(client, password_ok) = weechat_infolist_integer (
+ infolist, "password_ok");
+ RELAY_WEECHAT_DATA(client, compression) = weechat_infolist_integer (
+ infolist, "compression");
/* sync of buffers */
- RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_INTEGER,
- NULL,
- NULL);
+ RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_INTEGER,
+ NULL, NULL);
index = 0;
while (1)
{
@@ -253,8 +253,7 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client,
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_POINTER,
WEECHAT_HASHTABLE_POINTER,
- NULL,
- NULL);
+ NULL, NULL);
weechat_hashtable_set_pointer (RELAY_WEECHAT_DATA(client, buffers_nicklist),
"callback_free_value",
&relay_weechat_free_buffers_nicklist);
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 573757375..2598e9483 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -29,7 +29,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-ruby.h"
@@ -921,24 +920,26 @@ weechat_ruby_api_list_free (VALUE class, VALUE weelist)
}
int
-weechat_ruby_api_config_reload_cb (void *data,
+weechat_ruby_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -987,29 +988,31 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function,
}
int
-weechat_ruby_api_config_read_cb (void *data,
+weechat_ruby_api_config_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -1031,26 +1034,28 @@ weechat_ruby_api_config_read_cb (void *data,
}
int
-weechat_ruby_api_config_section_write_cb (void *data,
+weechat_ruby_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1070,26 +1075,28 @@ weechat_ruby_api_config_section_write_cb (void *data,
}
int
-weechat_ruby_api_config_section_write_default_cb (void *data,
+weechat_ruby_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1109,30 +1116,32 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
}
int
-weechat_ruby_api_config_section_create_option_cb (void *data,
+weechat_ruby_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -1154,28 +1163,30 @@ weechat_ruby_api_config_section_create_option_cb (void *data,
}
int
-weechat_ruby_api_config_section_delete_option_cb (void *data,
+weechat_ruby_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1260,27 +1271,29 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file,
c_function_delete_option = StringValuePtr (function_delete_option);
c_data_delete_option = StringValuePtr (data_delete_option);
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_config_file),
- c_name,
- c_user_can_add_options,
- c_user_can_delete_options,
- &weechat_ruby_api_config_read_cb,
- c_function_read,
- c_data_read,
- &weechat_ruby_api_config_section_write_cb,
- c_function_write,
- c_data_write,
- &weechat_ruby_api_config_section_write_default_cb,
- c_function_write_default,
- c_data_write_default,
- &weechat_ruby_api_config_section_create_option_cb,
- c_function_create_option,
- c_data_create_option,
- &weechat_ruby_api_config_section_delete_option_cb,
- c_function_delete_option,
- c_data_delete_option));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_ruby_plugin,
+ ruby_current_script,
+ API_STR2PTR(c_config_file),
+ c_name,
+ c_user_can_add_options,
+ c_user_can_delete_options,
+ &weechat_ruby_api_config_read_cb,
+ c_function_read,
+ c_data_read,
+ &weechat_ruby_api_config_section_write_cb,
+ c_function_write,
+ c_data_write,
+ &weechat_ruby_api_config_section_write_default_cb,
+ c_function_write_default,
+ c_data_write_default,
+ &weechat_ruby_api_config_section_create_option_cb,
+ c_function_create_option,
+ c_data_create_option,
+ &weechat_ruby_api_config_section_delete_option_cb,
+ c_function_delete_option,
+ c_data_delete_option));
API_RETURN_STRING_FREE(result);
}
@@ -1309,26 +1322,28 @@ weechat_ruby_api_config_search_section (VALUE class, VALUE config_file,
}
int
-weechat_ruby_api_config_option_check_value_cb (void *data,
+weechat_ruby_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1348,24 +1363,26 @@ weechat_ruby_api_config_option_check_value_cb (void *data,
}
void
-weechat_ruby_api_config_option_change_cb (void *data,
+weechat_ruby_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1377,24 +1394,26 @@ weechat_ruby_api_config_option_change_cb (void *data,
}
void
-weechat_ruby_api_config_option_delete_cb (void *data,
+weechat_ruby_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1965,9 +1984,7 @@ weechat_ruby_api_config_option_free (VALUE class, VALUE option)
c_option = StringValuePtr (option);
- plugin_script_api_config_option_free (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_option));
+ weechat_config_option_free (API_STR2PTR(c_option));
API_RETURN_OK;
}
@@ -1985,9 +2002,7 @@ weechat_ruby_api_config_section_free_options (VALUE class, VALUE section)
c_section = StringValuePtr (section);
- plugin_script_api_config_section_free_options (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_section));
+ weechat_config_section_free_options (API_STR2PTR(c_section));
API_RETURN_OK;
}
@@ -2005,9 +2020,7 @@ weechat_ruby_api_config_section_free (VALUE class, VALUE section)
c_section = StringValuePtr (section);
- plugin_script_api_config_section_free (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_section));
+ weechat_config_section_free (API_STR2PTR(c_section));
API_RETURN_OK;
}
@@ -2025,9 +2038,7 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file)
c_config_file = StringValuePtr (config_file);
- plugin_script_api_config_free (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_config_file));
+ weechat_config_free (API_STR2PTR(c_config_file));
API_RETURN_OK;
}
@@ -2351,28 +2362,31 @@ weechat_ruby_api_log_print (VALUE class, VALUE message)
}
int
-weechat_ruby_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_ruby_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2437,25 +2451,28 @@ weechat_ruby_api_hook_command (VALUE class, VALUE command, VALUE description,
}
int
-weechat_ruby_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_ruby_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2504,26 +2521,29 @@ weechat_ruby_api_hook_command_run (VALUE class, VALUE command, VALUE function,
}
int
-weechat_ruby_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_ruby_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2578,25 +2598,27 @@ weechat_ruby_api_hook_timer (VALUE class, VALUE interval, VALUE align_second,
}
int
-weechat_ruby_api_hook_fd_cb (void *data, int fd)
+weechat_ruby_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2654,28 +2676,30 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
}
int
-weechat_ruby_api_hook_process_cb (void *data,
+weechat_ruby_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssiss", func_argv);
if (!rc)
@@ -2771,34 +2795,37 @@ weechat_ruby_api_hook_process_hashtable (VALUE class, VALUE command,
}
int
-weechat_ruby_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_ruby_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2869,28 +2896,31 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
}
int
-weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_ruby_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2901,9 +2931,9 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssiiss", func_argv);
if (!rc)
@@ -2966,20 +2996,23 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
}
int
-weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
+weechat_ruby_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -3004,9 +3037,9 @@ weechat_ruby_api_hook_signal_cb (void *data, const char *signal, const char *typ
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -3098,25 +3131,28 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data,
}
int
-weechat_ruby_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_ruby_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
if (!rc)
@@ -3191,24 +3227,27 @@ weechat_ruby_api_hook_hsignal_send (VALUE class, VALUE signal, VALUE hashtable)
}
int
-weechat_ruby_api_hook_config_cb (void *data, const char *option, const char *value)
+weechat_ruby_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -3255,27 +3294,30 @@ weechat_ruby_api_hook_config (VALUE class, VALUE option, VALUE function,
}
int
-weechat_ruby_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_ruby_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -3385,25 +3427,29 @@ weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion,
}
char *
-weechat_ruby_api_hook_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+weechat_ruby_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_ruby_exec (script_callback->script,
+ return (char *)weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -3464,24 +3510,27 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
}
const char *
-weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
+weechat_ruby_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_ruby_exec (script_callback->script,
+ return (const char *)weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -3526,25 +3575,29 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
}
struct t_hashtable *
-weechat_ruby_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_ruby_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
- return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "ssh", func_argv);
+ return (struct t_hashtable *)weechat_ruby_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "ssh", func_argv);
}
return NULL;
@@ -3595,27 +3648,31 @@ weechat_ruby_api_hook_info_hashtable (VALUE class, VALUE info_name,
}
struct t_infolist *
-weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_ruby_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_ruby_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_ruby_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -3670,23 +3727,27 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
}
struct t_hashtable *
-weechat_ruby_api_hook_focus_cb (void *data, struct t_hashtable *info)
+weechat_ruby_api_hook_focus_cb (const void *pointer, void *data,
+ struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
- return (struct t_hashtable *)weechat_ruby_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", func_argv);
+ return (struct t_hashtable *)weechat_ruby_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "sh", func_argv);
}
return NULL;
@@ -3759,9 +3820,7 @@ weechat_ruby_api_unhook (VALUE class, VALUE hook)
c_hook = StringValuePtr (hook);
- plugin_script_api_unhook (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_hook));
+ weechat_unhook (API_STR2PTR(c_hook));
API_RETURN_OK;
}
@@ -3771,31 +3830,34 @@ weechat_ruby_api_unhook_all (VALUE class)
{
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_ruby_plugin, ruby_current_script);
+ weechat_unhook_all_plugin (ruby_current_script->name);
API_RETURN_OK;
}
int
-weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_ruby_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -3815,23 +3877,26 @@ weechat_ruby_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_ruby_api_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_ruby_exec (script_callback->script,
+ rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -3967,9 +4032,7 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer)
c_buffer = StringValuePtr (buffer);
- plugin_script_api_buffer_close (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_buffer));
+ weechat_buffer_close (API_STR2PTR(c_buffer));
API_RETURN_OK;
}
@@ -4687,31 +4750,34 @@ weechat_ruby_api_bar_item_search (VALUE class, VALUE name)
}
char *
-weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_ruby_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_ruby_exec (script_callback->script,
+ ret = (char *)weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssh", func_argv);
if (func_argv[1])
@@ -4724,13 +4790,13 @@ weechat_ruby_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_ruby_exec (script_callback->script,
+ ret = (char *)weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -4805,9 +4871,7 @@ weechat_ruby_api_bar_item_remove (VALUE class, VALUE item)
c_item = StringValuePtr (item);
- plugin_script_api_bar_item_remove (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_item));
+ weechat_bar_item_remove (API_STR2PTR(c_item));
API_RETURN_OK;
}
@@ -5888,25 +5952,80 @@ weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property)
API_RETURN_STRING(result);
}
+int
+weechat_ruby_api_upgrade_read_cb (const void *pointer, void *data,
+ struct t_upgrade_file *upgrade_file,
+ int object_id,
+ struct t_infolist *infolist)
+{
+ struct t_plugin_script *script;
+ void *func_argv[4];
+ char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
+ int *rc, ret;
+
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
+
+ if (ptr_function && ptr_function[0])
+ {
+ snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
+
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
+ func_argv[1] = API_PTR2STR(upgrade_file);
+ func_argv[2] = str_object_id;
+ func_argv[3] = API_PTR2STR(infolist);
+
+ rc = (int *) weechat_ruby_exec (script,
+ WEECHAT_SCRIPT_EXEC_INT,
+ ptr_function,
+ "ssss", func_argv);
+
+ if (!rc)
+ ret = WEECHAT_RC_ERROR;
+ else
+ {
+ ret = *rc;
+ free (rc);
+ }
+ if (func_argv[1])
+ free (func_argv[1]);
+ if (func_argv[3])
+ free (func_argv[3]);
+
+ return ret;
+ }
+
+ return WEECHAT_RC_ERROR;
+}
+
static VALUE
-weechat_ruby_api_upgrade_new (VALUE class, VALUE filename, VALUE write)
+weechat_ruby_api_upgrade_new (VALUE class, VALUE filename, VALUE function,
+ VALUE data)
{
- char *c_filename, *result;
- int c_write;
+ char *c_filename, *c_function, *c_data, *result;
VALUE return_value;
API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- if (NIL_P (filename) || NIL_P (write))
+ if (NIL_P (filename) || NIL_P (function) || NIL_P (data))
API_WRONG_ARGS(API_RETURN_EMPTY);
Check_Type (filename, T_STRING);
- Check_Type (write, T_FIXNUM);
+ Check_Type (function, T_STRING);
+ Check_Type (data, T_STRING);
c_filename = StringValuePtr (filename);
- c_write = FIX2INT (write);
+ c_function = StringValuePtr (function);
+ c_data = StringValuePtr (data);
- result = API_PTR2STR(weechat_upgrade_new (c_filename,
- c_write));
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_ruby_plugin,
+ ruby_current_script,
+ c_filename,
+ &weechat_ruby_api_upgrade_read_cb,
+ c_function,
+ c_data));
API_RETURN_STRING_FREE(result);
}
@@ -5937,76 +6056,21 @@ weechat_ruby_api_upgrade_write_object (VALUE class, VALUE upgrade_file,
API_RETURN_INT(rc);
}
-int
-weechat_ruby_api_upgrade_read_cb (void *data,
- struct t_upgrade_file *upgrade_file,
- int object_id,
- struct t_infolist *infolist)
-{
- struct t_plugin_script_cb *script_callback;
- void *func_argv[4];
- char empty_arg[1] = { '\0' }, str_object_id[32];
- int *rc, ret;
-
- script_callback = (struct t_plugin_script_cb *)data;
-
- if (script_callback && script_callback->function && script_callback->function[0])
- {
- snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
-
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
- func_argv[1] = API_PTR2STR(upgrade_file);
- func_argv[2] = str_object_id;
- func_argv[3] = API_PTR2STR(infolist);
-
- rc = (int *) weechat_ruby_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- "ssss", func_argv);
-
- if (!rc)
- ret = WEECHAT_RC_ERROR;
- else
- {
- ret = *rc;
- free (rc);
- }
- if (func_argv[1])
- free (func_argv[1]);
- if (func_argv[3])
- free (func_argv[3]);
-
- return ret;
- }
-
- return WEECHAT_RC_ERROR;
-}
-
static VALUE
-weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file,
- VALUE function, VALUE data)
+weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file)
{
- char *c_upgrade_file, *c_function, *c_data;
+ char *c_upgrade_file;
int rc;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
- if (NIL_P (upgrade_file) || NIL_P (function) || NIL_P (data))
+ if (NIL_P (upgrade_file))
API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (upgrade_file, T_STRING);
- Check_Type (function, T_STRING);
- Check_Type (data, T_STRING);
c_upgrade_file = StringValuePtr (upgrade_file);
- c_function = StringValuePtr (function);
- c_data = StringValuePtr (data);
- rc = plugin_script_api_upgrade_read (weechat_ruby_plugin,
- ruby_current_script,
- API_STR2PTR(c_upgrade_file),
- &weechat_ruby_api_upgrade_read_cb,
- c_function,
- c_data);
+ rc = weechat_upgrade_read (API_STR2PTR(c_upgrade_file));
API_RETURN_INT(rc);
}
@@ -6270,8 +6334,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
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_new, 3);
API_DEF_FUNC(upgrade_write_object, 3);
- API_DEF_FUNC(upgrade_read, 3);
+ API_DEF_FUNC(upgrade_read, 1);
API_DEF_FUNC(upgrade_close, 1);
}
diff --git a/src/plugins/ruby/weechat-ruby-api.h b/src/plugins/ruby/weechat-ruby-api.h
index d6676bb03..39f84c706 100644
--- a/src/plugins/ruby/weechat-ruby-api.h
+++ b/src/plugins/ruby/weechat-ruby-api.h
@@ -21,10 +21,12 @@
#ifndef WEECHAT_RUBY_API_H
#define WEECHAT_RUBY_API_H 1
-extern int weechat_ruby_api_buffer_input_data_cb (void *data,
+extern int weechat_ruby_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_ruby_api_buffer_close_cb (void *data,
+extern int weechat_ruby_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
extern void weechat_ruby_api_init (VALUE ruby_mWeechat);
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index d55e1d7c4..5a1590fe2 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -146,8 +146,7 @@ weechat_ruby_hashtable_to_hash (struct t_hashtable *hashtable)
if (NIL_P (hash))
return Qnil;
- weechat_hashtable_map_string (hashtable,
- &weechat_ruby_hashtable_map_cb,
+ weechat_hashtable_map_string (hashtable, &weechat_ruby_hashtable_map_cb,
&hash);
return hash;
@@ -776,12 +775,14 @@ weechat_ruby_unload_all ()
*/
int
-weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_ruby_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -877,11 +878,13 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_ruby_completion_cb (void *data, const char *completion_item,
+weechat_ruby_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -896,9 +899,11 @@ weechat_ruby_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_ruby_hdata_cb (void *data, const char *hdata_name)
+weechat_ruby_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -911,10 +916,12 @@ weechat_ruby_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_ruby_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_ruby_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -923,7 +930,7 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "ruby_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_ruby_plugin,
- ruby_scripts, pointer,
+ ruby_scripts, obj_pointer,
arguments);
}
@@ -935,10 +942,12 @@ weechat_ruby_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_ruby_signal_debug_dump_cb (void *data, const char *signal,
+weechat_ruby_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -957,10 +966,12 @@ weechat_ruby_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_ruby_signal_debug_libs_cb (void *data, const char *signal,
+weechat_ruby_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -976,37 +987,20 @@ weechat_ruby_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_ruby_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (ruby_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_ruby_timer_action_cb (void *data, int remaining_calls)
+weechat_ruby_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &ruby_action_install_list)
+ if (pointer == &ruby_action_install_list)
{
plugin_script_action_install (weechat_ruby_plugin,
ruby_scripts,
@@ -1015,7 +1009,7 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
&ruby_quiet,
&ruby_action_install_list);
}
- else if (data == &ruby_action_remove_list)
+ else if (pointer == &ruby_action_remove_list)
{
plugin_script_action_remove (weechat_ruby_plugin,
ruby_scripts,
@@ -1023,7 +1017,7 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
&ruby_quiet,
&ruby_action_remove_list);
}
- else if (data == &ruby_action_autoload_list)
+ else if (pointer == &ruby_action_autoload_list)
{
plugin_script_action_autoload (weechat_ruby_plugin,
&ruby_quiet,
@@ -1039,11 +1033,13 @@ weechat_ruby_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_ruby_signal_script_action_cb (void *data, const char *signal,
+weechat_ruby_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -1054,7 +1050,7 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_ruby_timer_action_cb,
- &ruby_action_install_list);
+ &ruby_action_install_list, NULL);
}
else if (strcmp (signal, "ruby_script_remove") == 0)
{
@@ -1062,7 +1058,7 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_ruby_timer_action_cb,
- &ruby_action_remove_list);
+ &ruby_action_remove_list, NULL);
}
else if (strcmp (signal, "ruby_script_autoload") == 0)
{
@@ -1070,7 +1066,7 @@ weechat_ruby_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_ruby_timer_action_cb,
- &ruby_action_autoload_list);
+ &ruby_action_autoload_list, NULL);
}
}
@@ -1190,7 +1186,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_ruby_infolist_cb;
init.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_ruby_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_ruby_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_ruby_signal_script_action_cb;
init.callback_load_file = &weechat_ruby_load_cb;
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c
index 2dab05f53..3c4510b8e 100644
--- a/src/plugins/script/script-action.c
+++ b/src/plugins/script/script-action.c
@@ -483,12 +483,14 @@ script_action_autoload (const char *name, int quiet, int autoload)
*/
int
-script_action_installnext_timer_cb (void *data, int remaining_calls)
+script_action_installnext_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- script_action_install ((data) ? 1 : 0);
+ script_action_install ((pointer) ? 1 : 0);
return WEECHAT_RC_OK;
}
@@ -498,7 +500,8 @@ script_action_installnext_timer_cb (void *data, int remaining_calls)
*/
int
-script_action_install_process_cb (void *data, const char *command,
+script_action_install_process_cb (const void *pointer, void *data,
+ const char *command,
int return_code, const char *out,
const char *err)
{
@@ -507,9 +510,10 @@ script_action_install_process_cb (void *data, const char *command,
struct t_script_repo *ptr_script;
/* make C compiler happy */
+ (void) data;
(void) out;
- quiet = (data) ? 1 : 0;
+ quiet = (pointer) ? 1 : 0;
if (return_code >= 0)
{
@@ -558,7 +562,8 @@ script_action_install_process_cb (void *data, const char *command,
/* schedule install of next script */
weechat_hook_timer (10, 0, 1,
&script_action_installnext_timer_cb,
- (quiet) ? (void *)1 : (void *)0);
+ (quiet) ? (void *)1 : (void *)0,
+ NULL);
}
}
}
@@ -633,8 +638,7 @@ script_action_install (int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (options)
{
url = script_build_download_url (ptr_script_to_install->url);
@@ -653,7 +657,8 @@ script_action_install (int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_action_install_process_cb,
- (quiet) ? (void *)1 : (void *)0);
+ (quiet) ? (void *)1 : (void *)0,
+ NULL);
free (url);
}
weechat_hashtable_free (options);
@@ -799,7 +804,8 @@ script_action_hold (const char *name, int quiet)
*/
int
-script_action_show_diff_process_cb (void *data, const char *command,
+script_action_show_diff_process_cb (const void *pointer, void *data,
+ const char *command,
int return_code, const char *out,
const char *err)
{
@@ -808,6 +814,7 @@ script_action_show_diff_process_cb (void *data, const char *command,
int num_lines, i, diff_color;
/* make C compiler happy */
+ (void) data;
(void) command;
if (script_buffer && script_buffer_detail_script
@@ -876,7 +883,7 @@ script_action_show_diff_process_cb (void *data, const char *command,
if ((return_code == WEECHAT_HOOK_PROCESS_ERROR) || (return_code >= 0))
{
/* last call to this callback: delete temporary file */
- filename = (char *)data;
+ filename = (char *)pointer;
unlink (filename);
free (filename);
}
@@ -889,7 +896,8 @@ script_action_show_diff_process_cb (void *data, const char *command,
*/
int
-script_action_show_source_process_cb (void *data, const char *command,
+script_action_show_source_process_cb (const void *pointer, void *data,
+ const char *command,
int return_code, const char *out,
const char *err)
{
@@ -901,6 +909,7 @@ script_action_show_source_process_cb (void *data, const char *command,
int length, diff_made;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) out;
@@ -999,7 +1008,7 @@ script_action_show_source_process_cb (void *data, const char *command,
weechat_color ("magenta"));
weechat_hook_process (diff_command, 10000,
&script_action_show_diff_process_cb,
- filename);
+ filename, NULL);
diff_made = 1;
free (diff_command);
}
@@ -1062,8 +1071,7 @@ script_action_show (const char *name, int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (options)
{
url = script_build_download_url (ptr_script->url);
@@ -1075,7 +1083,7 @@ script_action_show (const char *name, int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_action_show_source_process_cb,
- NULL);
+ NULL, NULL);
free (url);
}
weechat_hashtable_free (options);
diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c
index 0bf1ec642..fd23bfbe6 100644
--- a/src/plugins/script/script-buffer.c
+++ b/src/plugins/script/script-buffer.c
@@ -403,12 +403,9 @@ script_buffer_get_script_usage (struct t_script_repo *script)
struct t_weelist *list;
char hdata_name[128], str_option[256], str_info[1024];
int config_files;
- const char *ptr_name_hdata_callback, *type;
- struct t_hdata *ptr_hdata_script, *ptr_hdata_callback;
- struct t_hdata *ptr_hdata_config_file, *ptr_hdata_bar_item;
- void *ptr_script, *ptr_callback;
- struct t_config_file *ptr_config_file;
- struct t_hook *ptr_hook;
+ struct t_hdata *hdata_script, *hdata_config, *hdata_bar_item;
+ void *ptr_script, *callback_pointer;
+ struct t_config_file *ptr_config;
struct t_gui_bar_item *ptr_bar_item;
struct t_infolist *infolist;
@@ -416,126 +413,161 @@ script_buffer_get_script_usage (struct t_script_repo *script)
snprintf (hdata_name, sizeof (hdata_name),
"%s_script", script_language[script->language]);
- ptr_hdata_script = weechat_hdata_get (hdata_name);
- if (!ptr_hdata_script)
+ hdata_script = weechat_hdata_get (hdata_name);
+ if (!hdata_script)
return NULL;
- ptr_script = script_buffer_get_script_pointer (script, ptr_hdata_script);
+ ptr_script = script_buffer_get_script_pointer (script, hdata_script);
if (!ptr_script)
return NULL;
- ptr_name_hdata_callback = weechat_hdata_get_var_hdata (ptr_hdata_script,
- "callbacks");
- if (!ptr_name_hdata_callback)
- return NULL;
- ptr_hdata_callback = weechat_hdata_get (ptr_name_hdata_callback);
- if (!ptr_hdata_callback)
- return NULL;
-
list = weechat_list_new ();
- ptr_hdata_config_file = weechat_hdata_get ("config_file");
- ptr_hdata_bar_item = weechat_hdata_get ("bar_item");
-
- ptr_callback = weechat_hdata_pointer (ptr_hdata_script,
- ptr_script,
- "callbacks");
- while (ptr_callback)
+ /* get configuration files created by the script */
+ hdata_config = weechat_hdata_get ("config_file");
+ ptr_config = weechat_hdata_get_list (hdata_config, "config_files");
+ while (ptr_config)
{
- str_info[0] = '\0';
- ptr_config_file = weechat_hdata_pointer (ptr_hdata_callback,
- ptr_callback,
- "config_file");
- ptr_hook = weechat_hdata_pointer (ptr_hdata_callback,
- ptr_callback,
- "hook");
- ptr_bar_item = weechat_hdata_pointer (ptr_hdata_callback,
- ptr_callback,
- "bar_item");
- if (ptr_config_file)
+ callback_pointer = weechat_hdata_pointer (
+ hdata_config, ptr_config, "callback_reload_pointer");
+ if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
_("configuration file \"%s\" (options %s.*)"),
- weechat_hdata_string (ptr_hdata_config_file,
- ptr_config_file,
+ weechat_hdata_string (hdata_config, ptr_config,
"filename"),
- weechat_hdata_string (ptr_hdata_config_file,
- ptr_config_file,
+ weechat_hdata_string (hdata_config, ptr_config,
"name"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
config_files++;
}
- else if (ptr_hook)
+ ptr_config = weechat_hdata_move (hdata_config, ptr_config, 1);
+ }
+
+ /* get the commands created by the script */
+ infolist = weechat_infolist_get ("hook", NULL, "command");
+ if (infolist)
+ {
+ while (weechat_infolist_next (infolist))
{
- infolist = weechat_infolist_get ("hook", ptr_hook, NULL);
- if (infolist)
+ callback_pointer = weechat_infolist_pointer (infolist,
+ "callback_pointer");
+ if (callback_pointer == ptr_script)
{
- if (weechat_infolist_next (infolist))
- {
- type = weechat_infolist_string (infolist, "type");
- if (type)
- {
- if (strcmp (type, "command") == 0)
- {
- snprintf (str_info, sizeof (str_info),
- _("command /%s"),
- weechat_infolist_string (infolist,
- "command"));
- }
- else if (strcmp (type, "completion") == 0)
- {
- snprintf (str_info, sizeof (str_info),
- _("completion %%(%s)"),
- weechat_infolist_string (infolist,
- "completion_item"));
- }
- else if (strcmp (type, "info") == 0)
- {
- snprintf (str_info, sizeof (str_info),
- "info \"%s\"",
- weechat_infolist_string (infolist,
- "info_name"));
- }
- else if (strcmp (type, "info_hashtable") == 0)
- {
- snprintf (str_info, sizeof (str_info),
- "info_hashtable \"%s\"",
- weechat_infolist_string (infolist,
- "info_name"));
- }
- else if (strcmp (type, "infolist") == 0)
- {
- snprintf (str_info, sizeof (str_info),
- "infolist \"%s\"",
- weechat_infolist_string (infolist,
- "infolist_name"));
- }
- }
- }
- weechat_infolist_free (infolist);
+ snprintf (str_info, sizeof (str_info),
+ _("command /%s"),
+ weechat_infolist_string (infolist,
+ "command"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
+ }
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ /* get the completions created by the script */
+ infolist = weechat_infolist_get ("hook", NULL, "completion");
+ if (infolist)
+ {
+ while (weechat_infolist_next (infolist))
+ {
+ callback_pointer = weechat_infolist_pointer (infolist,
+ "callback_pointer");
+ if (callback_pointer == ptr_script)
+ {
+ snprintf (str_info, sizeof (str_info),
+ _("completion %%(%s)"),
+ weechat_infolist_string (infolist,
+ "completion_item"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
+ }
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ /* get the infos created by the script */
+ infolist = weechat_infolist_get ("hook", NULL, "info");
+ if (infolist)
+ {
+ while (weechat_infolist_next (infolist))
+ {
+ callback_pointer = weechat_infolist_pointer (infolist,
+ "callback_pointer");
+ if (callback_pointer == ptr_script)
+ {
+ snprintf (str_info, sizeof (str_info),
+ "info \"%s\"",
+ weechat_infolist_string (infolist,
+ "info_name"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
- else if (ptr_bar_item)
+ weechat_infolist_free (infolist);
+ }
+
+ /* get the infos (hashtable) created by the script */
+ infolist = weechat_infolist_get ("hook", NULL, "info_hashtable");
+ if (infolist)
+ {
+ while (weechat_infolist_next (infolist))
+ {
+ callback_pointer = weechat_infolist_pointer (infolist,
+ "callback_pointer");
+ if (callback_pointer == ptr_script)
+ {
+ snprintf (str_info, sizeof (str_info),
+ "info_hashtable \"%s\"",
+ weechat_infolist_string (infolist,
+ "info_name"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
+ }
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ /* get the infolists created by the script */
+ infolist = weechat_infolist_get ("hook", NULL, "infolist");
+ if (infolist)
+ {
+ while (weechat_infolist_next (infolist))
+ {
+ callback_pointer = weechat_infolist_pointer (infolist,
+ "callback_pointer");
+ if (callback_pointer == ptr_script)
+ {
+ snprintf (str_info, sizeof (str_info),
+ "infolist \"%s\"",
+ weechat_infolist_string (infolist,
+ "infolist_name"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
+ }
+ }
+ weechat_infolist_free (infolist);
+ }
+
+ /* get the bar items created by the script */
+ hdata_bar_item = weechat_hdata_get ("bar_item");
+ ptr_bar_item = weechat_hdata_get_list (hdata_bar_item, "gui_bar_items");
+ while (ptr_bar_item)
+ {
+ callback_pointer = weechat_hdata_pointer (hdata_bar_item, ptr_bar_item,
+ "build_callback_pointer");
+ if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
_("bar item \"%s\""),
- weechat_hdata_string (ptr_hdata_bar_item,
+ weechat_hdata_string (hdata_bar_item,
ptr_bar_item,
"name"));
+ weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
- if (str_info[0])
- {
- weechat_list_add (list, str_info,
- WEECHAT_LIST_POS_END, NULL);
- }
- ptr_callback = weechat_hdata_move (ptr_hdata_callback,
- ptr_callback,
- 1);
+ ptr_bar_item = weechat_hdata_move (hdata_bar_item, ptr_bar_item, 1);
}
+ /* get the script options (in plugins.var) */
snprintf (str_option, sizeof (str_option),
"plugins.var.%s.%s.*",
script_language[script->language],
- weechat_hdata_string (ptr_hdata_script, ptr_script, "name"));
+ weechat_hdata_string (hdata_script, ptr_script, "name"));
infolist = weechat_infolist_get ("option", NULL, str_option);
if (infolist)
{
@@ -892,13 +924,14 @@ script_buffer_check_line_outside_window ()
*/
int
-script_buffer_window_scrolled_cb (void *data, const char *signal,
- const char *type_data,
+script_buffer_window_scrolled_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
int start_line_y, chat_height, line;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -936,7 +969,8 @@ script_buffer_window_scrolled_cb (void *data, const char *signal,
*/
int
-script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+script_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
char *actions[][2] = { { "A", "toggleautoload" },
@@ -953,6 +987,7 @@ script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* close buffer */
@@ -1010,9 +1045,11 @@ script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-script_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+script_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -1089,9 +1126,10 @@ script_buffer_open ()
{
if (!script_buffer)
{
- script_buffer = weechat_buffer_new (SCRIPT_BUFFER_NAME,
- &script_buffer_input_cb, NULL,
- &script_buffer_close_cb, NULL);
+ script_buffer = weechat_buffer_new (
+ SCRIPT_BUFFER_NAME,
+ &script_buffer_input_cb, NULL, NULL,
+ &script_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then exit */
if (!script_buffer)
diff --git a/src/plugins/script/script-buffer.h b/src/plugins/script/script-buffer.h
index 63b5f6af6..7f23729c7 100644
--- a/src/plugins/script/script-buffer.h
+++ b/src/plugins/script/script-buffer.h
@@ -36,12 +36,15 @@ extern void script_buffer_show_detail_script (struct t_script_repo *script);
extern void script_buffer_get_window_info (struct t_gui_window *window,
int *start_line_y, int *chat_height);
extern void script_buffer_check_line_outside_window ();
-extern int script_buffer_window_scrolled_cb (void *data, const char *signal,
+extern int script_buffer_window_scrolled_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data);
-extern int script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+extern int script_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data);
-extern int script_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
+extern int script_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer);
extern void script_buffer_set_callbacks ();
extern void script_buffer_set_keys ();
extern void script_buffer_open ();
diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c
index 20916368e..1cf459bac 100644
--- a/src/plugins/script/script-command.c
+++ b/src/plugins/script/script-command.c
@@ -121,7 +121,8 @@ script_command_action (struct t_gui_buffer *buffer, const char *action,
*/
int
-script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
+script_command_script (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *error, command[128];
@@ -129,6 +130,7 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
int line;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (argc == 1)
@@ -383,5 +385,5 @@ script_command_init ()
" || hold %(script_scripts)|%*"
" || update"
" || upgrade",
- &script_command_script, NULL);
+ &script_command_script, NULL, NULL);
}
diff --git a/src/plugins/script/script-completion.c b/src/plugins/script/script-completion.c
index 781fd4877..053873ac1 100644
--- a/src/plugins/script/script-completion.c
+++ b/src/plugins/script/script-completion.c
@@ -34,13 +34,15 @@
*/
int
-script_completion_languages_cb (void *data, const char *completion_item,
+script_completion_languages_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -60,13 +62,15 @@ script_completion_languages_cb (void *data, const char *completion_item,
*/
int
-script_completion_extensions_cb (void *data, const char *completion_item,
+script_completion_extensions_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -86,13 +90,15 @@ script_completion_extensions_cb (void *data, const char *completion_item,
*/
int
-script_completion_scripts_cb (void *data, const char *completion_item,
+script_completion_scripts_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_script_repo *ptr_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -113,13 +119,15 @@ script_completion_scripts_cb (void *data, const char *completion_item,
*/
int
-script_completion_scripts_installed_cb (void *data, const char *completion_item,
+script_completion_scripts_installed_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_script_repo *ptr_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -176,7 +184,8 @@ script_completion_exec_file_cb (void *data, const char *filename)
*/
int
-script_completion_scripts_files_cb (void *data, const char *completion_item,
+script_completion_scripts_files_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -186,6 +195,7 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
void *pointers[2];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -205,13 +215,15 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
snprintf (directory, length,
"%s/%s", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
- pointers, &script_completion_exec_file_cb);
+ &script_completion_exec_file_cb,
+ pointers);
/* look for files in "~/.weechat/<language>/autoload/" */
snprintf (directory, length,
"%s/%s/autoload", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
- pointers, &script_completion_exec_file_cb);
+ &script_completion_exec_file_cb,
+ pointers);
}
free (directory);
}
@@ -224,7 +236,8 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
*/
int
-script_completion_tags_cb (void *data, const char *completion_item,
+script_completion_tags_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -233,6 +246,7 @@ script_completion_tags_cb (void *data, const char *completion_item,
int num_tags, i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -269,20 +283,20 @@ script_completion_init ()
{
weechat_hook_completion ("script_languages",
N_("list of script languages"),
- &script_completion_languages_cb, NULL);
+ &script_completion_languages_cb, NULL, NULL);
weechat_hook_completion ("script_extensions",
N_("list of script extensions"),
- &script_completion_extensions_cb, NULL);
+ &script_completion_extensions_cb, NULL, NULL);
weechat_hook_completion ("script_scripts",
N_("list of scripts in repository"),
- &script_completion_scripts_cb, NULL);
+ &script_completion_scripts_cb, NULL, NULL);
weechat_hook_completion ("script_scripts_installed",
N_("list of scripts installed (from repository)"),
- &script_completion_scripts_installed_cb, NULL);
+ &script_completion_scripts_installed_cb, NULL, NULL);
weechat_hook_completion ("script_files",
N_("files in script directories"),
- &script_completion_scripts_files_cb, NULL);
+ &script_completion_scripts_files_cb, NULL, NULL);
weechat_hook_completion ("script_tags",
N_("tags of scripts in repository"),
- &script_completion_tags_cb, NULL);
+ &script_completion_tags_cb, NULL, NULL);
}
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index ac5363190..ee3d7a187 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -205,9 +205,11 @@ script_config_get_script_download_filename (struct t_script_repo *script,
*/
void
-script_config_refresh_cb (void *data, struct t_config_option *option)
+script_config_refresh_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -221,9 +223,11 @@ script_config_refresh_cb (void *data, struct t_config_option *option)
*/
void
-script_config_reload_scripts_cb (void *data, struct t_config_option *option)
+script_config_reload_scripts_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -240,9 +244,11 @@ script_config_reload_scripts_cb (void *data, struct t_config_option *option)
*/
void
-script_config_change_use_keys_cb (void *data, struct t_config_option *option)
+script_config_change_use_keys_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -255,9 +261,11 @@ script_config_change_use_keys_cb (void *data, struct t_config_option *option)
*/
void
-script_config_change_hold_cb (void *data, struct t_config_option *option)
+script_config_change_hold_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -355,9 +363,11 @@ script_config_unhold (const char *name_with_extension)
*/
int
-script_config_reload (void *data, struct t_config_file *config_file)
+script_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return weechat_config_reload (config_file);
@@ -377,16 +387,18 @@ script_config_init ()
struct t_config_section *ptr_section;
script_config_file = weechat_config_new (SCRIPT_CONFIG_NAME,
- &script_config_reload, NULL);
+ &script_config_reload, NULL, NULL);
if (!script_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (script_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -403,13 +415,15 @@ script_config_init ()
"%u=date updated, %v=version, %V=version loaded, %w=min_weechat, "
"%W=max_weechat)"),
NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_look_diff_color = weechat_config_new_option (
script_config_file, ptr_section,
"diff_color", "boolean",
N_("colorize output of diff"),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_diff_command = weechat_config_new_option (
script_config_file, ptr_section,
"diff_command", "string",
@@ -418,7 +432,7 @@ script_config_init ()
"or diff), empty value = disable diff, other string = name of "
"command, for example \"diff\")"),
NULL, 0, 0, "auto", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_display_source = weechat_config_new_option (
script_config_file, ptr_section,
"display_source", "boolean",
@@ -426,7 +440,7 @@ script_config_init ()
"(script is downloaded in a temporary file when detail on script "
"is displayed)"),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_quiet_actions = weechat_config_new_option (
script_config_file, ptr_section,
"quiet_actions", "boolean",
@@ -434,7 +448,7 @@ script_config_init ()
"buffer when scripts are installed/removed/loaded/unloaded (only "
"errors are displayed)"),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_sort = weechat_config_new_option (
script_config_file, ptr_section,
"sort", "string",
@@ -445,14 +459,18 @@ script_config_init ()
"order; example: \"i,u\": installed scripts first, sorted by update "
"date"),
NULL, 0, 0, "p,n", NULL, 0,
- NULL, NULL, &script_config_reload_scripts_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_reload_scripts_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_look_translate_description = weechat_config_new_option (
script_config_file, ptr_section,
"translate_description", "boolean",
N_("translate description of scripts (if translation is available in "
"your language, otherwise English version is used)"),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, &script_config_reload_scripts_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_reload_scripts_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_look_use_keys = weechat_config_new_option (
script_config_file, ptr_section,
"use_keys", "boolean",
@@ -460,14 +478,18 @@ script_config_init ()
"install, alt+r = remove, ...); if disabled, only the input is "
"allowed: i, r, ..."),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, &script_config_change_use_keys_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_change_use_keys_cb, NULL, NULL,
+ NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (script_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -479,164 +501,218 @@ script_config_init ()
"status_autoloaded", "color",
N_("color for status \"autoloaded\" (\"a\")"),
NULL, 0, 0, "cyan", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_held = weechat_config_new_option (
script_config_file, ptr_section,
"status_held", "color",
N_("color for status \"held\" (\"H\")"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_installed = weechat_config_new_option (
script_config_file, ptr_section,
"status_installed", "color",
N_("color for status \"installed\" (\"i\")"),
NULL, 0, 0, "lightcyan", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_obsolete = weechat_config_new_option (
script_config_file, ptr_section,
"status_obsolete", "color",
N_("color for status \"obsolete\" (\"N\")"),
NULL, 0, 0, "lightmagenta", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_popular = weechat_config_new_option (
script_config_file, ptr_section,
"status_popular", "color",
N_("color for status \"popular\" (\"*\")"),
NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_running = weechat_config_new_option (
script_config_file, ptr_section,
"status_running", "color",
N_("color for status \"running\" (\"r\")"),
NULL, 0, 0, "lightgreen", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_status_unknown = weechat_config_new_option (
script_config_file, ptr_section,
"status_unknown", "color",
N_("color for status \"unknown\" (\"?\")"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text = weechat_config_new_option (
script_config_file, ptr_section,
"text", "color",
N_("text color in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_bg = weechat_config_new_option (
script_config_file, ptr_section,
"text_bg", "color",
N_("background color in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_bg_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_bg_selected", "color",
N_("background color for selected line in script buffer"),
NULL, 0, 0, "red", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_date = weechat_config_new_option (
script_config_file, ptr_section,
"text_date", "color",
N_("text color of dates in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_date_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_date_selected", "color",
N_("text color of dates for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_delimiters = weechat_config_new_option (
script_config_file, ptr_section,
"text_delimiters", "color",
N_("text color of delimiters in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_description = weechat_config_new_option (
script_config_file, ptr_section,
"text_description", "color",
N_("text color of description in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_description_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_description_selected", "color",
N_("text color of description for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_extension = weechat_config_new_option (
script_config_file, ptr_section,
"text_extension", "color",
N_("text color of extension in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_extension_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_extension_selected", "color",
N_("text color of extension for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_name = weechat_config_new_option (
script_config_file, ptr_section,
"text_name", "color",
N_("text color of script name in script buffer"),
NULL, 0, 0, "cyan", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_name_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_name_selected", "color",
N_("text color of script name for selected line in script buffer"),
NULL, 0, 0, "lightcyan", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_selected", "color",
N_("text color for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_tags = weechat_config_new_option (
script_config_file, ptr_section,
"text_tags", "color",
N_("text color of tags in script buffer"),
NULL, 0, 0, "brown", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_tags_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_tags_selected", "color",
N_("text color of tags for selected line in script buffer"),
NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_version = weechat_config_new_option (
script_config_file, ptr_section,
"text_version", "color",
N_("text color of version in script buffer"),
NULL, 0, 0, "magenta", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_version_loaded = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_loaded", "color",
N_("text color of version loaded in script buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_version_loaded_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_loaded_selected", "color",
N_("text color of version loaded for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_color_text_version_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_selected", "color",
N_("text color of version for selected line in script buffer"),
NULL, 0, 0, "lightmagenta", NULL, 0,
- NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
/* scripts */
ptr_section = weechat_config_new_section (script_config_file, "scripts",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -649,51 +725,53 @@ script_config_init ()
N_("autoload scripts installed (make a link in \"autoload\" directory "
"to script in parent directory)"),
NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_cache_expire = weechat_config_new_option (
script_config_file, ptr_section,
"cache_expire", "integer",
N_("local cache expiration time, in minutes (-1 = never expires, "
"0 = always expire)"),
- NULL, -1, 525600, "1440", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, -1, 525600, "1440", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_download_timeout = weechat_config_new_option (
script_config_file, ptr_section,
"download_timeout", "integer",
N_("timeout (in seconds) for download of scripts and list of scripts"),
- NULL, 1, 3600, "30", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 1, 3600, "30", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_path = weechat_config_new_option (
script_config_file, ptr_section,
"path", "string",
N_("local cache directory for scripts; \"%h\" at beginning of string "
"is replaced by WeeChat home (\"~/.weechat\" by default) "
"(note: content is evaluated, see /help eval)"),
- NULL, 0, 0, "%h/script", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "%h/script", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_hold = weechat_config_new_option (
script_config_file, ptr_section,
"hold", "string",
N_("scripts to \"hold\": comma-separated list of scripts which will "
"never been upgraded and can not be removed, for example: "
"\"buffers.pl,iset.pl\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL,
- &script_config_change_hold_cb, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_change_hold_cb, NULL, NULL,
+ NULL, NULL, NULL);
script_config_scripts_url = weechat_config_new_option (
script_config_file, ptr_section,
"url", "string",
N_("URL for file with list of scripts; by default HTTPS is forced, "
"see option script.scripts.url_force_https"),
- NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_url_force_https = weechat_config_new_option (
script_config_file, ptr_section,
"url_force_https", "boolean",
N_("force use of HTTPS for downloads (index and scripts); "
"you should disable this option only if you have problems with "
"the downloads"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
diff --git a/src/plugins/script/script-info.c b/src/plugins/script/script-info.c
index e9df673cb..c3111d5b9 100644
--- a/src/plugins/script/script-info.c
+++ b/src/plugins/script/script-info.c
@@ -33,27 +33,30 @@
*/
struct t_infolist *
-script_info_infolist_script_script_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+script_info_infolist_script_script_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer,
+ const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_script_repo *ptr_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
- if (pointer && !script_repo_script_valid (pointer))
+ if (obj_pointer && !script_repo_script_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one script */
- if (!script_repo_add_to_infolist (ptr_infolist, pointer))
+ if (!script_repo_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -97,10 +100,10 @@ script_info_init ()
N_("script pointer (optional)"),
N_("script name with extension "
"(wildcard \"*\" is allowed) (optional)"),
- &script_info_infolist_script_script_cb, NULL);
+ &script_info_infolist_script_script_cb, NULL, NULL);
/* hdata hooks */
weechat_hook_hdata (
"script_script", N_("scripts from repository"),
- &script_repo_hdata_script_cb, NULL);
+ &script_repo_hdata_script_cb, NULL, NULL);
}
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index c5790a338..72b02d4e5 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -1140,11 +1140,11 @@ script_repo_file_read (int quiet)
if (!script_repo_max_length_field)
{
- script_repo_max_length_field = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_INTEGER,
- NULL,
- NULL);
+ script_repo_max_length_field = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_INTEGER,
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (script_repo_max_length_field);
@@ -1201,8 +1201,7 @@ script_repo_file_read (int quiet)
descriptions = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
/* read plugins.xml.gz */
while (!gzeof (file))
@@ -1422,17 +1421,19 @@ script_repo_file_read (int quiet)
*/
int
-script_repo_file_update_process_cb (void *data, const char *command,
+script_repo_file_update_process_cb (const void *pointer, void *data,
+ const char *command,
int return_code, const char *out,
const char *err)
{
int quiet;
/* make C compiler happy */
+ (void) data;
(void) command;
(void) out;
- quiet = (data == 0) ? 0 : 1;
+ quiet = (pointer) ? 1 : 0;
if (return_code >= 0)
{
@@ -1479,8 +1480,7 @@ script_repo_file_update (int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (options)
{
url = script_build_download_url (
@@ -1499,7 +1499,8 @@ script_repo_file_update (int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_repo_file_update_process_cb,
- (quiet) ? (void *)1 : (void *)0);
+ (quiet) ? (void *)1 : (void *)0,
+ NULL);
free (url);
}
weechat_hashtable_free (options);
@@ -1513,11 +1514,13 @@ script_repo_file_update (int quiet)
*/
struct t_hdata *
-script_repo_hdata_script_cb (void *data, const char *hdata_name)
+script_repo_hdata_script_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
+ (void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
diff --git a/src/plugins/script/script-repo.h b/src/plugins/script/script-repo.h
index 8d14b0300..c2ff595fd 100644
--- a/src/plugins/script/script-repo.h
+++ b/src/plugins/script/script-repo.h
@@ -79,7 +79,8 @@ extern int script_repo_file_exists ();
extern int script_repo_file_is_uptodate ();
extern int script_repo_file_read (int quiet);
extern void script_repo_file_update (int quiet);
-extern struct t_hdata *script_repo_hdata_script_cb (void *data,
+extern struct t_hdata *script_repo_hdata_script_cb (const void *pointer,
+ void *data,
const char *hdata_name);
extern int script_repo_add_to_infolist (struct t_infolist *infolist,
struct t_script_repo *script);
diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c
index f5dfe4294..b95b73628 100644
--- a/src/plugins/script/script.c
+++ b/src/plugins/script/script.c
@@ -179,8 +179,7 @@ script_get_scripts ()
script_loaded = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
else
weechat_hashtable_remove_all (script_loaded);
@@ -217,10 +216,12 @@ script_get_scripts ()
*/
int
-script_debug_dump_cb (void *data, const char *signal, const char *type_data,
+script_debug_dump_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -247,9 +248,10 @@ script_debug_dump_cb (void *data, const char *signal, const char *type_data,
*/
int
-script_timer_refresh_cb (void *data, int remaining_calls)
+script_timer_refresh_cb (const void *pointer, void *data, int remaining_calls)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
script_get_loaded_plugins ();
@@ -268,10 +270,12 @@ script_timer_refresh_cb (void *data, int remaining_calls)
*/
int
-script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
+script_signal_plugin_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) type_data;
@@ -285,7 +289,8 @@ script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
if (!script_timer_refresh)
{
script_timer_refresh = weechat_hook_timer (50, 0, 1,
- &script_timer_refresh_cb, NULL);
+ &script_timer_refresh_cb,
+ NULL, NULL);
}
return WEECHAT_RC_OK;
@@ -296,10 +301,12 @@ script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
*/
int
-script_signal_script_cb (void *data, const char *signal, const char *type_data,
+script_signal_script_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) type_data;
@@ -313,7 +320,8 @@ script_signal_script_cb (void *data, const char *signal, const char *type_data,
if (!script_timer_refresh)
{
script_timer_refresh = weechat_hook_timer (50, 0, 1,
- &script_timer_refresh_cb, NULL);
+ &script_timer_refresh_cb,
+ NULL, NULL);
}
return WEECHAT_RC_OK;
@@ -324,7 +332,8 @@ script_signal_script_cb (void *data, const char *signal, const char *type_data,
*/
struct t_hashtable *
-script_focus_chat_cb (void *data, struct t_hashtable *info)
+script_focus_chat_cb (const void *pointer, void *data,
+ struct t_hashtable *info)
{
const char *buffer;
int rc;
@@ -336,6 +345,7 @@ script_focus_chat_cb (void *data, struct t_hashtable *info)
struct tm *tm;
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!script_buffer)
@@ -429,12 +439,16 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
script_completion_init ();
script_info_init ();
- weechat_hook_signal ("debug_dump", &script_debug_dump_cb, NULL);
- weechat_hook_signal ("window_scrolled", &script_buffer_window_scrolled_cb, NULL);
- weechat_hook_signal ("plugin_*", &script_signal_plugin_cb, NULL);
- weechat_hook_signal ("*_script_*", &script_signal_script_cb, NULL);
+ weechat_hook_signal ("debug_dump",
+ &script_debug_dump_cb, NULL, NULL);
+ weechat_hook_signal ("window_scrolled",
+ &script_buffer_window_scrolled_cb, NULL, NULL);
+ weechat_hook_signal ("plugin_*",
+ &script_signal_plugin_cb, NULL, NULL);
+ weechat_hook_signal ("*_script_*",
+ &script_signal_script_cb, NULL, NULL);
- weechat_hook_focus ("chat", &script_focus_chat_cb, NULL);
+ weechat_hook_focus ("chat", &script_focus_chat_cb, NULL, NULL);
if (script_repo_file_exists ())
{
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 8930927e5..31434ff45 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -32,7 +32,6 @@
#include "../weechat-plugin.h"
#include "../plugin-script.h"
#include "../plugin-script-api.h"
-#include "../plugin-script-callback.h"
#include "weechat-tcl.h"
@@ -934,25 +933,27 @@ API_FUNC(list_free)
}
int
-weechat_tcl_api_config_reload_cb (void *data,
+weechat_tcl_api_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -996,29 +997,31 @@ API_FUNC(config_new)
}
int
-weechat_tcl_api_config_section_read_cb (void *data,
+weechat_tcl_api_config_section_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -1040,26 +1043,28 @@ weechat_tcl_api_config_section_read_cb (void *data,
}
int
-weechat_tcl_api_config_section_write_cb (void *data,
+weechat_tcl_api_config_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1079,26 +1084,28 @@ weechat_tcl_api_config_section_write_cb (void *data,
}
int
-weechat_tcl_api_config_section_write_default_cb (void *data,
+weechat_tcl_api_config_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = (section_name) ? (char *)section_name : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1118,30 +1125,32 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
}
int
-weechat_tcl_api_config_section_create_option_cb (void *data,
+weechat_tcl_api_config_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = (option_name) ? (char *)option_name : empty_arg;
func_argv[4] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sssss", func_argv);
if (!rc)
@@ -1163,28 +1172,30 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
}
int
-weechat_tcl_api_config_section_delete_option_cb (void *data,
+weechat_tcl_api_config_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(config_file);
func_argv[2] = API_PTR2STR(section);
func_argv[3] = API_PTR2STR(option);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -1240,27 +1251,29 @@ API_FUNC(config_new_section)
function_delete_option = Tcl_GetStringFromObj (objv[13], &i);
data_delete_option = Tcl_GetStringFromObj (objv[14], &i);
- result = API_PTR2STR(plugin_script_api_config_new_section (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(cfg_file),
- name,
- can_add, /* user_can_add_options */
- can_delete, /* user_can_delete_options */
- &weechat_tcl_api_config_section_read_cb,
- function_read,
- data_read,
- &weechat_tcl_api_config_section_write_cb,
- function_write,
- data_write,
- &weechat_tcl_api_config_section_write_default_cb,
- function_write_default,
- data_write_default,
- &weechat_tcl_api_config_section_create_option_cb,
- function_create_option,
- data_create_option,
- &weechat_tcl_api_config_section_delete_option_cb,
- function_delete_option,
- data_delete_option));
+ result = API_PTR2STR(
+ plugin_script_api_config_new_section (
+ weechat_tcl_plugin,
+ tcl_current_script,
+ API_STR2PTR(cfg_file),
+ name,
+ can_add, /* user_can_add_options */
+ can_delete, /* user_can_delete_options */
+ &weechat_tcl_api_config_section_read_cb,
+ function_read,
+ data_read,
+ &weechat_tcl_api_config_section_write_cb,
+ function_write,
+ data_write,
+ &weechat_tcl_api_config_section_write_default_cb,
+ function_write_default,
+ data_write_default,
+ &weechat_tcl_api_config_section_create_option_cb,
+ function_create_option,
+ data_create_option,
+ &weechat_tcl_api_config_section_delete_option_cb,
+ function_delete_option,
+ data_delete_option));
API_RETURN_STRING_FREE(result);
}
@@ -1286,26 +1299,28 @@ API_FUNC(config_search_section)
int
-weechat_tcl_api_config_option_check_value_cb (void *data,
+weechat_tcl_api_config_option_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -1325,24 +1340,26 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
}
void
-weechat_tcl_api_config_option_change_cb (void *data,
+weechat_tcl_api_config_option_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1354,24 +1371,26 @@ weechat_tcl_api_config_option_change_cb (void *data,
}
void
-weechat_tcl_api_config_option_delete_cb (void *data,
+weechat_tcl_api_config_option_delete_cb (const void *pointer, void *data,
struct t_config_option *option)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(option);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (func_argv[1])
@@ -1818,9 +1837,8 @@ API_FUNC(config_option_free)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_option_free (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */
+ weechat_config_option_free (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */
API_RETURN_OK;
}
@@ -1834,9 +1852,8 @@ API_FUNC(config_section_free_options)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free_options (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */
+ weechat_config_section_free_options (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */
API_RETURN_OK;
}
@@ -1850,9 +1867,8 @@ API_FUNC(config_section_free)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_section_free (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */
+ weechat_config_section_free (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */
API_RETURN_OK;
}
@@ -1866,9 +1882,8 @@ API_FUNC(config_free)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_config_free (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
+ weechat_config_free (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */
API_RETURN_OK;
}
@@ -2152,28 +2167,31 @@ API_FUNC(log_print)
}
int
-weechat_tcl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_tcl_api_hook_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
/* make C compiler happy */
(void) argv;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (argc > 1) ? argv_eol[1] : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2226,25 +2244,28 @@ API_FUNC(hook_command)
}
int
-weechat_tcl_api_hook_command_run_cb (void *data, struct t_gui_buffer *buffer,
+weechat_tcl_api_hook_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (command) ? (char *)command : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2288,26 +2309,29 @@ API_FUNC(hook_command_run)
}
int
-weechat_tcl_api_hook_timer_cb (void *data, int remaining_calls)
+weechat_tcl_api_hook_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_remaining_calls[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_remaining_calls, sizeof (str_remaining_calls),
"%d", remaining_calls);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_remaining_calls;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2353,25 +2377,27 @@ API_FUNC(hook_timer)
}
int
-weechat_tcl_api_hook_fd_cb (void *data, int fd)
+weechat_tcl_api_hook_fd_cb (const void *pointer, void *data, int fd)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char str_fd[32], empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_fd, sizeof (str_fd), "%d", fd);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_fd;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
@@ -2418,28 +2444,30 @@ API_FUNC(hook_fd)
}
int
-weechat_tcl_api_hook_process_cb (void *data,
+weechat_tcl_api_hook_process_cb (const void *pointer, void *data,
const char *command, int return_code,
const char *out, const char *err)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (command) ? (char *)command : empty_arg;
func_argv[2] = &return_code;
func_argv[3] = (out) ? (char *)out : empty_arg;
func_argv[4] = (err) ? (char *)err : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssiss", func_argv);
if (!rc)
@@ -2522,34 +2550,37 @@ API_FUNC(hook_process_hashtable)
}
int
-weechat_tcl_api_hook_connect_cb (void *data, int status, int gnutls_rc,
+weechat_tcl_api_hook_connect_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[6];
char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_status, sizeof (str_status), "%d", status);
snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
snprintf (str_sock, sizeof (str_sock), "%d", sock);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = str_status;
func_argv[2] = str_gnutls_rc;
func_argv[3] = str_sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssss", func_argv);
if (!rc)
@@ -2607,28 +2638,31 @@ API_FUNC(hook_connect)
}
int
-weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
+weechat_tcl_api_hook_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date,
int tags_count, const char **tags,
int displayed, int highlight,
const char *prefix, const char *message)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[8];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)date);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = timebuffer;
func_argv[3] = weechat_string_build_with_split_string (tags, ",");
@@ -2639,9 +2673,9 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
func_argv[6] = (prefix) ? (char *)prefix : empty_arg;
func_argv[7] = (message) ? (char *)message : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssssiiss", func_argv);
if (!rc)
@@ -2695,20 +2729,23 @@ API_FUNC(hook_print)
}
int
-weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type_data,
+weechat_tcl_api_hook_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
static char str_value[64];
int *rc, ret, free_needed;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
free_needed = 0;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -2733,9 +2770,9 @@ weechat_tcl_api_hook_signal_cb (void *data, const char *signal, const char *type
else
func_argv[2] = empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2820,25 +2857,28 @@ API_FUNC(hook_signal_send)
}
int
-weechat_tcl_api_hook_hsignal_cb (void *data, const char *signal,
+weechat_tcl_api_hook_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (signal) ? (char *)signal : empty_arg;
func_argv[2] = hashtable;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssh", func_argv);
if (!rc)
@@ -2905,24 +2945,27 @@ API_FUNC(hook_hsignal_send)
}
int
-weechat_tcl_api_hook_config_cb (void *data, const char *option, const char *value)
+weechat_tcl_api_hook_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (option) ? (char *)option : empty_arg;
func_argv[2] = (value) ? (char *)value : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
@@ -2964,27 +3007,30 @@ API_FUNC(hook_config)
}
int
-weechat_tcl_api_hook_completion_cb (void *data, const char *completion_item,
+weechat_tcl_api_hook_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (completion_item) ? (char *)completion_item : empty_arg;
func_argv[2] = API_PTR2STR(buffer);
func_argv[3] = API_PTR2STR(completion);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -3077,25 +3123,29 @@ API_FUNC(hook_completion_list_add)
}
char *
-weechat_tcl_api_hook_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+weechat_tcl_api_hook_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
+ const char *modifier_data,
+ const char *string)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (modifier) ? (char *)modifier : empty_arg;
func_argv[2] = (modifier_data) ? (char *)modifier_data : empty_arg;
func_argv[3] = (string) ? (char *)string : empty_arg;
- return (char *)weechat_tcl_exec (script_callback->script,
+ return (char *)weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
}
@@ -3146,24 +3196,27 @@ API_FUNC(hook_modifier_exec)
}
const char *
-weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
+weechat_tcl_api_hook_info_cb (const void *pointer, void *data,
+ const char *info_name,
const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
- return (const char *)weechat_tcl_exec (script_callback->script,
+ return (const char *)weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
}
@@ -3199,25 +3252,29 @@ API_FUNC(hook_info)
}
struct t_hashtable *
-weechat_tcl_api_hook_info_hashtable_cb (void *data, const char *info_name,
+weechat_tcl_api_hook_info_hashtable_cb (const void *pointer, void *data,
+ const char *info_name,
struct t_hashtable *hashtable)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
func_argv[2] = hashtable;
- return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "ssh", func_argv);
+ return (struct t_hashtable *)weechat_tcl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "ssh", func_argv);
}
return NULL;
@@ -3255,27 +3312,31 @@ API_FUNC(hook_info_hashtable)
}
struct t_infolist *
-weechat_tcl_api_hook_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_tcl_api_hook_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
struct t_infolist *result;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = (infolist_name) ? (char *)infolist_name : empty_arg;
- func_argv[2] = API_PTR2STR(pointer);
+ func_argv[2] = API_PTR2STR(obj_pointer);
func_argv[3] = (arguments) ? (char *)arguments : empty_arg;
- result = (struct t_infolist *)weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- "ssss", func_argv);
+ result = (struct t_infolist *)weechat_tcl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ ptr_function,
+ "ssss", func_argv);
if (func_argv[2])
free (func_argv[2]);
@@ -3318,24 +3379,27 @@ API_FUNC(hook_infolist)
}
struct t_hashtable *
-weechat_tcl_api_hook_focus_cb (void *data,
+weechat_tcl_api_hook_focus_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = info;
- return (struct t_hashtable *)weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_HASHTABLE,
- script_callback->function,
- "sh", func_argv);
+ return (struct t_hashtable *)weechat_tcl_exec (
+ script,
+ WEECHAT_SCRIPT_EXEC_HASHTABLE,
+ ptr_function,
+ "sh", func_argv);
}
return NULL;
@@ -3393,9 +3457,8 @@ API_FUNC(unhook)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_unhook (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* hook */
+ weechat_unhook (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* hook */
API_RETURN_OK;
}
@@ -3411,31 +3474,34 @@ API_FUNC(unhook_all)
API_INIT_FUNC(1, "unhook_all", API_RETURN_ERROR);
- plugin_script_api_unhook_all (weechat_tcl_plugin, tcl_current_script);
+ weechat_unhook_all_plugin (tcl_current_script->name);
API_RETURN_OK;
}
int
-weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
+weechat_tcl_api_buffer_input_data_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[3];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
func_argv[2] = (input_data) ? (char *)input_data : empty_arg;
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3454,23 +3520,26 @@ weechat_tcl_api_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
}
int
-weechat_tcl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+weechat_tcl_api_buffer_close_cb (const void *pointer,
+ void *data, struct t_gui_buffer *buffer)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[2];
char empty_arg[1] = { '\0' };
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(buffer);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;
@@ -3593,9 +3662,8 @@ API_FUNC(buffer_close)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_buffer_close (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
+ weechat_buffer_close (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* buffer */
API_RETURN_OK;
}
@@ -4198,31 +4266,34 @@ API_FUNC(bar_item_search)
}
char *
-weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
+weechat_tcl_api_bar_item_build_cb (const void *pointer, void *data,
+ struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[5];
char empty_arg[1] = { '\0' }, *ret;
+ const char *ptr_function, *ptr_data;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
- if (strncmp (script_callback->function, "(extra)", 7) == 0)
+ if (strncmp (ptr_function, "(extra)", 7) == 0)
{
/* new callback: data, item, window, buffer, extra_info */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
func_argv[3] = API_PTR2STR(buffer);
func_argv[4] = extra_info;
- ret = (char *)weechat_tcl_exec (script_callback->script,
+ ret = (char *)weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function + 7,
+ ptr_function + 7,
"ssssh", func_argv);
if (func_argv[1])
@@ -4235,13 +4306,13 @@ weechat_tcl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item,
else
{
/* old callback: data, item, window */
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(item);
func_argv[2] = API_PTR2STR(window);
- ret = (char *)weechat_tcl_exec (script_callback->script,
+ ret = (char *)weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
+ ptr_function,
"sss", func_argv);
if (func_argv[1])
@@ -4303,9 +4374,8 @@ API_FUNC(bar_item_remove)
if (objc < 2)
API_WRONG_ARGS(API_RETURN_ERROR);
- plugin_script_api_bar_item_remove (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* item */
+ weechat_bar_item_remove (
+ API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* item */
API_RETURN_OK;
}
@@ -5179,74 +5249,33 @@ API_FUNC(hdata_get_string)
API_RETURN_STRING(result);
}
-API_FUNC(upgrade_new)
-{
- Tcl_Obj *objp;
- char *result, *filename;
- int i, write;
-
- API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
- if (objc < 3)
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- if (Tcl_GetIntFromObj (interp, objv[2], &write) != TCL_OK)
- API_WRONG_ARGS(API_RETURN_EMPTY);
-
- filename = Tcl_GetStringFromObj (objv[1], &i);
-
- result = API_PTR2STR(weechat_upgrade_new (filename, write));
-
- API_RETURN_STRING_FREE(result);
-}
-
-API_FUNC(upgrade_write_object)
-{
- Tcl_Obj *objp;
- char *upgrade_file, *infolist;
- int rc, i, object_id;
-
- API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
- if (objc < 4)
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- if (Tcl_GetIntFromObj (interp, objv[2], &object_id) != TCL_OK)
- API_WRONG_ARGS(API_RETURN_INT(0));
-
- upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
- infolist = Tcl_GetStringFromObj (objv[3], &i);
-
- rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
- object_id,
- API_STR2PTR(infolist));
-
- API_RETURN_INT(rc);
-}
-
int
-weechat_tcl_api_upgrade_read_cb (void *data,
+weechat_tcl_api_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- struct t_plugin_script_cb *script_callback;
+ struct t_plugin_script *script;
void *func_argv[4];
char empty_arg[1] = { '\0' }, str_object_id[32];
+ const char *ptr_function, *ptr_data;
int *rc, ret;
- script_callback = (struct t_plugin_script_cb *)data;
+ script = (struct t_plugin_script *)pointer;
+ plugin_script_get_function_and_data (data, &ptr_function, &ptr_data);
- if (script_callback && script_callback->function && script_callback->function[0])
+ if (ptr_function && ptr_function[0])
{
snprintf (str_object_id, sizeof (str_object_id), "%d", object_id);
- func_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
+ func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
func_argv[1] = API_PTR2STR(upgrade_file);
func_argv[2] = str_object_id;
func_argv[3] = API_PTR2STR(infolist);
- rc = (int *) weechat_tcl_exec (script_callback->script,
+ rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
+ ptr_function,
"ssss", func_argv);
if (!rc)
@@ -5267,26 +5296,68 @@ weechat_tcl_api_upgrade_read_cb (void *data,
return WEECHAT_RC_ERROR;
}
+API_FUNC(upgrade_new)
+{
+ Tcl_Obj *objp;
+ char *result, *filename, *function, *data;
+ int i;
+
+ API_INIT_FUNC(1, "upgrade_new", API_RETURN_EMPTY);
+ if (objc < 4)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ filename = Tcl_GetStringFromObj (objv[1], &i);
+ function = Tcl_GetStringFromObj (objv[2], &i);
+ data = Tcl_GetStringFromObj (objv[3], &i);
+
+ result = API_PTR2STR(
+ plugin_script_api_upgrade_new (
+ weechat_tcl_plugin,
+ tcl_current_script,
+ filename,
+ &weechat_tcl_api_upgrade_read_cb,
+ function,
+ data));
+
+ API_RETURN_STRING_FREE(result);
+}
+
+API_FUNC(upgrade_write_object)
+{
+ Tcl_Obj *objp;
+ char *upgrade_file, *infolist;
+ int rc, i, object_id;
+
+ API_INIT_FUNC(1, "upgrade_write_object", API_RETURN_INT(0));
+ if (objc < 4)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ if (Tcl_GetIntFromObj (interp, objv[2], &object_id) != TCL_OK)
+ API_WRONG_ARGS(API_RETURN_INT(0));
+
+ upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
+ infolist = Tcl_GetStringFromObj (objv[3], &i);
+
+ rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file),
+ object_id,
+ API_STR2PTR(infolist));
+
+ API_RETURN_INT(rc);
+}
+
API_FUNC(upgrade_read)
{
Tcl_Obj *objp;
- char *upgrade_file, *function, *data;
+ char *upgrade_file;
int i, rc;
API_INIT_FUNC(1, "upgrade_read", API_RETURN_INT(0));
- if (objc < 4)
+ if (objc < 2)
API_WRONG_ARGS(API_RETURN_INT(0));
upgrade_file = Tcl_GetStringFromObj (objv[1], &i);
- function = Tcl_GetStringFromObj (objv[2], &i);
- data = Tcl_GetStringFromObj (objv[3], &i);
- rc = plugin_script_api_upgrade_read (weechat_tcl_plugin,
- tcl_current_script,
- API_STR2PTR(upgrade_file),
- &weechat_tcl_api_upgrade_read_cb,
- function,
- data);
+ rc = weechat_upgrade_read (API_STR2PTR(upgrade_file));
API_RETURN_INT(rc);
}
diff --git a/src/plugins/tcl/weechat-tcl-api.h b/src/plugins/tcl/weechat-tcl-api.h
index 5fd7d7ab4..758bb7f48 100644
--- a/src/plugins/tcl/weechat-tcl-api.h
+++ b/src/plugins/tcl/weechat-tcl-api.h
@@ -21,10 +21,12 @@
#ifndef WEECHAT_TCL_API_H
#define WEECHAT_TCL_API_H 1
-extern int weechat_tcl_api_buffer_input_data_cb (void *data,
+extern int weechat_tcl_api_buffer_input_data_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data);
-extern int weechat_tcl_api_buffer_close_cb (void *data,
+extern int weechat_tcl_api_buffer_close_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer);
extern void weechat_tcl_api_init (Tcl_Interp *interp);
diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c
index eed63715a..91297e56a 100644
--- a/src/plugins/tcl/weechat-tcl.c
+++ b/src/plugins/tcl/weechat-tcl.c
@@ -122,8 +122,7 @@ weechat_tcl_hashtable_to_dict (Tcl_Interp *interp,
data[0] = interp;
data[1] = dict;
- weechat_hashtable_map_string (hashtable,
- &weechat_tcl_hashtable_map_cb,
+ weechat_hashtable_map_string (hashtable, &weechat_tcl_hashtable_map_cb,
data);
return dict;
@@ -519,12 +518,14 @@ weechat_tcl_reload_name (const char *name)
*/
int
-weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
+weechat_tcl_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char *ptr_name, *path_script;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -620,11 +621,13 @@ weechat_tcl_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-weechat_tcl_completion_cb (void *data, const char *completion_item,
+weechat_tcl_completion_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -639,9 +642,11 @@ weechat_tcl_completion_cb (void *data, const char *completion_item,
*/
struct t_hdata *
-weechat_tcl_hdata_cb (void *data, const char *hdata_name)
+weechat_tcl_hdata_cb (const void *pointer, void *data,
+ const char *hdata_name)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return plugin_script_hdata_script (weechat_plugin,
@@ -654,10 +659,12 @@ weechat_tcl_hdata_cb (void *data, const char *hdata_name)
*/
struct t_infolist *
-weechat_tcl_infolist_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+weechat_tcl_infolist_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!infolist_name || !infolist_name[0])
@@ -666,7 +673,7 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
if (weechat_strcasecmp (infolist_name, "tcl_script") == 0)
{
return plugin_script_infolist_list_scripts (weechat_tcl_plugin,
- tcl_scripts, pointer,
+ tcl_scripts, obj_pointer,
arguments);
}
@@ -678,10 +685,12 @@ weechat_tcl_infolist_cb (void *data, const char *infolist_name,
*/
int
-weechat_tcl_signal_debug_dump_cb (void *data, const char *signal,
+weechat_tcl_signal_debug_dump_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -700,10 +709,12 @@ weechat_tcl_signal_debug_dump_cb (void *data, const char *signal,
*/
int
-weechat_tcl_signal_debug_libs_cb (void *data, const char *signal,
+weechat_tcl_signal_debug_libs_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -719,37 +730,20 @@ weechat_tcl_signal_debug_libs_cb (void *data, const char *signal,
}
/*
- * Callback called when a buffer is closed.
- */
-
-int
-weechat_tcl_signal_buffer_closed_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
-{
- /* make C compiler happy */
- (void) data;
- (void) signal;
- (void) type_data;
-
- if (signal_data)
- plugin_script_remove_buffer_callbacks (tcl_scripts, signal_data);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Timer for executing actions.
*/
int
-weechat_tcl_timer_action_cb (void *data, int remaining_calls)
+weechat_tcl_timer_action_cb (const void *pointer, void *data,
+ int remaining_calls)
{
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- if (data)
+ if (pointer)
{
- if (data == &tcl_action_install_list)
+ if (pointer == &tcl_action_install_list)
{
plugin_script_action_install (weechat_tcl_plugin,
tcl_scripts,
@@ -758,7 +752,7 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
&tcl_quiet,
&tcl_action_install_list);
}
- else if (data == &tcl_action_remove_list)
+ else if (pointer == &tcl_action_remove_list)
{
plugin_script_action_remove (weechat_tcl_plugin,
tcl_scripts,
@@ -766,7 +760,7 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
&tcl_quiet,
&tcl_action_remove_list);
}
- else if (data == &tcl_action_autoload_list)
+ else if (pointer == &tcl_action_autoload_list)
{
plugin_script_action_autoload (weechat_tcl_plugin,
&tcl_quiet,
@@ -782,11 +776,13 @@ weechat_tcl_timer_action_cb (void *data, int remaining_calls)
*/
int
-weechat_tcl_signal_script_action_cb (void *data, const char *signal,
+weechat_tcl_signal_script_action_cb (const void *pointer, void *data,
+ const char *signal,
const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
@@ -797,7 +793,7 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_tcl_timer_action_cb,
- &tcl_action_install_list);
+ &tcl_action_install_list, NULL);
}
else if (strcmp (signal, "tcl_script_remove") == 0)
{
@@ -805,7 +801,7 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_tcl_timer_action_cb,
- &tcl_action_remove_list);
+ &tcl_action_remove_list, NULL);
}
else if (strcmp (signal, "tcl_script_autoload") == 0)
{
@@ -813,7 +809,7 @@ weechat_tcl_signal_script_action_cb (void *data, const char *signal,
(const char *)signal_data);
weechat_hook_timer (1, 0, 1,
&weechat_tcl_timer_action_cb,
- &tcl_action_autoload_list);
+ &tcl_action_autoload_list, NULL);
}
}
@@ -837,7 +833,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
init.callback_infolist = &weechat_tcl_infolist_cb;
init.callback_signal_debug_dump = &weechat_tcl_signal_debug_dump_cb;
init.callback_signal_debug_libs = &weechat_tcl_signal_debug_libs_cb;
- init.callback_signal_buffer_closed = &weechat_tcl_signal_buffer_closed_cb;
init.callback_signal_script_action = &weechat_tcl_signal_script_action_cb;
init.callback_load_file = &weechat_tcl_load_cb;
diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c
index 7fd28e9f4..aaf660204 100644
--- a/src/plugins/trigger/trigger-buffer.c
+++ b/src/plugins/trigger/trigger-buffer.c
@@ -114,10 +114,12 @@ trigger_buffer_set_title ()
*/
int
-trigger_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
- const char *input_data)
+trigger_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
+ const char *input_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
/* close buffer */
@@ -144,9 +146,11 @@ trigger_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-trigger_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+trigger_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -188,9 +192,10 @@ trigger_buffer_open (const char *filter, int switch_to_buffer)
{
if (!trigger_buffer)
{
- trigger_buffer = weechat_buffer_new (TRIGGER_BUFFER_NAME,
- &trigger_buffer_input_cb, NULL,
- &trigger_buffer_close_cb, NULL);
+ trigger_buffer = weechat_buffer_new (
+ TRIGGER_BUFFER_NAME,
+ &trigger_buffer_input_cb, NULL, NULL,
+ &trigger_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then return */
if (!trigger_buffer)
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index 78b3636e8..3ac37a463 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -56,8 +56,7 @@ trigger_callback_irc_message_parse (const char *irc_message,
hashtable_in = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (hashtable_in)
{
weechat_hashtable_set (hashtable_in, "message", irc_message);
@@ -187,8 +186,7 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
pointers = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
- NULL,
- NULL);
+ NULL, NULL);
if (!pointers)
return;
pointers_allocated = 1;
@@ -366,8 +364,9 @@ trigger_callback_execute (struct t_trigger *trigger,
*/
int
-trigger_callback_signal_cb (void *data, const char *signal,
- const char *type_data, void *signal_data)
+trigger_callback_signal_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
+ void *signal_data)
{
const char *ptr_signal_data;
char str_data[128], *irc_server;
@@ -463,7 +462,8 @@ end:
*/
int
-trigger_callback_hsignal_cb (void *data, const char *signal,
+trigger_callback_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable)
{
const char *type_values;
@@ -510,8 +510,9 @@ end:
*/
char *
-trigger_callback_modifier_cb (void *data, const char *modifier,
- const char *modifier_data, const char *string)
+trigger_callback_modifier_cb (const void *pointer, void *data,
+ const char *modifier, const char *modifier_data,
+ const char *string)
{
struct t_gui_buffer *buffer;
const char *ptr_string;
@@ -691,7 +692,8 @@ end:
*/
int
-trigger_callback_print_cb (void *data, struct t_gui_buffer *buffer,
+trigger_callback_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date, int tags_count, const char **tags,
int displayed, int highlight, const char *prefix,
const char *message)
@@ -766,7 +768,8 @@ end:
*/
int
-trigger_callback_command_cb (void *data, struct t_gui_buffer *buffer,
+trigger_callback_command_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char str_name[32];
@@ -799,7 +802,8 @@ end:
*/
int
-trigger_callback_command_run_cb (void *data, struct t_gui_buffer *buffer,
+trigger_callback_command_run_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *command)
{
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
@@ -823,7 +827,8 @@ end:
*/
int
-trigger_callback_timer_cb (void *data, int remaining_calls)
+trigger_callback_timer_cb (const void *pointer, void *data,
+ int remaining_calls)
{
char str_temp[128];
int i;
@@ -870,7 +875,8 @@ end:
*/
int
-trigger_callback_config_cb (void *data, const char *option, const char *value)
+trigger_callback_config_cb (const void *pointer, void *data,
+ const char *option, const char *value)
{
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
@@ -892,7 +898,8 @@ end:
*/
struct t_hashtable *
-trigger_callback_focus_cb (void *data, struct t_hashtable *info)
+trigger_callback_focus_cb (const void *pointer, void *data,
+ struct t_hashtable *info)
{
const char *ptr_value;
long unsigned int value;
@@ -936,8 +943,7 @@ trigger_callback_init ()
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
if (trigger_callback_hashtable_options_conditions)
{
weechat_hashtable_set (trigger_callback_hashtable_options_conditions,
@@ -948,8 +954,7 @@ trigger_callback_init ()
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ NULL, NULL);
}
/*
diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h
index 9e411d763..9f7fb781a 100644
--- a/src/plugins/trigger/trigger-callback.h
+++ b/src/plugins/trigger/trigger-callback.h
@@ -26,10 +26,11 @@
int trigger_rc; \
pointers = NULL; \
extra_vars = NULL; \
+ (void) data; \
(void) trigger_rc; \
if (!trigger_enabled) \
return __rc; \
- trigger = (struct t_trigger *)data; \
+ trigger = (struct t_trigger *)pointer; \
if (!trigger || trigger->hook_running) \
return __rc; \
trigger->hook_count_cb++; \
@@ -43,8 +44,7 @@
32, \
WEECHAT_HASHTABLE_STRING, \
WEECHAT_HASHTABLE_POINTER, \
- NULL, \
- NULL); \
+ NULL, NULL); \
if (!pointers) \
goto end;
@@ -53,8 +53,7 @@
32, \
WEECHAT_HASHTABLE_STRING, \
WEECHAT_HASHTABLE_STRING, \
- NULL, \
- NULL); \
+ NULL, NULL); \
if (!extra_vars) \
goto end;
@@ -66,27 +65,38 @@
trigger->hook_running = 0; \
return __rc;
-extern int trigger_callback_signal_cb (void *data, const char *signal,
- const char *type_data, void *signal_data);
-extern int trigger_callback_hsignal_cb (void *data, const char *signal,
+extern int trigger_callback_signal_cb (const void *pointer, void *data,
+ const char *signal,
+ const char *type_data,
+ void *signal_data);
+extern int trigger_callback_hsignal_cb (const void *pointer, void *data,
+ const char *signal,
struct t_hashtable *hashtable);
-extern char *trigger_callback_modifier_cb (void *data, const char *modifier,
+extern char *trigger_callback_modifier_cb (const void *pointer, void *data,
+ const char *modifier,
const char *modifier_data,
const char *string);
-extern int trigger_callback_print_cb (void *data, struct t_gui_buffer *buffer,
+extern int trigger_callback_print_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
time_t date, int tags_count,
const char **tags, int displayed,
int highlight, const char *prefix,
const char *message);
-extern int trigger_callback_command_cb (void *data, struct t_gui_buffer *buffer,
- int argc, char **argv, char **argv_eol);
-extern int trigger_callback_command_run_cb (void *data,
+extern int trigger_callback_command_cb (const void *pointer,
+ void *data,
+ struct t_gui_buffer *buffer,
+ int argc, char **argv,
+ char **argv_eol);
+extern int trigger_callback_command_run_cb (const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *command);
-extern int trigger_callback_timer_cb (void *data, int remaining_calls);
-extern int trigger_callback_config_cb (void *data, const char *option,
- const char *value);
-extern struct t_hashtable *trigger_callback_focus_cb (void *data,
+extern int trigger_callback_timer_cb (const void *pointer, void *data,
+ int remaining_calls);
+extern int trigger_callback_config_cb (const void *pointer, void *data,
+ const char *option, const char *value);
+extern struct t_hashtable *trigger_callback_focus_cb (const void *pointer,
+ void *data,
struct t_hashtable *info);
extern void trigger_callback_init ();
extern void trigger_callback_end ();
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c
index 602b82f5b..3affef98e 100644
--- a/src/plugins/trigger/trigger-command.c
+++ b/src/plugins/trigger/trigger-command.c
@@ -449,7 +449,8 @@ end:
*/
int
-trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc,
+trigger_command_trigger (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_trigger *ptr_trigger, *ptr_trigger2;
@@ -459,6 +460,7 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc,
int regex_count, regex_rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
rc = WEECHAT_RC_OK;
@@ -1180,5 +1182,5 @@ trigger_command_init ()
" || restore %(trigger_names_default)|%*"
" || default"
" || monitor %(trigger_names)|%(trigger_hooks_filter)",
- &trigger_command_trigger, NULL);
+ &trigger_command_trigger, NULL, NULL);
}
diff --git a/src/plugins/trigger/trigger-completion.c b/src/plugins/trigger/trigger-completion.c
index c0f39dba0..7cde28930 100644
--- a/src/plugins/trigger/trigger-completion.c
+++ b/src/plugins/trigger/trigger-completion.c
@@ -33,13 +33,15 @@
*/
int
-trigger_completion_triggers_cb (void *data, const char *completion_item,
+trigger_completion_triggers_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -59,7 +61,8 @@ trigger_completion_triggers_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_triggers_default_cb (void *data,
+trigger_completion_triggers_default_cb (const void *pointer, void *data,
+
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
@@ -67,6 +70,7 @@ trigger_completion_triggers_default_cb (void *data,
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -86,13 +90,15 @@ trigger_completion_triggers_default_cb (void *data,
*/
int
-trigger_completion_options_cb (void *data, const char *completion_item,
+trigger_completion_options_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -112,7 +118,8 @@ trigger_completion_options_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_option_value_cb (void *data, const char *completion_item,
+trigger_completion_option_value_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -122,6 +129,7 @@ trigger_completion_option_value_cb (void *data, const char *completion_item,
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -170,13 +178,15 @@ trigger_completion_option_value_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hooks_cb (void *data, const char *completion_item,
+trigger_completion_hooks_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -196,7 +206,8 @@ trigger_completion_hooks_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hooks_filter_cb (void *data, const char *completion_item,
+trigger_completion_hooks_filter_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -204,6 +215,7 @@ trigger_completion_hooks_filter_cb (void *data, const char *completion_item,
char str_hook[128];
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -300,11 +312,13 @@ trigger_completion_add_default_for_hook (struct t_gui_completion *completion,
*/
int
-trigger_completion_hook_arguments_cb (void *data, const char *completion_item,
+trigger_completion_hook_arguments_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -323,11 +337,13 @@ trigger_completion_hook_arguments_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hook_conditions_cb (void *data, const char *completion_item,
+trigger_completion_hook_conditions_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -347,11 +363,13 @@ trigger_completion_hook_conditions_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hook_regex_cb (void *data, const char *completion_item,
+trigger_completion_hook_regex_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -371,11 +389,13 @@ trigger_completion_hook_regex_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hook_command_cb (void *data, const char *completion_item,
+trigger_completion_hook_command_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -395,11 +415,13 @@ trigger_completion_hook_command_cb (void *data, const char *completion_item,
*/
int
-trigger_completion_hook_rc_cb (void *data, const char *completion_item,
+trigger_completion_hook_rc_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -420,35 +442,35 @@ trigger_completion_init ()
{
weechat_hook_completion ("trigger_names",
N_("triggers"),
- &trigger_completion_triggers_cb, NULL);
+ &trigger_completion_triggers_cb, NULL, NULL);
weechat_hook_completion ("trigger_names_default",
N_("default triggers"),
- &trigger_completion_triggers_default_cb, NULL);
+ &trigger_completion_triggers_default_cb, NULL, NULL);
weechat_hook_completion ("trigger_options",
N_("options for triggers"),
- &trigger_completion_options_cb, NULL);
+ &trigger_completion_options_cb, NULL, NULL);
weechat_hook_completion ("trigger_option_value",
N_("value of a trigger option"),
- &trigger_completion_option_value_cb, NULL);
+ &trigger_completion_option_value_cb, NULL, NULL);
weechat_hook_completion ("trigger_hooks",
N_("hooks for triggers"),
- &trigger_completion_hooks_cb, NULL);
+ &trigger_completion_hooks_cb, NULL, NULL);
weechat_hook_completion ("trigger_hooks_filter",
N_("hooks for triggers (for filter in monitor buffer)"),
- &trigger_completion_hooks_filter_cb, NULL);
+ &trigger_completion_hooks_filter_cb, NULL, NULL);
weechat_hook_completion ("trigger_hook_arguments",
N_("default arguments for a hook"),
- &trigger_completion_hook_arguments_cb, NULL);
+ &trigger_completion_hook_arguments_cb, NULL, NULL);
weechat_hook_completion ("trigger_hook_conditions",
N_("default conditions for a hook"),
- &trigger_completion_hook_conditions_cb, NULL);
+ &trigger_completion_hook_conditions_cb, NULL, NULL);
weechat_hook_completion ("trigger_hook_regex",
N_("default regular expression for a hook"),
- &trigger_completion_hook_regex_cb, NULL);
+ &trigger_completion_hook_regex_cb, NULL, NULL);
weechat_hook_completion ("trigger_hook_command",
N_("default command for a hook"),
- &trigger_completion_hook_command_cb, NULL);
+ &trigger_completion_hook_command_cb, NULL, NULL);
weechat_hook_completion ("trigger_hook_rc",
N_("default return codes for hook callback"),
- &trigger_completion_hook_rc_cb, NULL);
+ &trigger_completion_hook_rc_cb, NULL, NULL);
}
diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c
index 30faf9f8c..5038f2c59 100644
--- a/src/plugins/trigger/trigger-config.c
+++ b/src/plugins/trigger/trigger-config.c
@@ -102,9 +102,11 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
*/
void
-trigger_config_change_enabled (void *data, struct t_config_option *option)
+trigger_config_change_enabled (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
trigger_enabled = weechat_config_boolean (option);
@@ -115,12 +117,13 @@ trigger_config_change_enabled (void *data, struct t_config_option *option)
*/
void
-trigger_config_change_trigger_enabled (void *data,
+trigger_config_change_trigger_enabled (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_trigger = trigger_search_with_option (option);
@@ -138,11 +141,13 @@ trigger_config_change_trigger_enabled (void *data,
*/
void
-trigger_config_change_trigger_hook (void *data, struct t_config_option *option)
+trigger_config_change_trigger_hook (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_trigger = trigger_search_with_option (option);
@@ -158,12 +163,13 @@ trigger_config_change_trigger_hook (void *data, struct t_config_option *option)
*/
void
-trigger_config_change_trigger_arguments (void *data,
+trigger_config_change_trigger_arguments (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_trigger = trigger_search_with_option (option);
@@ -179,11 +185,13 @@ trigger_config_change_trigger_arguments (void *data,
*/
void
-trigger_config_change_trigger_regex (void *data, struct t_config_option *option)
+trigger_config_change_trigger_regex (const void *pointer, void *data,
+ struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_trigger = trigger_search_with_option (option);
@@ -223,12 +231,13 @@ trigger_config_change_trigger_regex (void *data, struct t_config_option *option)
*/
void
-trigger_config_change_trigger_command (void *data,
+trigger_config_change_trigger_command (const void *pointer, void *data,
struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_trigger = trigger_search_with_option (option);
@@ -273,8 +282,10 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
option_name, "boolean",
N_("if disabled, the hooks are removed from trigger, so it is "
"not called any more"),
- NULL, 0, 0, value, NULL, 0, NULL, NULL,
- &trigger_config_change_trigger_enabled, NULL, NULL, NULL);
+ NULL, 0, 0, value, NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_trigger_enabled, NULL, NULL,
+ NULL, NULL, NULL);
break;
case TRIGGER_OPTION_HOOK:
ptr_option = weechat_config_new_option (
@@ -282,8 +293,10 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
option_name, "integer",
N_("type of hook used"),
trigger_hook_option_values,
- 0, 0, value, NULL, 0, NULL, NULL,
- &trigger_config_change_trigger_hook, NULL, NULL, NULL);
+ 0, 0, value, NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_trigger_hook, NULL, NULL,
+ NULL, NULL, NULL);
break;
case TRIGGER_OPTION_ARGUMENTS:
ptr_option = weechat_config_new_option (
@@ -291,8 +304,10 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
option_name, "string",
N_("arguments for the hook (depend on the hook type, see /help "
"trigger)"),
- NULL, 0, 0, value, NULL, 0, NULL, NULL,
- &trigger_config_change_trigger_arguments, NULL, NULL, NULL);
+ NULL, 0, 0, value, NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_trigger_arguments, NULL, NULL,
+ NULL, NULL, NULL);
break;
case TRIGGER_OPTION_CONDITIONS:
ptr_option = weechat_config_new_option (
@@ -302,7 +317,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
"hook callback) (note: content is evaluated when trigger is "
"run, see /help eval)"),
NULL, 0, 0, value, NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
break;
case TRIGGER_OPTION_REGEX:
ptr_option = weechat_config_new_option (
@@ -321,8 +336,10 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
"replace: ${re:0} to ${re:99}, ${re:+} for last match and "
"${hide:c,${re:N}} to replace all chars of group N by "
"char 'c'"),
- NULL, 0, 0, value, NULL, 0, NULL, NULL,
- &trigger_config_change_trigger_regex, NULL, NULL, NULL);
+ NULL, 0, 0, value, NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_trigger_regex, NULL, NULL,
+ NULL, NULL, NULL);
break;
case TRIGGER_OPTION_COMMAND:
ptr_option = weechat_config_new_option (
@@ -330,8 +347,10 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
option_name, "string",
N_("command(s) to run if conditions are OK, after regex "
"replacements (many commands can be separated by semicolons)"),
- NULL, 0, 0, value, NULL, 0, NULL, NULL,
- &trigger_config_change_trigger_command, NULL, NULL, NULL);
+ NULL, 0, 0, value, NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_trigger_command, NULL, NULL,
+ NULL, NULL, NULL);
break;
case TRIGGER_OPTION_RETURN_CODE:
ptr_option = weechat_config_new_option (
@@ -340,7 +359,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
N_("return code for hook callback (see plugin API reference to "
"know where ok_eat/error can be used efficiently)"),
"ok|ok_eat|error", 0, 0, value, NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
break;
case TRIGGER_NUM_OPTIONS:
break;
@@ -434,7 +453,8 @@ trigger_config_use_temp_triggers ()
*/
int
-trigger_config_trigger_read_cb (void *data, struct t_config_file *config_file,
+trigger_config_trigger_read_cb (const void *pointer, void *data,
+ struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
{
@@ -443,6 +463,7 @@ trigger_config_trigger_read_cb (void *data, struct t_config_file *config_file,
int index_option;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) config_file;
(void) section;
@@ -504,7 +525,7 @@ trigger_config_trigger_read_cb (void *data, struct t_config_file *config_file,
*/
int
-trigger_config_trigger_write_default_cb (void *data,
+trigger_config_trigger_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
@@ -512,6 +533,7 @@ trigger_config_trigger_write_default_cb (void *data,
char option_name[512];
/* make C compiler happy */
+ (void) pointer;
(void) data;
if (!weechat_config_write_line (config_file, section_name, NULL))
@@ -545,11 +567,13 @@ trigger_config_trigger_write_default_cb (void *data,
*/
int
-trigger_config_reload_cb (void *data, struct t_config_file *config_file)
+trigger_config_reload_cb (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
int rc;
/* make C compiler happy */
+ (void) pointer;
(void) data;
trigger_free_all ();
@@ -574,17 +598,19 @@ trigger_config_init ()
{
struct t_config_section *ptr_section;
- trigger_config_file = weechat_config_new (TRIGGER_CONFIG_NAME,
- &trigger_config_reload_cb, NULL);
+ trigger_config_file = weechat_config_new (
+ TRIGGER_CONFIG_NAME, &trigger_config_reload_cb, NULL, NULL);
if (!trigger_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (trigger_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (trigger_config_file);
@@ -595,21 +621,25 @@ trigger_config_init ()
trigger_config_file, ptr_section,
"enabled", "boolean",
N_("enable trigger support"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL,
- &trigger_config_change_enabled, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &trigger_config_change_enabled, NULL, NULL,
+ NULL, NULL, NULL);
trigger_config_look_monitor_strip_colors = weechat_config_new_option (
trigger_config_file, ptr_section,
"monitor_strip_colors", "boolean",
N_("strip colors in hashtable values displayed on monitor buffer"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (trigger_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (trigger_config_file);
@@ -621,59 +651,60 @@ trigger_config_init ()
"flag_command", "color",
N_("text color for command flag (in /trigger list)"),
NULL, 0, 0, "lightgreen", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_flag_conditions = weechat_config_new_option (
trigger_config_file, ptr_section,
"flag_conditions", "color",
N_("text color for conditions flag (in /trigger list)"),
NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_flag_regex = weechat_config_new_option (
trigger_config_file, ptr_section,
"flag_regex", "color",
N_("text color for regex flag (in /trigger list)"),
NULL, 0, 0, "lightcyan", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_flag_return_code = weechat_config_new_option (
trigger_config_file, ptr_section,
"flag_return_code", "color",
N_("text color for return code flag (in /trigger list)"),
NULL, 0, 0, "lightmagenta", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_regex = weechat_config_new_option (
trigger_config_file, ptr_section,
"regex", "color",
N_("text color for regular expressions"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_replace = weechat_config_new_option (
trigger_config_file, ptr_section,
"replace", "color",
N_("text color for replacement text (for regular expressions)"),
NULL, 0, 0, "cyan", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_trigger = weechat_config_new_option (
trigger_config_file, ptr_section,
"trigger", "color",
N_("text color for trigger name"),
NULL, 0, 0, "green", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_trigger_disabled = weechat_config_new_option (
trigger_config_file, ptr_section,
"trigger_disabled", "color",
N_("text color for disabled trigger name"),
NULL, 0, 0, "red", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* trigger */
- ptr_section = weechat_config_new_section (trigger_config_file,
- TRIGGER_CONFIG_SECTION_TRIGGER,
- 0, 0,
- &trigger_config_trigger_read_cb, NULL,
- NULL, NULL,
- &trigger_config_trigger_write_default_cb, NULL,
- NULL, NULL,
- NULL, NULL);
+ ptr_section = weechat_config_new_section (
+ trigger_config_file,
+ TRIGGER_CONFIG_SECTION_TRIGGER,
+ 0, 0,
+ &trigger_config_trigger_read_cb, NULL, NULL,
+ NULL, NULL, NULL,
+ &trigger_config_trigger_write_default_cb, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (trigger_config_file);
diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c
index 0c4f121d0..92aacadbe 100644
--- a/src/plugins/trigger/trigger.c
+++ b/src/plugins/trigger/trigger.c
@@ -266,7 +266,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_signal (
argv[i],
&trigger_callback_signal_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -283,7 +283,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_hsignal (
argv[i],
&trigger_callback_hsignal_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -300,7 +300,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_modifier (
argv[i],
&trigger_callback_modifier_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -330,7 +330,7 @@ trigger_hook (struct t_trigger *trigger)
message,
strip_colors,
&trigger_callback_print_cb,
- trigger);
+ trigger, NULL);
}
break;
case TRIGGER_HOOK_COMMAND:
@@ -347,7 +347,7 @@ trigger_hook (struct t_trigger *trigger)
(argc > 3) ? argv[3] : "", /* description of args */
(argc > 4) ? argv[4] : "", /* completion */
&trigger_callback_command_cb,
- trigger);
+ trigger, NULL);
}
}
break;
@@ -363,7 +363,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_command_run (
argv[i],
&trigger_callback_command_run_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -393,7 +393,7 @@ trigger_hook (struct t_trigger *trigger)
(int)align_second,
(int)max_calls,
&trigger_callback_timer_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -410,7 +410,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_config (
argv[i],
&trigger_callback_config_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -427,7 +427,7 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks[i] = weechat_hook_focus (
argv[i],
&trigger_callback_focus_cb,
- trigger);
+ trigger, NULL);
}
}
}
@@ -1151,10 +1151,12 @@ trigger_print_log ()
*/
int
-trigger_debug_dump_cb (void *data, const char *signal, const char *type_data,
+trigger_debug_dump_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1197,7 +1199,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
trigger_config_read ();
/* hook some signals */
- weechat_hook_signal ("debug_dump", &trigger_debug_dump_cb, NULL);
+ weechat_hook_signal ("debug_dump", &trigger_debug_dump_cb, NULL, NULL);
/* hook completions */
trigger_completion_init ();
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 0b8c24e8b..438c2c4c2 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -57,7 +57,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 "20150822-01"
+#define WEECHAT_PLUGIN_API_VERSION "20160321-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -294,7 +294,8 @@ struct t_weechat_plugin
char *(*string_replace_regex) (const char *string, void *regex,
const char *replace,
const char reference_char,
- char *(*callback)(void *data, const char *text),
+ char *(*callback)(void *data,
+ const char *text),
void *callback_data);
char **(*string_split) (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
@@ -342,8 +343,9 @@ struct t_weechat_plugin
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
int (*mkdir_parents) (const char *directory, int mode);
- void (*exec_on_files) (const char *directory, int hidden_files, void *data,
- void (*callback)(void *data, const char *filename));
+ void (*exec_on_files) (const char *directory, int hidden_files,
+ void (*callback)(void *data, const char *filename),
+ void *callback_data);
char *(*file_get_content) (const char *filename);
/* util */
@@ -428,37 +430,49 @@ struct t_weechat_plugin
/* config files */
struct t_config_file *(*config_new) (struct t_weechat_plugin *plugin,
const char *name,
- int (*callback_reload)(void *data,
+ int (*callback_reload)(const void *pointer,
+ void *data,
struct t_config_file *config_file),
+ const void *callback_reload_pointer,
void *callback_reload_data);
struct t_config_section *(*config_new_section) (struct t_config_file *config_file,
const char *name,
int user_can_add_options,
int user_can_delete_options,
- int (*callback_read)(void *data,
+ int (*callback_read)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
+ const void *callback_read_pointer,
void *callback_read_data,
- int (*callback_write)(void *data,
+ int (*callback_write)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
+ const void *callback_write_pointer,
void *callback_write_data,
- int (*callback_write_default)(void *data,
+ int (*callback_write_default)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
const char *section_name),
+ const void *callback_write_default_pointer,
void *callback_write_default_data,
- int (*callback_create_option)(void *data,
+ int (*callback_create_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
+ const void *callback_create_option_pointer,
void *callback_create_option_data,
- int (*callback_delete_option)(void *data,
+ int (*callback_delete_option)(const void *pointer,
+ void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
+ const void *callback_delete_option_pointer,
void *callback_delete_option_data);
struct t_config_section *(*config_search_section) (struct t_config_file *config_file,
const char *section_name);
@@ -473,15 +487,21 @@ struct t_weechat_plugin
const char *default_value,
const char *value,
int null_value_allowed,
- int (*callback_check_value)(void *data,
+ int (*callback_check_value)(const void *pointer,
+ void *data,
struct t_config_option *option,
const char *value),
+ const void *callback_check_value_pointer,
void *callback_check_value_data,
- void (*callback_change)(void *data,
+ void (*callback_change)(const void *pointer,
+ void *data,
struct t_config_option *option),
+ const void *callback_change_pointer,
void *callback_change_data,
- void (*callback_delete)(void *data,
+ void (*callback_delete)(const void *pointer,
+ void *data,
struct t_config_option *option),
+ const void *callback_delete_pointer,
void *callback_delete_data);
struct t_config_option *(*config_search_option) (struct t_config_file *config_file,
struct t_config_section *section,
@@ -563,49 +583,62 @@ struct t_weechat_plugin
const char *args,
const char *args_description,
const char *completion,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
int argc, char **argv,
char **argv_eol),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_command_run) (struct t_weechat_plugin *plugin,
const char *command,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *command),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_timer) (struct t_weechat_plugin *plugin,
long interval,
int align_second,
int max_calls,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
int remaining_calls),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_fd) (struct t_weechat_plugin *plugin,
int fd,
int flag_read,
int flag_write,
int flag_exception,
- int (*callback)(void *data, int fd),
+ int (*callback)(const void *pointer,
+ void *data,
+ int fd),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_process) (struct t_weechat_plugin *plugin,
const char *command,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
const char *err),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_process_hashtable) (struct t_weechat_plugin *plugin,
const char *command,
struct t_hashtable *options,
int timeout,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *command,
int return_code,
const char *out,
const char *err),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_connect) (struct t_weechat_plugin *plugin,
const char *proxy,
@@ -617,19 +650,22 @@ struct t_weechat_plugin
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
int status,
int gnutls_rc,
int sock,
const char *error,
const char *ip_address),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
const char *tags,
const char *message,
int strip_colors,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@@ -638,37 +674,46 @@ struct t_weechat_plugin
int highlight,
const char *prefix,
const char *message),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_signal) (struct t_weechat_plugin *plugin,
const char *signal,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *signal,
const char *type_data,
void *signal_data),
+ const void *callback_pointer,
void *callback_data);
int (*hook_signal_send) (const char *signal, const char *type_data,
void *signal_data);
struct t_hook *(*hook_hsignal) (struct t_weechat_plugin *plugin,
const char *signal,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *signal,
struct t_hashtable *hashtable),
+ const void *callback_pointer,
void *callback_data);
int (*hook_hsignal_send) (const char *signal,
struct t_hashtable *hashtable);
struct t_hook *(*hook_config) (struct t_weechat_plugin *plugin,
const char *option,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *option,
const char *value),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_completion) (struct t_weechat_plugin *plugin,
const char *completion_item,
const char *description,
- int (*callback)(void *data,
+ int (*callback)(const void *pointer,
+ void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
+ const void *callback_pointer,
void *callback_data);
const char *(*hook_completion_get_string) (struct t_gui_completion *completion,
const char *property);
@@ -678,10 +723,12 @@ struct t_weechat_plugin
const char *where);
struct t_hook *(*hook_modifier) (struct t_weechat_plugin *plugin,
const char *modifier,
- char *(*callback)(void *data,
+ char *(*callback)(const void *pointer,
+ void *data,
const char *modifier,
const char *modifier_data,
const char *string),
+ const void *callback_pointer,
void *callback_data);
char *(*hook_modifier_exec) (struct t_weechat_plugin *plugin,
const char *modifier,
@@ -691,54 +738,69 @@ struct t_weechat_plugin
const char *info_name,
const char *description,
const char *args_description,
- const char *(*callback)(void *data,
+ const char *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
const char *arguments),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_info_hashtable) (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
const char *args_description,
const char *output_description,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
const char *info_name,
struct t_hashtable *hashtable),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
- struct t_infolist *(*callback)(void *data,
+ struct t_infolist *(*callback)(const void *cb_pointer,
+ void *data,
const char *infolist_name,
- void *pointer,
+ void *obj_pointer,
const char *arguments),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_hdata) (struct t_weechat_plugin *plugin,
const char *hdata_name,
const char *description,
- struct t_hdata *(*callback)(void *data,
+ struct t_hdata *(*callback)(const void *pointer,
+ void *data,
const char *hdata_name),
+ const void *callback_pointer,
void *callback_data);
struct t_hook *(*hook_focus) (struct t_weechat_plugin *plugin,
const char *area,
- struct t_hashtable *(*callback)(void *data,
+ struct t_hashtable *(*callback)(const void *pointer,
+ void *data,
struct t_hashtable *info),
+ const void *callback_pointer,
void *callback_data);
void (*hook_set) (struct t_hook *hook, const char *property,
const char *value);
void (*unhook) (struct t_hook *hook);
- void (*unhook_all) (struct t_weechat_plugin *plugin);
+ void (*unhook_all_plugin) (struct t_weechat_plugin *plugin,
+ const char *subplugin);
/* buffers */
struct t_gui_buffer *(*buffer_new) (struct t_weechat_plugin *plugin,
const char *name,
- int (*input_callback)(void *data,
+ int (*input_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer,
const char *input_data),
+ const void *input_callback_pointer,
void *input_callback_data,
- int (*close_callback)(void *data,
+ int (*close_callback)(const void *pointer,
+ void *data,
struct t_gui_buffer *buffer),
+ const void *close_callback_pointer,
void *close_callback_data);
struct t_gui_buffer *(*buffer_search) (const char *plugin, const char *name);
struct t_gui_buffer *(*buffer_search_main) ();
@@ -827,11 +889,13 @@ struct t_weechat_plugin
struct t_gui_bar_item *(*bar_item_search) (const char *name);
struct t_gui_bar_item *(*bar_item_new) (struct t_weechat_plugin *plugin,
const char *name,
- char *(*build_callback)(void *data,
+ char *(*build_callback)(const void *pointer,
+ void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info),
+ const void *build_callback_pointer,
void *build_callback_data);
void (*bar_item_update) (const char *name);
void (*bar_item_remove) (struct t_gui_bar_item *item);
@@ -973,16 +1037,17 @@ struct t_weechat_plugin
/* upgrade */
struct t_upgrade_file *(*upgrade_new) (const char *filename,
- int write);
+ int (*callback_read)(const void *pointer,
+ void *data,
+ struct t_upgrade_file *upgrade_file,
+ int object_id,
+ struct t_infolist *infolist),
+ const void *callback_read_pointer,
+ void *callback_read_data);
int (*upgrade_write_object) (struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist);
- int (*upgrade_read) (struct t_upgrade_file *upgrade_file,
- int (*callback_read)(void *data,
- struct t_upgrade_file *upgrade_file,
- int object_id,
- struct t_infolist *infolist),
- void *callback_read_data);
+ int (*upgrade_read) (struct t_upgrade_file *upgrade_file);
void (*upgrade_close) (struct t_upgrade_file *upgrade_file);
};
@@ -1158,10 +1223,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->mkdir)(__directory, __mode)
#define weechat_mkdir_parents(__directory, __mode) \
(weechat_plugin->mkdir_parents)(__directory, __mode)
-#define weechat_exec_on_files(__directory, __hidden_files, __data, \
- __callback) \
+#define weechat_exec_on_files(__directory, __hidden_files, __callback, \
+ __callback_data) \
(weechat_plugin->exec_on_files)(__directory, __hidden_files, \
- __data, __callback)
+ __callback, __callback_data)
#define weechat_file_get_content(__filename) \
(weechat_plugin->file_get_content)(__filename)
@@ -1211,9 +1276,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* hash tables */
#define weechat_hashtable_new(__size, __type_keys, __type_values, \
- __hash_key_cb, __keycmp_cb) \
+ __callback_hash_key, __callback_keycmp) \
(weechat_plugin->hashtable_new)(__size, __type_keys, __type_values, \
- __hash_key_cb, __keycmp_cb)
+ __callback_hash_key, \
+ __callback_keycmp)
#define weechat_hashtable_set_with_size(__hashtable, __key, __key_size, \
__value, __value_size) \
(weechat_plugin->hashtable_set_with_size)(__hashtable, __key, \
@@ -1256,31 +1322,47 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* config files */
#define weechat_config_new(__name, __callback_reload, \
+ __callback_reload_pointer, \
__callback_reload_data) \
(weechat_plugin->config_new)(weechat_plugin, __name, \
__callback_reload, \
+ __callback_reload_pointer, \
__callback_reload_data)
#define weechat_config_new_section(__config, __name, \
__user_can_add_options, \
__user_can_delete_options, \
- __cb_read, __cb_read_data, \
- __cb_write_std, __cb_write_std_data, \
- __cb_write_def, __cb_write_def_data, \
+ __cb_read, \
+ __cb_read_pointer, \
+ __cb_read_data, \
+ __cb_write_std, \
+ __cb_write_std_pointer, \
+ __cb_write_std_data, \
+ __cb_write_def, \
+ __cb_write_def_pointer, \
+ __cb_write_def_data, \
__cb_create_option, \
+ __cb_create_option_pointer, \
__cb_create_option_data, \
__cb_delete_option, \
+ __cb_delete_option_pointer, \
__cb_delete_option_data) \
(weechat_plugin->config_new_section)(__config, __name, \
__user_can_add_options, \
__user_can_delete_options, \
- __cb_read, __cb_read_data, \
+ __cb_read, \
+ __cb_read_pointer, \
+ __cb_read_data, \
__cb_write_std, \
+ __cb_write_std_pointer, \
__cb_write_std_data, \
__cb_write_def, \
+ __cb_write_def_pointer, \
__cb_write_def_data, \
__cb_create_option, \
+ __cb_create_option_pointer, \
__cb_create_option_data, \
__cb_delete_option, \
+ __cb_delete_option_pointer, \
__cb_delete_option_data)
#define weechat_config_search_section(__config, __name) \
(weechat_plugin->config_search_section)(__config, __name)
@@ -1289,10 +1371,13 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__max, __default, __value, \
__null_value_allowed, \
__callback_check, \
+ __callback_check_pointer, \
__callback_check_data, \
__callback_change, \
+ __callback_change_pointer, \
__callback_change_data, \
__callback_delete, \
+ __callback_delete_pointer, \
__callback_delete_data) \
(weechat_plugin->config_new_option)(__config, __section, __name, \
__type, __desc, \
@@ -1301,10 +1386,13 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__value, \
__null_value_allowed, \
__callback_check, \
+ __callback_check_pointer, \
__callback_check_data, \
__callback_change, \
+ __callback_change_pointer, \
__callback_change_data, \
__callback_delete, \
+ __callback_delete_pointer, \
__callback_delete_data)
#define weechat_config_search_option(__config, __section, __name) \
(weechat_plugin->config_search_option)(__config, __section, __name)
@@ -1420,69 +1508,75 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* hooks */
#define weechat_hook_command(__command, __description, __args, \
__args_desc, __completion, __callback, \
- __data) \
+ __pointer, __data) \
(weechat_plugin->hook_command)(weechat_plugin, __command, \
__description, __args, __args_desc, \
- __completion, __callback, __data)
-#define weechat_hook_command_run(__command, __callback, __data) \
+ __completion, __callback, __pointer, \
+ __data)
+#define weechat_hook_command_run(__command, __callback, __pointer, \
+ __data) \
(weechat_plugin->hook_command_run)(weechat_plugin, __command, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_timer(__interval, __align_second, __max_calls, \
- __callback, __data) \
+ __callback, __pointer, __data) \
(weechat_plugin->hook_timer)(weechat_plugin, __interval, \
__align_second, __max_calls, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_fd(__fd, __flag_read, __flag_write, \
- __flag_exception, __callback, __data) \
+ __flag_exception, __callback, __pointer, \
+ __data) \
(weechat_plugin->hook_fd)(weechat_plugin, __fd, __flag_read, \
__flag_write, __flag_exception, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_process(__command, __timeout, __callback, \
- __callback_data) \
+ __callback_pointer, __callback_data) \
(weechat_plugin->hook_process)(weechat_plugin, __command, \
__timeout, __callback, \
- __callback_data)
+ __callback_pointer, __callback_data)
#define weechat_hook_process_hashtable(__command, __options, __timeout, \
- __callback, __callback_data) \
+ __callback, __callback_pointer, \
+ __callback_data) \
(weechat_plugin->hook_process_hashtable)(weechat_plugin, __command, \
__options, __timeout, \
__callback, \
+ __callback_pointer, \
__callback_data)
#define weechat_hook_connect(__proxy, __address, __port, __ipv6, \
__retry, __gnutls_sess, __gnutls_cb, \
__gnutls_dhkey_size, __gnutls_priorities, \
- __local_hostname, __callback, __data) \
+ __local_hostname, __callback, __pointer, \
+ __data) \
(weechat_plugin->hook_connect)(weechat_plugin, __proxy, __address, \
__port, __ipv6, __retry, \
__gnutls_sess, __gnutls_cb, \
__gnutls_dhkey_size, \
__gnutls_priorities, \
__local_hostname, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
- __callback, __data) \
+ __callback, __pointer, __data) \
(weechat_plugin->hook_print)(weechat_plugin, __buffer, __tags, \
__msg, __strip__colors, __callback, \
- __data)
-#define weechat_hook_signal(__signal, __callback, __data) \
+ __pointer, __data)
+#define weechat_hook_signal(__signal, __callback, __pointer, __data) \
(weechat_plugin->hook_signal)(weechat_plugin, __signal, __callback, \
- __data)
+ __pointer, __data)
#define weechat_hook_signal_send(__signal, __type_data, __signal_data) \
(weechat_plugin->hook_signal_send)(__signal, __type_data, \
__signal_data)
-#define weechat_hook_hsignal(__signal, __callback, __data) \
+#define weechat_hook_hsignal(__signal, __callback, __pointer, __data) \
(weechat_plugin->hook_hsignal)(weechat_plugin, __signal, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_hsignal_send(__signal, __hashtable) \
(weechat_plugin->hook_hsignal_send)(__signal, __hashtable)
-#define weechat_hook_config(__option, __callback, __data) \
+#define weechat_hook_config(__option, __callback, __pointer, __data) \
(weechat_plugin->hook_config)(weechat_plugin, __option, __callback, \
- __data)
+ __pointer, __data)
#define weechat_hook_completion(__completion, __description, \
- __callback, __data) \
+ __callback, __pointer, __data) \
(weechat_plugin->hook_completion)(weechat_plugin, __completion, \
__description, __callback, \
- __data)
+ __pointer, __data)
#define weechat_hook_completion_get_string(__completion, __property) \
(weechat_plugin->hook_completion_get_string)(__completion, \
__property)
@@ -1491,58 +1585,69 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->hook_completion_list_add)(__completion, __word, \
__nick_completion, \
__where)
-#define weechat_hook_modifier(__modifier, __callback, __data) \
+#define weechat_hook_modifier(__modifier, __callback, __pointer, \
+ __data) \
(weechat_plugin->hook_modifier)(weechat_plugin, __modifier, \
- __callback, __data)
+ __callback, __pointer, __data)
#define weechat_hook_modifier_exec(__modifier, __modifier_data, \
__string) \
(weechat_plugin->hook_modifier_exec)(weechat_plugin, __modifier, \
__modifier_data, __string)
#define weechat_hook_info(__info_name, __description, \
- __args_description, __callback, __data) \
+ __args_description, __callback, __pointer, \
+ __data) \
(weechat_plugin->hook_info)(weechat_plugin, __info_name, \
- __description, __args_description, \
- __callback, __data)
+ __description, __args_description, \
+ __callback, __pointer, __data)
#define weechat_hook_info_hashtable(__info_name, __description, \
__args_description, \
__output_description, \
__callback, \
+ __pointer, \
__data) \
(weechat_plugin->hook_info_hashtable)(weechat_plugin, __info_name, \
__description, \
__args_description, \
__output_description, \
- __callback, __data)
+ __callback, __pointer, \
+ __data)
#define weechat_hook_infolist(__infolist_name, __description, \
__pointer_description, \
- __args_description, __callback, __data) \
+ __args_description, __callback, \
+ __pointer, __data) \
(weechat_plugin->hook_infolist)(weechat_plugin, __infolist_name, \
__description, \
__pointer_description, \
__args_description, __callback, \
- __data)
+ __pointer, __data)
#define weechat_hook_hdata(__hdata_name, __description, __callback, \
- __data) \
+ __pointer, __data) \
(weechat_plugin->hook_hdata)(weechat_plugin, __hdata_name, \
- __description, __callback, __data)
-#define weechat_hook_focus(__area, __callback, __data) \
- (weechat_plugin->hook_focus)(weechat_plugin, __area, __callback, \
+ __description, __callback, __pointer, \
__data)
+#define weechat_hook_focus(__area, __callback, __pointer, __data) \
+ (weechat_plugin->hook_focus)(weechat_plugin, __area, __callback, \
+ __pointer, __data)
#define weechat_hook_set(__hook, __property, __value) \
(weechat_plugin->hook_set)(__hook, __property, __value)
#define weechat_unhook(__hook) \
(weechat_plugin->unhook)( __hook)
-#define weechat_unhook_all() \
- (weechat_plugin->unhook_all_plugin)(weechat_plugin)
+#define weechat_unhook_all_plugin(__subplugin) \
+ (weechat_plugin->unhook_all_plugin)(weechat_plugin, __subplugin)
/* buffers */
#define weechat_buffer_new(__name, __input_callback, \
- __input_callback_data, __close_callback, \
+ __input_callback_pointer, \
+ __input_callback_data, \
+ __close_callback, \
+ __close_callback_pointer, \
__close_callback_data) \
(weechat_plugin->buffer_new)(weechat_plugin, __name, \
__input_callback, \
+ __input_callback_pointer, \
__input_callback_data, \
__close_callback, \
+ __close_callback_pointer, \
__close_callback_data)
#define weechat_buffer_search(__plugin, __name) \
(weechat_plugin->buffer_search)(__plugin, __name)
@@ -1646,9 +1751,13 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* bars */
#define weechat_bar_item_search(__name) \
(weechat_plugin->bar_item_search)(__name)
-#define weechat_bar_item_new(__name, __build_callback, __data) \
+#define weechat_bar_item_new(__name, __build_callback, \
+ __build_callback_pointer, \
+ __build_callback_data) \
(weechat_plugin->bar_item_new)(weechat_plugin, __name, \
- __build_callback, __data)
+ __build_callback, \
+ __build_callback_pointer, \
+ __build_callback_data)
#define weechat_bar_item_update(__name) \
(weechat_plugin->bar_item_update)(__name)
#define weechat_bar_item_remove(__item) \
@@ -1818,16 +1927,18 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
(weechat_plugin->hdata_get_string)(__hdata, __property)
/* upgrade */
-#define weechat_upgrade_new(__filename, __write) \
- (weechat_plugin->upgrade_new)(__filename, __write)
+#define weechat_upgrade_new(__filename, __callback_read, \
+ __callback_read_pointer, \
+ __callback_read_data) \
+ (weechat_plugin->upgrade_new)(__filename, __callback_read, \
+ __callback_read_pointer, \
+ __callback_read_data)
#define weechat_upgrade_write_object(__upgrade_file, __object_id, \
__infolist) \
(weechat_plugin->upgrade_write_object)(__upgrade_file, __object_id, \
__infolist)
-#define weechat_upgrade_read(__upgrade_file, __callback_read, \
- __callback_read_data) \
- (weechat_plugin->upgrade_read)(__upgrade_file, __callback_read, \
- __callback_read_data)
+#define weechat_upgrade_read(__upgrade_file) \
+ (weechat_plugin->upgrade_read)(__upgrade_file)
#define weechat_upgrade_close(__upgrade_file) \
(weechat_plugin->upgrade_close)(__upgrade_file)
diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c
index c6840a44a..934797b46 100644
--- a/src/plugins/xfer/xfer-buffer.c
+++ b/src/plugins/xfer/xfer-buffer.c
@@ -259,12 +259,14 @@ xfer_buffer_refresh (const char *hotlist)
*/
int
-xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+xfer_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_xfer *xfer, *ptr_xfer, *next_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
xfer = xfer_search_by_number (xfer_buffer_selected_line);
@@ -323,9 +325,11 @@ xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-xfer_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+xfer_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -344,8 +348,8 @@ xfer_buffer_open ()
if (!xfer_buffer)
{
xfer_buffer = weechat_buffer_new (XFER_BUFFER_NAME,
- &xfer_buffer_input_cb, NULL,
- &xfer_buffer_close_cb, NULL);
+ &xfer_buffer_input_cb, NULL, NULL,
+ &xfer_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then exit */
if (!xfer_buffer)
diff --git a/src/plugins/xfer/xfer-buffer.h b/src/plugins/xfer/xfer-buffer.h
index a855f0939..6d5ebb188 100644
--- a/src/plugins/xfer/xfer-buffer.h
+++ b/src/plugins/xfer/xfer-buffer.h
@@ -26,9 +26,11 @@ extern struct t_gui_buffer *xfer_buffer;
extern int xfer_buffer_selected_line;
extern void xfer_buffer_refresh (const char *hotlist);
-extern int xfer_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+extern int xfer_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data);
-extern int xfer_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
+extern int xfer_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer);
extern void xfer_buffer_open ();
#endif /* WEECHAT_XFER_BUFFER_H */
diff --git a/src/plugins/xfer/xfer-chat.c b/src/plugins/xfer/xfer-chat.c
index 5ac687da0..ce620bdd9 100644
--- a/src/plugins/xfer/xfer-chat.c
+++ b/src/plugins/xfer/xfer-chat.c
@@ -104,7 +104,7 @@ xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
*/
int
-xfer_chat_recv_cb (void *arg_xfer, int fd)
+xfer_chat_recv_cb (const void *pointer, void *data, int fd)
{
struct t_xfer *xfer;
static char buffer[4096 + 2];
@@ -115,9 +115,10 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
int num_read, length, ctcp_action;
/* make C compiler happy */
+ (void) data;
(void) fd;
- xfer = (struct t_xfer *)arg_xfer;
+ xfer = (struct t_xfer *)pointer;
num_read = recv (xfer->sock, buffer, sizeof (buffer) - 2, 0);
if (num_read > 0)
@@ -259,13 +260,15 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
*/
int
-xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
+xfer_chat_buffer_input_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
const char *input_data)
{
struct t_xfer *ptr_xfer;
char *input_data_color, str_tags[256], *str_color;
/* make C compiler happy */
+ (void) pointer;
(void) data;
ptr_xfer = xfer_search_by_buffer (buffer);
@@ -307,11 +310,13 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
-xfer_chat_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
+xfer_chat_buffer_close_cb (const void *pointer, void *data,
+ struct t_gui_buffer *buffer)
{
struct t_xfer *ptr_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
@@ -353,9 +358,10 @@ xfer_chat_open_buffer (struct t_xfer *xfer)
xfer->buffer = weechat_buffer_search (XFER_PLUGIN_NAME, name);
if (!xfer->buffer)
{
- xfer->buffer = weechat_buffer_new (name,
- &xfer_chat_buffer_input_cb, NULL,
- &xfer_chat_buffer_close_cb, NULL);
+ xfer->buffer = weechat_buffer_new (
+ name,
+ &xfer_chat_buffer_input_cb, NULL, NULL,
+ &xfer_chat_buffer_close_cb, NULL, NULL);
buffer_created = 1;
/* failed to create buffer ? then return */
diff --git a/src/plugins/xfer/xfer-chat.h b/src/plugins/xfer/xfer-chat.h
index f2ecca818..fa1018651 100644
--- a/src/plugins/xfer/xfer-chat.h
+++ b/src/plugins/xfer/xfer-chat.h
@@ -21,7 +21,7 @@
#define WEECHAT_XFER_CHAT_H 1
extern void xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...);
-extern int xfer_chat_recv_cb (void *arg_xfer, int fd);
+extern int xfer_chat_recv_cb (const void *pointer, void *data, int fd);
extern void xfer_chat_open_buffer (struct t_xfer *xfer);
#endif /* WEECHAT_XFER_CHAT_H */
diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c
index 21790fa09..3c643e58c 100644
--- a/src/plugins/xfer/xfer-command.c
+++ b/src/plugins/xfer/xfer-command.c
@@ -35,12 +35,14 @@
*/
int
-xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
+xfer_command_me (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_xfer *ptr_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) argc;
(void) argv;
@@ -192,10 +194,12 @@ xfer_command_xfer_list (int full)
*/
int
-xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc,
+xfer_command_xfer (const void *pointer, void *data,
+ struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) buffer;
(void) argv_eol;
@@ -251,7 +255,8 @@ xfer_command_init ()
N_("send a CTCP action to remote host"),
N_("<message>"),
N_("message: message to send"),
- NULL, &xfer_command_me, NULL);
+ NULL,
+ &xfer_command_me, NULL, NULL);
weechat_hook_command (
"xfer",
N_("xfer control"),
@@ -260,5 +265,6 @@ xfer_command_init ()
"listfull: list xfer (verbose)\n"
"\n"
"Without argument, this command opens buffer with xfer list."),
- "list|listfull", &xfer_command_xfer, NULL);
+ "list|listfull",
+ &xfer_command_xfer, NULL, NULL);
}
diff --git a/src/plugins/xfer/xfer-completion.c b/src/plugins/xfer/xfer-completion.c
index a65e34aeb..75004657e 100644
--- a/src/plugins/xfer/xfer-completion.c
+++ b/src/plugins/xfer/xfer-completion.c
@@ -33,13 +33,15 @@
*/
int
-xfer_completion_nick_cb (void *data, const char *completion_item,
+xfer_completion_nick_cb (const void *pointer, void *data,
+ const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_xfer *ptr_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) completion_item;
@@ -70,5 +72,5 @@ xfer_completion_init ()
{
weechat_hook_completion ("nick",
N_("nicks of DCC chat"),
- &xfer_completion_nick_cb, NULL);
+ &xfer_completion_nick_cb, NULL, NULL);
}
diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c
index e6d374a30..b3971690c 100644
--- a/src/plugins/xfer/xfer-config.c
+++ b/src/plugins/xfer/xfer-config.c
@@ -71,9 +71,11 @@ struct t_config_option *xfer_config_file_use_nick_in_filename;
*/
void
-xfer_config_refresh_cb (void *data, struct t_config_option *option)
+xfer_config_refresh_cb (const void *pointer, void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) option;
@@ -86,9 +88,11 @@ xfer_config_refresh_cb (void *data, struct t_config_option *option)
*/
int
-xfer_config_reload (void *data, struct t_config_file *config_file)
+xfer_config_reload (const void *pointer, void *data,
+ struct t_config_file *config_file)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
return weechat_config_reload (config_file);
@@ -108,15 +112,17 @@ xfer_config_init ()
struct t_config_section *ptr_section;
xfer_config_file = weechat_config_new (XFER_CONFIG_NAME,
- &xfer_config_reload, NULL);
+ &xfer_config_reload, NULL, NULL);
if (!xfer_config_file)
return 0;
ptr_section = weechat_config_new_section (xfer_config_file, "look",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -128,26 +134,31 @@ xfer_config_init ()
"auto_open_buffer", "boolean",
N_("auto open xfer buffer when a new xfer is added "
"to list"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_look_progress_bar_size = weechat_config_new_option (
xfer_config_file, ptr_section,
"progress_bar_size", "integer",
N_("size of progress bar, in chars (if 0, progress bar is disabled)"),
NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_look_pv_tags = weechat_config_new_option (
xfer_config_file, ptr_section,
"pv_tags", "string",
N_("comma separated list of tags used in private messages, for example: "
"\"notify_message\", \"notify_private\" or \"notify_highlight\""),
- NULL, 0, 0, "notify_private", NULL, 0, NULL, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "notify_private", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "color",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -159,61 +170,81 @@ xfer_config_init ()
"status_waiting", "color",
N_("text color for \"waiting\" status"),
NULL, 0, 0, "lightcyan", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_CONNECTING] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_connecting", "color",
N_("text color for \"connecting\" status"),
NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_ACTIVE] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_active", "color",
N_("text color for \"active\" status"),
NULL, 0, 0, "lightblue", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_DONE] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_done", "color",
N_("text color for \"done\" status"),
NULL, 0, 0, "lightgreen", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_FAILED] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_failed", "color",
N_("text color for \"failed\" status"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_status[XFER_STATUS_ABORTED] = weechat_config_new_option (
xfer_config_file, ptr_section,
"status_aborted", "color",
N_("text color for \"aborted\" status"),
NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_text = weechat_config_new_option (
xfer_config_file, ptr_section,
"text", "color",
N_("text color in xfer buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_text_bg = weechat_config_new_option (
xfer_config_file, ptr_section,
"text_bg", "color",
N_("background color in xfer buffer"),
NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
xfer_config_color_text_selected = weechat_config_new_option (
xfer_config_file, ptr_section,
"text_selected", "color",
N_("text color of selected line in xfer buffer"),
NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ &xfer_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "network",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -225,18 +256,20 @@ xfer_config_init ()
"blocksize", "integer",
N_("block size for sending packets, in bytes"),
NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_fast_send = weechat_config_new_option (
xfer_config_file, ptr_section,
"fast_send", "boolean",
N_("does not wait for ACK when sending file"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_own_ip = weechat_config_new_option (
xfer_config_file, ptr_section,
"own_ip", "string",
N_("IP or DNS address used for sending files/chats "
"(if empty, local interface IP is used)"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_port_range = weechat_config_new_option (
xfer_config_file, ptr_section,
"port_range", "string",
@@ -245,24 +278,29 @@ xfer_config_init ()
"range, ie. 5000-5015, empty value means any port, it's recommended "
"to use ports greater than 1024, because only root can use ports "
"below 1024)"),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_speed_limit = weechat_config_new_option (
xfer_config_file, ptr_section,
"speed_limit", "integer",
N_("speed limit for sending files, in kilo-bytes by second (0 means "
"no limit)"),
- NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, INT_MAX, "0", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_network_timeout = weechat_config_new_option (
xfer_config_file, ptr_section,
"timeout", "integer",
N_("timeout for xfer request (in seconds)"),
- NULL, 5, INT_MAX, "300", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 5, INT_MAX, "300", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (xfer_config_file, "file",
0, 0,
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
- NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (xfer_config_file);
@@ -273,12 +311,14 @@ xfer_config_init ()
xfer_config_file, ptr_section,
"auto_accept_chats", "boolean",
N_("automatically accept chat requests (use carefully!)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_accept_files = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_accept_files", "boolean",
N_("automatically accept incoming files (use carefully!)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_accept_nicks = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_accept_nicks", "string",
@@ -286,36 +326,42 @@ xfer_config_init ()
"chats are automatically accepted; format is \"server.nick\" (for a "
"specific server) or \"nick\" (for all servers); example: "
"\"freenode.FlashCode,andrew\""),
- NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_check_crc32 = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_check_crc32", "boolean",
N_("automatically check CRC32 file checksum if it is found in the "
"filename (8 hexadecimal chars)"),
- NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_rename = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_rename", "boolean",
N_("rename incoming files if already exists (add \".1\", \".2\", ...)"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_auto_resume = weechat_config_new_option (
xfer_config_file, ptr_section,
"auto_resume", "boolean",
N_("automatically resume file transfer if connection with remote host "
"is lost"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_convert_spaces = weechat_config_new_option (
xfer_config_file, ptr_section,
"convert_spaces", "boolean",
N_("convert spaces to underscores when sending and receiving files"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_download_path = weechat_config_new_option (
xfer_config_file, ptr_section,
"download_path", "string",
N_("path for writing incoming files: \"%h\" at beginning of string is "
"replaced by WeeChat home (\"~/.weechat\" by default) "
"(note: content is evaluated, see /help eval)"),
- NULL, 0, 0, "%h/xfer", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "%h/xfer", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_upload_path = weechat_config_new_option (
xfer_config_file, ptr_section,
"upload_path", "string",
@@ -323,12 +369,14 @@ xfer_config_init ()
"by user): \"%h\" at beginning of string is replaced by WeeChat "
"home (\"~/.weechat\" by default) "
"(note: content is evaluated, see /help eval)"),
- NULL, 0, 0, "~", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "~", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
xfer_config_file_use_nick_in_filename = weechat_config_new_option (
xfer_config_file, ptr_section,
"use_nick_in_filename", "boolean",
N_("use remote nick as prefix in local filename when receiving a file"),
- NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
diff --git a/src/plugins/xfer/xfer-info.c b/src/plugins/xfer/xfer-info.c
index d4a5b5c69..a3f55d84e 100644
--- a/src/plugins/xfer/xfer-info.c
+++ b/src/plugins/xfer/xfer-info.c
@@ -31,28 +31,30 @@
*/
struct t_infolist *
-xfer_info_infolist_xfer_cb (void *data, const char *infolist_name,
- void *pointer, const char *arguments)
+xfer_info_infolist_xfer_cb (const void *pointer, void *data,
+ const char *infolist_name,
+ void *obj_pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_xfer *ptr_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) infolist_name;
(void) arguments;
- if (pointer && !xfer_valid (pointer))
+ if (obj_pointer && !xfer_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
- if (pointer)
+ if (obj_pointer)
{
/* build list with only one xfer */
- if (!xfer_add_to_infolist (ptr_infolist, pointer))
+ if (!xfer_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -88,5 +90,5 @@ xfer_info_init ()
"xfer", N_("list of xfer"),
N_("xfer pointer (optional)"),
NULL,
- &xfer_info_infolist_xfer_cb, NULL);
+ &xfer_info_infolist_xfer_cb, NULL, NULL);
}
diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c
index d536b4fb4..f52345dee 100644
--- a/src/plugins/xfer/xfer-network.c
+++ b/src/plugins/xfer/xfer-network.c
@@ -93,16 +93,17 @@ xfer_network_write_pipe (struct t_xfer *xfer, int status, int error)
*/
int
-xfer_network_child_read_cb (void *arg_xfer, int fd)
+xfer_network_child_read_cb (const void *pointer, void *data, int fd)
{
struct t_xfer *xfer;
char bufpipe[1 + 1 + 32 + 1];
int num_read;
/* make C compiler happy */
+ (void) data;
(void) fd;
- xfer = (struct t_xfer *)arg_xfer;
+ xfer = (struct t_xfer *)pointer;
num_read = read (xfer->child_read, bufpipe, sizeof (bufpipe));
if (num_read > 0)
@@ -270,7 +271,7 @@ xfer_network_send_file_fork (struct t_xfer *xfer)
xfer->hook_fd = weechat_hook_fd (xfer->child_read,
1, 0, 0,
&xfer_network_child_read_cb,
- xfer);
+ xfer, NULL);
}
/*
@@ -328,7 +329,7 @@ xfer_network_recv_file_fork (struct t_xfer *xfer)
xfer->hook_fd = weechat_hook_fd (xfer->child_read,
1, 0, 0,
&xfer_network_child_read_cb,
- xfer);
+ xfer, NULL);
}
/*
@@ -364,7 +365,7 @@ xfer_network_child_kill (struct t_xfer *xfer)
*/
int
-xfer_network_fd_cb (void *arg_xfer, int fd)
+xfer_network_fd_cb (const void *pointer, void *data, int fd)
{
struct t_xfer *xfer;
int sock, flags, error;
@@ -373,11 +374,12 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
char str_address[NI_MAXHOST];
/* make C compiler happy */
+ (void) data;
(void) fd;
length = sizeof (addr);
memset (&addr, 0, length);
- xfer = (struct t_xfer *)arg_xfer;
+ xfer = (struct t_xfer *)pointer;
if (xfer->status == XFER_STATUS_CONNECTING)
{
@@ -484,7 +486,7 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
xfer->hook_fd = weechat_hook_fd (xfer->sock,
1, 0, 0,
&xfer_chat_recv_cb,
- xfer);
+ xfer, NULL);
xfer_chat_open_buffer (xfer);
}
}
@@ -498,14 +500,15 @@ xfer_network_fd_cb (void *arg_xfer, int fd)
*/
int
-xfer_network_timer_cb (void *arg_xfer, int remaining_calls)
+xfer_network_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_xfer *xfer;
/* make C compiler happy */
+ (void) data;
(void) remaining_calls;
- xfer = (struct t_xfer *)arg_xfer;
+ xfer = (struct t_xfer *)pointer;
if ((xfer->status == XFER_STATUS_WAITING)
|| (xfer->status == XFER_STATUS_CONNECTING))
@@ -526,7 +529,8 @@ xfer_network_timer_cb (void *arg_xfer, int remaining_calls)
*/
int
-xfer_network_connect_chat_recv_cb (void *data, int status, int gnutls_rc,
+xfer_network_connect_chat_recv_cb (const void *pointer, void *data,
+ int status, int gnutls_rc,
int sock, const char *error,
const char *ip_address)
{
@@ -534,10 +538,11 @@ xfer_network_connect_chat_recv_cb (void *data, int status, int gnutls_rc,
int flags;
/* make C compiler happy */
+ (void) data;
(void) gnutls_rc;
(void) ip_address;
- xfer = (struct t_xfer*)data;
+ xfer = (struct t_xfer*)pointer;
weechat_unhook (xfer->hook_connect);
xfer->hook_connect = NULL;
@@ -567,7 +572,7 @@ xfer_network_connect_chat_recv_cb (void *data, int status, int gnutls_rc,
xfer->hook_fd = weechat_hook_fd (xfer->sock,
1, 0, 0,
&xfer_chat_recv_cb,
- xfer);
+ xfer, NULL);
xfer_chat_open_buffer (xfer);
xfer->status = XFER_STATUS_ACTIVE;
@@ -691,7 +696,7 @@ xfer_network_connect (struct t_xfer *xfer)
xfer->hook_fd = weechat_hook_fd (xfer->sock,
1, 0, 0,
&xfer_network_fd_cb,
- xfer);
+ xfer, NULL);
/* add timeout */
if (weechat_config_integer (xfer_config_network_timeout) > 0)
@@ -699,7 +704,7 @@ xfer_network_connect (struct t_xfer *xfer)
xfer->hook_timer = weechat_hook_timer (weechat_config_integer (xfer_config_network_timeout) * 1000,
0, 1,
&xfer_network_timer_cb,
- xfer);
+ xfer, NULL);
}
}
@@ -711,7 +716,7 @@ xfer_network_connect (struct t_xfer *xfer)
xfer->port, 1, 0, NULL, NULL,
0, "NONE", NULL,
&xfer_network_connect_chat_recv_cb,
- xfer);
+ xfer, NULL);
}
/* for file receiving, connection is made in child process (blocking) */
diff --git a/src/plugins/xfer/xfer-upgrade.c b/src/plugins/xfer/xfer-upgrade.c
index 65b3bbcab..8d0cb2809 100644
--- a/src/plugins/xfer/xfer-upgrade.c
+++ b/src/plugins/xfer/xfer-upgrade.c
@@ -58,7 +58,8 @@ xfer_upgrade_save ()
int rc;
struct t_upgrade_file *upgrade_file;
- upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME, 1);
+ upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME,
+ NULL, NULL, NULL);
if (!upgrade_file)
return 0;
@@ -106,17 +107,19 @@ xfer_upgrade_set_buffer_callbacks ()
*/
int
-xfer_upgrade_read_cb (void *data,
+xfer_upgrade_read_cb (const void *pointer, void *data,
struct t_upgrade_file *upgrade_file,
int object_id,
struct t_infolist *infolist)
{
- /* TODO: write xfer read cb */
+ /* make C compiler happy */
+ (void) pointer;
(void) data;
(void) upgrade_file;
(void) object_id;
(void) infolist;
+ /* TODO: write xfer read cb */
return WEECHAT_RC_OK;
}
@@ -136,10 +139,13 @@ xfer_upgrade_load ()
xfer_upgrade_set_buffer_callbacks ();
- upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME, 0);
+ upgrade_file = weechat_upgrade_new (XFER_UPGRADE_FILENAME,
+ &xfer_upgrade_read_cb, NULL, NULL);
if (!upgrade_file)
return 0;
- rc = weechat_upgrade_read (upgrade_file, &xfer_upgrade_read_cb, NULL);
+
+ rc = weechat_upgrade_read (upgrade_file);
+
weechat_upgrade_close (upgrade_file);
return rc;
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 5af0fc7cf..fb7d5ff52 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -116,10 +116,12 @@ xfer_valid (struct t_xfer *xfer)
*/
int
-xfer_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
+xfer_signal_upgrade_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -997,7 +999,8 @@ xfer_resolve_addr (const char *str_address, const char *str_port,
*/
int
-xfer_add_cb (void *data, const char *signal, const char *type_data,
+xfer_add_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_infolist *infolist;
@@ -1014,6 +1017,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
struct t_xfer *ptr_xfer;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1367,7 +1371,8 @@ error:
*/
int
-xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
+xfer_start_resume_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_infolist *infolist;
@@ -1377,6 +1382,7 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
unsigned long long start_resume;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1451,7 +1457,8 @@ error:
*/
int
-xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
+xfer_accept_resume_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
struct t_infolist *infolist;
@@ -1461,6 +1468,7 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
unsigned long long start_resume;
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1737,10 +1745,12 @@ xfer_print_log ()
*/
int
-xfer_debug_dump_cb (void *data, const char *signal, const char *type_data,
+xfer_debug_dump_cb (const void *pointer, void *data,
+ const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
+ (void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -1783,11 +1793,16 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
xfer_command_init ();
/* hook some signals */
- weechat_hook_signal ("upgrade", &xfer_signal_upgrade_cb, NULL);
- weechat_hook_signal ("xfer_add", &xfer_add_cb, NULL);
- weechat_hook_signal ("xfer_start_resume", &xfer_start_resume_cb, NULL);
- weechat_hook_signal ("xfer_accept_resume", &xfer_accept_resume_cb, NULL);
- weechat_hook_signal ("debug_dump", &xfer_debug_dump_cb, NULL);
+ weechat_hook_signal ("upgrade",
+ &xfer_signal_upgrade_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_add",
+ &xfer_add_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_start_resume",
+ &xfer_start_resume_cb, NULL, NULL);
+ weechat_hook_signal ("xfer_accept_resume",
+ &xfer_accept_resume_cb, NULL, NULL);
+ weechat_hook_signal ("debug_dump",
+ &xfer_debug_dump_cb, NULL, NULL);
/* hook completions */
xfer_completion_init ();