From 74f0e11948d2e266b19f7d10d425e132c475f400 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 27 May 2005 12:07:20 +0000 Subject: [PATCH] we are now warned when we are disconnected from a server --- src/common/connection.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index d8bf6d3e3..83047cf18 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -122,6 +122,7 @@ class Connection: self.gpg = None self.status = '' self.myVCardID = [] + self.on_purpose = False self.password = gajim.config.get_per('accounts', name, 'password') if USE_GPG: self.gpg = GnuPG.GnuPG() @@ -301,10 +302,14 @@ class Connection: def _disconnectedCB(self): """Called when we are disconnected""" gajim.log.debug('disconnectedCB') - if self.connection: - self.connected = 0 - self.dispatch('STATUS', 'offline') - self.connection = None + if not self.connection: + return + self.connected = 0 + self.dispatch('STATUS', 'offline') + self.connection = None + if not self.on_purpose: + self.dispatch('ERROR', 'You have been disconected from %s' & self.name) + self.on_purpose = False # END disconenctedCB def _rosterSetCB(self, con, iq_obj): @@ -654,6 +659,7 @@ class Connection: elif show == 'offline' and self.connected: self.connected = 0 if self.connection: + self.on_purpose = True p = common.xmpp.Presence(typ = 'unavailable') if msg: p.setStatus(msg)