1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

Added event handler to plugin API

This commit is contained in:
Sebastien Helleu
2007-02-05 22:18:33 +00:00
parent 4713f94602
commit 8e436c58cd
44 changed files with 5140 additions and 2052 deletions
+25
View File
@@ -356,6 +356,22 @@ weechat_plugin_keyboard_handler_add (t_weechat_plugin *plugin,
return NULL;
}
/*
* weechat_plugin_event_handler_add: add an event handler
*/
t_plugin_handler *
weechat_plugin_event_handler_add (t_weechat_plugin *plugin, char *event,
t_plugin_handler_func *handler_func,
char *handler_args, void *handler_pointer)
{
if (plugin && event && handler_func)
return plugin_event_handler_add (plugin, event, handler_func,
handler_args, handler_pointer);
return NULL;
}
/*
* weechat_plugin_handler_remove: remove a WeeChat handler
*/
@@ -571,6 +587,15 @@ weechat_plugin_get_info (t_weechat_plugin *plugin, char *info, char *server)
if (ptr_server && ptr_server->is_connected && ptr_server->name)
return strdup (ptr_server->name);
}
else if (ascii_strcasecmp (info, "type") == 0)
{
return_str = (char *) malloc (32);
if (!return_str)
return NULL;
snprintf (return_str, 32, "%d",
gui_current_window->buffer->type);
return return_str;
}
else if (ascii_strcasecmp (info, "away") == 0)
{
if (ptr_server && ptr_server->is_connected && ptr_server->is_away)