From 0724a4ffea7e623b2c6eefb73fa9f4d6e4d396f2 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 19 Feb 2009 14:46:54 +0000
Subject: [PATCH] show Error Dialog with full error message instead of popup
 when Stream Error arrives. see #4660

---
 src/common/connection.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/common/connection.py b/src/common/connection.py
index 6eb2269e76..c6679b35e4 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -625,12 +625,17 @@ class Connection(ConnectionHandlers):
 			if not self.retrycount and self.connected != 0:
 				self.disconnect(on_purpose = True)
 				self.dispatch('STATUS', 'offline')
-				sectxt = ''
+				pritxt = _('Could not connect to "%s"') % self._hostname
+				sectxt = _('Check your connection or try again later.')
 				if self.streamError:
-					sectxt = _('Server replied: %s\n') % self.streamError
-				self.dispatch('CONNECTION_LOST',
-					(_('Could not connect to "%s"') % self._hostname,
-					_('%sCheck your connection or try again later.') % sectxt))
+					# show error dialog
+					key = common.xmpp.NS_XMPP_STREAMS + ' ' + self.streamError
+					if key in common.xmpp.ERRORS:
+						sectxt2 = _('Server replied: %s') % common.xmpp.ERRORS[key][2]
+						self.dispatch('ERROR', (pritxt, '%s\n%s' % (sectxt2, sectxt)))
+						return
+				# show popup
+				self.dispatch('CONNECTION_LOST', (pritxt, sectxt))
 
 	def on_proxy_failure(self, reason):
 		log.error('Connection to proxy failed: %s' % reason)
-- 
GitLab