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
S
slixmpp-omemo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
poezio
slixmpp-omemo
Commits
e6ce39bc
Verified
Commit
e6ce39bc
authored
Sep 02, 2019
by
Maxime Buquet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Echo_bot: Add documentation for expect_problems
Signed-off-by:
Maxime “pep” Buquet
<
pep@bouah.net
>
parent
153edfb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
examples/echo_client.py
examples/echo_client.py
+12
-1
No files found.
examples/echo_client.py
View file @
e6ce39bc
...
...
@@ -173,7 +173,7 @@ class EchoBot(ClientXMPP):
# `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
#
`expect_problems`: See EncryptionPrepareException handling.
recipients
=
[
mto
]
encrypt
=
await
self
[
'xep_0384'
].
encrypt_message
(
body
,
recipients
,
expect_problems
)
msg
.
append
(
encrypt
)
...
...
@@ -186,9 +186,20 @@ class EchoBot(ClientXMPP):
self
[
'xep_0384'
].
trust
(
exn
.
bare_jid
,
exn
.
device
,
exn
.
ik
)
# TODO: catch NoEligibleDevicesException
except
EncryptionPrepareException
as
exn
:
# This exception is being raised when the library has tried
# all it could and doesn't know what to do anymore. It
# contains a list of exceptions that the user must resolve, or
# explicitely ignore via `expect_problems`.
# TODO: We might need to bail out here if errors are the same?
for
error
in
exn
.
errors
:
if
isinstance
(
error
,
MissingBundleException
):
# We choose to ignore MissingBundleException. It seems
# to be somewhat accepted that it's better not to
# encrypt for a device if it has problems and encrypt
# for the rest, rather than error out. The "faulty"
# device won't be able to decrypt and should display a
# generic message. The receiving end-user at this
# point can bring up the issue if it happens.
self
.
plain_reply
(
original_msg
,
'Could not find keys for device "%d" of recipient "%s". Skipping.'
%
...
...
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