diff options
Diffstat (limited to 'xmpp-vala/src')
-rw-r--r-- | xmpp-vala/src/module/xep/0048_bookmarks/conference.vala | 9 | ||||
-rw-r--r-- | xmpp-vala/src/module/xep/0048_bookmarks/module.vala | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala index 21072c3f..6964f83d 100644 --- a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala +++ b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala @@ -28,7 +28,10 @@ public class Conference : Object { public string? name { get { return stanza_node.get_attribute(ATTRIBUTE_NAME); } - set { stanza_node.set_attribute(ATTRIBUTE_NAME, value); } + set { + if (value == null) return; // TODO actually remove + stanza_node.set_attribute(ATTRIBUTE_NAME, value); + } } public string? nick { @@ -58,6 +61,10 @@ public class Conference : Object { } set { StanzaNode? password_node = stanza_node.get_subnode(NODE_PASSWORD); + if (value == null) { + if (password_node != null) stanza_node.sub_nodes.remove(password_node); + return; + } if (password_node == null) { password_node = new StanzaNode.build(NODE_PASSWORD); stanza_node.put_node(password_node); diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala index 0e0d9489..bf5bd612 100644 --- a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala +++ b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala @@ -8,25 +8,27 @@ private const string NS_URI = "storage:bookmarks"; public class Module : XmppStreamModule { public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0048_bookmarks_module"); - public signal void conferences_updated(XmppStream stream, ArrayList<Conference> conferences); + public signal void received_conferences(XmppStream stream, Gee.List<Conference> conferences); - [CCode (has_target = false)] public delegate void OnResult(XmppStream stream, ArrayList<Conference> conferences, Object? reference); + [CCode (has_target = false)] public delegate void OnResult(XmppStream stream, Gee.List<Conference> conferences, Object? storage); public void get_conferences(XmppStream stream, OnResult listener, Object? store) { StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns(); stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node, (stream, node, o) => { Tuple<OnResult, Object?> tuple = o as Tuple<OnResult, Object?>; OnResult on_result = tuple.a; - on_result(stream, get_conferences_from_stanza(node), tuple.b); + Gee.List<Conference> conferences = get_conferences_from_stanza(node); + stream.get_module(Module.IDENTITY).received_conferences(stream, conferences); + on_result(stream, conferences, tuple.b); }, Tuple.create(listener, store)); } - public void set_conferences(XmppStream stream, ArrayList<Conference> conferences) { + public void set_conferences(XmppStream stream, Gee.List<Conference> conferences) { StanzaNode storage_node = (new StanzaNode.build("storage", NS_URI)).add_self_xmlns(); foreach (Conference conference in conferences) { storage_node.put_node(conference.stanza_node); } stream.get_module(PrivateXmlStorage.Module.IDENTITY).store(stream, storage_node, (stream, o) => { - stream.get_module(Module.IDENTITY).conferences_updated(stream, o as ArrayList<Conference>); + stream.get_module(Module.IDENTITY).received_conferences(stream, o as ArrayList<Conference>); }, conferences); } |