Now hexchat_hook_server_attrs() and hexchat_hook_print_attrs() is called

when it should. This should close #661.
This commit is contained in:
Diogo Sousa 2013-07-09 23:11:28 +01:00
parent 98aa62f637
commit 7101b7b864
7 changed files with 29 additions and 15 deletions

View File

@ -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))

View File

@ -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)

View File

@ -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;

View File

@ -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[],
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);

View File

@ -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;
}

View File

@ -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 */

View File

@ -2,7 +2,9 @@ EXPORTED {
global:
hexchat_hook_command;
hexchat_hook_server;
hexchat_hook_server_attrs;
hexchat_hook_print;
hexchat_hook_print_attrs;
hexchat_hook_timer;
hexchat_hook_fd;
hexchat_unhook;