diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2016-03-21 18:11:21 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2016-03-21 18:11:21 +0100 |
commit | cf6aca1619c32422a43fa3d82e0674f6b7b49fe9 (patch) | |
tree | 65392ef12eab877f544fe306fe0abb98214ddebd /src/plugins/relay | |
parent | 6d764b64c50adb19309a9de14bfeafac648ab47a (diff) | |
download | weechat-cf6aca1619c32422a43fa3d82e0674f6b7b49fe9.zip |
core: add pointer in some callbacks (closes #406)
This pointer is the first argument received by callbacks, and the
existing argument "data" is now automatically freed by WeeChat when the
object containing the callback is removed.
With this new pointer, the linked list of callbacks in scripts has been
removed. This will improve speed of scripts (using a lot of hooks),
reduce memory used by scripts and reduce time to unload scripts.
Following functions are affected in the C API:
* exec_on_files
* config_new
* config_new_section
* config_new_option
* hook_command
* hook_command_run
* hook_timer
* hook_fd
* hook_process
* hook_process_hashtable
* hook_connect
* hook_print
* hook_signal
* hook_hsignal
* hook_config
* hook_completion
* hook_modifier
* hook_info
* hook_info_hashtable
* hook_infolist
* hook_hdata
* hook_focus
* unhook_all_plugin
* buffer_new
* bar_item_new
* upgrade_new
* upgrade_read
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/irc/relay-irc.c | 43 | ||||
-rw-r--r-- | src/plugins/relay/relay-buffer.c | 12 | ||||
-rw-r--r-- | src/plugins/relay/relay-buffer.h | 8 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.c | 34 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.h | 5 | ||||
-rw-r--r-- | src/plugins/relay/relay-command.c | 17 | ||||
-rw-r--r-- | src/plugins/relay/relay-completion.c | 18 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 222 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.h | 2 | ||||
-rw-r--r-- | src/plugins/relay/relay-info.c | 20 | ||||
-rw-r--r-- | src/plugins/relay/relay-raw.c | 7 | ||||
-rw-r--r-- | src/plugins/relay/relay-server.c | 7 | ||||
-rw-r--r-- | src/plugins/relay/relay-upgrade.c | 13 | ||||
-rw-r--r-- | src/plugins/relay/relay.c | 14 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-msg.c | 3 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 35 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.h | 15 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat.c | 33 |
18 files changed, 318 insertions, 190 deletions
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); |