1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +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:
Sébastien Helleu
2016-03-21 18:11:21 +01:00
parent 6d764b64c5
commit cf6aca1619
207 changed files with 9596 additions and 7472 deletions
+23 -15
View File
@@ -483,12 +483,14 @@ script_action_autoload (const char *name, int quiet, int autoload)
*/
int
script_action_installnext_timer_cb (void *data, int remaining_calls)
script_action_installnext_timer_cb (const void *pointer, void *data,
int remaining_calls)
{
/* make C compiler happy */
(void) data;
(void) remaining_calls;
script_action_install ((data) ? 1 : 0);
script_action_install ((pointer) ? 1 : 0);
return WEECHAT_RC_OK;
}
@@ -498,7 +500,8 @@ script_action_installnext_timer_cb (void *data, int remaining_calls)
*/
int
script_action_install_process_cb (void *data, const char *command,
script_action_install_process_cb (const void *pointer, void *data,
const char *command,
int return_code, const char *out,
const char *err)
{
@@ -507,9 +510,10 @@ script_action_install_process_cb (void *data, const char *command,
struct t_script_repo *ptr_script;
/* make C compiler happy */
(void) data;
(void) out;
quiet = (data) ? 1 : 0;
quiet = (pointer) ? 1 : 0;
if (return_code >= 0)
{
@@ -558,7 +562,8 @@ script_action_install_process_cb (void *data, const char *command,
/* schedule install of next script */
weechat_hook_timer (10, 0, 1,
&script_action_installnext_timer_cb,
(quiet) ? (void *)1 : (void *)0);
(quiet) ? (void *)1 : (void *)0,
NULL);
}
}
}
@@ -633,8 +638,7 @@ script_action_install (int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
NULL, NULL);
if (options)
{
url = script_build_download_url (ptr_script_to_install->url);
@@ -653,7 +657,8 @@ script_action_install (int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_action_install_process_cb,
(quiet) ? (void *)1 : (void *)0);
(quiet) ? (void *)1 : (void *)0,
NULL);
free (url);
}
weechat_hashtable_free (options);
@@ -799,7 +804,8 @@ script_action_hold (const char *name, int quiet)
*/
int
script_action_show_diff_process_cb (void *data, const char *command,
script_action_show_diff_process_cb (const void *pointer, void *data,
const char *command,
int return_code, const char *out,
const char *err)
{
@@ -808,6 +814,7 @@ script_action_show_diff_process_cb (void *data, const char *command,
int num_lines, i, diff_color;
/* make C compiler happy */
(void) data;
(void) command;
if (script_buffer && script_buffer_detail_script
@@ -876,7 +883,7 @@ script_action_show_diff_process_cb (void *data, const char *command,
if ((return_code == WEECHAT_HOOK_PROCESS_ERROR) || (return_code >= 0))
{
/* last call to this callback: delete temporary file */
filename = (char *)data;
filename = (char *)pointer;
unlink (filename);
free (filename);
}
@@ -889,7 +896,8 @@ script_action_show_diff_process_cb (void *data, const char *command,
*/
int
script_action_show_source_process_cb (void *data, const char *command,
script_action_show_source_process_cb (const void *pointer, void *data,
const char *command,
int return_code, const char *out,
const char *err)
{
@@ -901,6 +909,7 @@ script_action_show_source_process_cb (void *data, const char *command,
int length, diff_made;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) out;
@@ -999,7 +1008,7 @@ script_action_show_source_process_cb (void *data, const char *command,
weechat_color ("magenta"));
weechat_hook_process (diff_command, 10000,
&script_action_show_diff_process_cb,
filename);
filename, NULL);
diff_made = 1;
free (diff_command);
}
@@ -1062,8 +1071,7 @@ script_action_show (const char *name, int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
NULL, NULL);
if (options)
{
url = script_build_download_url (ptr_script->url);
@@ -1075,7 +1083,7 @@ script_action_show (const char *name, int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_action_show_source_process_cb,
NULL);
NULL, NULL);
free (url);
}
weechat_hashtable_free (options);
+141 -103
View File
@@ -403,12 +403,9 @@ script_buffer_get_script_usage (struct t_script_repo *script)
struct t_weelist *list;
char hdata_name[128], str_option[256], str_info[1024];
int config_files;
const char *ptr_name_hdata_callback, *type;
struct t_hdata *ptr_hdata_script, *ptr_hdata_callback;
struct t_hdata *ptr_hdata_config_file, *ptr_hdata_bar_item;
void *ptr_script, *ptr_callback;
struct t_config_file *ptr_config_file;
struct t_hook *ptr_hook;
struct t_hdata *hdata_script, *hdata_config, *hdata_bar_item;
void *ptr_script, *callback_pointer;
struct t_config_file *ptr_config;
struct t_gui_bar_item *ptr_bar_item;
struct t_infolist *infolist;
@@ -416,126 +413,161 @@ script_buffer_get_script_usage (struct t_script_repo *script)
snprintf (hdata_name, sizeof (hdata_name),
"%s_script", script_language[script->language]);
ptr_hdata_script = weechat_hdata_get (hdata_name);
if (!ptr_hdata_script)
hdata_script = weechat_hdata_get (hdata_name);
if (!hdata_script)
return NULL;
ptr_script = script_buffer_get_script_pointer (script, ptr_hdata_script);
ptr_script = script_buffer_get_script_pointer (script, hdata_script);
if (!ptr_script)
return NULL;
ptr_name_hdata_callback = weechat_hdata_get_var_hdata (ptr_hdata_script,
"callbacks");
if (!ptr_name_hdata_callback)
return NULL;
ptr_hdata_callback = weechat_hdata_get (ptr_name_hdata_callback);
if (!ptr_hdata_callback)
return NULL;
list = weechat_list_new ();
ptr_hdata_config_file = weechat_hdata_get ("config_file");
ptr_hdata_bar_item = weechat_hdata_get ("bar_item");
ptr_callback = weechat_hdata_pointer (ptr_hdata_script,
ptr_script,
"callbacks");
while (ptr_callback)
/* get configuration files created by the script */
hdata_config = weechat_hdata_get ("config_file");
ptr_config = weechat_hdata_get_list (hdata_config, "config_files");
while (ptr_config)
{
str_info[0] = '\0';
ptr_config_file = weechat_hdata_pointer (ptr_hdata_callback,
ptr_callback,
"config_file");
ptr_hook = weechat_hdata_pointer (ptr_hdata_callback,
ptr_callback,
"hook");
ptr_bar_item = weechat_hdata_pointer (ptr_hdata_callback,
ptr_callback,
"bar_item");
if (ptr_config_file)
callback_pointer = weechat_hdata_pointer (
hdata_config, ptr_config, "callback_reload_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
_("configuration file \"%s\" (options %s.*)"),
weechat_hdata_string (ptr_hdata_config_file,
ptr_config_file,
weechat_hdata_string (hdata_config, ptr_config,
"filename"),
weechat_hdata_string (ptr_hdata_config_file,
ptr_config_file,
weechat_hdata_string (hdata_config, ptr_config,
"name"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
config_files++;
}
else if (ptr_hook)
ptr_config = weechat_hdata_move (hdata_config, ptr_config, 1);
}
/* get the commands created by the script */
infolist = weechat_infolist_get ("hook", NULL, "command");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
infolist = weechat_infolist_get ("hook", ptr_hook, NULL);
if (infolist)
callback_pointer = weechat_infolist_pointer (infolist,
"callback_pointer");
if (callback_pointer == ptr_script)
{
if (weechat_infolist_next (infolist))
{
type = weechat_infolist_string (infolist, "type");
if (type)
{
if (strcmp (type, "command") == 0)
{
snprintf (str_info, sizeof (str_info),
_("command /%s"),
weechat_infolist_string (infolist,
"command"));
}
else if (strcmp (type, "completion") == 0)
{
snprintf (str_info, sizeof (str_info),
_("completion %%(%s)"),
weechat_infolist_string (infolist,
"completion_item"));
}
else if (strcmp (type, "info") == 0)
{
snprintf (str_info, sizeof (str_info),
"info \"%s\"",
weechat_infolist_string (infolist,
"info_name"));
}
else if (strcmp (type, "info_hashtable") == 0)
{
snprintf (str_info, sizeof (str_info),
"info_hashtable \"%s\"",
weechat_infolist_string (infolist,
"info_name"));
}
else if (strcmp (type, "infolist") == 0)
{
snprintf (str_info, sizeof (str_info),
"infolist \"%s\"",
weechat_infolist_string (infolist,
"infolist_name"));
}
}
}
weechat_infolist_free (infolist);
snprintf (str_info, sizeof (str_info),
_("command /%s"),
weechat_infolist_string (infolist,
"command"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
else if (ptr_bar_item)
weechat_infolist_free (infolist);
}
/* get the completions created by the script */
infolist = weechat_infolist_get ("hook", NULL, "completion");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
callback_pointer = weechat_infolist_pointer (infolist,
"callback_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
_("completion %%(%s)"),
weechat_infolist_string (infolist,
"completion_item"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
weechat_infolist_free (infolist);
}
/* get the infos created by the script */
infolist = weechat_infolist_get ("hook", NULL, "info");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
callback_pointer = weechat_infolist_pointer (infolist,
"callback_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
"info \"%s\"",
weechat_infolist_string (infolist,
"info_name"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
weechat_infolist_free (infolist);
}
/* get the infos (hashtable) created by the script */
infolist = weechat_infolist_get ("hook", NULL, "info_hashtable");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
callback_pointer = weechat_infolist_pointer (infolist,
"callback_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
"info_hashtable \"%s\"",
weechat_infolist_string (infolist,
"info_name"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
weechat_infolist_free (infolist);
}
/* get the infolists created by the script */
infolist = weechat_infolist_get ("hook", NULL, "infolist");
if (infolist)
{
while (weechat_infolist_next (infolist))
{
callback_pointer = weechat_infolist_pointer (infolist,
"callback_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
"infolist \"%s\"",
weechat_infolist_string (infolist,
"infolist_name"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
}
weechat_infolist_free (infolist);
}
/* get the bar items created by the script */
hdata_bar_item = weechat_hdata_get ("bar_item");
ptr_bar_item = weechat_hdata_get_list (hdata_bar_item, "gui_bar_items");
while (ptr_bar_item)
{
callback_pointer = weechat_hdata_pointer (hdata_bar_item, ptr_bar_item,
"build_callback_pointer");
if (callback_pointer == ptr_script)
{
snprintf (str_info, sizeof (str_info),
_("bar item \"%s\""),
weechat_hdata_string (ptr_hdata_bar_item,
weechat_hdata_string (hdata_bar_item,
ptr_bar_item,
"name"));
weechat_list_add (list, str_info, WEECHAT_LIST_POS_END, NULL);
}
if (str_info[0])
{
weechat_list_add (list, str_info,
WEECHAT_LIST_POS_END, NULL);
}
ptr_callback = weechat_hdata_move (ptr_hdata_callback,
ptr_callback,
1);
ptr_bar_item = weechat_hdata_move (hdata_bar_item, ptr_bar_item, 1);
}
/* get the script options (in plugins.var) */
snprintf (str_option, sizeof (str_option),
"plugins.var.%s.%s.*",
script_language[script->language],
weechat_hdata_string (ptr_hdata_script, ptr_script, "name"));
weechat_hdata_string (hdata_script, ptr_script, "name"));
infolist = weechat_infolist_get ("option", NULL, str_option);
if (infolist)
{
@@ -892,13 +924,14 @@ script_buffer_check_line_outside_window ()
*/
int
script_buffer_window_scrolled_cb (void *data, const char *signal,
const char *type_data,
script_buffer_window_scrolled_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
int start_line_y, chat_height, line;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -936,7 +969,8 @@ script_buffer_window_scrolled_cb (void *data, const char *signal,
*/
int
script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
script_buffer_input_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
const char *input_data)
{
char *actions[][2] = { { "A", "toggleautoload" },
@@ -953,6 +987,7 @@ script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
/* close buffer */
@@ -1010,9 +1045,11 @@ script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
*/
int
script_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
script_buffer_close_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) buffer;
@@ -1089,9 +1126,10 @@ script_buffer_open ()
{
if (!script_buffer)
{
script_buffer = weechat_buffer_new (SCRIPT_BUFFER_NAME,
&script_buffer_input_cb, NULL,
&script_buffer_close_cb, NULL);
script_buffer = weechat_buffer_new (
SCRIPT_BUFFER_NAME,
&script_buffer_input_cb, NULL, NULL,
&script_buffer_close_cb, NULL, NULL);
/* failed to create buffer ? then exit */
if (!script_buffer)
+6 -3
View File
@@ -36,12 +36,15 @@ extern void script_buffer_show_detail_script (struct t_script_repo *script);
extern void script_buffer_get_window_info (struct t_gui_window *window,
int *start_line_y, int *chat_height);
extern void script_buffer_check_line_outside_window ();
extern int script_buffer_window_scrolled_cb (void *data, const char *signal,
extern int script_buffer_window_scrolled_cb (const void *pointer, void *data,
const char *signal,
const char *type_data,
void *signal_data);
extern int script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
extern int script_buffer_input_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
const char *input_data);
extern int script_buffer_close_cb (void *data, struct t_gui_buffer *buffer);
extern int script_buffer_close_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer);
extern void script_buffer_set_callbacks ();
extern void script_buffer_set_keys ();
extern void script_buffer_open ();
+4 -2
View File
@@ -121,7 +121,8 @@ script_command_action (struct t_gui_buffer *buffer, const char *action,
*/
int
script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
script_command_script (const void *pointer, void *data,
struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *error, command[128];
@@ -129,6 +130,7 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
int line;
/* make C compiler happy */
(void) pointer;
(void) data;
if (argc == 1)
@@ -383,5 +385,5 @@ script_command_init ()
" || hold %(script_scripts)|%*"
" || update"
" || upgrade",
&script_command_script, NULL);
&script_command_script, NULL, NULL);
}
+28 -14
View File
@@ -34,13 +34,15 @@
*/
int
script_completion_languages_cb (void *data, const char *completion_item,
script_completion_languages_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -60,13 +62,15 @@ script_completion_languages_cb (void *data, const char *completion_item,
*/
int
script_completion_extensions_cb (void *data, const char *completion_item,
script_completion_extensions_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -86,13 +90,15 @@ script_completion_extensions_cb (void *data, const char *completion_item,
*/
int
script_completion_scripts_cb (void *data, const char *completion_item,
script_completion_scripts_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_script_repo *ptr_script;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -113,13 +119,15 @@ script_completion_scripts_cb (void *data, const char *completion_item,
*/
int
script_completion_scripts_installed_cb (void *data, const char *completion_item,
script_completion_scripts_installed_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_script_repo *ptr_script;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -176,7 +184,8 @@ script_completion_exec_file_cb (void *data, const char *filename)
*/
int
script_completion_scripts_files_cb (void *data, const char *completion_item,
script_completion_scripts_files_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -186,6 +195,7 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
void *pointers[2];
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -205,13 +215,15 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
snprintf (directory, length,
"%s/%s", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
pointers, &script_completion_exec_file_cb);
&script_completion_exec_file_cb,
pointers);
/* look for files in "~/.weechat/<language>/autoload/" */
snprintf (directory, length,
"%s/%s/autoload", weechat_home, script_language[i]);
weechat_exec_on_files (directory, 0,
pointers, &script_completion_exec_file_cb);
&script_completion_exec_file_cb,
pointers);
}
free (directory);
}
@@ -224,7 +236,8 @@ script_completion_scripts_files_cb (void *data, const char *completion_item,
*/
int
script_completion_tags_cb (void *data, const char *completion_item,
script_completion_tags_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
@@ -233,6 +246,7 @@ script_completion_tags_cb (void *data, const char *completion_item,
int num_tags, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
@@ -269,20 +283,20 @@ script_completion_init ()
{
weechat_hook_completion ("script_languages",
N_("list of script languages"),
&script_completion_languages_cb, NULL);
&script_completion_languages_cb, NULL, NULL);
weechat_hook_completion ("script_extensions",
N_("list of script extensions"),
&script_completion_extensions_cb, NULL);
&script_completion_extensions_cb, NULL, NULL);
weechat_hook_completion ("script_scripts",
N_("list of scripts in repository"),
&script_completion_scripts_cb, NULL);
&script_completion_scripts_cb, NULL, NULL);
weechat_hook_completion ("script_scripts_installed",
N_("list of scripts installed (from repository)"),
&script_completion_scripts_installed_cb, NULL);
&script_completion_scripts_installed_cb, NULL, NULL);
weechat_hook_completion ("script_files",
N_("files in script directories"),
&script_completion_scripts_files_cb, NULL);
&script_completion_scripts_files_cb, NULL, NULL);
weechat_hook_completion ("script_tags",
N_("tags of scripts in repository"),
&script_completion_tags_cb, NULL);
&script_completion_tags_cb, NULL, NULL);
}
+140 -62
View File
@@ -205,9 +205,11 @@ script_config_get_script_download_filename (struct t_script_repo *script,
*/
void
script_config_refresh_cb (void *data, struct t_config_option *option)
script_config_refresh_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
@@ -221,9 +223,11 @@ script_config_refresh_cb (void *data, struct t_config_option *option)
*/
void
script_config_reload_scripts_cb (void *data, struct t_config_option *option)
script_config_reload_scripts_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
@@ -240,9 +244,11 @@ script_config_reload_scripts_cb (void *data, struct t_config_option *option)
*/
void
script_config_change_use_keys_cb (void *data, struct t_config_option *option)
script_config_change_use_keys_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
@@ -255,9 +261,11 @@ script_config_change_use_keys_cb (void *data, struct t_config_option *option)
*/
void
script_config_change_hold_cb (void *data, struct t_config_option *option)
script_config_change_hold_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
@@ -355,9 +363,11 @@ script_config_unhold (const char *name_with_extension)
*/
int
script_config_reload (void *data, struct t_config_file *config_file)
script_config_reload (const void *pointer, void *data,
struct t_config_file *config_file)
{
/* make C compiler happy */
(void) pointer;
(void) data;
return weechat_config_reload (config_file);
@@ -377,16 +387,18 @@ script_config_init ()
struct t_config_section *ptr_section;
script_config_file = weechat_config_new (SCRIPT_CONFIG_NAME,
&script_config_reload, NULL);
&script_config_reload, NULL, NULL);
if (!script_config_file)
return 0;
/* look */
ptr_section = weechat_config_new_section (script_config_file, "look",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -403,13 +415,15 @@ script_config_init ()
"%u=date updated, %v=version, %V=version loaded, %w=min_weechat, "
"%W=max_weechat)"),
NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_look_diff_color = weechat_config_new_option (
script_config_file, ptr_section,
"diff_color", "boolean",
N_("colorize output of diff"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_diff_command = weechat_config_new_option (
script_config_file, ptr_section,
"diff_command", "string",
@@ -418,7 +432,7 @@ script_config_init ()
"or diff), empty value = disable diff, other string = name of "
"command, for example \"diff\")"),
NULL, 0, 0, "auto", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_display_source = weechat_config_new_option (
script_config_file, ptr_section,
"display_source", "boolean",
@@ -426,7 +440,7 @@ script_config_init ()
"(script is downloaded in a temporary file when detail on script "
"is displayed)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_quiet_actions = weechat_config_new_option (
script_config_file, ptr_section,
"quiet_actions", "boolean",
@@ -434,7 +448,7 @@ script_config_init ()
"buffer when scripts are installed/removed/loaded/unloaded (only "
"errors are displayed)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_sort = weechat_config_new_option (
script_config_file, ptr_section,
"sort", "string",
@@ -445,14 +459,18 @@ script_config_init ()
"order; example: \"i,u\": installed scripts first, sorted by update "
"date"),
NULL, 0, 0, "p,n", NULL, 0,
NULL, NULL, &script_config_reload_scripts_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_reload_scripts_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_look_translate_description = weechat_config_new_option (
script_config_file, ptr_section,
"translate_description", "boolean",
N_("translate description of scripts (if translation is available in "
"your language, otherwise English version is used)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, &script_config_reload_scripts_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_reload_scripts_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_look_use_keys = weechat_config_new_option (
script_config_file, ptr_section,
"use_keys", "boolean",
@@ -460,14 +478,18 @@ script_config_init ()
"install, alt+r = remove, ...); if disabled, only the input is "
"allowed: i, r, ..."),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, &script_config_change_use_keys_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_change_use_keys_cb, NULL, NULL,
NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (script_config_file, "color",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -479,164 +501,218 @@ script_config_init ()
"status_autoloaded", "color",
N_("color for status \"autoloaded\" (\"a\")"),
NULL, 0, 0, "cyan", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_held = weechat_config_new_option (
script_config_file, ptr_section,
"status_held", "color",
N_("color for status \"held\" (\"H\")"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_installed = weechat_config_new_option (
script_config_file, ptr_section,
"status_installed", "color",
N_("color for status \"installed\" (\"i\")"),
NULL, 0, 0, "lightcyan", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_obsolete = weechat_config_new_option (
script_config_file, ptr_section,
"status_obsolete", "color",
N_("color for status \"obsolete\" (\"N\")"),
NULL, 0, 0, "lightmagenta", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_popular = weechat_config_new_option (
script_config_file, ptr_section,
"status_popular", "color",
N_("color for status \"popular\" (\"*\")"),
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_running = weechat_config_new_option (
script_config_file, ptr_section,
"status_running", "color",
N_("color for status \"running\" (\"r\")"),
NULL, 0, 0, "lightgreen", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_status_unknown = weechat_config_new_option (
script_config_file, ptr_section,
"status_unknown", "color",
N_("color for status \"unknown\" (\"?\")"),
NULL, 0, 0, "lightred", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text = weechat_config_new_option (
script_config_file, ptr_section,
"text", "color",
N_("text color in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_bg = weechat_config_new_option (
script_config_file, ptr_section,
"text_bg", "color",
N_("background color in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_bg_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_bg_selected", "color",
N_("background color for selected line in script buffer"),
NULL, 0, 0, "red", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_date = weechat_config_new_option (
script_config_file, ptr_section,
"text_date", "color",
N_("text color of dates in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_date_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_date_selected", "color",
N_("text color of dates for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_delimiters = weechat_config_new_option (
script_config_file, ptr_section,
"text_delimiters", "color",
N_("text color of delimiters in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_description = weechat_config_new_option (
script_config_file, ptr_section,
"text_description", "color",
N_("text color of description in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_description_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_description_selected", "color",
N_("text color of description for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_extension = weechat_config_new_option (
script_config_file, ptr_section,
"text_extension", "color",
N_("text color of extension in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_extension_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_extension_selected", "color",
N_("text color of extension for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_name = weechat_config_new_option (
script_config_file, ptr_section,
"text_name", "color",
N_("text color of script name in script buffer"),
NULL, 0, 0, "cyan", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_name_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_name_selected", "color",
N_("text color of script name for selected line in script buffer"),
NULL, 0, 0, "lightcyan", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_selected", "color",
N_("text color for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_tags = weechat_config_new_option (
script_config_file, ptr_section,
"text_tags", "color",
N_("text color of tags in script buffer"),
NULL, 0, 0, "brown", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_tags_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_tags_selected", "color",
N_("text color of tags for selected line in script buffer"),
NULL, 0, 0, "yellow", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_version = weechat_config_new_option (
script_config_file, ptr_section,
"text_version", "color",
N_("text color of version in script buffer"),
NULL, 0, 0, "magenta", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_version_loaded = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_loaded", "color",
N_("text color of version loaded in script buffer"),
NULL, 0, 0, "default", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_version_loaded_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_loaded_selected", "color",
N_("text color of version loaded for selected line in script buffer"),
NULL, 0, 0, "white", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_color_text_version_selected = weechat_config_new_option (
script_config_file, ptr_section,
"text_version_selected", "color",
N_("text color of version for selected line in script buffer"),
NULL, 0, 0, "lightmagenta", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
NULL, NULL, NULL,
&script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
/* scripts */
ptr_section = weechat_config_new_section (script_config_file, "scripts",
0, 0,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL);
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
weechat_config_free (script_config_file);
@@ -649,51 +725,53 @@ script_config_init ()
N_("autoload scripts installed (make a link in \"autoload\" directory "
"to script in parent directory)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_cache_expire = weechat_config_new_option (
script_config_file, ptr_section,
"cache_expire", "integer",
N_("local cache expiration time, in minutes (-1 = never expires, "
"0 = always expire)"),
NULL, -1, 525600, "1440", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, -1, 525600, "1440", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_download_timeout = weechat_config_new_option (
script_config_file, ptr_section,
"download_timeout", "integer",
N_("timeout (in seconds) for download of scripts and list of scripts"),
NULL, 1, 3600, "30", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, 1, 3600, "30", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_path = weechat_config_new_option (
script_config_file, ptr_section,
"path", "string",
N_("local cache directory for scripts; \"%h\" at beginning of string "
"is replaced by WeeChat home (\"~/.weechat\" by default) "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "%h/script", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, 0, 0, "%h/script", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_hold = weechat_config_new_option (
script_config_file, ptr_section,
"hold", "string",
N_("scripts to \"hold\": comma-separated list of scripts which will "
"never been upgraded and can not be removed, for example: "
"\"buffers.pl,iset.pl\""),
NULL, 0, 0, "", NULL, 0, NULL, NULL,
&script_config_change_hold_cb, NULL, NULL, NULL);
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
&script_config_change_hold_cb, NULL, NULL,
NULL, NULL, NULL);
script_config_scripts_url = weechat_config_new_option (
script_config_file, ptr_section,
"url", "string",
N_("URL for file with list of scripts; by default HTTPS is forced, "
"see option script.scripts.url_force_https"),
NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
script_config_scripts_url_force_https = weechat_config_new_option (
script_config_file, ptr_section,
"url_force_https", "boolean",
N_("force use of HTTPS for downloads (index and scripts); "
"you should disable this option only if you have problems with "
"the downloads"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return 1;
}
+10 -7
View File
@@ -33,27 +33,30 @@
*/
struct t_infolist *
script_info_infolist_script_script_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
script_info_infolist_script_script_cb (const void *pointer, void *data,
const char *infolist_name,
void *obj_pointer,
const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_script_repo *ptr_script;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) infolist_name;
if (pointer && !script_repo_script_valid (pointer))
if (obj_pointer && !script_repo_script_valid (obj_pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (!ptr_infolist)
return NULL;
if (pointer)
if (obj_pointer)
{
/* build list with only one script */
if (!script_repo_add_to_infolist (ptr_infolist, pointer))
if (!script_repo_add_to_infolist (ptr_infolist, obj_pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
@@ -97,10 +100,10 @@ script_info_init ()
N_("script pointer (optional)"),
N_("script name with extension "
"(wildcard \"*\" is allowed) (optional)"),
&script_info_infolist_script_script_cb, NULL);
&script_info_infolist_script_script_cb, NULL, NULL);
/* hdata hooks */
weechat_hook_hdata (
"script_script", N_("scripts from repository"),
&script_repo_hdata_script_cb, NULL);
&script_repo_hdata_script_cb, NULL, NULL);
}
+16 -13
View File
@@ -1140,11 +1140,11 @@ script_repo_file_read (int quiet)
if (!script_repo_max_length_field)
{
script_repo_max_length_field = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
NULL);
script_repo_max_length_field = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL, NULL);
}
else
weechat_hashtable_remove_all (script_repo_max_length_field);
@@ -1201,8 +1201,7 @@ script_repo_file_read (int quiet)
descriptions = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
NULL, NULL);
/* read plugins.xml.gz */
while (!gzeof (file))
@@ -1422,17 +1421,19 @@ script_repo_file_read (int quiet)
*/
int
script_repo_file_update_process_cb (void *data, const char *command,
script_repo_file_update_process_cb (const void *pointer, void *data,
const char *command,
int return_code, const char *out,
const char *err)
{
int quiet;
/* make C compiler happy */
(void) data;
(void) command;
(void) out;
quiet = (data == 0) ? 0 : 1;
quiet = (pointer) ? 1 : 0;
if (return_code >= 0)
{
@@ -1479,8 +1480,7 @@ script_repo_file_update (int quiet)
options = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
NULL, NULL);
if (options)
{
url = script_build_download_url (
@@ -1499,7 +1499,8 @@ script_repo_file_update (int quiet)
options,
weechat_config_integer (script_config_scripts_download_timeout) * 1000,
&script_repo_file_update_process_cb,
(quiet) ? (void *)1 : (void *)0);
(quiet) ? (void *)1 : (void *)0,
NULL);
free (url);
}
weechat_hashtable_free (options);
@@ -1513,11 +1514,13 @@ script_repo_file_update (int quiet)
*/
struct t_hdata *
script_repo_hdata_script_cb (void *data, const char *hdata_name)
script_repo_hdata_script_cb (const void *pointer, void *data,
const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) pointer;
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
+2 -1
View File
@@ -79,7 +79,8 @@ extern int script_repo_file_exists ();
extern int script_repo_file_is_uptodate ();
extern int script_repo_file_read (int quiet);
extern void script_repo_file_update (int quiet);
extern struct t_hdata *script_repo_hdata_script_cb (void *data,
extern struct t_hdata *script_repo_hdata_script_cb (const void *pointer,
void *data,
const char *hdata_name);
extern int script_repo_add_to_infolist (struct t_infolist *infolist,
struct t_script_repo *script);
+28 -14
View File
@@ -179,8 +179,7 @@ script_get_scripts ()
script_loaded = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
NULL, NULL);
}
else
weechat_hashtable_remove_all (script_loaded);
@@ -217,10 +216,12 @@ script_get_scripts ()
*/
int
script_debug_dump_cb (void *data, const char *signal, const char *type_data,
script_debug_dump_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) signal;
(void) type_data;
@@ -247,9 +248,10 @@ script_debug_dump_cb (void *data, const char *signal, const char *type_data,
*/
int
script_timer_refresh_cb (void *data, int remaining_calls)
script_timer_refresh_cb (const void *pointer, void *data, int remaining_calls)
{
/* make C compiler happy */
(void) pointer;
(void) data;
script_get_loaded_plugins ();
@@ -268,10 +270,12 @@ script_timer_refresh_cb (void *data, int remaining_calls)
*/
int
script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
script_signal_plugin_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) type_data;
@@ -285,7 +289,8 @@ script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
if (!script_timer_refresh)
{
script_timer_refresh = weechat_hook_timer (50, 0, 1,
&script_timer_refresh_cb, NULL);
&script_timer_refresh_cb,
NULL, NULL);
}
return WEECHAT_RC_OK;
@@ -296,10 +301,12 @@ script_signal_plugin_cb (void *data, const char *signal, const char *type_data,
*/
int
script_signal_script_cb (void *data, const char *signal, const char *type_data,
script_signal_script_cb (const void *pointer, void *data,
const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) type_data;
@@ -313,7 +320,8 @@ script_signal_script_cb (void *data, const char *signal, const char *type_data,
if (!script_timer_refresh)
{
script_timer_refresh = weechat_hook_timer (50, 0, 1,
&script_timer_refresh_cb, NULL);
&script_timer_refresh_cb,
NULL, NULL);
}
return WEECHAT_RC_OK;
@@ -324,7 +332,8 @@ script_signal_script_cb (void *data, const char *signal, const char *type_data,
*/
struct t_hashtable *
script_focus_chat_cb (void *data, struct t_hashtable *info)
script_focus_chat_cb (const void *pointer, void *data,
struct t_hashtable *info)
{
const char *buffer;
int rc;
@@ -336,6 +345,7 @@ script_focus_chat_cb (void *data, struct t_hashtable *info)
struct tm *tm;
/* make C compiler happy */
(void) pointer;
(void) data;
if (!script_buffer)
@@ -429,12 +439,16 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
script_completion_init ();
script_info_init ();
weechat_hook_signal ("debug_dump", &script_debug_dump_cb, NULL);
weechat_hook_signal ("window_scrolled", &script_buffer_window_scrolled_cb, NULL);
weechat_hook_signal ("plugin_*", &script_signal_plugin_cb, NULL);
weechat_hook_signal ("*_script_*", &script_signal_script_cb, NULL);
weechat_hook_signal ("debug_dump",
&script_debug_dump_cb, NULL, NULL);
weechat_hook_signal ("window_scrolled",
&script_buffer_window_scrolled_cb, NULL, NULL);
weechat_hook_signal ("plugin_*",
&script_signal_plugin_cb, NULL, NULL);
weechat_hook_signal ("*_script_*",
&script_signal_script_cb, NULL, NULL);
weechat_hook_focus ("chat", &script_focus_chat_cb, NULL);
weechat_hook_focus ("chat", &script_focus_chat_cb, NULL, NULL);
if (script_repo_file_exists ())
{