aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/bind.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-11 23:04:58 +0100
committerfiaxh <git@mx.ax.lt>2017-03-11 23:09:57 +0100
commitf40a34bdc1995e656b09cc1252a8dcce685e373f (patch)
treed56684122d0a2f0e13ee9d94e6e8675bae1b4c52 /xmpp-vala/src/module/bind.vala
parent0ea4ac7e20674e3e6a8d1b3d4b53702dace72907 (diff)
downloaddino-f40a34bdc1995e656b09cc1252a8dcce685e373f.tar.gz
dino-f40a34bdc1995e656b09cc1252a8dcce685e373f.zip
Use delegates + object storage instead of listener objects
Diffstat (limited to 'xmpp-vala/src/module/bind.vala')
-rw-r--r--xmpp-vala/src/module/bind.vala16
1 files changed, 7 insertions, 9 deletions
diff --git a/xmpp-vala/src/module/bind.vala b/xmpp-vala/src/module/bind.vala
index 4ddce17d..0bc271fb 100644
--- a/xmpp-vala/src/module/bind.vala
+++ b/xmpp-vala/src/module/bind.vala
@@ -33,19 +33,13 @@ namespace Xmpp.Bind {
var bind = stream.features.get_subnode("bind", NS_URI);
if (bind != null) {
var flag = new Flag();
- StanzaNode bind_node = new StanzaNode.build("bind", NS_URI).add_self_xmlns()
- .put_node(new StanzaNode.build("resource", NS_URI).put_node(new StanzaNode.text(requested_resource)));
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.set(bind_node), new IqResponseListenerImpl());
+ StanzaNode bind_node = new StanzaNode.build("bind", NS_URI).add_self_xmlns();
+ bind_node.put_node(new StanzaNode.build("resource", NS_URI).put_node(new StanzaNode.text(requested_resource)));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, new Iq.Stanza.set(bind_node), on_bind_response);
stream.add_flag(flag);
}
}
- private class IqResponseListenerImpl : Iq.ResponseListener, Object {
- public void on_result(XmppStream stream, Iq.Stanza iq) {
- stream.get_module(Bind.Module.IDENTITY).iq_response_stanza(stream, iq);
- }
- }
-
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
stream.received_features_node.connect(this.received_features_node);
@@ -69,6 +63,10 @@ namespace Xmpp.Bind {
public override string get_ns() { return NS_URI; }
public override string get_id() { return ID; }
+
+ private static void on_bind_response(XmppStream stream, Iq.Stanza iq) {
+ stream.get_module(Bind.Module.IDENTITY).iq_response_stanza(stream, iq);
+ }
}
public class Flag : XmppStreamFlag {