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
P
poezio-omemo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Link Mauve
poezio-omemo
Commits
6adbf64a
Verified
Commit
6adbf64a
authored
Dec 31, 2019
by
Maxime Buquet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MUC support
Signed-off-by:
Maxime “pep” Buquet
<
pep@bouah.net
>
parent
05310c10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
poezio_plugins/omemo/__init__.py
poezio_plugins/omemo/__init__.py
+18
-11
No files found.
poezio_plugins/omemo/__init__.py
View file @
6adbf64a
...
...
@@ -17,7 +17,7 @@ from typing import Dict, List, Optional
from
poezio.plugin_e2ee
import
E2EEPlugin
from
poezio.xdg
import
DATA_HOME
from
poezio.tabs
import
DynamicConversationTab
,
StaticConversationTab
,
MucTab
from
poezio.tabs
import
ChatTab
,
DynamicConversationTab
,
StaticConversationTab
,
MucTab
from
omemo.exceptions
import
MissingBundleException
from
slixmpp
import
JID
...
...
@@ -94,15 +94,18 @@ class Plugin(E2EEPlugin):
if
trust
is
not
None
]
def
decrypt
(
self
,
message
:
Message
,
tab
)
->
None
:
def
decrypt
(
self
,
message
:
Message
,
jid
:
Optional
[
JID
],
tab
:
ChatTab
)
->
None
:
if
jid
is
None
:
self
.
display_error
(
'Unable to decrypt the message.'
)
return
None
body
=
None
try
:
mfrom
=
message
[
'from'
]
encrypted
=
message
[
'omemo_encrypted'
]
body
=
self
.
core
.
xmpp
[
'xep_0384'
].
decrypt_message
(
encrypted
,
mfrom
,
jid
,
# Always decrypt. Let us handle how we then warn the user.
allow_untrusted
=
True
,
)
...
...
@@ -136,8 +139,11 @@ class Plugin(E2EEPlugin):
if
body
is
not
None
:
message
[
'body'
]
=
body
async
def
encrypt
(
self
,
message
:
Message
,
_tab
)
->
None
:
mto
=
message
[
'to'
]
async
def
encrypt
(
self
,
message
:
Message
,
jids
:
Optional
[
List
[
JID
]],
_tab
)
->
None
:
if
jids
is
None
:
self
.
display_error
(
'Unable to encrypt the message.'
)
return
None
body
=
message
[
'body'
]
expect_problems
=
{}
# type: Optional[Dict[JID, List[int]]]
...
...
@@ -151,11 +157,12 @@ class Plugin(E2EEPlugin):
# and not a full Message stanza. This combined with the
# `recipients` parameter that requires for a list of JIDs,
# allows you to encrypt for 1:1 as well as groupchats (MUC).
#
# TODO: Document expect_problems
# TODO: Handle multiple recipients (MUCs)
recipients
=
[
mto
]
encrypt
=
await
self
.
core
.
xmpp
[
'xep_0384'
].
encrypt_message
(
body
,
recipients
,
expect_problems
)
recipients
=
jids
encrypt
=
await
self
.
core
.
xmpp
[
'xep_0384'
].
encrypt_message
(
body
,
recipients
,
expect_problems
,
)
message
.
append
(
encrypt
)
return
None
except
UndecidedException
as
exn
:
...
...
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