From 7bbbb738fdb233f4ad91ffdd7d9247b28849d715 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 13 Jun 2017 18:14:59 +0200 Subject: Get rid of manual storage objects for delegates --- xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala') 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 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 tuple = store as Tuple; - 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); } } -- cgit v1.2.3-70-g09d2