aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/bind.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-19 12:55:36 +0100
committerfiaxh <git@mx.ax.lt>2017-03-20 22:28:27 +0100
commitdb57a973534f099af2b150f1a1307d1948553d9f (patch)
tree238ae1d4e53412a33e3febd07318dfd38b0eb2f8 /xmpp-vala/src/module/bind.vala
parent233f2b35d033cd20d1ac648bf2d723bcb7a918fc (diff)
downloaddino-db57a973534f099af2b150f1a1307d1948553d9f.tar.gz
dino-db57a973534f099af2b150f1a1307d1948553d9f.zip
Add typed identity to manager modules and stream flags
Diffstat (limited to 'xmpp-vala/src/module/bind.vala')
-rw-r--r--xmpp-vala/src/module/bind.vala23
1 files changed, 7 insertions, 16 deletions
diff --git a/xmpp-vala/src/module/bind.vala b/xmpp-vala/src/module/bind.vala
index 0bc271fb..f4b1a948 100644
--- a/xmpp-vala/src/module/bind.vala
+++ b/xmpp-vala/src/module/bind.vala
@@ -5,8 +5,7 @@ namespace Xmpp.Bind {
/** The parties to a stream MUST consider resource binding as mandatory-to-negotiate. (RFC6120 7.3.1) */
public class Module : XmppStreamNegotiationModule {
- public const string ID = "bind_module";
- public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "bind_module");
private string requested_resource;
@@ -17,7 +16,7 @@ namespace Xmpp.Bind {
}
public void iq_response_stanza(XmppStream stream, Iq.Stanza iq) {
- var flag = Flag.get_flag(stream);
+ var flag = stream.get_flag(Flag.IDENTITY);
if (flag == null || flag.finished) return;
if (iq.type_ == Iq.Stanza.TYPE_RESULT) {
@@ -54,15 +53,15 @@ namespace Xmpp.Bind {
}
public override bool mandatory_outstanding(XmppStream stream) {
- return !Flag.has_flag(stream) || !Flag.get_flag(stream).finished;
+ return !stream.has_flag(Flag.IDENTITY) || !stream.get_flag(Flag.IDENTITY).finished;
}
public override bool negotiation_active(XmppStream stream) {
- return Flag.has_flag(stream) && !Flag.get_flag(stream).finished;
+ return stream.has_flag(Flag.IDENTITY) && !stream.get_flag(Flag.IDENTITY).finished;
}
public override string get_ns() { return NS_URI; }
- public override string get_id() { return ID; }
+ public override string get_id() { return IDENTITY.id; }
private static void on_bind_response(XmppStream stream, Iq.Stanza iq) {
stream.get_module(Bind.Module.IDENTITY).iq_response_stanza(stream, iq);
@@ -70,19 +69,11 @@ namespace Xmpp.Bind {
}
public class Flag : XmppStreamFlag {
- public const string ID = "bind";
+ public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "bind");
public string? my_jid;
public bool finished = false;
- public static Flag? get_flag(XmppStream stream) {
- return (Flag?) stream.get_flag(NS_URI, ID);
- }
-
- public static bool has_flag(XmppStream stream) {
- return get_flag(stream) != null;
- }
-
public override string get_ns() { return NS_URI; }
- public override string get_id() { return ID; }
+ public override string get_id() { return IDENTITY.id; }
}
}