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/roster | |
parent | 95e8d126db06a183918b4db4e84013ff28f8b1f7 (diff) | |
download | dino-1ccad732b9a783d8f0140373602b7c1b84d04198.tar.gz dino-1ccad732b9a783d8f0140373602b7c1b84d04198.zip |
Use typed identity in stream modules
Diffstat (limited to 'xmpp-vala/src/module/roster')
-rw-r--r-- | xmpp-vala/src/module/roster/module.vala | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/xmpp-vala/src/module/roster/module.vala b/xmpp-vala/src/module/roster/module.vala index 7bf8917c..c9400b3a 100644 --- a/xmpp-vala/src/module/roster/module.vala +++ b/xmpp-vala/src/module/roster/module.vala @@ -72,24 +72,20 @@ namespace Xmpp.Roster { public void on_iq_get(XmppStream stream, Iq.Stanza iq) { } - 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 void attach(XmppStream stream) { Iq.Module.require(stream); - Iq.Module.get_module(stream).register_for_namespace(NS_URI, this); + stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this); Presence.Module.require(stream); - Presence.Module.get_module(stream).initial_presence_sent.connect(roster_get); + stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.connect(roster_get); stream.add_flag(new Flag()); } public override void detach(XmppStream stream) { - Presence.Module.get_module(stream).initial_presence_sent.disconnect(roster_get); + stream.get_module(Presence.Module.IDENTITY).initial_presence_sent.disconnect(roster_get); } internal override string get_ns() { return NS_URI; } @@ -99,7 +95,7 @@ namespace Xmpp.Roster { Flag.get_flag(stream).iq_id = random_uuid(); StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns(); Iq.Stanza iq = new Iq.Stanza.get(query_node, Flag.get_flag(stream).iq_id); - Iq.Module.get_module(stream).send_iq(stream, iq, new IqResponseListenerImpl()); + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqResponseListenerImpl()); } private class IqResponseListenerImpl : Iq.ResponseListener, Object { @@ -111,7 +107,7 @@ namespace Xmpp.Roster { Item item = new Item.from_stanza_node(item_node); flag.roster_items[item.jid] = item; } - Module.get_module(stream).received_roster(stream, flag.roster_items.values); + stream.get_module(Module.IDENTITY).received_roster(stream, flag.roster_items.values); } } } @@ -120,7 +116,7 @@ namespace Xmpp.Roster { StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns() .put_node(roster_item.stanza_node); Iq.Stanza iq = new Iq.Stanza.set(query_node); - Iq.Module.get_module(stream).send_iq(stream, iq, null); + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, null); } } } |