| 1 |
namespace Xmpp { |
| 2 |
|
| 3 |
public class FlagIdentity<T> : Object { |
| 4 |
public string ns { get; private set; } |
| 5 |
public string id { get; private set; } |
| 6 |
|
| 7 |
public FlagIdentity(string ns, string id) { |
| 8 |
this.ns = ns; |
| 9 |
this.id = id; |
| 10 |
} |
| 11 |
|
| 12 |
public T? cast(XmppStreamFlag flag) { |
| 13 |
#if VALA_0_56_11 |
| 14 |
// We can't typecheck due to compiler bug |
| 15 |
return (T) module; |
| 16 |
#else |
| 17 |
return flag.get_type().is_a(typeof(T)) ? (T?) flag : null; |
| 18 |
#endif |
| 19 |
} |
| 20 |
|
| 21 |
public bool matches(XmppStreamFlag module) { |
| 22 |
return module.get_ns() == ns && module.get_id() == id; |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
public abstract class XmppStreamFlag : Object { |
| 27 |
public abstract string get_ns(); |
| 28 |
|
| 29 |
public abstract string get_id(); |
| 30 |
} |
| 31 |
|
| 32 |
public class ModuleIdentity<T> : Object { |
| 33 |
public string ns { get; private set; } |
| 34 |
public string id { get; private set; } |
| 35 |
|
| 36 |
public ModuleIdentity(string ns, string id) { |
| 37 |
this.ns = ns; |
| 38 |
this.id = id; |
| 39 |
} |
| 40 |
|
| 41 |
public T? cast(XmppStreamModule module) { |
| 42 |
#if VALA_0_56_11 |
| 43 |
// We can't typecheck due to compiler bug |
| 44 |
return (T) module; |
| 45 |
#else |
| 46 |
return module.get_type().is_a(typeof(T)) ? (T?) module : null; |
| 47 |
#endif |
| 48 |
} |
| 49 |
|
| 50 |
public bool matches(XmppStreamModule module) { |
| 51 |
return module.get_ns() == ns && module.get_id() == id; |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
public abstract class XmppStreamModule : Object { |
| 56 |
public abstract void attach(XmppStream stream); |
| 57 |
|
| 58 |
public abstract void detach(XmppStream stream); |
| 59 |
|
| 60 |
public abstract string get_ns(); |
| 61 |
|
| 62 |
public abstract string get_id(); |
| 63 |
} |
| 64 |
|
| 65 |
public abstract class XmppStreamNegotiationModule : XmppStreamModule { |
| 66 |
public abstract bool mandatory_outstanding(XmppStream stream); |
| 67 |
|
| 68 |
public abstract bool negotiation_active(XmppStream stream); |
| 69 |
} |
| 70 |
|
| 71 |
} |