Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Malte L
gajim-plugins
Commits
a10ffe4b
Commit
a10ffe4b
authored
May 07, 2017
by
Philipp Hörist
Browse files
[httpupload] Use new encryption API
parent
de369fc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
httpupload/httpupload.py
View file @
a10ffe4b
...
...
@@ -155,7 +155,7 @@ class Base(object):
self
.
controls
[
jid
]
=
button
id_
=
button
.
connect
(
'clicked'
,
self
.
on_file_button_clicked
,
jid
,
chat_control
)
'clicked'
,
self
.
on_file_button_clicked
,
chat_control
)
chat_control
.
handlers
[
id_
]
=
button
self
.
set_button_state
(
self
.
enabled
,
button
)
button
.
show
()
...
...
@@ -174,17 +174,12 @@ class Base(object):
for
jid
in
self
.
controls
:
self
.
set_button_state
(
state
,
self
.
controls
[
jid
])
def
encryption_activated
(
self
,
jid
):
for
plugin
in
gajim
.
plugin_manager
.
active_plugins
:
if
type
(
plugin
).
__name__
==
'OmemoPlugin'
:
state
=
plugin
.
get_omemo_state
(
self
.
account
)
encryption
=
state
.
encryption
.
is_active
(
jid
)
log
.
info
(
'Encryption is: %s'
,
bool
(
encryption
))
return
bool
(
encryption
)
log
.
info
(
'OMEMO not found, encryption disabled'
)
return
False
def
encryption_activated
(
self
,
chat_control
):
encrypted
=
chat_control
.
encryption
==
'OMEMO'
log
.
info
(
'Encryption is: %s'
,
encrypted
)
return
encrypted
def
on_file_dialog_ok
(
self
,
widget
,
jid
,
chat_control
):
def
on_file_dialog_ok
(
self
,
widget
,
chat_control
):
path
=
widget
.
get_filename
()
widget
.
destroy
()
...
...
@@ -205,7 +200,7 @@ class Base(object):
transient_for
=
chat_control
.
parent_win
.
window
)
return
encrypted
=
self
.
encryption_activated
(
jid
)
encrypted
=
self
.
encryption_activated
(
chat_control
)
if
encrypted
and
not
ENCRYPTION_AVAILABLE
:
ErrorDialog
(
_
(
'Error'
),
...
...
@@ -233,9 +228,9 @@ class Base(object):
progress
=
progress
,
event
=
event
)
self
.
request_slot
(
file
)
def
on_file_button_clicked
(
self
,
widget
,
jid
,
chat_control
):
def
on_file_button_clicked
(
self
,
widget
,
chat_control
):
FileChooserDialog
(
on_response_ok
=
lambda
widget
:
self
.
on_file_dialog_ok
(
widget
,
jid
,
on_response_ok
=
lambda
widget
:
self
.
on_file_dialog_ok
(
widget
,
chat_control
),
title_text
=
_
(
'Choose file to send'
),
action
=
Gtk
.
FileChooserAction
.
OPEN
,
...
...
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