From 1b2700840a5deaf88b8ee045a718a23498d36f56 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 7 Mar 2005 11:13:24 +0000
Subject: [PATCH] we can now send a status message when we disconnect

---
 Core/core.py     | 8 ++++----
 common/jabber.py | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Core/core.py b/Core/core.py
index 9455efc84d..a2aad1ddd7 100644
--- a/Core/core.py
+++ b/Core/core.py
@@ -633,7 +633,7 @@ class GajimCore:
 					for con in self.connexions.keys():
 						if self.connected[self.connexions[con]]:
 							self.connected[self.connexions[con]] = 0
-							con.disconnect()
+							con.disconnect('Disconnected')
 					self.hub.sendPlugin('QUIT', None, ())
 					return 1
 			#('ASK_ROSTER', account, queue_for_response)
@@ -692,8 +692,8 @@ class GajimCore:
 					msg = ev[2][0]
 				signed = ''
 				keyID = ''
-				if self.cfgParser.tab[ev[1]].has_key("keyid"):
-					keyID = self.cfgParser.tab[ev[1]]["keyid"]
+				if self.cfgParser.tab[ev[1]].has_key('keyid'):
+					keyID = self.cfgParser.tab[ev[1]]['keyid']
 				if keyID and USE_GPG:
 					signed = self.gpg[ev[1]].sign(msg, keyID)
 					if signed == 'BAD_PASSPHRASE':
@@ -724,7 +724,7 @@ class GajimCore:
 						self.myVCardID.append(id)
 				elif (ev[2][0] == 'offline') and (self.connected[ev[1]]):
 					self.connected[ev[1]] = 0
-					con.disconnect()
+					con.disconnect(msg)
 					self.hub.sendPlugin('STATUS', ev[1], 'offline')
 				elif ev[2][0] != 'offline' and self.connected[ev[1]]:
 					statuss = ['offline', 'online', 'away', 'xa', 'dnd', \
diff --git a/common/jabber.py b/common/jabber.py
index 641b11eefe..9fb01e8f15 100644
--- a/common/jabber.py
+++ b/common/jabber.py
@@ -441,9 +441,9 @@ class Client(Connection):
         self._reg_info = {}
         self._reg_agent = ''
 
-    def disconnect(self):
+    def disconnect(self,status=None):
         """Safely disconnects from the connected server"""
-        self.send(Presence(type='unavailable'))
+        self.send(Presence(type='unavailable',status=status))
         xmlstream.Client.disconnect(self)
 
     def sendPresence(self,type=None,priority=None,show=None,status=None,signedStatus=None):
-- 
GitLab