From 5e240eb259c473dd5ef25a5d11ef5ad574470f3a Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Wed, 10 Jul 2013 00:42:34 +0100 Subject: Indentation fixes and code cleanup. --- src/common/plugin.c | 6 +++--- src/common/proto-irc.c | 24 ++++++++++++++++-------- src/common/text.c | 8 ++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src/common') diff --git a/src/common/plugin.c b/src/common/plugin.c index ee7c7179..8e39f653 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -630,11 +630,11 @@ plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[]) int plugin_emit_server_attrs (session *sess, char *name, char *word[], char *word_eol[], - time_t server_time) + time_t server_time) { hexchat_event_attrs attrs; - attrs.server_time_utc=server_time; + attrs.server_time_utc = server_time; return plugin_hook_run (sess, name, word, word_eol, &attrs, HOOK_SERVER_ATTRS); } @@ -652,7 +652,7 @@ plugin_emit_print_attrs (session *sess, char *word[], time_t server_time) { hexchat_event_attrs attrs; - attrs.server_time_utc=server_time; + attrs.server_time_utc = server_time; return plugin_hook_run (sess, word[0], word, NULL, &attrs, HOOK_PRINT_ATTRS); } diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 07c2b696..128c0c85 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1493,6 +1493,9 @@ irc_inline (server *serv, char *buf, int len) if (buf[0] == ':') { + int eat1; + int eat2; + /* find a context for this message */ if (is_channel (serv, word[3])) { @@ -1507,10 +1510,11 @@ irc_inline (server *serv, char *buf, int len) word[0] = type; word_eol[1] = buf; /* keep the ":" for plugins */ - /* 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)) + eat1 = plugin_emit_server (sess, type, word, word_eol); + eat2 = plugin_emit_server_attrs (sess, type, word, word_eol, + tags_data.timestamp); + + if (eat1 || eat2) goto xit; word[1]++; @@ -1518,12 +1522,16 @@ irc_inline (server *serv, char *buf, int len) } else { + int eat1; + int eat2; + word[0] = type = word[1]; - /* 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)) + eat1 = plugin_emit_server (sess, type, word, word_eol); + eat2 = plugin_emit_server_attrs (sess, type, word, word_eol, + tags_data.timestamp); + + if (eat1 || eat2) goto xit; } diff --git a/src/common/text.c b/src/common/text.c index f251283b..94744e86 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -2070,6 +2070,8 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d, int i; unsigned int stripcolor_args = (chanopt_is_set (prefs.hex_text_stripcolor_msg, sess->text_strip) ? 0xFFFFFFFF : 0); char tbuf[NICKLEN + 4]; + int eat1; + int eat2; if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG)) { @@ -2086,9 +2088,11 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d, for (i = 5; i < PDIWORDS; i++) word[i] = "\000"; + eat1 = plugin_emit_print (sess, word); + eat2 = plugin_emit_print_attrs (sess, word, timestamp); + /* don't use || here, since it might short-circuit */ - if (plugin_emit_print (sess, word) - + plugin_emit_print_attrs (sess, word, timestamp)) + if (eat1 || eat2) return; /* If a plugin's callback executes "/close", 'sess' may be invalid */ -- cgit 1.4.1