Filter duplicate groups centrally.
This commit is contained in:
parent
cec93b6135
commit
d5ac527f84
|
@ -99,7 +99,7 @@ class Contact(CommonContact):
|
||||||
our_chatstate, composing_xep, chatstate, client_caps=client_caps)
|
our_chatstate, composing_xep, chatstate, client_caps=client_caps)
|
||||||
|
|
||||||
self.contact_name = '' # nick choosen by contact
|
self.contact_name = '' # nick choosen by contact
|
||||||
self.groups = groups
|
self.groups = [i for i in set(groups)] # filter duplicate values
|
||||||
|
|
||||||
self.sub = sub
|
self.sub = sub
|
||||||
self.ask = ask
|
self.ask = ask
|
||||||
|
@ -236,13 +236,7 @@ class Contacts:
|
||||||
our_chatstate=None, chatstate=None, last_status_time=None,
|
our_chatstate=None, chatstate=None, last_status_time=None,
|
||||||
composing_xep=None, mood={}, tune={}, activity={}):
|
composing_xep=None, mood={}, tune={}, activity={}):
|
||||||
|
|
||||||
# We don't want duplicated group values
|
return Contact(jid=jid, account=account, name=name, groups=groups,
|
||||||
groups_unique = []
|
|
||||||
for group in groups:
|
|
||||||
if group not in groups_unique:
|
|
||||||
groups_unique.append(group)
|
|
||||||
|
|
||||||
return Contact(jid=jid, account=account, name=name, groups=groups_unique,
|
|
||||||
show=show, status=status, sub=sub, ask=ask, resource=resource, priority=priority,
|
show=show, status=status, sub=sub, ask=ask, resource=resource, priority=priority,
|
||||||
keyID=keyID, client_caps=client_caps, our_chatstate=our_chatstate,
|
keyID=keyID, client_caps=client_caps, our_chatstate=our_chatstate,
|
||||||
chatstate=chatstate, last_status_time=last_status_time,
|
chatstate=chatstate, last_status_time=last_status_time,
|
||||||
|
|
Loading…
Reference in New Issue