Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
4a04c5aa
Commit
4a04c5aa
authored
2 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
chore: Misc: Add type annotations
parent
6feac48c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/common/modules/misc.py
+15
-7
15 additions, 7 deletions
gajim/common/modules/misc.py
with
15 additions
and
7 deletions
gajim/common/modules/misc.py
+
15
−
7
View file @
4a04c5aa
...
...
@@ -14,19 +14,25 @@
# All XEPs that don’t need their own module
from
typing
import
Optional
import
logging
from
nbxmpp.structs
import
MessageProperties
from
gajim.common.helpers
import
AdditionalDataDict
from
gajim.common.i18n
import
get_rfc5646_lang
log
=
logging
.
getLogger
(
'
gajim.c.m.misc
'
)
# XEP-0066: Out of Band Data
def
parse_oob
(
properties
,
additional_data
):
def
parse_oob
(
properties
:
MessageProperties
,
additional_data
:
AdditionalDataDict
)
->
None
:
if
not
properties
.
is_oob
:
return
assert
properties
.
oob
is
not
None
additional_data
.
set_value
(
'
gajim
'
,
'
oob_url
'
,
properties
.
oob
.
url
)
if
properties
.
oob
.
desc
is
not
None
:
additional_data
.
set_value
(
'
gajim
'
,
'
oob_desc
'
,
...
...
@@ -34,18 +40,20 @@ def parse_oob(properties, additional_data):
# XEP-0308: Last Message Correction
def
parse_correction
(
properties
):
def
parse_correction
(
properties
:
MessageProperties
)
->
Optional
[
str
]:
if
not
properties
.
is_correction
:
return
None
assert
properties
.
correction
is
not
None
return
properties
.
correction
.
id
# XEP-0071: XHTML-IM
def
parse_xhtml
(
properties
,
additional_data
):
def
parse_xhtml
(
properties
:
MessageProperties
,
additional_data
:
AdditionalDataDict
)
->
None
:
if
not
properties
.
has_xhtml
:
return
assert
properties
.
xhtml
is
not
None
body
=
properties
.
xhtml
.
get_body
(
get_rfc5646_lang
())
additional_data
.
set_value
(
'
gajim
'
,
'
xhtml
'
,
body
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment