From fa68a12725f6919332182ee3dc460a23aa65b380 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 16 Mar 2005 13:25:44 +0000
Subject: [PATCH] Core now sends ERROR instead of WARNING

---
 Core/core.py             | 12 ++++++------
 plugins/gtkgui/gtkgui.py |  9 +++++++--
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Core/core.py b/Core/core.py
index d1703a6ace..3111242822 100644
--- a/Core/core.py
+++ b/Core/core.py
@@ -481,7 +481,7 @@ class GajimCore:
 											#									
 				pass
 			elif errcode == '409':	#conflict :	Nick Conflict
-				self.hub.sendPlugin('WARNING', None, errmsg)
+				self.hub.sendPlugin('ERROR', None, errmsg)
 			else:
 				self.hub.sendPlugin('NOTIFY', self.connections[con], \
 					(prs.getFrom().getStripped(), 'error', errmsg, \
@@ -554,19 +554,19 @@ class GajimCore:
 		except IOError, e:
 			log.debug("Couldn't connect to %s %s" % (hostname, e))
 			self.hub.sendPlugin('STATUS', account, 'offline')
-			self.hub.sendPlugin('WARNING', None, _("Couldn't connect to %s") \
+			self.hub.sendPlugin('ERROR', None, _("Couldn't connect to %s") \
 				% hostname)
 			return 0
 		except common.xmlstream.socket.error, e:
 			log.debug("Couldn't connect to %s %s" % (hostname, e))
 			self.hub.sendPlugin('STATUS', account, 'offline')
-			self.hub.sendPlugin('WARNING', None, _("Couldn't connect to %s : %s") \
+			self.hub.sendPlugin('ERROR', None, _("Couldn't connect to %s : %s") \
 				% (hostname, e))
 			return 0
 		except common.xmlstream.error, e:
 			log.debug("Couldn't connect to %s %s" % (hostname, e))
 			self.hub.sendPlugin('STATUS', account, 'offline')
-			self.hub.sendPlugin('WARNING', None, _("Couldn't connect to %s : %s") \
+			self.hub.sendPlugin('ERROR', None, _("Couldn't connect to %s : %s") \
 				% (hostname, e))
 			return 0
 #		except:
@@ -587,7 +587,7 @@ class GajimCore:
 			else:
 				log.debug("Couldn't authentificate to %s" % hostname)
 				self.hub.sendPlugin('STATUS', account, 'offline')
-				self.hub.sendPlugin('WARNING', None, \
+				self.hub.sendPlugin('ERROR', None, \
 					_("Authentification failed with %s, check your login and password") % hostname)
 				return 0
 	# END connect
@@ -852,7 +852,7 @@ class GajimCore:
 					c.setRegInfo( 'username', ev[2][1])
 					c.setRegInfo( 'password', ev[2][2])
 					if not c.sendRegInfo():
-						self.hub.sendPlugin('WARNING', None, _('Error : ')+c.lastErr)
+						self.hub.sendPlugin('ERROR', None, _('Error : ')+c.lastErr)
 					else:
 						self.connected[ev[2][3]] = 0
 						self.passwords[ev[2][3]] = ''
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 428453b35f..75c8a77403 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -312,6 +312,9 @@ class plugin:
 	def handle_event_warning(self, unused, msg):
 		Warning_dialog(msg)
 	
+	def handle_event_error(self, unused, msg):
+		Error_dialog(msg)
+	
 	def handle_event_status(self, account, status):
 		#('STATUS', account, status)
 		self.roster.on_status_changed(account, status)
@@ -581,6 +584,8 @@ class plugin:
 				self.handle_event_roster(ev[1], ev[2])
 			elif ev[0] == 'WARNING':
 				self.handle_event_warning(ev[1], ev[2])
+			elif ev[0] == 'ERROR':
+				self.handle_event_error(ev[1], ev[2])
 			elif ev[0] == 'STATUS':
 				self.handle_event_status(ev[1], ev[2])
 			elif ev[0] == 'NOTIFY':
@@ -767,8 +772,8 @@ class plugin:
 			gtk.about_dialog_set_url_hook(self.on_launch_browser_mailer, 'url')
 		self.queueIN = quIN
 		self.queueOUT = quOUT
-		self.send('REG_MESSAGE', 'gtkgui', ['ROSTER', 'WARNING', 'STATUS', \
-			'NOTIFY', 'MSG', 'MSGERROR', 'SUBSCRIBED', 'UNSUBSCRIBED', \
+		self.send('REG_MESSAGE', 'gtkgui', ['ROSTER', 'WARNING', 'ERROR', \
+			'STATUS', 'NOTIFY', 'MSG', 'MSGERROR', 'SUBSCRIBED', 'UNSUBSCRIBED', \
 			'SUBSCRIBE', 'AGENTS', 'AGENT_INFO', 'REG_AGENT_INFO', 'QUIT', \
 			'ACC_OK', 'CONFIG', 'MYVCARD', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', \
 			'VISUAL', 'GC_MSG', 'GC_SUBJECT', 'BAD_PASSPHRASE', \
-- 
GitLab