aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-11 01:40:42 +0100
committerfiaxh <git@mx.ax.lt>2017-03-11 01:40:42 +0100
commit1ccad732b9a783d8f0140373602b7c1b84d04198 (patch)
tree368df267ba013c03d01c06c78b6559fa59338be3 /xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
parent95e8d126db06a183918b4db4e84013ff28f8b1f7 (diff)
downloaddino-1ccad732b9a783d8f0140373602b7c1b84d04198.tar.gz
dino-1ccad732b9a783d8f0140373602b7c1b84d04198.zip
Use typed identity in stream modules
Diffstat (limited to 'xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala')
-rw-r--r--xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala20
1 files changed, 8 insertions, 12 deletions
diff --git a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
index c39f9cad..6b8ae3bb 100644
--- a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
+++ b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
@@ -18,7 +18,7 @@ namespace Xmpp.Xep.EntityCapabilities {
private string get_own_hash(XmppStream stream) {
if (own_ver_hash == null) {
- own_ver_hash = compute_hash(ServiceDiscovery.Module.get_module(stream).identities, ServiceDiscovery.Flag.get_flag(stream).features);
+ own_ver_hash = compute_hash(stream.get_module(ServiceDiscovery.Module.IDENTITY).identities, ServiceDiscovery.Flag.get_flag(stream).features);
}
return own_ver_hash;
}
@@ -26,22 +26,18 @@ namespace Xmpp.Xep.EntityCapabilities {
public override void attach(XmppStream stream) {
ServiceDiscovery.Module.require(stream);
Presence.Module.require(stream);
- Presence.Module.get_module(stream).pre_send_presence_stanza.connect(on_pre_send_presence_stanza);
- Presence.Module.get_module(stream).received_presence.connect(on_received_presence);
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
+ stream.get_module(Presence.Module.IDENTITY).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(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
}
public override void detach(XmppStream stream) {
- Presence.Module.get_module(stream).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza);
- 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).pre_send_presence_stanza.disconnect(on_pre_send_presence_stanza);
+ 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("EntityCapabilitiesModule required but not attached!\n");
+ if (stream.get_module(IDENTITY) == null) stderr.printf("EntityCapabilitiesModule required but not attached!\n");
}
public override string get_ns() { return NS_URI; }
@@ -62,7 +58,7 @@ namespace Xmpp.Xep.EntityCapabilities {
string ver_attribute = c_node.get_attribute("ver", NS_URI);
ArrayList<string> capabilities = storage.get_features(ver_attribute);
if (capabilities.size == 0) {
- ServiceDiscovery.Module.get_module(stream)
+ stream.get_module(ServiceDiscovery.Module.IDENTITY)
.request_info(stream, presence.from, new ServiceDiscoveryInfoResponseListenerImpl(storage, ver_attribute));
} else {
ServiceDiscovery.Flag.get_flag(stream).set_entitiy_features(presence.from, capabilities);