diff options
author | fiaxh <git@mx.ax.lt> | 2017-06-13 18:14:59 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-06-13 20:12:40 +0200 |
commit | 7bbbb738fdb233f4ad91ffdd7d9247b28849d715 (patch) | |
tree | 649ac26e3feef6bae614442a7f3d6ee1057336e0 /xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala | |
parent | dabc2a8b1d2a7bf2019e5f913c736d80f11ceb53 (diff) | |
download | dino-7bbbb738fdb233f4ad91ffdd7d9247b28849d715.tar.gz dino-7bbbb738fdb233f4ad91ffdd7d9247b28849d715.zip |
Get rid of manual storage objects for delegates
Diffstat (limited to 'xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala index a3f0a704..6f19fb12 100644 --- a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala +++ b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala @@ -57,20 +57,20 @@ namespace Xmpp.Xep.EntityCapabilities { string ver_attribute = c_node.get_attribute("ver", NS_URI); ArrayList<string> capabilities = storage.get_features(ver_attribute); if (capabilities.size == 0) { - stream.get_module(ServiceDiscovery.Module.IDENTITY).request_info(stream, presence.from, on_received_info_response, Tuple.create(storage, ver_attribute)); + stream.get_module(ServiceDiscovery.Module.IDENTITY).request_info(stream, presence.from, (stream, query_result) => { + store_entity_result(stream, ver_attribute, query_result); + }); } else { stream.get_flag(ServiceDiscovery.Flag.IDENTITY).set_entity_features(presence.from, capabilities); } } } - private static void on_received_info_response(XmppStream stream, ServiceDiscovery.InfoResult? query_result, Object? store) { + private void store_entity_result(XmppStream stream, string entity, ServiceDiscovery.InfoResult? query_result) { if (query_result == null) return; - Tuple<Storage, string> tuple = store as Tuple<Storage, string>; - Storage storage = tuple.a; - string entity = tuple.b; if (compute_hash(query_result.identities, query_result.features) == entity) { storage.store_features(entity, query_result.features); + stream.get_flag(ServiceDiscovery.Flag.IDENTITY).set_entity_features(query_result.iq.from, query_result.features); } } |