diff --git a/src/common/connection.py b/src/common/connection.py index 31e2b0ba4..0d370d8b8 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -578,8 +578,6 @@ class CommonConnection: self.dispatch('STANZA_SENT', unicode(data)) def change_status(self, show, msg, auto=False): - if not show in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']: - return -1 if not msg: msg = '' sign_msg = False @@ -598,8 +596,9 @@ class CommonConnection: self.USE_GPG = True self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) self.connect_and_init(show, msg, sign_msg) + return - elif show == 'offline': + if show == 'offline': self.connected = 0 if self.connection: p = common.xmpp.Presence(typ = 'unavailable') @@ -612,14 +611,17 @@ class CommonConnection: self.connection.start_disconnect() else: self._on_disconnected() + return - elif show != 'offline' and self.connected > 0: + if show != 'offline' and self.connected > 0: # dont'try to connect, when we are in state 'connecting' if self.connected == 1: return if show == 'invisible': self._change_to_invisible(msg) return + if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']: + return -1 was_invisible = self.connected == gajim.SHOW_LIST.index('invisible') self.connected = gajim.SHOW_LIST.index(show) if was_invisible: diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 00882597e..043c2d728 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -2711,6 +2711,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, if show == 'invisible': self.send_invisible_presence(msg, signed, True) return + if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']: + return priority = gajim.get_priority(self.name, sshow) our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name)) vcard = self.get_cached_vcard(our_jid)