diff options
Diffstat (limited to 'xmpp-vala/src/module/xep/0030_service_discovery/flag.vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0030_service_discovery/flag.vala | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala b/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala index 4f3e5eea..4661fede 100644 --- a/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala +++ b/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala @@ -1,22 +1,20 @@ using Gee; -using Xmpp.Core; - namespace Xmpp.Xep.ServiceDiscovery { public class Flag : XmppStreamFlag { public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "service_discovery"); - private HashMap<string, Gee.List<string>?> entity_features = new HashMap<string, Gee.List<string>?>(); - private HashMap<string, Gee.List<Identity>?> entity_identities = new HashMap<string, Gee.List<Identity>?>(); - private HashMap<string, Gee.List<Item>?> entity_items = new HashMap<string, Gee.List<Item>?>(); + private HashMap<Jid, Gee.List<string>?> entity_features = new HashMap<Jid, Gee.List<string>?>(Jid.hash_func, Jid.equals_func); + private HashMap<Jid, Gee.List<Identity>?> entity_identities = new HashMap<Jid, Gee.List<Identity>?>(Jid.hash_func, Jid.equals_func); + private HashMap<Jid, Gee.List<Item>?> entity_items = new HashMap<Jid, Gee.List<Item>?>(Jid.hash_func, Jid.equals_func); public Gee.List<string> features = new ArrayList<string>(); - public Gee.List<Identity>? get_entity_categories(string jid) { + public Gee.List<Identity>? get_entity_categories(Jid jid) { return entity_identities.has_key(jid) ? entity_identities[jid] : null; // TODO isn’t this default for hashmap } - public bool? has_entity_identity(string jid, string category, string type) { + public bool? has_entity_identity(Jid jid, string category, string type) { if (!entity_identities.has_key(jid)) return null; if (entity_identities[jid] == null) return false; foreach (Identity identity in entity_identities[jid]) { @@ -25,21 +23,21 @@ public class Flag : XmppStreamFlag { return false; } - public bool? has_entity_feature(string jid, string feature) { + public bool? has_entity_feature(Jid jid, string feature) { if (!entity_features.has_key(jid)) return null; if (entity_features[jid] == null) return false; return entity_features[jid].contains(feature); } - public void set_entity_identities(string jid, Gee.List<Identity>? identities) { + public void set_entity_identities(Jid jid, Gee.List<Identity>? identities) { entity_identities[jid] = identities; } - public void set_entity_features(string jid, Gee.List<string>? features) { + public void set_entity_features(Jid jid, Gee.List<string>? features) { entity_features[jid] = features; } - public void set_entity_items(string jid, Gee.List<Item>? features) { + public void set_entity_items(Jid jid, Gee.List<Item>? features) { entity_items[jid] = features; } |