mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 01:05:43 +02:00
Add of "modifier" hook, migration of charset plugin to new API, SIGHUP signal catched (reload all config files), better config files reloading
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -110,19 +110,20 @@ weechat_perl_exec (struct t_plugin_script *script,
|
||||
char *func;
|
||||
unsigned int count;
|
||||
void *ret_value;
|
||||
int *ret_i, mem_err;
|
||||
int *ret_i, mem_err, length;
|
||||
SV *ret_s;
|
||||
|
||||
/* this code is placed here to conform ISO C90 */
|
||||
dSP;
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
int size = strlen (script->interpreter) + strlen(function) + 3;
|
||||
func = (char *)malloc (size * sizeof(char));
|
||||
int length = strlen (script->interpreter) + strlen (function) + 3;
|
||||
func = (char *)malloc (length * sizeof(char));
|
||||
if (!func)
|
||||
return NULL;
|
||||
snprintf (func, size, "%s::%s", (char *) script->interpreter, function);
|
||||
snprintf (func, length, "%s::%s", (char *) script->interpreter, function);
|
||||
#else
|
||||
(void) length;
|
||||
func = function;
|
||||
PERL_SET_CONTEXT (script->interpreter);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -385,6 +385,42 @@ script_api_hook_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
return new_hook;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_hook_modifier: hook a modifier
|
||||
* return new hook, NULL if error
|
||||
*/
|
||||
|
||||
struct t_hook *
|
||||
script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *modifier,
|
||||
char *(*callback)(void *data, char *modifier,
|
||||
char *modifier_data, char *string),
|
||||
char *function)
|
||||
{
|
||||
struct t_script_callback *new_script_callback;
|
||||
struct t_hook *new_hook;
|
||||
|
||||
new_script_callback = script_callback_alloc ();
|
||||
if (!new_script_callback)
|
||||
return NULL;
|
||||
|
||||
new_hook = weechat_hook_modifier (modifier, callback, new_script_callback);
|
||||
if (!new_hook)
|
||||
{
|
||||
free (new_script_callback);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_script_callback->script = script;
|
||||
new_script_callback->function = strdup (function);
|
||||
new_script_callback->hook = new_hook;
|
||||
|
||||
script_callback_add (script, new_script_callback);
|
||||
|
||||
return new_hook;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_unhook: unhook something
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -87,6 +87,14 @@ extern struct t_hook *script_api_hook_completion (struct t_weechat_plugin *weech
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_weelist *list),
|
||||
char *function);
|
||||
extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
char *modifier,
|
||||
char *(*callback)(void *data,
|
||||
char *modifier,
|
||||
char *modifier_data,
|
||||
char *string),
|
||||
char *function);
|
||||
extern int script_api_unhook (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_hook *hook);
|
||||
|
||||
Reference in New Issue
Block a user