Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Erik Huelsmann
gajim
Commits
22b33885
Commit
22b33885
authored
May 18, 2019
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move roster methods into Roster module
parent
f601ca0d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
24 deletions
+31
-24
gajim/common/connection.py
gajim/common/connection.py
+0
-11
gajim/common/modules/roster.py
gajim/common/modules/roster.py
+11
-0
gajim/dialogs.py
gajim/dialogs.py
+6
-4
gajim/roster_window.py
gajim/roster_window.py
+14
-9
No files found.
gajim/common/connection.py
View file @
22b33885
...
...
@@ -355,17 +355,6 @@ class CommonConnection:
additional_data
=
obj
.
additional_data
,
stanza_id
=
obj
.
stanza_id
)
def
update_contact
(
self
,
jid
,
name
,
groups
):
if
self
.
connection
:
self
.
getRoster
().
set_item
(
jid
=
jid
,
name
=
name
,
groups
=
groups
)
def
update_contacts
(
self
,
contacts
):
"""
Update multiple roster items
"""
if
self
.
connection
:
self
.
getRoster
().
set_item_multi
(
contacts
)
def
new_account
(
self
,
name
,
config
,
sync
=
False
):
"""
To be implemented by derived classes
...
...
gajim/common/modules/roster.py
View file @
22b33885
...
...
@@ -270,6 +270,17 @@ class Roster(BaseModule):
"""
return
self
.
_get_item_data
(
jid
,
'name'
)
def
update_contact
(
self
,
jid
,
name
,
groups
):
if
app
.
account_is_connected
(
self
.
_account
):
self
.
set_item
(
jid
=
jid
,
name
=
name
,
groups
=
groups
)
def
update_contacts
(
self
,
contacts
):
"""
Update multiple roster items
"""
if
app
.
account_is_connected
(
self
.
_account
):
self
.
set_item_multi
(
contacts
)
def
set_item
(
self
,
jid
,
name
=
None
,
groups
=
None
):
"""
Rename contact 'jid' and sets the groups list that it now belongs to
...
...
gajim/dialogs.py
View file @
22b33885
...
...
@@ -97,8 +97,9 @@ class EditGroupsDialog:
self
.
dialog
.
show_all
()
if
self
.
changes_made
:
for
(
contact
,
account
)
in
self
.
list_
:
app
.
connections
[
account
].
update_contact
(
contact
.
jid
,
contact
.
name
,
contact
.
groups
)
con
=
app
.
connections
[
account
]
con
.
get_module
(
'Roster'
).
update_contact
(
contact
.
jid
,
contact
.
name
,
contact
.
groups
)
def
on_edit_groups_dialog_response
(
self
,
widget
,
response_id
):
if
response_id
==
Gtk
.
ResponseType
.
CLOSE
:
...
...
@@ -1066,8 +1067,9 @@ class RosterItemExchangeWindow:
groups
=
[]
for
u
in
app
.
contacts
.
get_contact
(
self
.
account
,
jid
):
u
.
name
=
model
[
iter_
][
2
]
app
.
connections
[
self
.
account
].
update_contact
(
jid
,
model
[
iter_
][
2
],
groups
)
con
=
app
.
connections
[
self
.
account
]
con
.
get_module
(
'Roster'
).
update_contact
(
jid
,
model
[
iter_
][
2
],
groups
)
self
.
draw_contact
(
jid
,
self
.
account
)
# Update opened chat
ctrl
=
app
.
interface
.
msg_win_mgr
.
get_control
(
jid
,
self
.
account
)
...
...
gajim/roster_window.py
View file @
22b33885
...
...
@@ -898,7 +898,8 @@ class RosterWindow:
changed_contacts
.
append
({
'jid'
:
jid
,
'name'
:
contact
.
name
,
'groups'
:
contact
.
groups
})
app
.
connections
[
acc
].
update_contacts
(
changed_contacts
)
app
.
connections
[
acc
].
get_module
(
'Roster'
).
update_contacts
(
changed_contacts
)
for
c
in
changed_contacts
:
self
.
add_contact
(
c
[
'jid'
],
acc
)
...
...
@@ -929,8 +930,9 @@ class RosterWindow:
# we might be dropped from meta to group
contact
.
groups
.
append
(
group
)
if
update
:
app
.
connections
[
account
].
update_contact
(
jid
,
contact
.
name
,
contact
.
groups
)
con
=
app
.
connections
[
account
]
con
.
get_module
(
'Roster'
).
update_contact
(
jid
,
contact
.
name
,
contact
.
groups
)
self
.
add_contact
(
jid
,
account
)
...
...
@@ -957,8 +959,9 @@ class RosterWindow:
# Needed when we remove from "General" or "Observers"
contact
.
groups
.
remove
(
group
)
if
update
:
app
.
connections
[
account
].
update_contact
(
jid
,
contact
.
name
,
contact
.
groups
)
con
=
app
.
connections
[
account
]
con
.
get_module
(
'Roster'
).
update_contact
(
jid
,
contact
.
name
,
contact
.
groups
)
self
.
add_contact
(
jid
,
account
)
# Also redraw old groups
...
...
@@ -2890,8 +2893,9 @@ class RosterWindow:
contacts
=
app
.
contacts
.
get_contacts
(
account
,
jid
)
for
contact
in
contacts
:
contact
.
name
=
new_text
app
.
connections
[
account
].
update_contact
(
jid
,
new_text
,
\
contacts
[
0
].
groups
)
con
=
app
.
connections
[
account
]
con
.
get_module
(
'Roster'
).
update_contact
(
jid
,
new_text
,
contacts
[
0
].
groups
)
self
.
draw_contact
(
jid
,
account
)
# Update opened chats
for
ctrl
in
app
.
interface
.
msg_win_mgr
.
get_controls
(
jid
,
...
...
@@ -4075,8 +4079,9 @@ class RosterWindow:
_contact
.
groups
=
c_dest
.
groups
[:]
app
.
contacts
.
add_metacontact
(
account_dest
,
c_dest
.
jid
,
_account
,
_contact
.
jid
,
contacts
)
app
.
connections
[
account_source
].
update_contact
(
_contact
.
jid
,
_contact
.
name
,
_contact
.
groups
)
con
=
app
.
connections
[
account_source
]
con
.
get_module
(
'Roster'
).
update_contact
(
_contact
.
jid
,
_contact
.
name
,
_contact
.
groups
)
# Re-add all and update GUI
new_family
=
app
.
contacts
.
get_metacontacts_family
(
account_source
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment