From 1ccad732b9a783d8f0140373602b7c1b84d04198 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 11 Mar 2017 01:40:42 +0100 Subject: Use typed identity in stream modules --- xmpp-vala/src/module/xep/0054_vcard/module.vala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'xmpp-vala/src/module/xep/0054_vcard') diff --git a/xmpp-vala/src/module/xep/0054_vcard/module.vala b/xmpp-vala/src/module/xep/0054_vcard/module.vala index d0b23db5..037f723b 100644 --- a/xmpp-vala/src/module/xep/0054_vcard/module.vala +++ b/xmpp-vala/src/module/xep/0054_vcard/module.vala @@ -19,19 +19,15 @@ public class Module : XmppStreamModule { public override void attach(XmppStream stream) { Iq.Module.require(stream); Presence.Module.require(stream); - Presence.Module.get_module(stream).received_presence.connect(on_received_presence); + stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence); } public override void detach(XmppStream stream) { - Presence.Module.get_module(stream).received_presence.disconnect(on_received_presence); - } - - public static Module? get_module(XmppStream stream) { - return (Module?) stream.get_module(IDENTITY); + stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence); } public static void require(XmppStream stream) { - if (get_module(stream) == null) stderr.printf("VCardModule required but not attached!\n"); ; + if (stream.get_module(IDENTITY) == null) stderr.printf("VCardModule required but not attached!\n"); ; } public override string get_ns() { return NS_URI; } @@ -57,7 +53,7 @@ public class Module : XmppStreamModule { } else { iq.to = get_bare_jid(presence.from); } - Iq.Module.get_module(stream).send_iq(stream, iq, new IqResponseListenerImpl(this, storage, sha1)); + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqResponseListenerImpl(this, storage, sha1)); } } -- cgit v1.2.3-70-g09d2