summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorDiogo Sousa <diogogsousa@gmail.com>2013-06-23 19:53:41 +0100
committerDiogo Sousa <diogogsousa@gmail.com>2013-06-28 16:07:42 +0100
commitce6fef3d0ab8b70a88eaf83decb5a596a7f0e246 (patch)
tree0a7fa2e8f3f3af39802c5900c00856e96a30e7fb /src/common
parent4057b7dd5852575a415cca8f465b4d419dcbdf9d (diff)
A few messages missing regarding server-time.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ctcp.c4
-rw-r--r--src/common/dcc.c17
-rw-r--r--src/common/dcc.h4
-rw-r--r--src/common/inbound.c58
-rw-r--r--src/common/inbound.h7
-rw-r--r--src/common/notify.c2
-rw-r--r--src/common/outbound.c14
-rw-r--r--src/common/proto-irc.c2
-rw-r--r--src/common/text.c6
-rw-r--r--src/common/text.h1
10 files changed, 71 insertions, 44 deletions
diff --git a/src/common/ctcp.c b/src/common/ctcp.c
index 7045c08a..b4fb55b7 100644
--- a/src/common/ctcp.c
+++ b/src/common/ctcp.c
@@ -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;
 	}
 
diff --git a/src/common/dcc.c b/src/common/dcc.c
index afdf67a5..c0527510 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -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);
 	}
 }
 
diff --git a/src/common/dcc.h b/src/common/dcc.h
index 32d0ed5f..e3163c8a 100644
--- a/src/common/dcc.h
+++ b/src/common/dcc.h
@@ -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);
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 82f5826a..8547a70a 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -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
diff --git a/src/common/inbound.h b/src/common/inbound.h
index 742152ea..cbb04890 100644
--- a/src/common/inbound.h
+++ b/src/common/inbound.h
@@ -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);
 
diff --git a/src/common/notify.c b/src/common/notify.c
index 96b3a097..944d826c 100644
--- a/src/common/notify.c
+++ b/src/common/notify.c
@@ -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)
diff --git a/src/common/outbound.c b/src/common/outbound.c
index d3e0ff56..5e840769 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -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);
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 875247e7..204fccda 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -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 ':' */
diff --git a/src/common/text.c b/src/common/text.c
index 05a20230..a0e860ce 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -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;
@@ -1857,7 +1857,7 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig
 
 static void
 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];
 	format_event (sess, event, args, o, sizeof (o), stripcolor_args);
@@ -2064,7 +2064,7 @@ text_color_of (char *name)
 
 void
 text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
-	   time_t timestamp)
+			  time_t timestamp)
 {
 	char *word[PDIWORDS];
 	int i;
diff --git a/src/common/text.h b/src/common/text.h
index 27848616..5a51c894 100644
--- a/src/common/text.h
+++ b/src/common/text.h
@@ -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);