don't request privacy lists when connecting if server doesn't support that. Fixes #7990
This commit is contained in:
parent
f2271ced53
commit
9f3fec4ef7
2 changed files with 40 additions and 31 deletions
|
@ -1855,7 +1855,6 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
if iq_obj.getType() == 'error': # server doesn't support privacy lists
|
if iq_obj.getType() == 'error': # server doesn't support privacy lists
|
||||||
return
|
return
|
||||||
# active the privacy rule
|
# active the privacy rule
|
||||||
self.privacy_rules_supported = True
|
|
||||||
self.activate_privacy_rule('invisible')
|
self.activate_privacy_rule('invisible')
|
||||||
self.connected = gajim.SHOW_LIST.index('invisible')
|
self.connected = gajim.SHOW_LIST.index('invisible')
|
||||||
self.status = msg
|
self.status = msg
|
||||||
|
@ -1933,13 +1932,40 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.awaiting_answers[id_] = (PRIVACY_ARRIVED, )
|
self.awaiting_answers[id_] = (PRIVACY_ARRIVED, )
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
|
def _continue_connection_request_privacy(self):
|
||||||
|
if self.privacy_rules_supported:
|
||||||
|
if not self.privacy_rules_requested:
|
||||||
|
self.privacy_rules_requested = True
|
||||||
|
self._request_privacy()
|
||||||
|
else:
|
||||||
|
if self.continue_connect_info and self.continue_connect_info[0]\
|
||||||
|
== 'invisible':
|
||||||
|
# Trying to login as invisible but privacy list not
|
||||||
|
# supported
|
||||||
|
self.disconnect(on_purpose=True)
|
||||||
|
gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
|
||||||
|
show='offline'))
|
||||||
|
gajim.nec.push_incoming_event(InformationEvent(None,
|
||||||
|
conn=self, level='error', pri_txt=_('Invisibility not '
|
||||||
|
'supported'), sec_txt=_('Account %s doesn\'t support '
|
||||||
|
'invisibility.') % self.name))
|
||||||
|
return
|
||||||
|
if self.blocking_supported:
|
||||||
|
iq = nbxmpp.Iq('get', xmlns='')
|
||||||
|
query = iq.setQuery(name='blocklist')
|
||||||
|
query.setNamespace(nbxmpp.NS_BLOCKING)
|
||||||
|
id2_ = self.connection.getAnID()
|
||||||
|
iq.setID(id2_)
|
||||||
|
self.awaiting_answers[id2_] = (BLOCKING_ARRIVED, )
|
||||||
|
self.connection.send(iq)
|
||||||
|
# Ask metacontacts before roster
|
||||||
|
self.get_metacontacts()
|
||||||
|
|
||||||
def _nec_agent_info_error_received(self, obj):
|
def _nec_agent_info_error_received(self, obj):
|
||||||
if obj.conn.name != self.name:
|
if obj.conn.name != self.name:
|
||||||
return
|
return
|
||||||
if obj.id_[:6] == 'Gajim_':
|
if obj.id_[:6] == 'Gajim_':
|
||||||
if not self.privacy_rules_requested:
|
self._continue_connection_request_privacy()
|
||||||
self.privacy_rules_requested = True
|
|
||||||
self._request_privacy()
|
|
||||||
|
|
||||||
def _nec_agent_info_received(self, obj):
|
def _nec_agent_info_received(self, obj):
|
||||||
if obj.conn.name != self.name:
|
if obj.conn.name != self.name:
|
||||||
|
@ -2010,6 +2036,9 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
iq = nbxmpp.Iq('set')
|
iq = nbxmpp.Iq('set')
|
||||||
iq.setTag('enable', namespace=nbxmpp.NS_CARBONS)
|
iq.setTag('enable', namespace=nbxmpp.NS_CARBONS)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
if nbxmpp.NS_PRIVACY in obj.features:
|
||||||
|
self.privacy_rules_supported = True
|
||||||
|
|
||||||
if nbxmpp.NS_BYTESTREAM in obj.features and \
|
if nbxmpp.NS_BYTESTREAM in obj.features and \
|
||||||
gajim.config.get_per('accounts', self.name, 'use_ft_proxies'):
|
gajim.config.get_per('accounts', self.name, 'use_ft_proxies'):
|
||||||
our_fjid = helpers.parse_jid(our_jid + '/' + \
|
our_fjid = helpers.parse_jid(our_jid + '/' + \
|
||||||
|
@ -2026,9 +2055,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.available_transports[transport_type].append(obj.fjid)
|
self.available_transports[transport_type].append(obj.fjid)
|
||||||
else:
|
else:
|
||||||
self.available_transports[transport_type] = [obj.fjid]
|
self.available_transports[transport_type] = [obj.fjid]
|
||||||
if not self.privacy_rules_requested:
|
self._continue_connection_request_privacy()
|
||||||
self.privacy_rules_requested = True
|
|
||||||
self._request_privacy()
|
|
||||||
|
|
||||||
def send_custom_status(self, show, msg, jid):
|
def send_custom_status(self, show, msg, jid):
|
||||||
if not show in gajim.SHOW_LIST:
|
if not show in gajim.SHOW_LIST:
|
||||||
|
|
|
@ -574,32 +574,14 @@ class ConnectionVcard:
|
||||||
elif self.awaiting_answers[id_][0] == PRIVACY_ARRIVED:
|
elif self.awaiting_answers[id_][0] == PRIVACY_ARRIVED:
|
||||||
del self.awaiting_answers[id_]
|
del self.awaiting_answers[id_]
|
||||||
if iq_obj.getType() != 'error':
|
if iq_obj.getType() != 'error':
|
||||||
self.privacy_rules_supported = True
|
|
||||||
self.get_privacy_list('block')
|
self.get_privacy_list('block')
|
||||||
|
# Ask metacontacts before roster
|
||||||
|
self.get_metacontacts()
|
||||||
else:
|
else:
|
||||||
if self.blocking_supported:
|
# That should never happen, but as it's blocking in the
|
||||||
iq = nbxmpp.Iq('get', xmlns='')
|
# connection process, we don't take the risk
|
||||||
query = iq.setQuery(name='blocklist')
|
self.privacy_rules_supported = False
|
||||||
query.setNamespace(nbxmpp.NS_BLOCKING)
|
self._continue_connection_request_privacy()
|
||||||
id2_ = self.connection.getAnID()
|
|
||||||
iq.setID(id2_)
|
|
||||||
self.awaiting_answers[id2_] = (BLOCKING_ARRIVED, )
|
|
||||||
self.connection.send(iq)
|
|
||||||
|
|
||||||
if self.continue_connect_info and self.continue_connect_info[0]\
|
|
||||||
== 'invisible':
|
|
||||||
# Trying to login as invisible but privacy list not
|
|
||||||
# supported
|
|
||||||
self.disconnect(on_purpose=True)
|
|
||||||
gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
|
|
||||||
show='offline'))
|
|
||||||
gajim.nec.push_incoming_event(InformationEvent(None,
|
|
||||||
conn=self, level='error', pri_txt=_('Invisibility not '
|
|
||||||
'supported'), sec_txt=_('Account %s doesn\'t support '
|
|
||||||
'invisibility.') % self.name))
|
|
||||||
return
|
|
||||||
# Ask metacontacts before roster
|
|
||||||
self.get_metacontacts()
|
|
||||||
elif self.awaiting_answers[id_][0] == BLOCKING_ARRIVED:
|
elif self.awaiting_answers[id_][0] == BLOCKING_ARRIVED:
|
||||||
del self.awaiting_answers[id_]
|
del self.awaiting_answers[id_]
|
||||||
if iq_obj.getType() == 'result':
|
if iq_obj.getType() == 'result':
|
||||||
|
|
Loading…
Add table
Reference in a new issue