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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
eta
gajim
Commits
7c7df9d4
Commit
7c7df9d4
authored
6 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Detect invalid user mood
Fixes #9546, #9547
parent
cf8eafff
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/user_mood.py
+11
-3
11 additions, 3 deletions
gajim/common/modules/user_mood.py
with
11 additions
and
3 deletions
gajim/common/modules/user_mood.py
+
11
−
3
View file @
7c7df9d4
...
...
@@ -67,6 +67,9 @@ class UserMood(AbstractPEPModule):
if
mood_tag
is
None
:
raise
StanzaMalformed
(
'
No mood node
'
)
if
not
mood_tag
.
getChildren
():
return
None
for
child
in
mood_tag
.
getChildren
():
name
=
child
.
getName
().
strip
()
if
name
==
'
text
'
:
...
...
@@ -74,15 +77,20 @@ class UserMood(AbstractPEPModule):
else
:
mood_dict
[
'
mood
'
]
=
name
return
mood_dict
or
None
if
'
mood
'
not
in
mood_dict
:
raise
StanzaMalformed
(
'
No mood value found
'
)
return
mood_dict
def
_build_node
(
self
,
data
:
Optional
[
Tuple
[
str
,
str
]])
->
nbxmpp
.
Node
:
item
=
nbxmpp
.
Node
(
'
mood
'
,
{
'
xmlns
'
:
nbxmpp
.
NS_MOOD
})
if
data
is
None
:
return
item
mood
,
text
=
data
if
mood
:
item
.
addChild
(
mood
)
if
not
mood
:
return
item
item
.
addChild
(
mood
)
if
text
:
item
.
addChild
(
'
text
'
,
payload
=
text
)
return
item
...
...
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