mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 17:53:13 +02:00
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
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
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,
|
||||
&charset_config_create_option, 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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+13
-10
@@ -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 ();
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+11
-6
@@ -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 ();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -802,39 +814,21 @@ weechat_guile_signal_debug_libs_cb (void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+229
-304
File diff suppressed because it is too large
Load Diff
@@ -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) \
|
||||
{ \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+676
-379
File diff suppressed because it is too large
Load Diff
@@ -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 ();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
+103
-70
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+30
-14
@@ -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;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
@@ -710,41 +722,21 @@ weechat_js_signal_debug_libs_cb (void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+45
-19
@@ -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_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);
|
||||
weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL, NULL);
|
||||
|
||||
logger_info_init ();
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+378
-315
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
@@ -805,38 +817,21 @@ weechat_lua_signal_debug_libs_cb (void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
+380
-312
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -837,38 +848,21 @@ weechat_perl_signal_debug_libs_cb (void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
+246
-165
File diff suppressed because it is too large
Load Diff
+39
-23
@@ -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
|
||||
{
|
||||
|
||||
+385
-523
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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 */
|
||||
+254
-139
@@ -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 */
|
||||
@@ -333,13 +334,75 @@ invalid:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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");
|
||||
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])
|
||||
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.
|
||||
*/
|
||||
|
||||
ptr_script_cb = next_script_cb;
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
plugin_script_close_buffers (weechat_plugin, script);
|
||||
|
||||
/* unhook */
|
||||
if (ptr_script_cb->hook)
|
||||
weechat_unhook (ptr_script_cb->hook);
|
||||
plugin_script_remove_bar_items (weechat_plugin, script);
|
||||
|
||||
/* close buffer */
|
||||
if (ptr_script_cb->buffer)
|
||||
weechat_buffer_close (ptr_script_cb->buffer);
|
||||
plugin_script_remove_configs (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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 ("");
|
||||
|
||||
+26
-17
@@ -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,
|
||||
|
||||
+12
-9
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
@@ -1158,39 +1172,21 @@ weechat_python_signal_debug_libs_cb (void *data, const char *signal,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user