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 (!ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset))
{ {
if (!ignore_check (word[1], IG_DCC)) if (!ignore_check (word[1], IG_DCC))
handle_dcc (sess, nick, word, word_eol); handle_dcc (sess, nick, word, word_eol, tags_data);
} }
return; 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)) if (ctcp_check (sess, nick, word, word_eol, word[4] + ctcp_offset))
goto generic; 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; return;
} }

View File

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

View File

@ -20,6 +20,7 @@
/* dcc.h */ /* dcc.h */
#include <time.h> /* for time_t */ #include <time.h> /* for time_t */
#include "proto-irc.h"
#ifndef HEXCHAT_DCC_H #ifndef HEXCHAT_DCC_H
#define 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); struct DCC *find_dcc (char *nick, char *file, int type);
void dcc_get_nick (struct session *sess, char *nick); void dcc_get_nick (struct session *sess, char *nick);
void dcc_chat (session *sess, char *nick, int passive); 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); void dcc_show_list (session *sess);
guint32 dcc_get_my_address (void); guint32 dcc_get_my_address (void);
void dcc_get_with_destfile (struct DCC *dcc, char *utf8file); 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 * static session *
inbound_open_dialog (server *serv, char *from) inbound_open_dialog (server *serv, char *from,
const message_tags_data *tags_data)
{ {
session *sess; session *sess;
sess = new_ircwindow (serv, from, SESS_DIALOG, 0); sess = new_ircwindow (serv, from, SESS_DIALOG, 0);
/* for playing sounds */ /* 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; 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)) if (flood_check (from, ip, serv, current_sess, 1))
/* Create a dialog session */ /* Create a dialog session */
sess = inbound_open_dialog (serv, from); sess = inbound_open_dialog (serv, from, tags_data);
else else
sess = serv->server_session; sess = serv->server_session;
if (!sess) if (!sess)
@ -326,7 +328,8 @@ is_hilight (char *from, char *text, session *sess, server *serv)
} }
void 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; session *def = sess;
server *serv = sess->server; 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 */ /* but only if it wouldn't flood */
if (flood_check (from, ip, serv, current_sess, 1)) if (flood_check (from, ip, serv, current_sess, 1))
sess = inbound_open_dialog (serv, from); sess = inbound_open_dialog (serv, from, tags_data);
else else
sess = serv->server_session; 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)) 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; return;
} }
} }
if (fromme) 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) 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) 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 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 void
@ -457,7 +465,8 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from,
{ {
if (prefs.hex_away_auto_unmark && serv->is_away) if (prefs.hex_away_auto_unmark && serv->is_away)
sess->server->p_set_back (sess->server); 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; return;
} }
@ -467,14 +476,14 @@ inbound_chanmsg (server *serv, session *sess, char *chan, char *from,
hilight = TRUE; hilight = TRUE;
if (sess->type == SESS_DIALOG) if (sess->type == SESS_DIALOG)
EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0,
idtext, NULL, 0, tags_data->timestamp); tags_data->timestamp);
else if (hilight) else if (hilight)
EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text, EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANMSG, sess, from, text, nickchar, idtext,
nickchar, idtext, 0, tags_data->timestamp); 0, tags_data->timestamp);
else else
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text, EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANMSG, sess, from, text, nickchar, idtext,
nickchar, idtext, 0, tags_data->timestamp); 0, tags_data->timestamp);
} }
void void
@ -660,12 +669,13 @@ inbound_nameslist (server *serv, char *chan, char *names,
sess = find_channel (serv, chan); sess = find_channel (serv, chan);
if (!sess) if (!sess)
{ {
EMIT_SIGNAL (XP_TE_USERSONCHAN, serv->server_session, chan, names, NULL, EMIT_SIGNAL_TIMESTAMP (XP_TE_USERSONCHAN, serv->server_session, chan,
NULL, 0); names, NULL, NULL, 0, tags_data->timestamp);
return; return;
} }
if (!sess->ignore_names) 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) if (sess->end_of_names)
{ {
@ -1245,7 +1255,8 @@ inbound_next_nick (session *sess, char *nick, int error,
} }
void 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 *po;
char tbuf[1024]; char tbuf[1024];
@ -1253,7 +1264,8 @@ do_dns (session *sess, char *nick, char *host)
po = strrchr (host, '@'); po = strrchr (host, '@');
if (po) if (po)
host = po + 1; 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); snprintf (tbuf, sizeof (tbuf), "exec -d %s %s", prefs.hex_dnsprogram, host);
handle_command (sess, tbuf, FALSE); handle_command (sess, tbuf, FALSE);
} }
@ -1382,7 +1394,7 @@ inbound_user_info (session *sess, char *chan, char *user, char *host,
else else
{ {
if (serv->doing_dns && nick && host) if (serv->doing_dns && nick && host)
do_dns (sess, nick, host); do_dns (sess, nick, host, tags_data);
} }
} }
else else

View File

@ -82,7 +82,9 @@ void clear_channel (session *sess);
void set_topic (session *sess, char *topic, char *stripped_topic); void set_topic (session *sess, char *topic, char *stripped_topic);
void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id, void inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
const message_tags_data *tags_data); 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, void inbound_newnick (server *serv, char *nick, char *newnick, int quiet,
const message_tags_data *tags_data); const message_tags_data *tags_data);
void inbound_identified (server *serv); 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_nak (server *serv, const message_tags_data *tags_data);
void inbound_cap_list (server *serv, char *nick, char *extensions, void inbound_cap_list (server *serv, char *nick, char *extensions,
const message_tags_data *tags_data); 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_word (char *word, char *masks);
gboolean alert_match_text (char *text, 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); snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name);
else else
snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name); snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name);
PrintText (sess, outbuf); PrintTextTimeStamp (sess, outbuf, tags_data->timestamp);
list = list->next; list = list->next;
} }
if (i) 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); user = userlist_find (sess, nick);
if (user && user->hostname) 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 } else
{ {
sess->server->p_get_ip (sess->server, nick); 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; char *split_text = NULL;
int cmd_length = 22; /* " PRIVMSG ", " ", :, \001ACTION, " ", \001, \r, \n */ int cmd_length = 22; /* " PRIVMSG ", " ", :, \001ACTION, " ", \001, \r, \n */
int offset = 0; int offset = 0;
message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
if (!(*act)) if (!(*act))
return FALSE; 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)) if (dcc_write_chat (sess->channel, tbuf))
{ {
/* print it to screen */ /* 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 } else
{ {
/* DCC CHAT failed, try through server */ /* 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); sess->server->p_action (sess->server, sess->channel, split_text);
/* print it to screen */ /* 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) if (*split_text)
offset += strlen(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); sess->server->p_action (sess->server, sess->channel, act + offset);
/* print it to screen */ /* 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 } else
{ {
notc_msg (sess); notc_msg (sess);

View File

@ -1285,7 +1285,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
garbage: garbage:
/* unknown message */ /* 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 ':' */ /* handle named messages that DON'T start with a ':' */

View File

@ -865,7 +865,7 @@ text_validate (char **text, int *len)
return utf; return utf;
} }
static void void
PrintTextTimeStamp (session *sess, char *text, time_t timestamp) PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
{ {
char *conv; char *conv;
@ -1857,7 +1857,7 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig
static void static void
display_event (session *sess, int event, char **args, display_event (session *sess, int event, char **args,
unsigned int stripcolor_args, time_t timestamp) unsigned int stripcolor_args, time_t timestamp)
{ {
char o[4096]; char o[4096];
format_event (sess, event, args, o, sizeof (o), stripcolor_args); format_event (sess, event, args, o, sizeof (o), stripcolor_args);
@ -2064,7 +2064,7 @@ text_color_of (char *name)
void void
text_emit (int index, session *sess, char *a, char *b, char *c, char *d, text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
time_t timestamp) time_t timestamp)
{ {
char *word[PDIWORDS]; char *word[PDIWORDS];
int i; int i;

View File

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