From 42da8fe3efb3d6bb7e3fb14169e7cc362e21921a Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Sat, 22 Jun 2013 16:55:41 +0100 Subject: server-time supported in all named servermsg: ping, error, notice and authenticate. The only thing left to do for server-time are the numeric messages. --- src/common/ctcp.c | 19 +++++++++++-------- src/common/ctcp.h | 4 +++- src/common/dcc.c | 5 ++--- src/common/inbound.c | 4 ++-- src/common/proto-irc.c | 23 +++++++++++++++-------- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/common/ctcp.c b/src/common/ctcp.c index ebfb604d..7045c08a 100644 --- a/src/common/ctcp.c +++ b/src/common/ctcp.c @@ -85,7 +85,8 @@ ctcp_check (session *sess, char *nick, char *word[], char *word_eol[], void ctcp_handle (session *sess, char *to, char *nick, char *ip, - char *msg, char *word[], char *word_eol[], int id) + char *msg, char *word[], char *word_eol[], int id, + const message_tags_data *tags_data) { char *po; session *chansess; @@ -161,12 +162,13 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip, if (!chansess) chansess = sess; - EMIT_SIGNAL (XP_TE_CTCPSNDC, chansess, word[5], - nick, to, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPSNDC, chansess, word[5], + nick, to, NULL, 0, tags_data->timestamp); } else { - EMIT_SIGNAL (XP_TE_CTCPSND, sess->server->front_session, word[5], - nick, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPSND, sess->server->front_session, + word[5], nick, NULL, NULL, 0, + tags_data->timestamp); } /* don't let IRCers specify path */ @@ -187,13 +189,14 @@ generic: if (!is_channel (sess->server, to)) { - EMIT_SIGNAL (XP_TE_CTCPGEN, sess->server->front_session, msg, nick, - NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPGEN, sess->server->front_session, msg, + nick, NULL, NULL, 0, tags_data->timestamp); } else { chansess = find_channel (sess->server, to); if (!chansess) chansess = sess; - EMIT_SIGNAL (XP_TE_CTCPGENC, chansess, msg, nick, to, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPGENC, chansess, msg, nick, to, NULL, 0, + tags_data->timestamp); } } diff --git a/src/common/ctcp.h b/src/common/ctcp.h index 54e33f4c..9d811e57 100644 --- a/src/common/ctcp.h +++ b/src/common/ctcp.h @@ -20,6 +20,8 @@ #ifndef HEXCHAT_CTCP_H #define HEXCHAT_CTCP_H -void ctcp_handle (session *sess, char *to, char *nick, char *ip, char *msg, char *word[], char *word_eol[], int id); +void ctcp_handle (session *sess, char *to, char *nick, char *ip, char *msg, + char *word[], char *word_eol[], int id, + const message_tags_data *tags_data); #endif diff --git a/src/common/dcc.c b/src/common/dcc.c index 3eeb81bd..afdf67a5 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -509,8 +509,7 @@ dcc_chat_line (struct DCC *dcc, char *line) int len; gsize utf_len; char portbuf[32]; - message_tags_data tags_data_ = MESSAGE_TAGS_DATA_INIT; /* TODO: this will be an argument */ - const message_tags_data *tags_data = &tags_data_; + message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT; len = strlen (line); if (dcc->serv->using_cp1255) @@ -581,7 +580,7 @@ dcc_chat_line (struct DCC *dcc, char *line) inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, FALSE); } else { - inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, tags_data); + inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags); } if (utf) g_free (utf); diff --git a/src/common/inbound.c b/src/common/inbound.c index 070eb585..cac37b32 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -414,8 +414,8 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, - char *text, char fromme, int id, - const message_tags_data *tags_data) + char *text, char fromme, int id, + const message_tags_data *tags_data) { struct User *user; int hilight = FALSE; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 72c73417..d111bd22 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1178,14 +1178,16 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[], if (g_ascii_strncasecmp (text, "DCC ", 4) == 0) /* redo this with handle_quotes TRUE */ process_data_init (word[1], word_eol[1], word, word_eol, TRUE, FALSE); - ctcp_handle (sess, to, nick, ip, text, word, word_eol, id); + ctcp_handle (sess, to, nick, ip, text, word, word_eol, id, + tags_data); } else { if (is_channel (serv, to)) { if (ignore_check (word[1], IG_CHAN)) return; - inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id, tags_data); + inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id, + tags_data); } else { if (ignore_check (word[1], IG_PRIV)) @@ -1256,7 +1258,8 @@ garbage: /* handle named messages that DON'T start with a ':' */ static void -process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol[]) +process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol[], + const message_tags_data *tags_data) { sess = sess->server->server_session; @@ -1267,7 +1270,8 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol } if (!strncmp (buf, "ERROR", 5)) { - EMIT_SIGNAL (XP_TE_SERVERERROR, sess, buf + 7, NULL, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVERERROR, sess, buf + 7, NULL, NULL, NULL, + 0, tags_data->timestamp); return; } if (!strncmp (buf, "NOTICE ", 7)) @@ -1275,7 +1279,9 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol buf = word_eol[3]; if (*buf == ':') buf++; - EMIT_SIGNAL (XP_TE_SERVNOTICE, sess, buf, sess->server->servername, NULL, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, buf, + sess->server->servername, NULL, NULL, 0, + tags_data->timestamp); return; } if (!strncmp (buf, "AUTHENTICATE +", 14)) /* omit SASL "empty" responses */ @@ -1283,7 +1289,8 @@ process_named_servermsg (session *sess, char *buf, char *rawname, char *word_eol return; } - EMIT_SIGNAL (XP_TE_SERVTEXT, sess, buf, sess->server->servername, rawname, NULL, 0); + EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVTEXT, sess, buf, sess->server->servername, + rawname, NULL, 0, tags_data->timestamp); } /* Handle time-server tags. @@ -1444,7 +1451,7 @@ irc_inline (server *serv, char *buf, int len) if (buf[0] != ':') { - process_named_servermsg (sess, buf, word[0], word_eol); // TODO (data tags) + process_named_servermsg (sess, buf, word[0], word_eol, &tags_data); goto xit; } @@ -1458,7 +1465,7 @@ irc_inline (server *serv, char *buf, int len) process_numeric (sess, atoi (word[2]), word, word_eol, text, &tags_data); // TODO (data tags) } else { - process_named_msg (sess, type, word, word_eol, &tags_data); // TODO (data tags) + process_named_msg (sess, type, word, word_eol, &tags_data); } xit: -- cgit 1.4.1