diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/dcc.c | 3 | ||||
-rw-r--r-- | src/common/hexchat-plugin.h | 7 | ||||
-rw-r--r-- | src/common/plugin.c | 9 | ||||
-rw-r--r-- | src/common/plugin.h | 6 | ||||
-rw-r--r-- | src/common/proto-irc.c | 13 | ||||
-rw-r--r-- | src/common/text.c | 4 |
6 files changed, 27 insertions, 15 deletions
diff --git a/src/common/dcc.c b/src/common/dcc.c index c0527510..1137c444 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -548,7 +548,8 @@ dcc_chat_line (struct DCC *dcc, char *line) for (i = 5; i < PDIWORDS; i++) word[i] = "\000"; - ret = plugin_emit_print (sess, word); + ret = plugin_emit_print (sess, word) + + plugin_emit_print_attrs (sess, word, 0); /* did the plugin close it? */ if (!g_slist_find (dcc_list, dcc)) diff --git a/src/common/hexchat-plugin.h b/src/common/hexchat-plugin.h index fd730459..f5583e2a 100644 --- a/src/common/hexchat-plugin.h +++ b/src/common/hexchat-plugin.h @@ -46,10 +46,13 @@ 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 +typedef struct +{ + time_t server_time_utc; /* 0 if not used */ +} hexchat_event_attrs; #ifndef PLUGIN_C struct _hexchat_plugin @@ -381,7 +384,9 @@ hexchat_pluginpref_list (hexchat_plugin *ph, #endif #define hexchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_command) #define hexchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server) +#define hexchat_hook_server_attrs ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server_attrs) #define hexchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print) +#define hexchat_hook_print_attrs ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print_attrs) #define hexchat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_timer) #define hexchat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_fd) #define hexchat_unhook ((HEXCHAT_PLUGIN_HANDLE)->hexchat_unhook) diff --git a/src/common/plugin.c b/src/common/plugin.c index abdd6ea1..ee7c7179 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -74,11 +74,6 @@ struct _hexchat_hook int pri; /* fd */ /* priority / fd for HOOK_FD only */ }; -struct _hexchat_event_attrs -{ - time_t server_time_utc; /* 0 if not used */ -}; - struct _hexchat_list { int type; /* LIST_* */ @@ -634,7 +629,7 @@ plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[]) } int -plugin_emit_server_attr (session *sess, char *name, char *word[], char *word_eol[], +plugin_emit_server_attrs (session *sess, char *name, char *word[], char *word_eol[], time_t server_time) { hexchat_event_attrs attrs; @@ -653,7 +648,7 @@ plugin_emit_print (session *sess, char *word[]) } int -plugin_emit_print_attr (session *sess, char *word[], time_t server_time) +plugin_emit_print_attrs (session *sess, char *word[], time_t server_time) { hexchat_event_attrs attrs; diff --git a/src/common/plugin.h b/src/common/plugin.h index 32072b7d..9af54426 100644 --- a/src/common/plugin.h +++ b/src/common/plugin.h @@ -170,10 +170,10 @@ void plugin_kill_all (void); void plugin_auto_load (session *sess); int plugin_emit_command (session *sess, char *name, char *word[], char *word_eol[]); int plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[]); -int plugin_emit_server_attr (session *sess, char *name, char *word[], - char *word_eol[], time_t server_time); +int plugin_emit_server_attrs (session *sess, char *name, char *word[], + char *word_eol[], time_t server_time); int plugin_emit_print (session *sess, char *word[]); -int plugin_emit_print_attr (session *sess, char *word[], time_t server_time); +int plugin_emit_print_attrs (session *sess, char *word[], time_t server_time); int plugin_emit_dummy_print (session *sess, char *name); int plugin_emit_keypress (session *sess, unsigned int state, unsigned int keyval, int len, char *string); GList* plugin_command_list(GList *tmp_list); diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index bea9f6f7..07c2b696 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1506,15 +1506,24 @@ irc_inline (server *serv, char *buf, int len) word[0] = type; word_eol[1] = buf; /* keep the ":" for plugins */ - if (plugin_emit_server (sess, type, word, word_eol)) + + /* don't use || here, since it might short-circuit */ + if (plugin_emit_server (sess, type, word, word_eol) + + plugin_emit_server_attrs (sess, type, word, word_eol, + tags_data.timestamp)) goto xit; + word[1]++; word_eol[1] = buf + 1; /* but not for HexChat internally */ } else { word[0] = type = word[1]; - if (plugin_emit_server (sess, type, word, word_eol)) + + /* don't use || here, since it might short-circuit */ + if (plugin_emit_server (sess, type, word, word_eol) + + plugin_emit_server_attrs (sess, type, word, word_eol, + tags_data.timestamp)) goto xit; } diff --git a/src/common/text.c b/src/common/text.c index a0e860ce..f251283b 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -2086,7 +2086,9 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d, for (i = 5; i < PDIWORDS; i++) word[i] = "\000"; - if (plugin_emit_print (sess, word)) + /* don't use || here, since it might short-circuit */ + if (plugin_emit_print (sess, word) + + plugin_emit_print_attrs (sess, word, timestamp)) return; /* If a plugin's callback executes "/close", 'sess' may be invalid */ |