aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep
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
parent95e8d126db06a183918b4db4e84013ff28f8b1f7 (diff)
downloaddino-1ccad732b9a783d8f0140373602b7c1b84d04198.tar.gz
dino-1ccad732b9a783d8f0140373602b7c1b84d04198.zip
Use typed identity in stream modules
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r--xmpp-vala/src/module/xep/0027_pgp/module.vala18
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/module.vala14
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala36
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/module.vala18
-rw-r--r--xmpp-vala/src/module/xep/0049_private_xml_storage.vala10
-rw-r--r--xmpp-vala/src/module/xep/0054_vcard/module.vala12
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala16
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala18
-rw-r--r--xmpp-vala/src/module/xep/0085_chat_state_notifications.vala18
-rw-r--r--xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala20
-rw-r--r--xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala18
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala12
-rw-r--r--xmpp-vala/src/module/xep/0203_delayed_delivery.vala8
-rw-r--r--xmpp-vala/src/module/xep/0280_message_carbons.vala16
-rw-r--r--xmpp-vala/src/module/xep/0333_chat_markers.vala18
15 files changed, 96 insertions, 156 deletions
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; }
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
index 163f8cfc..439d825c 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
@@ -32,7 +32,7 @@ namespace Xmpp.Xep.ServiceDiscovery {
public void request_info(XmppStream stream, string jid, InfoResponseListener response_listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_INFO).add_self_xmlns());
iq.to = jid;
- Iq.Module.get_module(stream).send_iq(stream, iq, new IqInfoResponseListener(response_listener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqInfoResponseListener(response_listener));
}
private class IqInfoResponseListener : Iq.ResponseListener, Object {
@@ -54,7 +54,7 @@ namespace Xmpp.Xep.ServiceDiscovery {
public void request_items(XmppStream stream, string jid, ItemsResponseListener response_listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_ITEMS).add_self_xmlns());
iq.to = jid;
- Iq.Module.get_module(stream).send_iq(stream, iq, new IqItemsResponseListener(response_listener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqItemsResponseListener(response_listener));
}
private class IqItemsResponseListener : Iq.ResponseListener, Object {
@@ -76,19 +76,15 @@ namespace Xmpp.Xep.ServiceDiscovery {
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
- Iq.Module.get_module(stream).register_for_namespace(NS_URI_INFO, this);
+ stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI_INFO, this);
stream.add_flag(new Flag());
add_feature(stream, NS_URI_INFO);
}
public override void detach(XmppStream stream) { }
- 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 ServiceDiscovery.Module());
+ if (stream.get_module(IDENTITY) == null) stream.add_module(new ServiceDiscovery.Module());
}
public override string get_ns() { return NS_URI; }
@@ -98,7 +94,7 @@ namespace Xmpp.Xep.ServiceDiscovery {
InfoResult query_result = new ServiceDiscovery.InfoResult(iq_request);
query_result.features = Flag.get_flag(stream).features;
query_result.identities = identities;
- Iq.Module.get_module(stream).send_iq(stream, query_result.iq, null);
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, query_result.iq, null);
}
}
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index cb7f0d85..3b0c3c12 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -48,7 +48,7 @@ public class Module : XmppStreamModule {
Muc.Flag.get_flag(stream).start_muc_enter(bare_jid, presence.id, listener);
- Presence.Module.get_module(stream).send_presence(stream, presence);
+ stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
public void exit(XmppStream stream, string jid) {
@@ -56,7 +56,7 @@ public class Module : XmppStreamModule {
Presence.Stanza presence = new Presence.Stanza();
presence.to = jid + "/" + nick;
presence.type_ = Presence.Stanza.TYPE_UNAVAILABLE;
- Presence.Module.get_module(stream).send_presence(stream, presence);
+ stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
public void change_subject(XmppStream stream, string jid, string subject) {
@@ -64,13 +64,13 @@ public class Module : XmppStreamModule {
message.to = jid;
message.type_ = Message.Stanza.TYPE_GROUPCHAT;
message.stanza.put_node((new StanzaNode.build("subject")).put_node(new StanzaNode.text(subject)));
- Message.Module.get_module(stream).send_message(stream, message);
+ stream.get_module(Message.Module.IDENTITY).send_message(stream, message);
}
public void change_nick(XmppStream stream, string jid, string new_nick) {
Presence.Stanza presence = new Presence.Stanza();
presence.to = jid + "/" + new_nick;
- Presence.Module.get_module(stream).send_presence(stream, presence);
+ stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
public void kick(XmppStream stream, string jid, string nick) {
@@ -80,30 +80,26 @@ public class Module : XmppStreamModule {
public override void attach(XmppStream stream) {
stream.add_flag(new Muc.Flag());
Message.Module.require(stream);
- Message.Module.get_module(stream).received_message.connect(on_received_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
Presence.Module.require(stream);
- Presence.Module.get_module(stream).received_presence.connect(on_received_presence);
- Presence.Module.get_module(stream).received_available.connect(on_received_available);
- Presence.Module.get_module(stream).received_unavailable.connect(on_received_unavailable);
- if (ServiceDiscovery.Module.get_module(stream) != null) {
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
+ stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
+ stream.get_module(Presence.Module.IDENTITY).received_available.connect(on_received_available);
+ stream.get_module(Presence.Module.IDENTITY).received_unavailable.connect(on_received_unavailable);
+ if (stream.get_module(ServiceDiscovery.Module.IDENTITY) != null) {
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
}
}
public override void detach(XmppStream stream) {
- Message.Module.get_module(stream).received_message.disconnect(on_received_message);
- Presence.Module.get_module(stream).received_presence.disconnect(on_received_presence);
- Presence.Module.get_module(stream).received_available.disconnect(on_received_available);
- Presence.Module.get_module(stream).received_unavailable.disconnect(on_received_unavailable);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
+ stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence);
+ stream.get_module(Presence.Module.IDENTITY).received_available.disconnect(on_received_available);
+ stream.get_module(Presence.Module.IDENTITY).received_unavailable.disconnect(on_received_unavailable);
}
public static void require(XmppStream stream) {
Presence.Module.require(stream);
- if (get_module(stream) == null) stream.add_module(new Muc.Module());
+ if (stream.get_module(IDENTITY) == null) stream.add_module(new Muc.Module());
}
public override string get_ns() { return NS_URI; }
@@ -114,7 +110,7 @@ public class Module : XmppStreamModule {
query.put_node(new StanzaNode.build("item", NS_URI_ADMIN).put_attribute("nick", nick, NS_URI_ADMIN).put_attribute("role", new_role, NS_URI_ADMIN));
Iq.Stanza iq = new Iq.Stanza.set(query);
iq.to = jid;
- Iq.Module.get_module(stream).send_iq(stream, iq);
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
private void on_received_message(XmppStream stream, Message.Stanza message) {
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
index 25a4678e..25191122 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
@@ -13,7 +13,7 @@ public class Module : XmppStreamModule {
public void get_conferences(XmppStream stream, ConferencesRetrieveResponseListener response_listener) {
StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns();
- PrivateXmlStorage.Module.get_module(stream).retrieve(stream, get_node, new GetConferences(response_listener));
+ stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node, new GetConferences(response_listener));
}
public void set_conferences(XmppStream stream, ArrayList<Conference> conferences) {
@@ -21,7 +21,7 @@ public class Module : XmppStreamModule {
foreach (Conference conference in conferences) {
storage_node.put_node(conference.stanza_node);
}
- PrivateXmlStorage.Module.get_module(stream).store(stream, storage_node, new StoreResponseListenerImpl(conferences));
+ stream.get_module(PrivateXmlStorage.Module.IDENTITY).store(stream, storage_node, new StoreResponseListenerImpl(conferences));
}
private class StoreResponseListenerImpl : PrivateXmlStorage.StoreResponseListener, Object {
@@ -30,7 +30,7 @@ public class Module : XmppStreamModule {
this.conferences = conferences;
}
public void on_success(XmppStream stream) {
- Module.get_module(stream).conferences_updated(stream, conferences);
+ stream.get_module(Module.IDENTITY).conferences_updated(stream, conferences);
}
}
@@ -65,7 +65,7 @@ public class Module : XmppStreamModule {
}
public void on_result(XmppStream stream, ArrayList<Conference> conferences) {
conferences.add(conference);
- Module.get_module(stream).set_conferences(stream, conferences);
+ stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
}
}
@@ -85,7 +85,7 @@ public class Module : XmppStreamModule {
break;
}
}
- Module.get_module(stream).set_conferences(stream, conferences);
+ stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
}
}
@@ -102,7 +102,7 @@ public class Module : XmppStreamModule {
}
}
if (rem != null) conferences.remove(rem);
- Module.get_module(stream).set_conferences(stream, conferences);
+ stream.get_module(Module.IDENTITY).set_conferences(stream, conferences);
}
}
@@ -110,12 +110,8 @@ public class Module : XmppStreamModule {
public override void detach(XmppStream stream) { }
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
- }
-
public static void require(XmppStream stream) {
- if (get_module(stream) == null) stderr.printf("");
+ if (stream.get_module(IDENTITY) == null) stderr.printf("");
}
public override string get_ns() { return NS_URI; }
diff --git a/xmpp-vala/src/module/xep/0049_private_xml_storage.vala b/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
index 0472296c..f59d0bdd 100644
--- a/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
+++ b/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
@@ -10,7 +10,7 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public void store(XmppStream stream, StanzaNode node, StoreResponseListener listener) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.set(queryNode);
- Iq.Module.get_module(stream).send_iq(stream, iq, new IqStoreResponse(listener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqStoreResponse(listener));
}
private class IqStoreResponse : Iq.ResponseListener, Object {
@@ -26,7 +26,7 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public void retrieve(XmppStream stream, StanzaNode node, RetrieveResponseListener responseListener) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.get(queryNode);
- Iq.Module.get_module(stream).send_iq(stream, iq, new IqRetrieveResponse(responseListener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqRetrieveResponse(responseListener));
}
private class IqRetrieveResponse : Iq.ResponseListener, Object {
@@ -44,12 +44,8 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public override void detach(XmppStream stream) { }
- 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 PrivateXmlStorage.Module());
+ if (stream.get_module(IDENTITY) == null) stream.add_module(new PrivateXmlStorage.Module());
}
public override string get_ns() { return NS_URI; }
diff --git a/xmpp-vala/src/module/xep/0054_vcard/module.vala b/xmpp-vala/src/module/xep/0054_vcard/module.vala
index d0b23db5..037f723b 100644
--- a/xmpp-vala/src/module/xep/0054_vcard/module.vala
+++ b/xmpp-vala/src/module/xep/0054_vcard/module.vala
@@ -19,19 +19,15 @@ public class Module : XmppStreamModule {
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
Presence.Module.require(stream);
- Presence.Module.get_module(stream).received_presence.connect(on_received_presence);
+ stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
}
public override void detach(XmppStream stream) {
- 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).received_presence.disconnect(on_received_presence);
}
public static void require(XmppStream stream) {
- if (get_module(stream) == null) stderr.printf("VCardModule required but not attached!\n"); ;
+ if (stream.get_module(IDENTITY) == null) stderr.printf("VCardModule required but not attached!\n"); ;
}
public override string get_ns() { return NS_URI; }
@@ -57,7 +53,7 @@ public class Module : XmppStreamModule {
} else {
iq.to = get_bare_jid(presence.from);
}
- Iq.Module.get_module(stream).send_iq(stream, iq, new IqResponseListenerImpl(this, storage, sha1));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, new IqResponseListenerImpl(this, storage, sha1));
}
}
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index f9379c45..c69f6a25 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -13,14 +13,14 @@ namespace Xmpp.Xep.Pubsub {
private HashMap<string, EventListenerDelegate> event_listeners = new HashMap<string, EventListenerDelegate>();
public void add_filtered_notification(XmppStream stream, string node, EventListenerDelegate.ResultFunc on_result, Object? reference = null) {
- ServiceDiscovery.Module.get_module(stream).add_feature_notify(stream, node);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature_notify(stream, node);
event_listeners[node] = new EventListenerDelegate(on_result, reference);
}
public void request(XmppStream stream, string jid, string node, RequestResponseListener listener) { // TODO multiple nodes gehen auch
Iq.Stanza a = new Iq.Stanza.get(new StanzaNode.build("pubsub", NS_URI).add_self_xmlns().put_node(new StanzaNode.build("items", NS_URI).put_attribute("node", node)));
a.to = jid;
- Iq.Module.get_module(stream).send_iq(stream, a, new IqRequestResponseListener(listener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, a, new IqRequestResponseListener(listener));
}
private class IqRequestResponseListener : Iq.ResponseListener, Object {
@@ -44,7 +44,7 @@ namespace Xmpp.Xep.Pubsub {
items_node.put_node(content);
publish_node.put_node(items_node);
Iq.Stanza iq = new Iq.Stanza.set(pubsub_node);
- Iq.Module.get_module(stream).send_iq(stream, iq, null);
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, null);
}
private class IqPublishResponseListener : Iq.ResponseListener, Object {
@@ -63,19 +63,15 @@ namespace Xmpp.Xep.Pubsub {
Iq.Module.require(stream);
Message.Module.require(stream);
ServiceDiscovery.Module.require(stream);
- Message.Module.get_module(stream).received_message.connect(on_received_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- Message.Module.get_module(stream).received_message.disconnect(on_received_message);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_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; }
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index 3654509c..edaa25df 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -21,7 +21,7 @@ namespace Xmpp.Xep.UserAvatars {
string sha1 = Checksum.compute_for_data(ChecksumType.SHA1, image);
StanzaNode data_node = new StanzaNode.build("data", NS_URI_DATA).add_self_xmlns()
.put_node(new StanzaNode.text(Base64.encode(image)));
- Pubsub.Module.get_module(stream).publish(stream, null, NS_URI_DATA, NS_URI_DATA, sha1, data_node);
+ stream.get_module(Pubsub.Module.IDENTITY).publish(stream, null, NS_URI_DATA, NS_URI_DATA, sha1, data_node);
StanzaNode metadata_node = new StanzaNode.build("metadata", NS_URI_METADATA).add_self_xmlns();
StanzaNode info_node = new StanzaNode.build("info", NS_URI_METADATA)
@@ -31,7 +31,7 @@ namespace Xmpp.Xep.UserAvatars {
.put_attribute("height", height.to_string())
.put_attribute("type", "image/png");
metadata_node.put_node(info_node);
- Pubsub.Module.get_module(stream).publish(stream, null, NS_URI_METADATA, NS_URI_METADATA, sha1, metadata_node);
+ stream.get_module(Pubsub.Module.IDENTITY).publish(stream, null, NS_URI_METADATA, NS_URI_METADATA, sha1, metadata_node);
}
private class PublishResponseListenerImpl : Pubsub.PublishResponseListener, Object {
@@ -47,7 +47,7 @@ namespace Xmpp.Xep.UserAvatars {
public override void attach(XmppStream stream) {
Pubsub.Module.require(stream);
- Pubsub.Module.get_module(stream).add_filtered_notification(stream, NS_URI_METADATA, on_event_result, this);
+ stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NS_URI_METADATA, on_event_result, this);
}
public override void detach(XmppStream stream) { }
@@ -57,9 +57,9 @@ namespace Xmpp.Xep.UserAvatars {
StanzaNode info_node = node.get_subnode("info", NS_URI_METADATA);
if (info_node.get_attribute("type") != "image/png") return;
if (storage.has_image(id)) {
- Module.get_module(stream).received_avatar(stream, jid, id);
+ stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
} else {
- Pubsub.Module.get_module(stream).request(stream, jid, NS_URI_DATA, new PubsubRequestResponseListenerImpl(storage));
+ stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, NS_URI_DATA, new PubsubRequestResponseListenerImpl(storage));
}
}
@@ -69,16 +69,12 @@ namespace Xmpp.Xep.UserAvatars {
public void on_result(XmppStream stream, string jid, string? id, StanzaNode? node) {
if (node == null) return;
storage.store(id, Base64.decode(node.get_string_content()));
- Module.get_module(stream).received_avatar(stream, jid, id);
+ stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
}
}
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
- }
-
public static void require(XmppStream stream) {
- if (get_module(stream) == null) stderr.printf("UserAvatarsModule required but not attached!\n");
+ if (stream.get_module(IDENTITY) == null) stderr.printf("UserAvatarsModule required but not attached!\n");
}
public override string get_ns() { return NS_URI; }
diff --git a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
index 3e92cd44..6dbbb6f6 100644
--- a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
+++ b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
@@ -27,27 +27,23 @@ public class Module : XmppStreamModule {
message.to = jid;
message.type_ = Message.Stanza.TYPE_CHAT;
message.stanza.put_node(new StanzaNode.build(state, NS_URI).add_self_xmlns());
- Message.Module.get_module(stream).send_message(stream, message);
+ stream.get_module(Message.Module.IDENTITY).send_message(stream, message);
}
public override void attach(XmppStream stream) {
ServiceDiscovery.Module.require(stream);
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
- Message.Module.get_module(stream).pre_send_message.connect(on_pre_send_message);
- Message.Module.get_module(stream).received_message.connect(on_received_message);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(on_pre_send_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- Message.Module.get_module(stream).pre_send_message.disconnect(on_pre_send_message);
- Message.Module.get_module(stream).received_message.disconnect(on_received_message);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.disconnect(on_pre_send_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_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; }
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);
diff --git a/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala b/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
index bd0fe98a..b8597d07 100644
--- a/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
+++ b/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
@@ -15,22 +15,18 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
ServiceDiscovery.Module.require(stream);
Message.Module.require(stream);
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
- Message.Module.get_module(stream).received_message.connect(received_message);
- Message.Module.get_module(stream).pre_send_message.connect(pre_send_message);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
+ stream.get_module(Message.Module.IDENTITY).received_message.connect(received_message);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(pre_send_message);
}
public override void detach(XmppStream stream) {
- Message.Module.get_module(stream).received_message.disconnect(received_message);
- Message.Module.get_module(stream).pre_send_message.disconnect(pre_send_message);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).received_message.disconnect(received_message);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.disconnect(pre_send_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; }
@@ -49,7 +45,7 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
Message.Stanza received_message = new Message.Stanza();
received_message.to = message.from;
received_message.stanza.put_node(new StanzaNode.build("received", NS_URI).add_self_xmlns().put_attribute("id", message.id));
- Message.Module.get_module(stream).send_message(stream, received_message);
+ stream.get_module(Message.Module.IDENTITY).send_message(stream, received_message);
}
private void pre_send_message(XmppStream stream, Message.Stanza message) {
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index 800ccfd8..a4157e99 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -12,7 +12,7 @@ namespace Xmpp.Xep.Ping {
public void send_ping(XmppStream stream, string jid, ResponseListener? listener = null) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("ping", NS_URI).add_self_xmlns());
iq.to = jid;
- Iq.Module.get_module(stream).send_iq(stream, iq, listener == null? null : new IqResponseListenerImpl(listener));
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, listener == null? null : new IqResponseListenerImpl(listener));
}
private class IqResponseListenerImpl : Iq.ResponseListener, Object {
@@ -27,17 +27,13 @@ namespace Xmpp.Xep.Ping {
public override void attach(XmppStream stream) {
Iq.Module.require(stream);
- Iq.Module.get_module(stream).register_for_namespace(NS_URI, new IqHandlerImpl());
+ stream.get_module(Iq.Module.IDENTITY).register_for_namespace(NS_URI, new IqHandlerImpl());
}
public override void detach(XmppStream stream) { }
- 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 string get_ns() { return NS_URI; }
@@ -45,7 +41,7 @@ namespace Xmpp.Xep.Ping {
private class IqHandlerImpl : Iq.Handler, Object {
public void on_iq_get(XmppStream stream, Iq.Stanza iq) {
- Iq.Module.get_module(stream).send_iq(stream, new Iq.Stanza.result(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) { }
}
diff --git a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
index 4dd8a0cb..4dbe33ff 100644
--- a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
+++ b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
@@ -24,17 +24,13 @@ namespace Xmpp.Xep.DelayedDelivery {
}
public override void attach(XmppStream 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);
}
public override void detach(XmppStream stream) { }
- 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 string get_ns() { return NS_URI; }
diff --git a/xmpp-vala/src/module/xep/0280_message_carbons.vala b/xmpp-vala/src/module/xep/0280_message_carbons.vala
index 097a4a76..6f11ec05 100644
--- a/xmpp-vala/src/module/xep/0280_message_carbons.vala
+++ b/xmpp-vala/src/module/xep/0280_message_carbons.vala
@@ -9,12 +9,12 @@ namespace Xmpp.Xep.MessageCarbons {
public void enable(XmppStream stream) {
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("enable", NS_URI).add_self_xmlns());
- Iq.Module.get_module(stream).send_iq(stream, iq);
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
public void disable(XmppStream stream) {
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("disable", NS_URI).add_self_xmlns());
- Iq.Module.get_module(stream).send_iq(stream, iq);
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
public override void attach(XmppStream stream) {
@@ -24,21 +24,17 @@ namespace Xmpp.Xep.MessageCarbons {
ServiceDiscovery.Module.require(stream);
stream.stream_negotiated.connect(enable);
- Message.Module.get_module(stream).pre_received_message.connect(pre_received_message);
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
+ stream.get_module(Message.Module.IDENTITY).pre_received_message.connect(pre_received_message);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
}
public override void detach(XmppStream stream) {
stream.stream_negotiated.disconnect(enable);
- Message.Module.get_module(stream).pre_received_message.disconnect(pre_received_message);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).pre_received_message.disconnect(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; }
diff --git a/xmpp-vala/src/module/xep/0333_chat_markers.vala b/xmpp-vala/src/module/xep/0333_chat_markers.vala
index 64388e47..46fb92fa 100644
--- a/xmpp-vala/src/module/xep/0333_chat_markers.vala
+++ b/xmpp-vala/src/module/xep/0333_chat_markers.vala
@@ -22,7 +22,7 @@ public class Module : XmppStreamModule {
received_message.to = jid;
received_message.type_ = type_;
received_message.stanza.put_node(new StanzaNode.build(marker, NS_URI).add_self_xmlns().put_attribute("id", message_id));
- Message.Module.get_module(stream).send_message(stream, received_message);
+ stream.get_module(Message.Module.IDENTITY).send_message(stream, received_message);
}
public static bool requests_marking(Message.Stanza message) {
@@ -35,22 +35,18 @@ public class Module : XmppStreamModule {
Message.Module.require(stream);
ServiceDiscovery.Module.require(stream);
- ServiceDiscovery.Module.get_module(stream).add_feature(stream, NS_URI);
- Message.Module.get_module(stream).pre_send_message.connect(on_pre_send_message);
- Message.Module.get_module(stream).received_message.connect(on_received_message);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.connect(on_pre_send_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- Message.Module.get_module(stream).pre_send_message.disconnect(on_pre_send_message);
- Message.Module.get_module(stream).received_message.disconnect(on_received_message);
- }
-
- public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(IDENTITY);
+ stream.get_module(Message.Module.IDENTITY).pre_send_message.disconnect(on_pre_send_message);
+ stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
}
public static void require(XmppStream stream) {
- if (get_module(stream) == null) stream.add_module(new ChatMarkers.Module());
+ if (stream.get_module(IDENTITY) == null) stream.add_module(new ChatMarkers.Module());
}
public override string get_ns() { return NS_URI; }