diff options
author | fiaxh <git@lightrise.org> | 2020-04-21 16:25:21 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-04-21 16:25:21 +0200 |
commit | 7c4260eed718961874fc0ea665263ea2ce59338b (patch) | |
tree | 7d583974ebf797e7e827836176c87735a87c39f6 /xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala | |
parent | 3a8fef7b7b3c101c4bcb8cd3d7460a009c98a41e (diff) | |
download | dino-7c4260eed718961874fc0ea665263ea2ce59338b.tar.gz dino-7c4260eed718961874fc0ea665263ea2ce59338b.zip |
Remove features from service discovery module when detaching module from stream
fixes #179
fixes #812
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, 7 insertions, 3 deletions
diff --git a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala index 22946d4b..1d5d10c9 100644 --- a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala +++ b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala @@ -28,7 +28,7 @@ namespace Xmpp.Xep.EntityCapabilities { private string get_own_hash(XmppStream stream) { if (own_ver_hash == null) { - own_ver_hash = compute_hash(stream.get_module(ServiceDiscovery.Module.IDENTITY).identities, stream.get_flag(ServiceDiscovery.Flag.IDENTITY).features, new ArrayList<DataForms.DataForm>()); + own_ver_hash = compute_hash(stream.get_flag(ServiceDiscovery.Flag.IDENTITY).own_identities, stream.get_flag(ServiceDiscovery.Flag.IDENTITY).own_features, new ArrayList<DataForms.DataForm>()); } return own_ver_hash; } @@ -42,6 +42,7 @@ namespace Xmpp.Xep.EntityCapabilities { public override void detach(XmppStream stream) { stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza); stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence); + stream.get_module(ServiceDiscovery.Module.IDENTITY).remove_feature(stream, NS_URI); } public override string get_ns() { return NS_URI; } @@ -86,7 +87,10 @@ namespace Xmpp.Xep.EntityCapabilities { } } - private static string compute_hash(Gee.List<ServiceDiscovery.Identity> identities, Gee.List<string> features, Gee.List<DataForms.DataForm> data_forms) { + private static string compute_hash(Gee.Set<ServiceDiscovery.Identity> identities_set, Gee.List<string> features, Gee.List<DataForms.DataForm> data_forms) { + var identities = new ArrayList<ServiceDiscovery.Identity>(); + foreach (var identity in identities_set) identities.add(identity); + identities.sort(compare_identities); features.sort(); @@ -154,7 +158,7 @@ namespace Xmpp.Xep.EntityCapabilities { } public interface Storage : Object { - public abstract void store_identities(string entity, Gee.List<ServiceDiscovery.Identity> identities); + public abstract void store_identities(string entity, Gee.Set<ServiceDiscovery.Identity> identities); public abstract void store_features(string entity, Gee.List<string> capabilities); public abstract ServiceDiscovery.Identity? get_identities(string entity); public abstract Gee.List<string> get_features(string entity); |