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

Add new hooks (info and infolist), IRC plugin now return infos and infolists

This commit is contained in:
Sebastien Helleu
2008-08-30 00:25:56 +02:00
parent eb57354984
commit 0839b359f9
45 changed files with 1990 additions and 402 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
+1 -1
View File
@@ -314,7 +314,7 @@ weechat_python_load (const char *filename)
/* adding $weechat_dir/python in $PYTHONPATH */
python_path = PySys_GetObject ("path");
w_home = weechat_info_get ("weechat_dir");
w_home = weechat_info_get ("weechat_dir", "");
if (w_home)
{
len = strlen (w_home) + 1 + strlen("python") + 1;
File diff suppressed because it is too large Load Diff
+78
View File
@@ -875,6 +875,84 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
return new_hook;
}
/*
* script_api_hook_info: hook an info
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
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_info (info_name, 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_infolist: hook an infolist
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
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_infolist (infolist_name,
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_unhook: unhook something
*/
+15
View File
@@ -150,6 +150,21 @@ extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat
const char *modifier_data,
const char *string),
const char *function);
extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *function);
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
const char *function);
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);
+3 -3
View File
@@ -214,7 +214,7 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
int dir_length;
/* build directory, adding WeeChat home */
dir_home = weechat_info_get ("weechat_dir");
dir_home = weechat_info_get ("weechat_dir", "");
if (!dir_home)
return;
dir_length = strlen (dir_home) + strlen (weechat_plugin->name) + 16;
@@ -277,7 +277,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
return NULL;
}
dir_home = weechat_info_get ("weechat_dir");
dir_home = weechat_info_get ("weechat_dir", "");
if (dir_home)
{
/* try WeeChat user's autoload dir */
@@ -321,7 +321,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
}
/* try WeeChat system dir */
dir_system = weechat_info_get ("weechat_sharedir");
dir_system = weechat_info_get ("weechat_sharedir", "");
if (dir_system)
{
length = strlen (dir_system) + strlen (weechat_plugin->name) +