diff options
author | fiaxh <git@mx.ax.lt> | 2017-03-11 01:40:42 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-03-11 01:40:42 +0100 |
commit | 1ccad732b9a783d8f0140373602b7c1b84d04198 (patch) | |
tree | 368df267ba013c03d01c06c78b6559fa59338be3 /xmpp-vala/src/module/xep/0199_ping.vala | |
parent | 95e8d126db06a183918b4db4e84013ff28f8b1f7 (diff) | |
download | dino-1ccad732b9a783d8f0140373602b7c1b84d04198.tar.gz dino-1ccad732b9a783d8f0140373602b7c1b84d04198.zip |
Use typed identity in stream modules
Diffstat (limited to 'xmpp-vala/src/module/xep/0199_ping.vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0199_ping.vala | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala index 800ccfd8..a4157e99 100644 --- a/xmpp-vala/src/module/xep/0199_ping.vala +++ b/xmpp-vala/src/module/xep/0199_ping.vala @@ -12,7 +12,7 @@ namespace Xmpp.Xep.Ping { public void send_ping(XmppStream stream, string jid, ResponseListener? listener = null) { Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("ping", NS_URI).add_self_xmlns()); iq.to = jid; - Iq.Module.get_module(stream).send_iq(stream, iq, listener == null? null : new IqResponseListenerImpl(listener)); + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, listener == null? null : new IqResponseListenerImpl(listener)); } private class IqResponseListenerImpl : Iq.ResponseListener, Object { @@ -27,17 +27,13 @@ namespace Xmpp.Xep.Ping { public override void attach(XmppStream stream) { Iq.Module.require(stream); - Iq.Module.get_module(stream).register_for_namespace(NS_URI, new IqHandlerImpl()); + stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, new IqHandlerImpl()); } public override void detach(XmppStream stream) { } - public static Module? get_module(XmppStream stream) { - return (Module?) stream.get_module(IDENTITY); - } - public static void require(XmppStream stream) { - if (get_module(stream) == null) stream.add_module(new Module()); + if (stream.get_module(IDENTITY) == null) stream.add_module(new Module()); } public override string get_ns() { return NS_URI; } @@ -45,7 +41,7 @@ namespace Xmpp.Xep.Ping { private class IqHandlerImpl : Iq.Handler, Object { public void on_iq_get(XmppStream stream, Iq.Stanza iq) { - Iq.Module.get_module(stream).send_iq(stream, new Iq.Stanza.result(iq)); + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.result(iq)); } public void on_iq_set(XmppStream stream, Iq.Stanza iq) { } } |