re-enable the ability to connect as invisible: check that we don't send presence with show=invisible at the correct place, after we diferenciate invisible conection from not-invisible connection. Fixes #5473

This commit is contained in:
Yann Leboulanger 2009-12-03 18:10:23 +01:00
parent 5dcd555faf
commit 9914792723
2 changed files with 8 additions and 4 deletions

View File

@ -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:

View File

@ -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)