aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0060_pubsub.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-06-10 19:53:56 +0200
committerfiaxh <git@lightrise.org>2020-06-10 19:53:56 +0200
commit50c55c7f55aff6622d242bdcf2b58d5f7956f28e (patch)
treeb8c26336bb3003defafe987980c17fd2fdc07bd4 /xmpp-vala/src/module/xep/0060_pubsub.vala
parentdaf803e7730555639517de18c89da42e73557679 (diff)
downloaddino-50c55c7f55aff6622d242bdcf2b58d5f7956f28e.tar.gz
dino-50c55c7f55aff6622d242bdcf2b58d5f7956f28e.zip
Fetch avatars only when they are used
Diffstat (limited to 'xmpp-vala/src/module/xep/0060_pubsub.vala')
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala20
1 files changed, 8 insertions, 12 deletions
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index 9e5d8651..c8472576 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -1,7 +1,7 @@
using Gee;
namespace Xmpp.Xep.Pubsub {
- private const string NS_URI = "http://jabber.org/protocol/pubsub";
+ public const string NS_URI = "http://jabber.org/protocol/pubsub";
private const string NS_URI_EVENT = NS_URI + "#event";
private const string NS_URI_OWNER = NS_URI + "#owner";
@@ -39,18 +39,14 @@ namespace Xmpp.Xep.Pubsub {
Iq.Stanza request_iq = new Iq.Stanza.get(new StanzaNode.build("pubsub", NS_URI).add_self_xmlns().put_node(new StanzaNode.build("items", NS_URI).put_attribute("node", node)));
request_iq.to = jid;
- Gee.List<StanzaNode>? ret = null;
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, request_iq, (stream, iq) => {
- StanzaNode event_node = iq.stanza.get_subnode("pubsub", NS_URI);
- if (event_node == null) return;
- StanzaNode items_node = event_node.get_subnode("items", NS_URI);
- if (items_node == null) return;
- ret = items_node.get_subnodes("item", NS_URI);
- Idle.add(request_all.callback);
- });
- yield;
+ Iq.Stanza iq_res = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, request_iq);
+
+ StanzaNode event_node = iq_res.stanza.get_subnode("pubsub", NS_URI);
+ if (event_node == null) return null;
+ StanzaNode items_node = event_node.get_subnode("items", NS_URI);
+ if (items_node == null) return null;
- return ret;
+ return items_node.get_subnodes("item", NS_URI);
}
public delegate void OnResult(XmppStream stream, Jid jid, string? id, StanzaNode? node);