Use startswith() instead of string slicing to check for prefixes or suffixes.
It's cleaner and less error prone, so simply use it everywhere.
This commit is contained in:
parent
f877fbea13
commit
92b596a698
|
@ -428,7 +428,7 @@ class ConnectionBytestream:
|
||||||
if real_id == self.awaiting_xmpp_ping_id:
|
if real_id == self.awaiting_xmpp_ping_id:
|
||||||
self.awaiting_xmpp_ping_id = None
|
self.awaiting_xmpp_ping_id = None
|
||||||
return
|
return
|
||||||
if real_id[:3] != 'au_':
|
if not real_id.startswith('au_'):
|
||||||
return
|
return
|
||||||
frm = helpers.get_full_jid_from_iq(iq_obj)
|
frm = helpers.get_full_jid_from_iq(iq_obj)
|
||||||
id = real_id[3:]
|
id = real_id[3:]
|
||||||
|
|
|
@ -454,7 +454,7 @@ class ConnectionBytestream:
|
||||||
# if we want to respect jep-0065 we have to check for proxy
|
# if we want to respect jep-0065 we have to check for proxy
|
||||||
# activation result in any result iq
|
# activation result in any result iq
|
||||||
real_id = unicode(iq_obj.getAttr('id'))
|
real_id = unicode(iq_obj.getAttr('id'))
|
||||||
if real_id[:3] != 'au_':
|
if not real_id.startswith('au_'):
|
||||||
return
|
return
|
||||||
frm = unicode(iq_obj.getFrom())
|
frm = unicode(iq_obj.getFrom())
|
||||||
id = real_id[3:]
|
id = real_id[3:]
|
||||||
|
|
Loading…
Reference in New Issue