aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala
blob: 0f82f498c834f111743f8bdc6153286b07dba60a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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, ArrayList<string>> entity_features = new HashMap<string, ArrayList<string>>();
    public ArrayList<string> features = new ArrayList<string>();

    public bool? has_entity_feature(string jid, string feature) {
        if (!entity_features.has_key(jid)) return null;
        return entity_features[jid].contains(feature);
    }

    public void set_entitiy_features(string jid, ArrayList<string> features) {
        entity_features[jid] = features;
    }

    public void add_own_feature(string feature) { features.add(feature); }

    public override string get_ns() { return NS_URI; }

    public override string get_id() { return IDENTITY.id; }
}

}