Added hexchat_hook_server_attrs() and hexchat_hook_print_attrs() to the plugin

interface. This hooks are similar to hexchat_hook_{server,print}() except the
callback passes an extra argument with the (new) structure hexchat_event_attrs.

This structure contains attributes related to the event; by now it only contains
the server_time_utc member which is non-zero if server-time is enabled and the
server used this extension to pass a timestamp.

See issue #661.

(Note: this hooks are still not called by hexchat in this commit.)
This commit is contained in:
Diogo Sousa
2013-07-09 20:21:16 +01:00
parent 1544a5d6cb
commit 798db7368a
3 changed files with 112 additions and 12 deletions

View File

@@ -46,6 +46,7 @@ extern "C" {
typedef struct _hexchat_plugin hexchat_plugin;
typedef struct _hexchat_list hexchat_list;
typedef struct _hexchat_hook hexchat_hook;
typedef struct _hexchat_event_attrs hexchat_event_attrs;
#ifndef PLUGIN_C
typedef struct _hexchat_context hexchat_context;
#endif
@@ -164,6 +165,18 @@ struct _hexchat_plugin
const char *var);
int (*hexchat_pluginpref_list) (hexchat_plugin *ph,
char *dest);
hexchat_hook *(*hexchat_hook_server_attrs) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[],
hexchat_event_attrs *attrs, void *user_data),
void *userdata);
hexchat_hook *(*hexchat_hook_print_attrs) (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], hexchat_event_attrs *attrs,
void *user_data),
void *userdata);
};
#endif
@@ -183,6 +196,15 @@ hexchat_hook_server (hexchat_plugin *ph,
int (*callback) (char *word[], char *word_eol[], void *user_data),
void *userdata);
hexchat_hook *
hexchat_hook_server_attrs (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], char *word_eol[],
hexchat_event_attrs *attrs, void *user_data),
void *userdata);
hexchat_hook *
hexchat_hook_print (hexchat_plugin *ph,
const char *name,
@@ -190,6 +212,14 @@ hexchat_hook_print (hexchat_plugin *ph,
int (*callback) (char *word[], void *user_data),
void *userdata);
hexchat_hook *
hexchat_hook_print_attrs (hexchat_plugin *ph,
const char *name,
int pri,
int (*callback) (char *word[], hexchat_event_attrs *attrs,
void *user_data),
void *userdata);
hexchat_hook *
hexchat_hook_timer (hexchat_plugin *ph,
int timeout,