aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0048_bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/xep/0048_bookmarks')
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/conference.vala13
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/module.vala16
2 files changed, 15 insertions, 14 deletions
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
index 6964f83d..e5037e42 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.Bookmarks {
public class Conference : Object {
@@ -21,9 +19,10 @@ public class Conference : Object {
set { stanza_node.set_attribute(ATTRIBUTE_AUTOJOIN, value.to_string()); }
}
- public string jid {
- get { return stanza_node.get_attribute(ATTRIBUTE_JID); }
- set { stanza_node.set_attribute(ATTRIBUTE_JID, value); }
+ private Jid jid_;
+ public Jid jid {
+ get { return jid_ ?? (jid_ = Jid.parse(stanza_node.get_attribute(ATTRIBUTE_JID))); }
+ set { stanza_node.set_attribute(ATTRIBUTE_JID, value.to_string()); }
}
public string? name {
@@ -73,7 +72,7 @@ public class Conference : Object {
}
}
- public Conference(string jid) {
+ public Conference(Jid jid) {
this.stanza_node = new StanzaNode.build("conference", NS_URI);
this.jid = jid;
}
@@ -90,4 +89,4 @@ public class Conference : Object {
}
}
-} \ No newline at end of file
+}
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
index 6b354c57..2c16f5f0 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Bookmarks {
private const string NS_URI = "storage:bookmarks";
@@ -10,12 +8,16 @@ public class Module : XmppStreamModule {
public signal void received_conferences(XmppStream stream, Gee.List<Conference> conferences);
- public delegate void OnResult(XmppStream stream, Gee.List<Conference> conferences);
+ public delegate void OnResult(XmppStream stream, Gee.List<Conference>? conferences);
public void get_conferences(XmppStream stream, owned OnResult listener) {
StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns();
stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node, (stream, node) => {
- Gee.List<Conference> conferences = get_conferences_from_stanza(node);
- listener(stream, conferences);
+ if (node == null) {
+ listener(stream, null);
+ } else {
+ Gee.List<Conference> conferences = get_conferences_from_stanza(node);
+ listener(stream, conferences);
+ }
});
}
@@ -39,7 +41,7 @@ public class Module : XmppStreamModule {
public void replace_conference(XmppStream stream, Conference orig_conference, Conference modified_conference) {
get_conferences(stream, (stream, conferences) => {
foreach (Conference conference in conferences) {
- if (conference.autojoin == orig_conference.autojoin && conference.jid == orig_conference.jid &&
+ if (conference.autojoin == orig_conference.autojoin && conference.jid.equals(orig_conference.jid) &&
conference.name == orig_conference.name && conference.nick == orig_conference.nick) {
conference.autojoin = modified_conference.autojoin;
conference.jid = modified_conference.jid;
@@ -56,7 +58,7 @@ public class Module : XmppStreamModule {
get_conferences(stream, (stream, conferences) => {
Conference? rem = null;
foreach (Conference conference in conferences) {
- if (conference.name == conference_remove.name && conference.jid == conference_remove.jid && conference.autojoin == conference_remove.autojoin) {
+ if (conference.name == conference_remove.name && conference.jid.equals(conference_remove.jid) && conference.autojoin == conference_remove.autojoin) {
rem = conference;
break;
}