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

View File

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

View File

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

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)
/* 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: