aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-04-17 22:46:12 +0200
committerfiaxh <git@mx.ax.lt>2017-04-17 22:48:43 +0200
commitc6ff3387fa7b23678bbfe644c9e1b668ac92a731 (patch)
treeb94ff5fb03bff01a0f204883bdcf827f528f7567 /xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
parent653c361420d658097a4affeb8bf256f02cc9bb2a (diff)
downloaddino-c6ff3387fa7b23678bbfe644c9e1b668ac92a731.tar.gz
dino-c6ff3387fa7b23678bbfe644c9e1b668ac92a731.zip
Handle conference bookmarks w/o nick
Diffstat (limited to 'xmpp-vala/src/module/xep/0048_bookmarks/conference.vala')
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/conference.vala20
1 files changed, 16 insertions, 4 deletions
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
index e0988041..21072c3f 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
@@ -38,10 +38,15 @@ public class Conference : Object {
}
set {
StanzaNode? nick_node = stanza_node.get_subnode(NODE_NICK);
+ if (value == null) {
+ if (nick_node != null) stanza_node.sub_nodes.remove(nick_node);
+ return;
+ }
if (nick_node == null) {
nick_node = new StanzaNode.build(NODE_NICK, NS_URI);
stanza_node.put_node(nick_node);
}
+ nick_node.sub_nodes.clear();
nick_node.put_node(new StanzaNode.text(value));
}
}
@@ -61,14 +66,21 @@ public class Conference : Object {
}
}
- public Conference.from_stanza_node(StanzaNode stanza_node) {
- this.stanza_node = stanza_node;
- }
-
public Conference(string jid) {
this.stanza_node = new StanzaNode.build("conference", NS_URI);
this.jid = jid;
}
+
+ public static Conference? create_from_stanza_node(StanzaNode stanza_node) {
+ if (stanza_node.get_attribute(ATTRIBUTE_JID) != null) {
+ return new Conference.from_stanza_node(stanza_node);
+ }
+ return null;
+ }
+
+ private Conference.from_stanza_node(StanzaNode stanza_node) {
+ this.stanza_node = stanza_node;
+ }
}
} \ No newline at end of file