we can now send a status message when we disconnect

This commit is contained in:
Yann Leboulanger 2005-03-07 11:13:24 +00:00
parent 2bd9750040
commit 1b2700840a
2 changed files with 6 additions and 6 deletions

View File

@ -633,7 +633,7 @@ class GajimCore:
for con in self.connexions.keys(): for con in self.connexions.keys():
if self.connected[self.connexions[con]]: if self.connected[self.connexions[con]]:
self.connected[self.connexions[con]] = 0 self.connected[self.connexions[con]] = 0
con.disconnect() con.disconnect('Disconnected')
self.hub.sendPlugin('QUIT', None, ()) self.hub.sendPlugin('QUIT', None, ())
return 1 return 1
#('ASK_ROSTER', account, queue_for_response) #('ASK_ROSTER', account, queue_for_response)
@ -692,8 +692,8 @@ class GajimCore:
msg = ev[2][0] msg = ev[2][0]
signed = '' signed = ''
keyID = '' keyID = ''
if self.cfgParser.tab[ev[1]].has_key("keyid"): if self.cfgParser.tab[ev[1]].has_key('keyid'):
keyID = self.cfgParser.tab[ev[1]]["keyid"] keyID = self.cfgParser.tab[ev[1]]['keyid']
if keyID and USE_GPG: if keyID and USE_GPG:
signed = self.gpg[ev[1]].sign(msg, keyID) signed = self.gpg[ev[1]].sign(msg, keyID)
if signed == 'BAD_PASSPHRASE': if signed == 'BAD_PASSPHRASE':
@ -724,7 +724,7 @@ class GajimCore:
self.myVCardID.append(id) self.myVCardID.append(id)
elif (ev[2][0] == 'offline') and (self.connected[ev[1]]): elif (ev[2][0] == 'offline') and (self.connected[ev[1]]):
self.connected[ev[1]] = 0 self.connected[ev[1]] = 0
con.disconnect() con.disconnect(msg)
self.hub.sendPlugin('STATUS', ev[1], 'offline') self.hub.sendPlugin('STATUS', ev[1], 'offline')
elif ev[2][0] != 'offline' and self.connected[ev[1]]: elif ev[2][0] != 'offline' and self.connected[ev[1]]:
statuss = ['offline', 'online', 'away', 'xa', 'dnd', \ statuss = ['offline', 'online', 'away', 'xa', 'dnd', \

View File

@ -441,9 +441,9 @@ class Client(Connection):
self._reg_info = {} self._reg_info = {}
self._reg_agent = '' self._reg_agent = ''
def disconnect(self): def disconnect(self,status=None):
"""Safely disconnects from the connected server""" """Safely disconnects from the connected server"""
self.send(Presence(type='unavailable')) self.send(Presence(type='unavailable',status=status))
xmlstream.Client.disconnect(self) xmlstream.Client.disconnect(self)
def sendPresence(self,type=None,priority=None,show=None,status=None,signedStatus=None): def sendPresence(self,type=None,priority=None,show=None,status=None,signedStatus=None):