changeset 1735:00f74db70f2d

[gaim-migrate @ 1745] have write_to_conv put on the timestamps for system messages. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 21 Apr 2001 00:32:40 +0000
parents dd78a230aa06
children 4f3448b3c8f8
files plugins/jabber/jabber.c src/buddy.c src/buddy_chat.c src/conversation.c src/oscar.c
diffstat 5 files changed, 23 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/jabber/jabber.c	Fri Apr 20 23:04:48 2001 +0000
+++ b/plugins/jabber/jabber.c	Sat Apr 21 00:32:40 2001 +0000
@@ -560,7 +560,7 @@
 				else if ((y = xmlnode_get_tag(p->x, "status"))) {
 					char buf[8192];
 					msg = xmlnode_get_data(y);
-					g_snprintf(buf, sizeof(buf), "<B>%s now has status: %s</B>",
+					g_snprintf(buf, sizeof(buf), "%s now has status: %s",
 							p->from->resource, msg);
 					write_to_conv(b, buf, WFLAG_SYSTEM, NULL);
 				}
@@ -698,7 +698,7 @@
 				else if ((y = xmlnode_get_tag(p->x, "status"))) {
 					char buf[8192];
 					char *msg = xmlnode_get_data(y);
-					g_snprintf(buf, sizeof(buf), "<B>%s now has status: %s</B>",
+					g_snprintf(buf, sizeof(buf), "%s now has status: %s",
 							p->from->resource, msg);
 					write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL);
 				}
--- a/src/buddy.c	Fri Apr 20 23:04:48 2001 +0000
+++ b/src/buddy.c	Sat Apr 21 00:32:40 2001 +0000
@@ -2250,9 +2250,7 @@
 				struct conversation *c = find_conversation(b->name);
 				if (c) {
 					char tmp[1024];
-					g_snprintf(tmp, sizeof(tmp), _("<B>%s logged in%s%s.</B>"), b->name,
-							((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""),
-							((display_options & OPT_DISP_SHOW_TIME) ? date() : ""));
+					g_snprintf(tmp, sizeof(tmp), _("%s logged in."), b->name);
 					write_to_conv(c, tmp, WFLAG_SYSTEM, NULL);
 				}
 			}
@@ -2304,9 +2302,7 @@
 			struct conversation *c = find_conversation(b->name);
 			if (c) {
 				char tmp[1024];
-				g_snprintf(tmp, sizeof(tmp), _("<B>%s logged out%s%s.</B>"), b->name,
-						((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""),
-						((display_options & OPT_DISP_SHOW_TIME) ? date() : ""));
+				g_snprintf(tmp, sizeof(tmp), _("%s logged out."), b->name);
 				write_to_conv(c, tmp, WFLAG_SYSTEM, NULL);
 			}
 		}
--- a/src/buddy_chat.c	Fri Apr 20 23:04:48 2001 +0000
+++ b/src/buddy_chat.c	Sat Apr 21 00:32:40 2001 +0000
@@ -541,12 +541,7 @@
 		play_sound(CHAT_JOIN);
 
 	if (display_options & OPT_DISP_CHAT_LOGON) {
-		if (display_options & OPT_DISP_SHOW_TIME)
-			g_snprintf(tmp, sizeof(tmp),
-					_("<FONT SIZE=\"2\">(%s) </FONT><B>%s entered the room.</B>"),
-						date(), name);
-		else
-			g_snprintf(tmp, sizeof(tmp), _("<B>%s entered the room.</B>"), name);
+		g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name);
 		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
 	}
 }
@@ -609,12 +604,7 @@
 	gtk_widget_show(list_item);
 
 	if (display_options & OPT_DISP_CHAT_LOGON) {
-		if (display_options & OPT_DISP_SHOW_TIME)
-			g_snprintf(tmp, sizeof(tmp),
-					_("<FONT SIZE=\"2\">(%s) </FONT><B>%s is now known as %s.</B>"),
-						date(), old, new);
-		else
-			g_snprintf(tmp, sizeof(tmp), _("<B>%s is now known as %s</B>"), old, new);
+		g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new);
 		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
 	}
 }
@@ -657,12 +647,7 @@
 		play_sound(CHAT_LEAVE);
 
 	if (display_options & OPT_DISP_CHAT_LOGON) {
-		if (display_options & OPT_DISP_SHOW_TIME)
-			g_snprintf(tmp, sizeof(tmp),
-					_("<FONT SIZE=\"2\">(%s) </FONT><B>%s left the room.</B>"),
-						date(), buddy);
-		else
-			g_snprintf(tmp, sizeof(tmp), _("<B>%s left the room.</B>"), buddy);
+		g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy);
 		write_to_conv(b, tmp, WFLAG_SYSTEM, NULL);
 	}
 }
--- a/src/conversation.c	Fri Apr 20 23:04:48 2001 +0000
+++ b/src/conversation.c	Sat Apr 21 00:32:40 2001 +0000
@@ -1266,16 +1266,16 @@
  * normal IM conversation or a chat window. but hopefully it won't matter */
 void write_to_conv(struct conversation *c, char *what, int flags, char *who)
 {
-	char *buf = g_malloc(BUF_LONG);
+	char buf[BUF_LONG];
 	char *str;
 	FILE *fd;
 	char colour[10];
 	int colorv = -1;
 	char *clr;
-	char *smiley = g_malloc(7);
 	struct buddy *b;
 	int gtk_font_options = 0;
 	GString *logstr;
+	char buf2[BUF_LONG];
 
 	gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS;
 
@@ -1312,18 +1312,22 @@
 	}
 
 	if (flags & WFLAG_SYSTEM) {
+		if (general_options & OPT_DISP_SHOW_TIME)
+			g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s) </FONT><B>%s</B>", date(), what);
+		else
+			g_snprintf(buf, BUF_LONG, "<B>%s</B>", date(), what);
+		g_snprintf(buf2, sizeof(buf2), "<FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B><BR>",
+			date(), what);
 
-		gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0);
-
-		gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
+		gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, 0);
 
 		if (logging_options & OPT_LOG_STRIP_HTML) {
-			char *t1 = strip_html(what);
+			char *t1 = strip_html(buf);
 			c->history = g_string_append(c->history, t1);
 			c->history = g_string_append(c->history, "\n");
 			g_free(t1);
 		} else {
-			c->history = g_string_append(c->history, what);
+			c->history = g_string_append(c->history, buf);
 			c->history = g_string_append(c->history, "<BR>\n");
 		}
 
@@ -1332,9 +1336,9 @@
 			char nm[256];
 
 			if (logging_options & OPT_LOG_STRIP_HTML) {
-				t1 = strip_html(what);
+				t1 = strip_html(buf);
 			} else {
-				t1 = what;
+				t1 = buf;
 			}
 			if (c->is_chat)
 				g_snprintf(nm, 256, "%s.chat", c->name);
@@ -1355,7 +1359,6 @@
 		}
 
 	} else {
-		char buf2[BUF_LONG];
 		if ((clr = strstr(what, "<BODY BGCOLOR=\"#")) != NULL) {
 			sscanf(clr + strlen("<BODY BGCOLOR=\"#"), "%x", &colorv);
 		}
@@ -1497,9 +1500,6 @@
 		gtk_style_unref(style);
 		c->unseen = TRUE;
 	}
-
-	g_free(smiley);
-	g_free(buf);
 }
 
 
--- a/src/oscar.c	Fri Apr 20 23:04:48 2001 +0000
+++ b/src/oscar.c	Sat Apr 21 00:32:40 2001 +0000
@@ -855,7 +855,7 @@
 	char buf[256];
 
 	if (!(dim->cnv = find_conversation(dim->name))) dim->cnv = new_conversation(dim->name);
-	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s established</B>"), dim->name);
+	g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name);
 	write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);
 
 	gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy",
@@ -2122,7 +2122,7 @@
 	dim->conn = newconn;
 	dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
 					oscar_callback, dim->conn);
-	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s established</B>"), priv->sn);
+	g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), priv->sn);
 	write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);
 
 	aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING,
@@ -2179,7 +2179,7 @@
 	gdk_input_remove(dim->watcher);
 	gtk_signal_disconnect_by_data(GTK_OBJECT(dim->cnv->window), dim);
 
-	g_snprintf(buf, sizeof buf, _("<B>Direct IM with %s closed</B>"), sn);
+	g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
 	if (dim->cnv)
 		write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);