This commit is contained in:
Johannes Kuhn 2023-03-06 18:16:06 +08:00 committed by GitHub
commit 57989e1242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 5 deletions

View File

@ -52,6 +52,7 @@ typedef struct _hexchat_context hexchat_context;
typedef struct
{
time_t server_time_utc; /* 0 if not used */
const char* tags; /* Only for server events. NULL if the server sent no tags. */
} hexchat_event_attrs;
#ifndef PLUGIN_C

View File

@ -664,11 +664,12 @@ hexchat_event_attrs_free (hexchat_plugin *ph, hexchat_event_attrs *attrs)
int
plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[],
time_t server_time)
time_t server_time, const char* tags)
{
hexchat_event_attrs attrs;
attrs.server_time_utc = server_time;
attrs.tags = tags;
return plugin_hook_run (sess, name, word, word_eol, &attrs,
HOOK_SERVER | HOOK_SERVER_ATTRS);

View File

@ -172,7 +172,7 @@ 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[],
time_t server_time);
time_t server_time, const char* tags);
int plugin_emit_print (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, gunichar key);

View File

@ -1581,10 +1581,11 @@ irc_inline (server *serv, char *buf, int len)
/* Python relies on this */
word[PDIWORDS] = NULL;
word_eol[PDIWORDS] = NULL;
char* tags = NULL;
if (*buf == '@')
{
char *tags = buf + 1; /* skip the '@' */
tags = buf + 1; /* skip the '@' */
char *sep = strchr (buf, ' ');
if (!sep)
@ -1618,7 +1619,7 @@ irc_inline (server *serv, char *buf, int len)
word_eol[1] = buf; /* keep the ":" for plugins */
if (plugin_emit_server (sess, type, word, word_eol,
tags_data.timestamp))
tags_data.timestamp, tags))
goto xit;
word[1]++;
@ -1629,7 +1630,7 @@ irc_inline (server *serv, char *buf, int len)
word[0] = type = word[1];
if (plugin_emit_server (sess, type, word, word_eol,
tags_data.timestamp))
tags_data.timestamp, tags))
goto xit;
}