mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 00:33:13 +02:00
core: add hdata for hooks
New hooks: - hook - hook_command - hook_command_run - hook_completion - hook_config - hook_connect - hook_fd - hook_focus - hook_hdata - hook_hsignal - hook_info - hook_info_hashtable - hook_infolist - hook_line - hook_modifier - hook_print - hook_process - hook_signal - hook_timer - hook_url New lists (for hooks of type "hook"): - weechat_hooks_command, last_weechat_hook_command - weechat_hooks_command_run, last_weechat_hook_command_run - weechat_hooks_completion, last_weechat_hook_completion - weechat_hooks_config, last_weechat_hook_config - weechat_hooks_connect, last_weechat_hook_connect - weechat_hooks_fd, last_weechat_hook_fd - weechat_hooks_focus, last_weechat_hook_focus - weechat_hooks_hdata, last_weechat_hook_hdata - weechat_hooks_hsignal, last_weechat_hook_hsignal - weechat_hooks_info, last_weechat_hook_info - weechat_hooks_info_hashtable, last_weechat_hook_info_hashtable - weechat_hooks_infolist, last_weechat_hook_infolist - weechat_hooks_line, last_weechat_hook_line - weechat_hooks_modifier, last_weechat_hook_modifier - weechat_hooks_print, last_weechat_hook_print - weechat_hooks_process, last_weechat_hook_process - weechat_hooks_signal, last_weechat_hook_signal - weechat_hooks_timer, last_weechat_hook_timer - weechat_hooks_url, last_weechat_hook_url
This commit is contained in:
@@ -31,10 +31,12 @@
|
||||
|
||||
#include "../weechat.h"
|
||||
#include "../core-hook.h"
|
||||
#include "../core-hdata.h"
|
||||
#include "../core-infolist.h"
|
||||
#include "../core-log.h"
|
||||
#include "../core-util.h"
|
||||
#include "../../gui/gui-chat.h"
|
||||
#include "../../plugins/plugin.h"
|
||||
|
||||
|
||||
time_t hook_last_system_time = 0; /* used to detect system clock skew */
|
||||
@@ -372,6 +374,35 @@ hook_timer_free_data (struct t_hook *hook)
|
||||
hook->hook_data = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns hdata for timer hook.
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
hook_timer_hdata_hook_timer_cb (const void *pointer, void *data,
|
||||
const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
|
||||
hdata = hdata_new (NULL, hdata_name, NULL, NULL, 0, 0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
HDATA_VAR(struct t_hook_timer, callback, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_hook_timer, interval, LONG, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_hook_timer, align_second, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_hook_timer, remaining_calls, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR_NAME(struct t_hook_timer, last_exec.tv_sec, "last_exec", TIME, 0, NULL, NULL);
|
||||
HDATA_VAR_NAME(struct t_hook_timer, last_exec.tv_usec, "last_exec_usec", LONG, 0, NULL, NULL);
|
||||
HDATA_VAR_NAME(struct t_hook_timer, next_exec.tv_sec, "next_exec", TIME, 0, NULL, NULL);
|
||||
HDATA_VAR_NAME(struct t_hook_timer, next_exec.tv_usec, "next_exec_usec", LONG, 0, NULL, NULL);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds timer hook data in the infolist item.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user