changeset 8722:230fee6f1e3e

[gaim-migrate @ 9477] So, I decided we should cut down on gaim_notify_* where possible and find less obtrusive ways to report errors, so I made GAIM_MESSAGE_ERROR as a flag that can be sent to gaim_conversation_write to report conversation-specific errors ("This message was not sent because %s is offline" and the sorts). I'll leave hacking the prpls to use it (without changing strings before Thursday) as an excercise. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 20 Apr 2004 05:00:27 +0000
parents 1fac5551b03e
children 07f670358f6e
files src/conversation.c src/conversation.h src/gtkconv.c
diffstat 3 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Apr 20 04:39:27 2004 +0000
+++ b/src/conversation.c	Tue Apr 20 05:00:27 2004 +0000
@@ -1492,7 +1492,7 @@
 	win = gaim_conversation_get_window(conv);
 
 	/* Tab highlighting */
-	if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM))
+	if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM) && !(flags & GAIM_MESSAGE_ERROR))
 		return;
 
 	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
@@ -1504,7 +1504,8 @@
 		if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK ||
 				gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK)
 			unseen = GAIM_UNSEEN_NICK;
-		else if ((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM &&
+		else if ((((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) ||
+			  ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) &&
 				 gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT)
 			unseen = GAIM_UNSEEN_EVENT;
 		else
--- a/src/conversation.h	Tue Apr 20 04:39:27 2004 +0000
+++ b/src/conversation.h	Tue Apr 20 05:00:27 2004 +0000
@@ -115,8 +115,8 @@
 	GAIM_MESSAGE_NICK      = 0x0020, /**< Contains your nick.      */
 	GAIM_MESSAGE_NO_LOG    = 0x0040, /**< Do not log.              */
 	GAIM_MESSAGE_WHISPER   = 0x0080, /**< Whispered message.       */
-	GAIM_MESSAGE_IMAGES    = 0x0100  /**< Message contains images. */
-
+	GAIM_MESSAGE_IMAGES    = 0x0100, /**< Message contains images. */
+	GAIM_MESSAGE_ERROR     = 0x0200  /**< Error message.           */
 } GaimMessageFlags;
 
 #include "account.h"
--- a/src/gtkconv.c	Tue Apr 20 04:39:27 2004 +0000
+++ b/src/gtkconv.c	Tue Apr 20 05:00:27 2004 +0000
@@ -4584,6 +4584,23 @@
 		conv->history = g_string_append(conv->history, buf);
 		conv->history = g_string_append(conv->history, "<BR>\n");
 
+	} else if (flags & GAIM_MESSAGE_ERROR) {
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps"))
+			g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s)</FONT> <B>%s</B>",
+				   mdate, message);
+		else
+			g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"#ff0000\"><B>%s</B></FONT>", message);
+		
+		g_snprintf(buf2, sizeof(buf2),
+			   "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>",
+			   sml_attrib, mdate, message);
+		
+		gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml),
+						   buf2, 0, images);
+		
+		/* Add the message to a conversations scrollback buffer */
+		conv->history = g_string_append(conv->history, buf);
+		conv->history = g_string_append(conv->history, "<BR>\n");
 	} else if (flags & GAIM_MESSAGE_NO_LOG) {
 		g_snprintf(buf, BUF_LONG,
 			   "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>",