aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/presence
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/presence')
-rw-r--r--xmpp-vala/src/module/presence/flag.vala8
-rw-r--r--xmpp-vala/src/module/presence/module.vala11
2 files changed, 7 insertions, 12 deletions
diff --git a/xmpp-vala/src/module/presence/flag.vala b/xmpp-vala/src/module/presence/flag.vala
index a92c9405..8fb44e13 100644
--- a/xmpp-vala/src/module/presence/flag.vala
+++ b/xmpp-vala/src/module/presence/flag.vala
@@ -5,7 +5,7 @@ using Xmpp.Core;
namespace Xmpp.Presence {
public class Flag : XmppStreamFlag {
- public const string ID = "presence";
+ public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "presence");
private HashMap<string, ConcurrentList<string>> resources = new HashMap<string, ConcurrentList<string>>();
private HashMap<string, Presence.Stanza> presences = new HashMap<string, Presence.Stanza>();
@@ -52,13 +52,9 @@ public class Flag : XmppStreamFlag {
}
}
- 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; }
}
} \ No newline at end of file
diff --git a/xmpp-vala/src/module/presence/module.vala b/xmpp-vala/src/module/presence/module.vala
index 7e5dca17..3c078453 100644
--- a/xmpp-vala/src/module/presence/module.vala
+++ b/xmpp-vala/src/module/presence/module.vala
@@ -4,8 +4,7 @@ namespace Xmpp.Presence {
private const string NS_URI = "jabber:client";
public class Module : XmppStreamModule {
- public const string ID = "presence_module";
- public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "presence_module");
public signal void received_presence(XmppStream stream, Presence.Stanza presence);
public signal void pre_send_presence_stanza(XmppStream stream, Presence.Stanza presence);
@@ -67,16 +66,16 @@ namespace Xmpp.Presence {
}
private void on_received_presence_stanza(XmppStream stream, StanzaNode node) {
- Presence.Stanza presence = new Presence.Stanza.from_stanza(node, Bind.Flag.get_flag(stream).my_jid);
+ Presence.Stanza presence = new Presence.Stanza.from_stanza(node, stream.get_flag(Bind.Flag.IDENTITY).my_jid);
received_presence(stream, presence);
switch (presence.type_) {
case Presence.Stanza.TYPE_AVAILABLE:
- Flag.get_flag(stream).add_presence(presence);
+ stream.get_flag(Flag.IDENTITY).add_presence(presence);
received_available(stream, presence);
received_available_show(stream, presence.from, presence.show);
break;
case Presence.Stanza.TYPE_UNAVAILABLE:
- Flag.get_flag(stream).remove_presence(presence.from);
+ stream.get_flag(Flag.IDENTITY).remove_presence(presence.from);
received_unavailable(stream, presence.from);
break;
case Presence.Stanza.TYPE_SUBSCRIBE:
@@ -101,7 +100,7 @@ namespace Xmpp.Presence {
}
public override string get_ns() { return NS_URI; }
- public override string get_id() { return ID; }
+ public override string get_id() { return IDENTITY.id; }
}
}