Ignore roster updates with unrecognized subscription values.
This commit is contained in:
parent
bc8b5774ac
commit
3bd84b8d27
1 changed files with 10 additions and 8 deletions
|
@ -287,12 +287,14 @@ class ClientXMPP(BaseXMPP):
|
||||||
if iq['roster']['ver']:
|
if iq['roster']['ver']:
|
||||||
roster.version = iq['roster']['ver']
|
roster.version = iq['roster']['ver']
|
||||||
items = iq['roster']['items']
|
items = iq['roster']['items']
|
||||||
for jid in items:
|
|
||||||
item = items[jid]
|
valid_subscriptions = ('to', 'from', 'both', 'none', 'remove')
|
||||||
|
for jid, item in items.items():
|
||||||
|
if item['subscription'] in valid_subscriptions:
|
||||||
roster[jid]['name'] = item['name']
|
roster[jid]['name'] = item['name']
|
||||||
roster[jid]['groups'] = item['groups']
|
roster[jid]['groups'] = item['groups']
|
||||||
roster[jid]['from'] = item['subscription'] in ['from', 'both']
|
roster[jid]['from'] = item['subscription'] in ('from', 'both')
|
||||||
roster[jid]['to'] = item['subscription'] in ['to', 'both']
|
roster[jid]['to'] = item['subscription'] in ('to', 'both')
|
||||||
roster[jid]['pending_out'] = (item['ask'] == 'subscribe')
|
roster[jid]['pending_out'] = (item['ask'] == 'subscribe')
|
||||||
|
|
||||||
roster[jid].save(remove=(item['subscription'] == 'remove'))
|
roster[jid].save(remove=(item['subscription'] == 'remove'))
|
||||||
|
|
Loading…
Reference in a new issue