1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 03:05:42 +02:00

Add hook type "command_run", add new function "string_remove_color" in plugin API (task #9089)

This commit is contained in:
Sebastien Helleu
2009-02-08 19:52:16 +01:00
parent a253398165
commit 29bc0276bc
25 changed files with 1153 additions and 205 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -356,6 +356,7 @@ weechat_python_load (const char *filename)
/* define some constants */
weechat_dict = PyModule_GetDict(weechat_module);
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK", PyInt_FromLong((long) WEECHAT_RC_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_EAT", PyInt_FromLong((long) WEECHAT_RC_OK_EAT));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_ERROR", PyInt_FromLong((long) WEECHAT_RC_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_CONFIG_READ_OK", PyInt_FromLong((long) WEECHAT_CONFIG_READ_OK));
File diff suppressed because it is too large Load Diff
+39
View File
@@ -663,6 +663,45 @@ script_api_hook_command (struct t_weechat_plugin *weechat_plugin,
return new_hook;
}
/*
* script_api_hook_command_run: hook a command_run
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *command,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
const char *command),
const 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_command_run (command,
callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
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_hook_timer: hook a timer
* return new hook, NULL if error
+7
View File
@@ -108,6 +108,13 @@ extern struct t_hook *script_api_hook_command (struct t_weechat_plugin *weechat_
int argc, char **argv,
char **argv_eol),
const char *function);
extern struct t_hook *script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *command,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
const char *command),
const char *function);
extern struct t_hook *script_api_hook_timer (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
int interval, int align_second,
File diff suppressed because it is too large Load Diff