summary refs log tree commit diff stats
path: root/src/common/text.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-06-28 11:59:33 -0400
committerTingPing <tingping@tingping.se>2013-06-28 11:59:33 -0400
commitad926e9b07f499bfb70b57890475c73f9d64812a (patch)
treee7274fe1de9f1caf264701be28b6785841f960ed /src/common/text.c
parentac5771377ea95287a99bfd5c8c99ec65e9bb069d (diff)
parent059cbcd406a3defbe43859c3d8df7afe5a89e362 (diff)
Merge pull request #656 from orium/server-time
Closes #499
Diffstat (limited to 'src/common/text.c')
-rw-r--r--src/common/text.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/common/text.c b/src/common/text.c
index f0a1dfb1..a0e860ce 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -866,7 +866,7 @@ text_validate (char **text, int *len)
 }
 
 void
-PrintText (session *sess, char *text)
+PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
 {
 	char *conv;
 
@@ -890,13 +890,19 @@ PrintText (session *sess, char *text)
 
 	log_write (sess, text);
 	scrollback_save (sess, text);
-	fe_print_text (sess, text, 0);
+	fe_print_text (sess, text, timestamp);
 
 	if (conv)
 		g_free (conv);
 }
 
 void
+PrintText (session *sess, char *text)
+{
+	PrintTextTimeStamp (sess, text, 0);
+}
+
+void
 PrintTextf (session *sess, char *format, ...)
 {
 	va_list args;
@@ -910,6 +916,20 @@ PrintTextf (session *sess, char *format, ...)
 	g_free (buf);
 }
 
+void
+PrintTextTimeStampf (session *sess, time_t timestamp, char *format, ...)
+{
+	va_list args;
+	char *buf;
+
+	va_start (args, format);
+	buf = g_strdup_vprintf (format, args);
+	va_end (args);
+
+	PrintTextTimeStamp (sess, buf, timestamp);
+	g_free (buf);
+}
+
 /* Print Events stuff here --AGL */
 
 /* Consider the following a NOTES file:
@@ -1836,12 +1856,13 @@ 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)
+display_event (session *sess, int event, char **args, 
+					unsigned int stripcolor_args, time_t timestamp)
 {
 	char o[4096];
 	format_event (sess, event, args, o, sizeof (o), stripcolor_args);
 	if (o[0])
-		PrintText (sess, o);
+		PrintTextTimeStamp (sess, o, timestamp);
 }
 
 int
@@ -2042,7 +2063,8 @@ text_color_of (char *name)
 /* called by EMIT_SIGNAL macro */
 
 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)
 {
 	char *word[PDIWORDS];
 	int i;
@@ -2120,7 +2142,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
 	}
 
 	sound_play_event (index);
-	display_event (sess, index, word, stripcolor_args);
+	display_event (sess, index, word, stripcolor_args, timestamp);
 }
 
 char *
@@ -2143,7 +2165,7 @@ text_emit_by_name (char *name, session *sess, char *a, char *b, char *c, char *d
 	i = pevent_find (name, &i);
 	if (i >= 0)
 	{
-		text_emit (i, sess, a, b, c, d);
+		text_emit (i, sess, a, b, c, d, 0);
 		return 1;
 	}