| 1 |
using Gee; |
| 2 |
|
| 3 |
namespace Xmpp.Xep.ServiceDiscovery { |
| 4 |
|
| 5 |
public class Flag : XmppStreamFlag { |
| 6 |
public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "service_discovery"); |
| 7 |
|
| 8 |
private Gee.Set<string> own_features_ = new HashSet<string>(); |
| 9 |
public Gee.List<string> own_features { |
| 10 |
owned get { |
| 11 |
var ret = new ArrayList<string>(); |
| 12 |
foreach (var feature in own_features_) ret.add(feature); |
| 13 |
return ret; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
private Gee.Set<Identity> own_identities_ = new HashSet<Identity>(Identity.hash_func, Identity.equals_func); |
| 18 |
public Gee.Set<Identity> own_identities { |
| 19 |
owned get { return own_identities_.read_only_view; } |
| 20 |
} |
| 21 |
|
| 22 |
public void add_own_feature(string feature) { |
| 23 |
if (own_features_.contains(feature)) { |
| 24 |
warning("Tried to add the feature %s a second time".printf(feature)); |
| 25 |
return; |
| 26 |
} |
| 27 |
own_features_.add(feature); |
| 28 |
} |
| 29 |
|
| 30 |
public void remove_own_feature(string feature) { |
| 31 |
own_features_.remove(feature); |
| 32 |
} |
| 33 |
|
| 34 |
public void add_own_identity(Identity identity) { own_identities_.add(identity); } |
| 35 |
public void remove_own_identity(Identity identity) { own_identities_.remove(identity); } |
| 36 |
|
| 37 |
public override string get_ns() { return NS_URI; } |
| 38 |
|
| 39 |
public override string get_id() { return IDENTITY.id; } |
| 40 |
} |
| 41 |
|
| 42 |
} |