summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-05-24 22:19:30 +0200
committerMaxime Buquet <pep@bouah.net>2020-05-24 22:19:30 +0200
commitcf131af4a877d1c19ff93cd618b7d936847311d6 (patch)
tree4071bdc76ff78e25e4a249c3db7a197d3b9f2932
parent1e7a8b6e88e324baebe0a23e2eeaed9b015207c7 (diff)
parente840590c735070ee4300baa86adb583c3a111fc2 (diff)
downloadpoezio-cf131af4a877d1c19ff93cd618b7d936847311d6.tar.gz
poezio-cf131af4a877d1c19ff93cd618b7d936847311d6.tar.bz2
poezio-cf131af4a877d1c19ff93cd618b7d936847311d6.tar.xz
poezio-cf131af4a877d1c19ff93cd618b7d936847311d6.zip
Merge branch 'no-gaming' into 'master'
Checks whether the gaming payload is empty or not See merge request poezio/poezio!118
-rw-r--r--CHANGELOG6
-rw-r--r--poezio/core/handlers.py17
2 files changed, 18 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 59c6ae66..8c5484f6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,12 @@ https://dev.louiz.org/projects/poezio/roadmap
* Poezio 0.14 - dev
+* Poezio 0.13.1 - dev
+
+# Bug fixes
+
+- Contacts won’t be seen playing games or music when they actually stop doing
+ so.
* Poezio 0.13
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index 445d8b74..cad4d47e 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -557,7 +557,9 @@ class HandlerCore:
return
item = message['pubsub_event']['items']['item']
old_gaming = contact.gaming
- if item.xml.find('{urn:xmpp:gaming:0}game') is not None:
+ xml_node = item.xml.find('{urn:xmpp:gaming:0}game')
+ # list(xml_node) checks whether there are children or not.
+ if xml_node is not None and list(xml_node):
item = item['gaming']
# only name and server_address are used for now
contact.gaming = {
@@ -599,7 +601,9 @@ class HandlerCore:
roster.modified()
item = message['pubsub_event']['items']['item']
old_mood = contact.mood
- if item.xml.find('{http://jabber.org/protocol/mood}mood') is not None:
+ xml_node = item.xml.find('{http://jabber.org/protocol/mood}mood')
+ # list(xml_node) checks whether there are children or not.
+ if xml_node is not None and list(xml_node):
mood = item['mood']['value']
if mood:
mood = pep.MOODS.get(mood, mood)
@@ -637,8 +641,9 @@ class HandlerCore:
roster.modified()
item = message['pubsub_event']['items']['item']
old_activity = contact.activity
- if item.xml.find(
- '{http://jabber.org/protocol/activity}activity') is not None:
+ xml_node = item.xml.find('{http://jabber.org/protocol/activity}activity')
+ # list(xml_node) checks whether there are children or not.
+ if xml_node is not None and list(xml_node):
try:
activity = item['activity']['value']
except ValueError:
@@ -683,7 +688,9 @@ class HandlerCore:
roster.modified()
item = message['pubsub_event']['items']['item']
old_tune = contact.tune
- if item.xml.find('{http://jabber.org/protocol/tune}tune') is not None:
+ xml_node = item.xml.find('{http://jabber.org/protocol/tune}tune')
+ # list(xml_node) checks whether there are children or not.
+ if xml_node is not None and list(xml_node):
item = item['tune']
contact.tune = {
'artist': item['artist'],