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/0027_pgp/module.vala | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'xmpp-vala/src/module/xep/0027_pgp') diff --git a/xmpp-vala/src/module/xep/0027_pgp/module.vala b/xmpp-vala/src/module/xep/0027_pgp/module.vala index 3fcd6559..8d75a17d 100644 --- a/xmpp-vala/src/module/xep/0027_pgp/module.vala +++ b/xmpp-vala/src/module/xep/0027_pgp/module.vala @@ -39,25 +39,21 @@ namespace Xmpp.Xep.Pgp { public override void attach(XmppStream stream) { Presence.Module.require(stream); - Presence.Module.get_module(stream).received_presence.connect(on_received_presence); - Presence.Module.get_module(stream).pre_send_presence_stanza.connect(on_pre_send_presence_stanza); + stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence); + stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.connect(on_pre_send_presence_stanza); Message.Module.require(stream); - Message.Module.get_module(stream).pre_received_message.connect(on_pre_received_message); + stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(on_pre_received_message); stream.add_flag(new Flag()); } public override void detach(XmppStream stream) { - Presence.Module.get_module(stream).received_presence.disconnect(on_received_presence); - Presence.Module.get_module(stream).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza); - Message.Module.get_module(stream).pre_received_message.disconnect(on_pre_received_message); - } - - 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); + stream.get_module(Presence.Module.IDENTITY).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza); + stream.get_module(Message.Module.IDENTITY).pre_received_message.disconnect(on_pre_received_message); } 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; } -- cgit v1.2.3-70-g09d2