diff options
author | Marvin W <git@larma.de> | 2019-12-22 04:10:53 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2019-12-23 16:58:53 +0100 |
commit | a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d (patch) | |
tree | cbb079649066c2001b6d6881137108e70eed9d3f /xmpp-vala/src/module/xep/0402_bookmarks2.vala | |
parent | 3218dc0211ac717230fe03fad82681a626d968b5 (diff) | |
download | dino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.tar.gz dino-a0a956ee0878d24bd06be7f5d75dc4ccd4e7901d.zip |
Properly check Jids everywhere
Diffstat (limited to 'xmpp-vala/src/module/xep/0402_bookmarks2.vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0402_bookmarks2.vala | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/xmpp-vala/src/module/xep/0402_bookmarks2.vala b/xmpp-vala/src/module/xep/0402_bookmarks2.vala index 15386398..50c52ac2 100644 --- a/xmpp-vala/src/module/xep/0402_bookmarks2.vala +++ b/xmpp-vala/src/module/xep/0402_bookmarks2.vala @@ -66,19 +66,28 @@ public class Module : BookmarksProvider, XmppStreamModule { } private void on_pupsub_retract(XmppStream stream, Jid jid, string id) { - Jid jid_parsed = Jid.parse(id); - Flag? flag = stream.get_flag(Flag.IDENTITY); - if (flag != null) { - flag.conferences.unset(jid_parsed); + try { + Jid jid_parsed = new Jid(id); + Flag? flag = stream.get_flag(Flag.IDENTITY); + if (flag != null) { + flag.conferences.unset(jid_parsed); + } + conference_removed(stream, jid_parsed); + } catch (InvalidJidError e) { + warning("Ignoring conference bookmark update with invalid Jid: %s", e.message); } - conference_removed(stream, jid_parsed); } private Conference? parse_item_node(StanzaNode conference_node, string id) { Conference conference = new Conference(); - Jid? jid_parsed = Jid.parse(id); - if (jid_parsed == null || jid_parsed.resourcepart != null) return null; - conference.jid = jid_parsed; + try { + Jid jid_parsed = new Jid(id); + if (jid_parsed.resourcepart != null) return null; + conference.jid = jid_parsed; + } catch (InvalidJidError e) { + warning("Ignoring conference bookmark update with invalid Jid: %s", e.message); + return null; + } if (conference_node.name != "conference" || conference_node.ns_uri != NS_URI) return null; |