Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
ca8b5774
Commit
ca8b5774
authored
4 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
add get_groups()
parent
0e12f7f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/common/modules/roster.py
+16
-0
16 additions, 0 deletions
gajim/common/modules/roster.py
with
16 additions
and
0 deletions
gajim/common/modules/roster.py
+
16
−
0
View file @
ca8b5774
...
...
@@ -45,6 +45,9 @@ def __init__(self, con):
self
.
_roster
=
{}
# Groups cache for performance
self
.
_groups
=
None
def
load_roster
(
self
):
self
.
_log
.
info
(
'
Load from database
'
)
roster
=
app
.
storage
.
cache
.
load_roster
(
self
.
_account
)
...
...
@@ -105,6 +108,8 @@ def _on_request_roster(self, task):
def
_set_roster_from_data
(
self
,
items
):
self
.
_roster
.
clear
()
self
.
_groups
=
None
for
item
in
items
:
self
.
_log
.
info
(
item
)
self
.
_con
.
get_module
(
'
Contacts
'
).
add_contact
(
item
.
jid
)
...
...
@@ -121,6 +126,7 @@ def _process_roster_push(self, _con, _stanza, properties):
else
:
self
.
_roster
[
item
.
jid
]
=
item
self
.
_groups
=
None
self
.
_store_roster
()
self
.
_log
.
info
(
'
New version: %s
'
,
properties
.
roster
.
version
)
...
...
@@ -143,6 +149,16 @@ def set_groups(self, jid, groups):
item
=
self
.
get_item
(
jid
)
self
.
_nbxmpp
(
'
Roster
'
).
set_item
(
jid
,
item
.
name
,
groups
)
def
get_groups
(
self
):
if
self
.
_groups
is
not
None
:
return
set
(
self
.
_groups
)
groups
=
set
()
for
item
in
self
.
_roster
.
values
():
groups
.
update
(
item
.
groups
)
self
.
_groups
=
groups
return
set
(
groups
)
def
change_group
(
self
,
jid
,
old_group
,
new_group
):
item
=
self
.
get_item
(
jid
)
groups
=
set
(
item
.
groups
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment