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.
This commit is contained in:
Diogo Sousa 2013-06-22 16:55:41 +01:00
parent a01bd83c64
commit 42da8fe3ef
5 changed files with 33 additions and 22 deletions

View File

@ -85,7 +85,8 @@ ctcp_check (session *sess, char *nick, char *word[], char *word_eol[],
void void
ctcp_handle (session *sess, char *to, char *nick, char *ip, 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; char *po;
session *chansess; session *chansess;
@ -161,12 +162,13 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (!chansess) if (!chansess)
chansess = sess; chansess = sess;
EMIT_SIGNAL (XP_TE_CTCPSNDC, chansess, word[5], EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPSNDC, chansess, word[5],
nick, to, NULL, 0); nick, to, NULL, 0, tags_data->timestamp);
} else } else
{ {
EMIT_SIGNAL (XP_TE_CTCPSND, sess->server->front_session, word[5], EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPSND, sess->server->front_session,
nick, NULL, NULL, 0); word[5], nick, NULL, NULL, 0,
tags_data->timestamp);
} }
/* don't let IRCers specify path */ /* don't let IRCers specify path */
@ -187,13 +189,14 @@ generic:
if (!is_channel (sess->server, to)) if (!is_channel (sess->server, to))
{ {
EMIT_SIGNAL (XP_TE_CTCPGEN, sess->server->front_session, msg, nick, EMIT_SIGNAL_TIMESTAMP (XP_TE_CTCPGEN, sess->server->front_session, msg,
NULL, NULL, 0); nick, NULL, NULL, 0, tags_data->timestamp);
} else } else
{ {
chansess = find_channel (sess->server, to); chansess = find_channel (sess->server, to);
if (!chansess) if (!chansess)
chansess = sess; 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);
} }
} }

View File

@ -20,6 +20,8 @@
#ifndef HEXCHAT_CTCP_H #ifndef HEXCHAT_CTCP_H
#define 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 #endif

View File

@ -509,8 +509,7 @@ dcc_chat_line (struct DCC *dcc, char *line)
int len; int len;
gsize utf_len; gsize utf_len;
char portbuf[32]; char portbuf[32];
message_tags_data tags_data_ = MESSAGE_TAGS_DATA_INIT; /* TODO: this will be an argument */ message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
const message_tags_data *tags_data = &tags_data_;
len = strlen (line); len = strlen (line);
if (dcc->serv->using_cp1255) 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); inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, FALSE);
} else } else
{ {
inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, tags_data); inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags);
} }
if (utf) if (utf)
g_free (utf); g_free (utf);

View File

@ -414,8 +414,8 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int
void void
inbound_chanmsg (server *serv, session *sess, char *chan, char *from, inbound_chanmsg (server *serv, session *sess, char *chan, char *from,
char *text, char fromme, int id, char *text, char fromme, int id,
const message_tags_data *tags_data) const message_tags_data *tags_data)
{ {
struct User *user; struct User *user;
int hilight = FALSE; int hilight = FALSE;

View File

@ -1178,14 +1178,16 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
if (g_ascii_strncasecmp (text, "DCC ", 4) == 0) if (g_ascii_strncasecmp (text, "DCC ", 4) == 0)
/* redo this with handle_quotes TRUE */ /* redo this with handle_quotes TRUE */
process_data_init (word[1], word_eol[1], word, word_eol, TRUE, FALSE); 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 } else
{ {
if (is_channel (serv, to)) if (is_channel (serv, to))
{ {
if (ignore_check (word[1], IG_CHAN)) if (ignore_check (word[1], IG_CHAN))
return; return;
inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id, tags_data); inbound_chanmsg (serv, NULL, to, nick, text, FALSE, id,
tags_data);
} else } else
{ {
if (ignore_check (word[1], IG_PRIV)) if (ignore_check (word[1], IG_PRIV))
@ -1256,7 +1258,8 @@ garbage:
/* handle named messages that DON'T start with a ':' */ /* handle named messages that DON'T start with a ':' */
static void 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; 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)) 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; return;
} }
if (!strncmp (buf, "NOTICE ", 7)) 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]; buf = word_eol[3];
if (*buf == ':') if (*buf == ':')
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; return;
} }
if (!strncmp (buf, "AUTHENTICATE +", 14)) /* omit SASL "empty" responses */ 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; 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. /* Handle time-server tags.
@ -1444,7 +1451,7 @@ irc_inline (server *serv, char *buf, int len)
if (buf[0] != ':') 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; 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) process_numeric (sess, atoi (word[2]), word, word_eol, text, &tags_data); // TODO (data tags)
} else } 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: xit: