aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-12-01 02:28:51 +0100
committerfiaxh <git@mx.ax.lt>2017-12-01 02:28:51 +0100
commitf3ca14f2d6f31c5a4b6438e64fbfca19ebad066e (patch)
tree81f9c53b9fb6f2d8ee28f80c649a57c8d54810be /xmpp-vala
parent1e011852e00efa9d4d3547d2ca37e395da1070c6 (diff)
downloaddino-f3ca14f2d6f31c5a4b6438e64fbfca19ebad066e.tar.gz
dino-f3ca14f2d6f31c5a4b6438e64fbfca19ebad066e.zip
ConversationView: Date separator
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/src/module/iq/stanza.vala1
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala1
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala21
3 files changed, 12 insertions, 11 deletions
diff --git a/xmpp-vala/src/module/iq/stanza.vala b/xmpp-vala/src/module/iq/stanza.vala
index 561c5866..8f114c9f 100644
--- a/xmpp-vala/src/module/iq/stanza.vala
+++ b/xmpp-vala/src/module/iq/stanza.vala
@@ -23,6 +23,7 @@ public class Stanza : Xmpp.Stanza {
public Stanza.result(Stanza request, StanzaNode? stanza_node = null) {
this(request.id);
+ this.to = request.from;
this.type_ = TYPE_RESULT;
if (stanza_node != null) {
stanza.put_node(stanza_node);
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala b/xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala
index 4ae917dc..ca0fba5b 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala
@@ -41,7 +41,6 @@ public class InfoResult {
public InfoResult(Iq.Stanza iq_request) {
iq = new Iq.Stanza.result(iq_request);
- iq.to = iq_request.from;
iq.stanza.put_node(new StanzaNode.build("query", NS_URI_INFO).add_self_xmlns());
}
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index 4902b0c7..ac467b35 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -5,7 +5,7 @@ using Xmpp.Core;
namespace Xmpp.Xep.Ping {
private const string NS_URI = "urn:xmpp:ping";
- public class Module : XmppStreamModule {
+ public class Module : XmppStreamModule, Iq.Handler {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0199_ping");
public delegate void OnResult(XmppStream stream);
@@ -18,19 +18,20 @@ namespace Xmpp.Xep.Ping {
}
public override void attach(XmppStream stream) {
- stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, new IqHandlerImpl());
+ stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, this);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
}
- public override void detach(XmppStream stream) { }
+ public override void detach(XmppStream stream) {
+ stream.get_module(Iq.Module.IDENTITY).unregister_from_namespace(NS_URI, this);
+ }
+
+ public void on_iq_get(XmppStream stream, Iq.Stanza 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) { }
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
-
- private class IqHandlerImpl : Iq.Handler, Object {
- public void on_iq_get(XmppStream stream, Iq.Stanza 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) { }
- }
}
}