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:
parent
5dcd555faf
commit
9914792723
|
@ -578,8 +578,6 @@ class CommonConnection:
|
||||||
self.dispatch('STANZA_SENT', unicode(data))
|
self.dispatch('STANZA_SENT', unicode(data))
|
||||||
|
|
||||||
def change_status(self, show, msg, auto=False):
|
def change_status(self, show, msg, auto=False):
|
||||||
if not show in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
|
|
||||||
return -1
|
|
||||||
if not msg:
|
if not msg:
|
||||||
msg = ''
|
msg = ''
|
||||||
sign_msg = False
|
sign_msg = False
|
||||||
|
@ -598,8 +596,9 @@ class CommonConnection:
|
||||||
self.USE_GPG = True
|
self.USE_GPG = True
|
||||||
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
|
self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent'))
|
||||||
self.connect_and_init(show, msg, sign_msg)
|
self.connect_and_init(show, msg, sign_msg)
|
||||||
|
return
|
||||||
|
|
||||||
elif show == 'offline':
|
if show == 'offline':
|
||||||
self.connected = 0
|
self.connected = 0
|
||||||
if self.connection:
|
if self.connection:
|
||||||
p = common.xmpp.Presence(typ = 'unavailable')
|
p = common.xmpp.Presence(typ = 'unavailable')
|
||||||
|
@ -612,14 +611,17 @@ class CommonConnection:
|
||||||
self.connection.start_disconnect()
|
self.connection.start_disconnect()
|
||||||
else:
|
else:
|
||||||
self._on_disconnected()
|
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'
|
# dont'try to connect, when we are in state 'connecting'
|
||||||
if self.connected == 1:
|
if self.connected == 1:
|
||||||
return
|
return
|
||||||
if show == 'invisible':
|
if show == 'invisible':
|
||||||
self._change_to_invisible(msg)
|
self._change_to_invisible(msg)
|
||||||
return
|
return
|
||||||
|
if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
|
||||||
|
return -1
|
||||||
was_invisible = self.connected == gajim.SHOW_LIST.index('invisible')
|
was_invisible = self.connected == gajim.SHOW_LIST.index('invisible')
|
||||||
self.connected = gajim.SHOW_LIST.index(show)
|
self.connected = gajim.SHOW_LIST.index(show)
|
||||||
if was_invisible:
|
if was_invisible:
|
||||||
|
|
|
@ -2711,6 +2711,8 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
|
||||||
if show == 'invisible':
|
if show == 'invisible':
|
||||||
self.send_invisible_presence(msg, signed, True)
|
self.send_invisible_presence(msg, signed, True)
|
||||||
return
|
return
|
||||||
|
if show not in ['offline', 'online', 'chat', 'away', 'xa', 'dnd']:
|
||||||
|
return
|
||||||
priority = gajim.get_priority(self.name, sshow)
|
priority = gajim.get_priority(self.name, sshow)
|
||||||
our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name))
|
our_jid = helpers.parse_jid(gajim.get_jid_from_account(self.name))
|
||||||
vcard = self.get_cached_vcard(our_jid)
|
vcard = self.get_cached_vcard(our_jid)
|
||||||
|
|
Loading…
Reference in New Issue