diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-12 21:45:00 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-08-12 21:45:00 +0200 |
commit | 42be1a74a036bb0318201a40d91eadc7d9d6454f (patch) | |
tree | 0aab3de96b55a97e12aa051b839e4297dbf3f559 /src/core/wee-hook.h | |
parent | 12a6f74ec01d9daa2e23dce5ab15b1ee3ce09006 (diff) | |
download | weechat-42be1a74a036bb0318201a40d91eadc7d9d6454f.zip |
api: add function hook_line
Diffstat (limited to 'src/core/wee-hook.h')
-rw-r--r-- | src/core/wee-hook.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h index f01f05b9c..70d521c78 100644 --- a/src/core/wee-hook.h +++ b/src/core/wee-hook.h @@ -50,6 +50,7 @@ enum t_hook_type HOOK_TYPE_FD, /* socket of file descriptor */ HOOK_TYPE_PROCESS, /* sub-process (fork) */ HOOK_TYPE_CONNECT, /* connect to peer with fork */ + HOOK_TYPE_LINE, /* new line in a buffer */ HOOK_TYPE_PRINT, /* printed message */ HOOK_TYPE_SIGNAL, /* signal */ HOOK_TYPE_HSIGNAL, /* signal (using hashtable) */ @@ -100,6 +101,7 @@ enum t_hook_type #define HOOK_FD(hook, var) (((struct t_hook_fd *)hook->hook_data)->var) #define HOOK_PROCESS(hook, var) (((struct t_hook_process *)hook->hook_data)->var) #define HOOK_CONNECT(hook, var) (((struct t_hook_connect *)hook->hook_data)->var) +#define HOOK_LINE(hook, var) (((struct t_hook_line *)hook->hook_data)->var) #define HOOK_PRINT(hook, var) (((struct t_hook_print *)hook->hook_data)->var) #define HOOK_SIGNAL(hook, var) (((struct t_hook_signal *)hook->hook_data)->var) #define HOOK_HSIGNAL(hook, var) (((struct t_hook_hsignal *)hook->hook_data)->var) @@ -282,6 +284,24 @@ struct t_hook_connect int sock_v6[HOOK_CONNECT_MAX_SOCKETS]; /* IPv6 sockets for connecting */ }; +/* hook line */ + +typedef struct t_hashtable *(t_hook_callback_line)(const void *pointer, + void *data, + struct t_hashtable *line); + +struct t_hook_line +{ + t_hook_callback_line *callback; /* line callback */ + int buffer_type; /* -1 = any type, ≥ 0: only this type*/ + char **buffers; /* list of buffer masks where the */ + /* hook is executed (see the */ + /* function "buffer_match_list") */ + int num_buffers; /* number of buffers in list */ + int tags_count; /* number of tags selected */ + char ***tags_array; /* tags selected (NULL = any) */ +}; + /* hook print */ typedef int (t_hook_callback_print)(const void *pointer, void *data, @@ -520,6 +540,14 @@ extern int hook_connect_gnutls_set_certificates (gnutls_session_t tls_session, gnutls_retr_st *answer); #endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */ #endif /* HAVE_GNUTLS */ +extern struct t_hook *hook_line (struct t_weechat_plugin *plugin, + const char *buffer_type, + const char *buffer_name, + const char *tags, + t_hook_callback_line *callback, + const void *callback_pointer, + void *callback_data); +extern void hook_line_exec (struct t_gui_line *line); extern struct t_hook *hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, const char *tags, const char *message, |