A few messages missing regarding server-time.

This commit is contained in:
Diogo Sousa 2013-06-23 19:53:41 +01:00
parent 4057b7dd58
commit ce6fef3d0a
10 changed files with 71 additions and 44 deletions

View File

@ -104,7 +104,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (!ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset))
{
if (!ignore_check (word[1], IG_DCC))
handle_dcc (sess, nick, word, word_eol);
handle_dcc (sess, nick, word, word_eol, tags_data);
}
return;
}
@ -129,7 +129,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset))
goto generic;
inbound_action (sess, to, nick, ip, msg + 7, FALSE, id);
inbound_action (sess, to, nick, ip, msg + 7, FALSE, id, tags_data);
return;
}

View File

@ -577,7 +577,8 @@ dcc_chat_line (struct DCC *dcc, char *line)
po = strchr (line + 8, '\001');
if (po)
po[0] = 0;
inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE, FALSE);
inbound_action (sess, dcc->serv->nick, dcc->nick, "", line + 8, FALSE,
FALSE, &no_tags);
} else
{
inbound_privmsg (dcc->serv, dcc->nick, "", line, FALSE, &no_tags);
@ -2376,8 +2377,8 @@ dcc_add_file (session *sess, char *file, DCC_SIZE size, int port, char *nick, gu
}
void
handle_dcc (struct session *sess, char *nick, char *word[],
char *word_eol[])
handle_dcc (struct session *sess, char *nick, char *word[], char *word_eol[],
const message_tags_data *tags_data)
{
char tbuf[512];
struct DCC *dcc;
@ -2473,8 +2474,9 @@ handle_dcc (struct session *sess, char *nick, char *word[],
dcc->serv->p_ctcp (dcc->serv, dcc->nick, tbuf);
}
sprintf (tbuf, "%"DCC_SFMT, dcc->pos);
EMIT_SIGNAL (XP_TE_DCCRESUMEREQUEST, sess, nick,
file_part (dcc->file), tbuf, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_DCCRESUMEREQUEST, sess, nick,
file_part (dcc->file), tbuf, NULL, 0,
tags_data->timestamp);
}
return;
}
@ -2544,8 +2546,9 @@ handle_dcc (struct session *sess, char *nick, char *word[],
} else
{
EMIT_SIGNAL (XP_TE_DCCGENERICOFFER, sess->server->front_session,
word_eol[4] + 2, nick, NULL, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_DCCGENERICOFFER, sess->server->front_session,
word_eol[4] + 2, nick, NULL, NULL, 0,
tags_data->timestamp);
}
}

View File

@ -20,6 +20,7 @@
/* dcc.h */
#include <time.h> /* for time_t */
#include "proto-irc.h"
#ifndef HEXCHAT_DCC_H
#define HEXCHAT_DCC_H
@ -127,7 +128,8 @@ void dcc_send (struct session *sess, char *to, char *file, int maxcps, int passi
struct DCC *find_dcc (char *nick, char *file, int type);
void dcc_get_nick (struct session *sess, char *nick);
void dcc_chat (session *sess, char *nick, int passive);
void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[]);
void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[],
const message_tags_data *tags_data);
void dcc_show_list (session *sess);
guint32 dcc_get_my_address (void);
void dcc_get_with_destfile (struct DCC *dcc, char *utf8file);

View File

@ -122,13 +122,15 @@ find_session_from_nick (char *nick, server *serv)
}
static session *
inbound_open_dialog (server *serv, char *from)
inbound_open_dialog (server *serv, char *from,
const message_tags_data *tags_data)
{
session *sess;
sess = new_ircwindow (serv, from, SESS_DIALOG, 0);
/* for playing sounds */
EMIT_SIGNAL (XP_TE_OPENDIALOG, sess, NULL, NULL, NULL, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_OPENDIALOG, sess, NULL, NULL, NULL, NULL, 0,
tags_data->timestamp);
return sess;
}
@ -169,7 +171,7 @@ inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
{
if (flood_check (from, ip, serv, current_sess, 1))
/* Create a dialog session */
sess = inbound_open_dialog (serv, from);
sess = inbound_open_dialog (serv, from, tags_data);
else
sess = serv->server_session;
if (!sess)
@ -326,7 +328,8 @@ is_hilight (char *from, char *text, session *sess, server *serv)
}
void
inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id)
inbound_action (session *sess, char *chan, char *from, char *ip, char *text,
int fromme, int id, const message_tags_data *tags_data)
{
session *def = sess;
server *serv = sess->server;
@ -351,7 +354,7 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int
{
/* but only if it wouldn't flood */
if (flood_check (from, ip, serv, current_sess, 1))
sess = inbound_open_dialog (serv, from);
sess = inbound_open_dialog (serv, from, tags_data);
else
sess = serv->server_session;
}
@ -397,19 +400,24 @@ inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int
{
if (is_hilight (from, text, sess, serv))
{
EMIT_SIGNAL (XP_TE_HCHANACTION, sess, from, text, nickchar, idtext, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANACTION, sess, from, text, nickchar,
idtext, 0, tags_data->timestamp);
return;
}
}
if (fromme)
EMIT_SIGNAL (XP_TE_UACTION, sess, from, text, nickchar, idtext, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_UACTION, sess, from, text, nickchar, idtext,
0, tags_data->timestamp);
else if (!privaction)
EMIT_SIGNAL (XP_TE_CHANACTION, sess, from, text, nickchar, idtext, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANACTION, sess, from, text, nickchar,
idtext, 0, tags_data->timestamp);
else if (sess->type == SESS_DIALOG)
EMIT_SIGNAL (XP_TE_DPRIVACTION, sess, from, text, idtext, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVACTION, sess, from, text, idtext, NULL,
0, tags_data->timestamp);
else
EMIT_SIGNAL (XP_TE_PRIVACTION, sess, from, text, idtext, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVACTION, sess, from, text, idtext, NULL, 0,
tags_data->timestamp);
}
void
@ -457,7 +465,8 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from,
{
if (prefs.hex_away_auto_unmark && serv->is_away)
sess->server->p_set_back (sess->server);
EMIT_SIGNAL (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL,
0, tags_data->timestamp);
return;
}
@ -467,14 +476,14 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from,
hilight = TRUE;
if (sess->type == SESS_DIALOG)
EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text,
idtext, NULL, 0, tags_data->timestamp);
EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0,
tags_data->timestamp);
else if (hilight)
EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text,
nickchar, idtext, 0, tags_data->timestamp);
EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text, nickchar, idtext,
0, tags_data->timestamp);
else
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text,
nickchar, idtext, 0, tags_data->timestamp);
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text, nickchar, idtext,
0, tags_data->timestamp);
}
void
@ -660,12 +669,13 @@ inbound_nameslist (server *serv, char *chan, char *names,
sess = find_channel (serv, chan);
if (!sess)
{
EMIT_SIGNAL (XP_TE_USERSONCHAN, serv->server_session, chan, names, NULL,
NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_USERSONCHAN, serv->server_session, chan,
names, NULL, NULL, 0, tags_data->timestamp);
return;
}
if (!sess->ignore_names)
EMIT_SIGNAL (XP_TE_USERSONCHAN, sess, chan, names, NULL, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_USERSONCHAN, sess, chan, names, NULL, NULL,
0, tags_data->timestamp);
if (sess->end_of_names)
{
@ -1245,7 +1255,8 @@ inbound_next_nick (session *sess, char *nick, int error,
}
void
do_dns (session *sess, char *nick, char *host)
do_dns (session *sess, char *nick, char *host,
const message_tags_data *tags_data)
{
char *po;
char tbuf[1024];
@ -1253,7 +1264,8 @@ do_dns (session *sess, char *nick, char *host)
po = strrchr (host, '@');
if (po)
host = po + 1;
EMIT_SIGNAL (XP_TE_RESOLVINGUSER, sess, nick, host, NULL, NULL, 0);
EMIT_SIGNAL_TIMESTAMP (XP_TE_RESOLVINGUSER, sess, nick, host, NULL, NULL, 0,
tags_data->timestamp);
snprintf (tbuf, sizeof (tbuf), "exec -d %s %s", prefs.hex_dnsprogram, host);
handle_command (sess, tbuf, FALSE);
}
@ -1382,7 +1394,7 @@ inbound_user_info (session *sess, char *chan, char *user, char *host,
else
{
if (serv->doing_dns && nick && host)
do_dns (sess, nick, host);
do_dns (sess, nick, host, tags_data);
}
}
else

View File

@ -82,7 +82,9 @@ void clear_channel (session *sess);
void set_topic (session *sess, char *topic, char *stripped_topic);
void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
const message_tags_data *tags_data);
void inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id);
void inbound_action (session *sess, char *chan, char *from, char *ip,
char *text, int fromme, int id,
const message_tags_data *tags_data);
void inbound_newnick (server *serv, char *nick, char *newnick, int quiet,
const message_tags_data *tags_data);
void inbound_identified (server *serv);
@ -93,7 +95,8 @@ void inbound_cap_ls (server *serv, char *nick, char *extensions,
void inbound_cap_nak (server *serv, const message_tags_data *tags_data);
void inbound_cap_list (server *serv, char *nick, char *extensions,
const message_tags_data *tags_data);
void do_dns (session *sess, char *nick, char *host);
void do_dns (session *sess, char *nick, char *host,
const message_tags_data *tags_data);
gboolean alert_match_word (char *word, char *masks);
gboolean alert_match_text (char *text, char *masks);

View File

@ -491,7 +491,7 @@ notify_showlist (struct session *sess, const message_tags_data *tags_data)
snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
else
snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
PrintText (sess, outbuf);
PrintTextTimeStamp (sess, outbuf, tags_data->timestamp);
list = list->next;
}
if (i)

View File

@ -1419,7 +1419,8 @@ cmd_dns (struct session *sess, char *tbuf, char *word[], char *word_eol[])
user = userlist_find (sess, nick);
if (user && user->hostname)
{
do_dns (sess, user->nick, user->hostname);
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
do_dns (sess, user->nick, user->hostname, &no_tags);
} else
{
sess->server->p_get_ip (sess->server, nick);
@ -2606,6 +2607,7 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
char *split_text = NULL;
int cmd_length = 22; /* " PRIVMSG ", " ", :, \001ACTION, " ", \001, \r, \n */
int offset = 0;
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
if (!(*act))
return FALSE;
@ -2621,7 +2623,8 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
if (dcc_write_chat (sess->channel, tbuf))
{
/* print it to screen */
inbound_action (sess, sess->channel, sess->server->nick, "", act, TRUE, FALSE);
inbound_action (sess, sess->channel, sess->server->nick, "", act, TRUE, FALSE,
&no_tags);
} else
{
/* DCC CHAT failed, try through server */
@ -2631,7 +2634,9 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
sess->server->p_action (sess->server, sess->channel, split_text);
/* print it to screen */
inbound_action (sess, sess->channel, sess->server->nick, "", split_text, TRUE, FALSE);
inbound_action (sess, sess->channel, sess->server->nick, "",
split_text, TRUE, FALSE,
&no_tags);
if (*split_text)
offset += strlen(split_text);
@ -2641,7 +2646,8 @@ cmd_me (struct session *sess, char *tbuf, char *word[], char *word_eol[])
sess->server->p_action (sess->server, sess->channel, act + offset);
/* print it to screen */
inbound_action (sess, sess->channel, sess->server->nick, "", act + offset, TRUE, FALSE);
inbound_action (sess, sess->channel, sess->server->nick, "",
act + offset, TRUE, FALSE, &no_tags);
} else
{
notc_msg (sess);

View File

@ -1285,7 +1285,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
garbage:
/* unknown message */
PrintTextf (sess, "GARBAGE: %s\n", word_eol[1]);
PrintTextTimeStampf (sess, tags_data->timestamp, "GARBAGE: %s\n", word_eol[1]);
}
/* handle named messages that DON'T start with a ':' */

View File

@ -865,7 +865,7 @@ text_validate (char **text, int *len)
return utf;
}
static void
void
PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
{
char *conv;

View File

@ -42,6 +42,7 @@ void scrollback_load (session *sess);
int text_word_check (char *word, int len);
void PrintText (session *sess, char *text);
void PrintTextTimeStamp (session *sess, char *text, time_t timestamp);
void PrintTextf (session *sess, char *format, ...);
void PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...);
void log_close (session *sess);