From 973631a2c97eca47909505166173793b27777342 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 15 Sep 2005 17:33:02 +0000
Subject: [PATCH] error messages are nowprinted as if they come from server

---
 src/gajim.py              | 3 ++-
 src/roster_window.py      | 7 +++++--
 src/tabbed_chat_window.py | 9 +++++++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/gajim.py b/src/gajim.py
index 524792a628..337e214314 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -474,7 +474,8 @@ class Interface:
 		if jid.find('@') <= 0:
 			jid = jid.replace('@', '')
 		self.roster.on_message(jid, _('error while sending') + \
-			' \"%s\" ( %s )' % (array[3], array[2]), array[4], account)
+			' \"%s\" ( %s )' % (array[3], array[2]), array[4], account, \
+			msg_type='error')
 		
 	def handle_event_msgsent(self, account, array):
 		#('MSGSENT', account, (jid, msg, keyID))
diff --git a/src/roster_window.py b/src/roster_window.py
index b1c93bb27d..3903b96d3c 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1498,14 +1498,17 @@ _('If "%s" accepts this request you will know his status.') %jid)
 		if qs.has_key(jid):
 			no_queue = False
 		if self.plugin.windows[account]['chats'].has_key(jid):
+			typ = ''
+			if msg_type == 'error':
+				typ = 'status'
 			self.plugin.windows[account]['chats'][jid].print_conversation(msg, 
-				jid, tim = tim, encrypted = encrypted, subject = subject)
+				jid, typ, tim = tim, encrypted = encrypted, subject = subject)
 			return
 
 		#We save it in a queue
 		if no_queue:
 			qs[jid] = []
-		qs[jid].append((msg, tim, encrypted))
+		qs[jid].append((msg, msg_type, tim, encrypted))
 		self.nb_unread += 1
 		if (not autopopup or ( not autopopupaway and \
 			gajim.connections[account].connected > 2)) and not \
diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py
index 79e3ae81d8..096df37231 100644
--- a/src/tabbed_chat_window.py
+++ b/src/tabbed_chat_window.py
@@ -700,8 +700,13 @@ timestamp, contact):
 		l = gajim.awaiting_messages[self.account][jid]
 		user = self.contacts[jid]
 		for event in l:
-			self.print_conversation(event[0], jid, tim = event[1],
-				encrypted = event[2], contact='print_queue')
+			ev1 = event[1]
+			if ev1 != 'error':
+				ev1 = 'print_queue'
+			else:
+				ev1 = 'status'
+			self.print_conversation(event[0], jid, ev1,
+				tim = event[2],	encrypted = event[3])
 			self.plugin.roster.nb_unread -= 1
 		self.plugin.roster.show_title()
 		del gajim.awaiting_messages[self.account][jid]
-- 
GitLab