Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
196
Issues
196
List
Boards
Labels
Service Desk
Milestones
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim
Commits
f907ada8
Commit
f907ada8
authored
Jun 21, 2019
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor around VCard events
parent
878f0458
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
42 deletions
+24
-42
gajim/common/modules/muc.py
gajim/common/modules/muc.py
+10
-1
gajim/common/modules/vcard_temp.py
gajim/common/modules/vcard_temp.py
+7
-19
gajim/groupchat_control.py
gajim/groupchat_control.py
+0
-7
gajim/gtk/profile.py
gajim/gtk/profile.py
+5
-6
gajim/remote_control.py
gajim/remote_control.py
+1
-1
gajim/roster_window.py
gajim/roster_window.py
+1
-8
No files found.
gajim/common/modules/muc.py
View file @
f907ada8
...
...
@@ -128,6 +128,9 @@ def _set_muc_state(self, room_jid, state):
def
_get_muc_state
(
self
,
room_jid
):
return
self
.
_muc_data
[
room_jid
].
state
def
get_mucs_with_state
(
self
,
states
):
return
[
muc
for
muc
in
self
.
_muc_data
.
values
()
if
muc
.
state
in
states
]
def
join
(
self
,
room_jid
,
nick
,
password
,
rejoin
=
False
):
if
not
app
.
account_is_connected
(
self
.
_account
):
return
...
...
@@ -165,7 +168,13 @@ def leave(self, room_jid):
'%s/%s'
%
(
room_jid
,
muc
.
nick
),
typ
=
'unavailable'
)
def
send_muc_presence
(
self
,
room_jid
,
auto
=
False
):
def
update_presence
(
self
,
auto
=
False
):
mucs
=
self
.
get_mucs_with_state
([
MUCJoinedState
.
JOINED
,
MUCJoinedState
.
JOINING
])
for
muc
in
mucs
:
self
.
_send_presence
(
muc
.
jid
,
auto
)
def
_send_presence
(
self
,
room_jid
,
auto
):
show
=
app
.
SHOW_LIST
[
self
.
_con
.
connected
]
if
show
in
(
'invisible'
,
'offline'
):
# FIXME: Check if this
...
...
gajim/common/modules/vcard_temp.py
View file @
f907ada8
...
...
@@ -23,7 +23,6 @@
from
gajim.common
import
app
from
gajim.common.const
import
RequestAvatar
from
gajim.common.nec
import
NetworkEvent
from
gajim.common.nec
import
NetworkIncomingEvent
from
gajim.common.modules.base
import
BaseModule
from
gajim.common.connection_handlers_events
import
InformationEvent
...
...
@@ -158,12 +157,13 @@ def _avatar_publish_result(self, _con, stanza, sha):
self
.
_con
.
get_module
(
'VCardAvatars'
).
send_avatar_presence
(
after_publish
=
True
)
self
.
_log
.
info
(
'%s: Published: %s'
,
self
.
_account
,
sha
)
self
.
_con
.
get_module
(
'MUC'
).
update_presence
()
app
.
nec
.
push_incoming_event
(
VcardPublishedEvent
(
None
,
conn
=
self
.
_con
))
NetworkEvent
(
'vcard-published'
,
account
=
self
.
_account
))
elif
stanza
.
getType
()
==
'error'
:
app
.
nec
.
push_incoming_event
(
VcardNotPublishedEvent
(
None
,
conn
=
self
.
_con
))
NetworkEvent
(
'vcard-not-published'
,
account
=
self
.
_account
))
def
_get_vcard_photo
(
self
,
vcard
,
jid
):
try
:
...
...
@@ -216,10 +216,10 @@ def _parse_vcard(self, _con, stanza, callback, expected_sha):
elif
'FN'
in
vcard
:
app
.
nicks
[
self
.
_account
]
=
vcard
[
'FN'
]
app
.
nec
.
push_incoming_event
(
VcardReceivedEvent
(
None
,
conn
=
self
.
_con
,
vcard_dict
=
vcar
d
,
jid
=
ji
d
))
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'vcard-received'
,
account
=
self
.
_account
,
jid
=
ji
d
,
vcard_dict
=
vcar
d
))
callback
(
jid
,
resource
,
room
,
vcard
,
expected_sha
)
...
...
@@ -309,17 +309,5 @@ def get_vard_name(self):
return
name
class
VcardPublishedEvent
(
NetworkIncomingEvent
):
name
=
'vcard-published'
class
VcardNotPublishedEvent
(
NetworkIncomingEvent
):
name
=
'vcard-not-published'
class
VcardReceivedEvent
(
NetworkIncomingEvent
):
name
=
'vcard-received'
def
get_instance
(
*
args
,
**
kwargs
):
return
VCardTemp
(
*
args
,
**
kwargs
),
'VCardTemp'
gajim/groupchat_control.py
View file @
f907ada8
...
...
@@ -328,7 +328,6 @@ def __init__(self, parent_win, contact, nick, acct, is_continued=False):
(
'muc-voice-approval'
,
ged
.
GUI1
,
self
.
_on_voice_approval
),
(
'gc-message-received'
,
ged
.
GUI1
,
self
.
_nec_gc_message_received
),
(
'mam-decrypted-message-received'
,
ged
.
GUI1
,
self
.
_nec_mam_decrypted_message_received
),
(
'vcard-published'
,
ged
.
GUI1
,
self
.
_nec_vcard_published
),
(
'update-gc-avatar'
,
ged
.
GUI1
,
self
.
_nec_update_avatar
),
(
'update-room-avatar'
,
ged
.
GUI1
,
self
.
_nec_update_room_avatar
),
(
'signed-in'
,
ged
.
GUI1
,
self
.
_nec_signed_in
),
...
...
@@ -1122,12 +1121,6 @@ def draw_banner_text(self):
subject_text
=
self
.
urlfinder
.
sub
(
self
.
make_href
,
subject
)
self
.
subject_button
.
get_popover
().
set_text
(
subject_text
)
def
_nec_vcard_published
(
self
,
obj
):
if
obj
.
conn
.
name
!=
self
.
account
:
return
obj
.
conn
.
get_module
(
'MUC'
).
send_muc_presence
(
self
.
room_jid
)
def
_nec_update_avatar
(
self
,
obj
):
if
obj
.
contact
.
room_jid
!=
self
.
room_jid
:
return
...
...
gajim/gtk/profile.py
View file @
f907ada8
...
...
@@ -29,6 +29,7 @@
from
gajim.common
import
ged
from
gajim.common.i18n
import
_
from
gajim.common.const
import
AvatarSize
from
gajim.common.helpers
import
event_filter
from
gajim
import
gtkgui_helpers
from
gajim.gui_menu_builder
import
show_save_as_menu
...
...
@@ -338,17 +339,15 @@ def on_ok_button_clicked(self, widget):
self
.
update_progressbar_timeout_id
=
GLib
.
timeout_add
(
100
,
self
.
update_progressbar
)
def
_nec_vcard_published
(
self
,
obj
):
if
obj
.
conn
.
name
!=
self
.
account
:
return
@
event_filter
([
'account'
])
def
_nec_vcard_published
(
self
,
_event
):
if
self
.
update_progressbar_timeout_id
is
not
None
:
GLib
.
source_remove
(
self
.
update_progressbar_timeout_id
)
self
.
update_progressbar_timeout_id
=
None
self
.
destroy
()
def
_nec_vcard_not_published
(
self
,
obj
):
if
obj
.
conn
.
name
!=
self
.
account
:
return
@
event_filter
([
'account'
])
def
_nec_vcard_not_published
(
self
,
_event
):
if
self
.
message_id
:
self
.
statusbar
.
remove
(
self
.
context_id
,
self
.
message_id
)
self
.
message_id
=
self
.
statusbar
.
push
(
...
...
gajim/remote_control.py
View file @
f907ada8
...
...
@@ -386,7 +386,7 @@ def on_account_created(self, obj):
self
.
raise_signal
(
'NewAccount'
,
(
obj
.
conn
.
name
,
obj
.
account_info
))
def
on_vcard_received
(
self
,
obj
):
self
.
raise_signal
(
'VcardInfo'
,
(
obj
.
conn
.
name
,
obj
.
vcard_dict
))
self
.
raise_signal
(
'VcardInfo'
,
(
obj
.
account
,
obj
.
vcard_dict
))
def
raise_signal
(
self
,
event_name
,
data
):
log
.
info
(
'Send event %s'
,
event_name
)
...
...
gajim/roster_window.py
View file @
f907ada8
...
...
@@ -2109,14 +2109,7 @@ def send_status_continue(self, account, status, txt, auto):
self
.
delete_pep
(
app
.
get_jid_from_account
(
account
),
account
)
was_invisible
=
app
.
is_invisible
(
account
)
app
.
connections
[
account
].
change_status
(
status
,
txt
,
auto
)
for
gc_control
in
app
.
interface
.
msg_win_mgr
.
get_controls
(
message_control
.
TYPE_GC
)
+
\
list
(
app
.
interface
.
minimized_controls
[
account
].
values
()):
if
gc_control
.
account
==
account
:
if
app
.
gc_connected
[
account
][
gc_control
.
room_jid
]:
app
.
connections
[
account
].
get_module
(
'MUC'
).
send_muc_presence
(
gc_control
.
room_jid
,
auto
=
auto
)
app
.
connections
[
account
].
get_module
(
'MUC'
).
update_presence
(
auto
)
if
was_invisible
and
status
!=
'offline'
:
# We come back from invisible, join bookmarks
con
=
app
.
connections
[
account
]
...
...
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