aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-10 23:20:36 +0100
committerfiaxh <git@mx.ax.lt>2017-03-10 23:20:36 +0100
commit95e8d126db06a183918b4db4e84013ff28f8b1f7 (patch)
tree05c0d3f6d538a95f984fb6108d7d3938d6731044
parent24b55d83a1f9e21b028c8d5ac9778e75565f417d (diff)
parentd8e102a160f316369c99d3dc2df7d7d54f5bc955 (diff)
downloaddino-95e8d126db06a183918b4db4e84013ff28f8b1f7.tar.gz
dino-95e8d126db06a183918b4db4e84013ff28f8b1f7.zip
Merge branch 'master' of github.com:dino/dino
-rw-r--r--libdino/src/service/avatar_manager.vala4
-rw-r--r--libdino/src/service/counterpart_interaction_manager.vala6
-rw-r--r--libdino/src/service/message_manager.vala2
-rw-r--r--libdino/src/service/module_manager.vala128
-rw-r--r--libdino/src/service/muc_manager.vala4
-rw-r--r--libdino/src/service/pgp_manager.vala3
-rw-r--r--libdino/src/service/presence_manager.vala6
-rw-r--r--libdino/src/service/roster_manager.vala6
-rw-r--r--libdino/src/service/stream_interactor.vala2
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala25
-rw-r--r--xmpp-vala/src/module/bind.vala3
-rw-r--r--xmpp-vala/src/module/iq/module.vala3
-rw-r--r--xmpp-vala/src/module/message/module.vala3
-rw-r--r--xmpp-vala/src/module/presence/module.vala3
-rw-r--r--xmpp-vala/src/module/roster/module.vala3
-rw-r--r--xmpp-vala/src/module/sasl.vala3
-rw-r--r--xmpp-vala/src/module/stream_error.vala3
-rw-r--r--xmpp-vala/src/module/tls.vala3
-rw-r--r--xmpp-vala/src/module/xep/0027_pgp/module.vala3
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/module.vala3
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala3
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/module.vala3
-rw-r--r--xmpp-vala/src/module/xep/0049_private_xml_storage.vala3
-rw-r--r--xmpp-vala/src/module/xep/0054_vcard/module.vala3
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala3
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala3
-rw-r--r--xmpp-vala/src/module/xep/0085_chat_state_notifications.vala3
-rw-r--r--xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala3
-rw-r--r--xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala3
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala3
-rw-r--r--xmpp-vala/src/module/xep/0203_delayed_delivery.vala3
-rw-r--r--xmpp-vala/src/module/xep/0280_message_carbons.vala3
-rw-r--r--xmpp-vala/src/module/xep/0333_chat_markers.vala3
33 files changed, 141 insertions, 114 deletions
diff --git a/libdino/src/service/avatar_manager.vala b/libdino/src/service/avatar_manager.vala
index de44c419..0a141449 100644
--- a/libdino/src/service/avatar_manager.vala
+++ b/libdino/src/service/avatar_manager.vala
@@ -89,10 +89,10 @@ public class AvatarManager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.user_avatars_modules[account].received_avatar.connect((stream, jid, id) =>
+ stream_interactor.module_manager.get_module(account, Xep.UserAvatars.Module.IDENTITY).received_avatar.connect((stream, jid, id) =>
on_user_avatar_received(account, new Jid(jid), id)
);
- stream_interactor.module_manager.vcard_modules[account].received_avatar.connect((stream, jid, id) =>
+ stream_interactor.module_manager.get_module(account, Xep.VCard.Module.IDENTITY).received_avatar.connect((stream, jid, id) =>
on_vcard_avatar_received(account, new Jid(jid), id)
);
diff --git a/libdino/src/service/counterpart_interaction_manager.vala b/libdino/src/service/counterpart_interaction_manager.vala
index 8ea8ba15..221fc4d4 100644
--- a/libdino/src/service/counterpart_interaction_manager.vala
+++ b/libdino/src/service/counterpart_interaction_manager.vala
@@ -44,13 +44,13 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.chat_markers_modules[account].marker_received.connect( (stream, jid, marker, id) => {
+ stream_interactor.module_manager.get_module(account, Xep.ChatMarkers.Module.IDENTITY).marker_received.connect( (stream, jid, marker, id) => {
on_chat_marker_received(account, new Jid(jid), marker, id);
});
- stream_interactor.module_manager.message_delivery_receipts_modules[account].receipt_received.connect((stream, jid, id) => {
+ stream_interactor.module_manager.get_module(account, Xep.MessageDeliveryReceipts.Module.IDENTITY).receipt_received.connect((stream, jid, id) => {
on_receipt_received(account, new Jid(jid), id);
});
- stream_interactor.module_manager.chat_state_notifications_modules[account].chat_state_received.connect((stream, jid, state) => {
+ stream_interactor.module_manager.get_module(account, Xep.ChatStateNotifications.Module.IDENTITY).chat_state_received.connect((stream, jid, state) => {
on_chat_state_received(account, new Jid(jid), state);
});
}
diff --git a/libdino/src/service/message_manager.vala b/libdino/src/service/message_manager.vala
index ec7a35c8..76a05f9e 100644
--- a/libdino/src/service/message_manager.vala
+++ b/libdino/src/service/message_manager.vala
@@ -75,7 +75,7 @@ public class MessageManager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.message_modules[account].received_message.connect( (stream, message) => {
+ stream_interactor.module_manager.get_module(account, Xmpp.Message.Module.IDENTITY).received_message.connect( (stream, message) => {
on_message_received(account, message);
});
stream_interactor.stream_negotiated.connect(send_unsent_messages);
diff --git a/libdino/src/service/module_manager.vala b/libdino/src/service/module_manager.vala
index 5ef93da8..c21e189e 100644
--- a/libdino/src/service/module_manager.vala
+++ b/libdino/src/service/module_manager.vala
@@ -6,90 +6,76 @@ using Xmpp;
namespace Dino {
public class ModuleManager {
-
- public HashMap<Account, Tls.Module> tls_modules = new HashMap<Account, Tls.Module>();
- public HashMap<Account, PlainSasl.Module> plain_sasl_modules = new HashMap<Account, PlainSasl.Module>();
- public HashMap<Account, Bind.Module> bind_modules = new HashMap<Account, Bind.Module>();
- public HashMap<Account, Roster.Module> roster_modules = new HashMap<Account, Roster.Module>();
- public HashMap<Account, Xep.ServiceDiscovery.Module> service_discovery_modules = new HashMap<Account, Xep.ServiceDiscovery.Module>();
- public HashMap<Account, Xep.PrivateXmlStorage.Module> private_xmp_storage_modules = new HashMap<Account, Xep.PrivateXmlStorage.Module>();
- public HashMap<Account, Xep.Bookmarks.Module> bookmarks_module = new HashMap<Account, Xep.Bookmarks.Module>();
- public HashMap<Account, Presence.Module> presence_modules = new HashMap<Account, Presence.Module>();
- public HashMap<Account, Xmpp.Message.Module> message_modules = new HashMap<Account, Xmpp.Message.Module>();
- public HashMap<Account, Xep.MessageCarbons.Module> message_carbons_modules = new HashMap<Account, Xep.MessageCarbons.Module>();
- public HashMap<Account, Xep.Muc.Module> muc_modules = new HashMap<Account, Xep.Muc.Module>();
- public HashMap<Account, Xep.Pgp.Module> pgp_modules = new HashMap<Account, Xep.Pgp.Module>();
- public HashMap<Account, Xep.Pubsub.Module> pubsub_modules = new HashMap<Account, Xep.Pubsub.Module>();
- public HashMap<Account, Xep.EntityCapabilities.Module> entity_capabilities_modules = new HashMap<Account, Xep.EntityCapabilities.Module>();
- public HashMap<Account, Xep.UserAvatars.Module> user_avatars_modules = new HashMap<Account, Xep.UserAvatars.Module>();
- public HashMap<Account, Xep.VCard.Module> vcard_modules = new HashMap<Account, Xep.VCard.Module>();
- public HashMap<Account, Xep.MessageDeliveryReceipts.Module> message_delivery_receipts_modules = new HashMap<Account, Xep.MessageDeliveryReceipts.Module>();
- public HashMap<Account, Xep.ChatStateNotifications.Module> chat_state_notifications_modules = new HashMap<Account, Xep.ChatStateNotifications.Module>();
- public HashMap<Account, Xep.ChatMarkers.Module> chat_markers_modules = new HashMap<Account, Xep.ChatMarkers.Module>();
- public HashMap<Account, Xep.Ping.Module> ping_modules = new HashMap<Account, Xep.Ping.Module>();
- public HashMap<Account, Xep.DelayedDelivery.Module> delayed_delivery_module = new HashMap<Account, Xep.DelayedDelivery.Module>();
- public HashMap<Account, StreamError.Module> stream_error_modules = new HashMap<Account, StreamError.Module>();
+ private HashMap<Account, ArrayList<Core.XmppStreamModule>> module_map = new HashMap<Account, ArrayList<Core.XmppStreamModule>>();
private AvatarStorage avatar_storage = new AvatarStorage("./");
private EntityCapabilitiesStorage entity_capabilities_storage;
+ public signal void initialize_account_modules(Account account, ArrayList<Core.XmppStreamModule> modules);
+
public ModuleManager(Database db) {
entity_capabilities_storage = new EntityCapabilitiesStorage(db);
}
+ public T? get_module<T>(Account account, Core.ModuleIdentity<T> identity) {
+ if (identity == null) return null;
+ lock (module_map) {
+ if (!module_map.has_key(account)) {
+ initialize(account);
+ }
+ var res = module_map[account].filter((module) => identity.matches(module));
+ if (res != null && res.next()) {
+ return identity.cast(res.get());
+ }
+ }
+ return null;
+ }
+
public ArrayList<Core.XmppStreamModule> get_modules(Account account, string? resource = null) {
ArrayList<Core.XmppStreamModule> modules = new ArrayList<Core.XmppStreamModule>();
-
- if (!tls_modules.has_key(account)) add_account(account);
-
- modules.add(tls_modules[account]);
- modules.add(plain_sasl_modules[account]);
- modules.add(new Bind.Module(resource == null ? account.resourcepart : resource));
- modules.add(roster_modules[account]);
- modules.add(service_discovery_modules[account]);
- modules.add(private_xmp_storage_modules[account]);
- modules.add(bookmarks_module[account]);
- modules.add(presence_modules[account]);
- modules.add(message_modules[account]);
- modules.add(message_carbons_modules[account]);
- modules.add(muc_modules[account]);
- modules.add(pgp_modules[account]);
- modules.add(pubsub_modules[account]);
- modules.add(entity_capabilities_modules[account]);
- modules.add(user_avatars_modules[account]);
- modules.add(vcard_modules[account]);
- modules.add(message_delivery_receipts_modules[account]);
- modules.add(chat_state_notifications_modules[account]);
- modules.add(chat_markers_modules[account]);
- modules.add(ping_modules[account]);
- modules.add(delayed_delivery_module[account]);
- modules.add(stream_error_modules[account]);
+ lock (module_map) {
+ if (!module_map.has_key(account)) {
+ initialize(account);
+ }
+ foreach (Core.XmppStreamModule module in module_map[account]) {
+ if (Bind.Module.IDENTITY.matches(module)) {
+ // TODO: argh?!
+ modules.add(new Bind.Module(resource == null ? account.resourcepart : resource));
+ } else {
+ modules.add(module);
+ }
+ }
+ }
return modules;
}
- public void add_account(Account account) {
- tls_modules[account] = new Tls.Module();
- plain_sasl_modules[account] = new PlainSasl.Module(account.bare_jid.to_string(), account.password);
- bind_modules[account] = new Bind.Module(account.resourcepart);
- roster_modules[account] = new Roster.Module();
- service_discovery_modules[account] = new Xep.ServiceDiscovery.Module.with_identity("client", "pc");
- private_xmp_storage_modules[account] = new Xep.PrivateXmlStorage.Module();
- bookmarks_module[account] = new Xep.Bookmarks.Module();
- presence_modules[account] = new Presence.Module();
- message_modules[account] = new Xmpp.Message.Module();
- message_carbons_modules[account] = new Xep.MessageCarbons.Module();
- muc_modules[account] = new Xep.Muc.Module();
- pgp_modules[account] = new Xep.Pgp.Module();
- pubsub_modules[account] = new Xep.Pubsub.Module();
- entity_capabilities_modules[account] = new Xep.EntityCapabilities.Module(entity_capabilities_storage);
- user_avatars_modules[account] = new Xep.UserAvatars.Module(avatar_storage);
- vcard_modules[account] = new Xep.VCard.Module(avatar_storage);
- message_delivery_receipts_modules[account] = new Xep.MessageDeliveryReceipts.Module();
- chat_state_notifications_modules[account] = new Xep.ChatStateNotifications.Module();
- chat_markers_modules[account] = new Xep.ChatMarkers.Module();
- ping_modules[account] = new Xep.Ping.Module();
- delayed_delivery_module[account] = new Xep.DelayedDelivery.Module();
- stream_error_modules[account] = new StreamError.Module();
+ public void initialize(Account account) {
+ lock(module_map) {
+ module_map[account] = new ArrayList<Core.XmppStreamModule>();
+ module_map[account].add(new Tls.Module());
+ module_map[account].add(new PlainSasl.Module(account.bare_jid.to_string(), account.password));
+ module_map[account].add(new Bind.Module(account.resourcepart));
+ module_map[account].add(new Roster.Module());
+ module_map[account].add(new Xep.ServiceDiscovery.Module.with_identity("client", "pc"));
+ module_map[account].add(new Xep.PrivateXmlStorage.Module());
+ module_map[account].add(new Xep.Bookmarks.Module());
+ module_map[account].add(new Presence.Module());
+ module_map[account].add(new Xmpp.Message.Module());
+ module_map[account].add(new Xep.MessageCarbons.Module());
+ module_map[account].add(new Xep.Muc.Module());
+ module_map[account].add(new Xep.Pgp.Module());
+ module_map[account].add(new Xep.Pubsub.Module());
+ module_map[account].add(new Xep.EntityCapabilities.Module(entity_capabilities_storage));
+ module_map[account].add(new Xep.UserAvatars.Module(avatar_storage));
+ module_map[account].add(new Xep.VCard.Module(avatar_storage));
+ module_map[account].add(new Xep.MessageDeliveryReceipts.Module());
+ module_map[account].add(new Xep.ChatStateNotifications.Module());
+ module_map[account].add(new Xep.ChatMarkers.Module());
+ module_map[account].add(new Xep.Ping.Module());
+ module_map[account].add(new Xep.DelayedDelivery.Module());
+ module_map[account].add(new StreamError.Module());
+ initialize_account_modules(account, module_map[account]);
+ }
}
}
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index be23d391..74467077 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -144,10 +144,10 @@ public class MucManager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.muc_modules[account].subject_set.connect( (stream, subject, jid) => {
+ stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).subject_set.connect( (stream, subject, jid) => {
on_subject_set(account, new Jid(jid), subject);
});
- stream_interactor.module_manager.bookmarks_module[account].conferences_updated.connect( (stream, conferences) => {
+ stream_interactor.module_manager.get_module(account, Xep.Bookmarks.Module.IDENTITY).conferences_updated.connect( (stream, conferences) => {
bookmarks_updated(account, conferences);
});
}
diff --git a/libdino/src/service/pgp_manager.vala b/libdino/src/service/pgp_manager.vala
index 6f3b63d7..c8bf2180 100644
--- a/libdino/src/service/pgp_manager.vala
+++ b/libdino/src/service/pgp_manager.vala
@@ -1,5 +1,6 @@
using Gee;
+using Xmpp;
using Dino.Entities;
namespace Dino {
@@ -37,7 +38,7 @@ namespace Dino {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.pgp_modules[account].received_jid_key_id.connect((stream, jid, key_id) => {
+ stream_interactor.module_manager.get_module(account, Xep.Pgp.Module.IDENTITY).received_jid_key_id.connect((stream, jid, key_id) => {
on_jid_key_received(account, new Jid(jid), key_id);
});
}
diff --git a/libdino/src/service/presence_manager.vala b/libdino/src/service/presence_manager.vala
index b89c6570..be1e00fc 100644
--- a/libdino/src/service/presence_manager.vala
+++ b/libdino/src/service/presence_manager.vala
@@ -79,13 +79,13 @@ public class PresenceManager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.presence_modules[account].received_available_show.connect((stream, jid, show) =>
+ stream_interactor.module_manager.get_module(account, Presence.Module.IDENTITY).received_available_show.connect((stream, jid, show) =>
on_received_available_show(account, new Jid(jid), show)
);
- stream_interactor.module_manager.presence_modules[account].received_unavailable.connect((stream, jid) =>
+ stream_interactor.module_manager.get_module(account, Presence.Module.IDENTITY).received_unavailable.connect((stream, jid) =>
on_received_unavailable(account, new Jid(jid))
);
- stream_interactor.module_manager.presence_modules[account].received_subscription_request.connect((stream, jid) =>
+ stream_interactor.module_manager.get_module(account, Presence.Module.IDENTITY).received_subscription_request.connect((stream, jid) =>
received_subscription_request(new Jid(jid), account)
);
}
diff --git a/libdino/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala
index 106405e2..6f6f402a 100644
--- a/libdino/src/service/roster_manager.vala
+++ b/libdino/src/service/roster_manager.vala
@@ -58,13 +58,13 @@ namespace Dino {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.roster_modules[account].received_roster.connect( (stream, roster) => {
+ stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).received_roster.connect( (stream, roster) => {
on_roster_received(account, roster);
});
- stream_interactor.module_manager.roster_modules[account].item_removed.connect( (stream, roster_item) => {
+ stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_removed.connect( (stream, roster_item) => {
removed_roster_item(account, new Jid(roster_item.jid), roster_item);
});
- stream_interactor.module_manager.roster_modules[account].item_updated.connect( (stream, roster_item) => {
+ stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_updated.connect( (stream, roster_item) => {
on_roster_item_updated(account, roster_item);
});
}
diff --git a/libdino/src/service/stream_interactor.vala b/libdino/src/service/stream_interactor.vala
index f3859e3b..5965cdd3 100644
--- a/libdino/src/service/stream_interactor.vala
+++ b/libdino/src/service/stream_interactor.vala
@@ -22,7 +22,7 @@ public class StreamInteractor {
}
public void connect(Account account) {
- module_manager.add_account(account);
+ module_manager.initialize(account);
account_added(account);
connection_manager.connect(account);
}
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index 2cba2b54..38b4abb4 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -126,11 +126,10 @@ public class XmppStream {
foreach (XmppStreamModule module in modules) module.detach(this);
}
- public XmppStreamModule? get_module(string ns, string id) {
+ public T? get_module<T>(ModuleIdentity<T>? identity) {
+ if (identity == null) return null;
foreach (var module in modules) {
- if (module.get_ns() == ns && module.get_id() == id) {
- return module;
- }
+ if (identity.matches(module)) return identity.cast(module);
}
return null;
}
@@ -231,6 +230,24 @@ public abstract class XmppStreamFlag {
public abstract string get_id();
}
+public class ModuleIdentity<T> : Object {
+ public string ns { get; private set; }
+ public string id { get; private set; }
+
+ public ModuleIdentity(string ns, string id) {
+ this.ns = ns;
+ this.id = id;
+ }
+
+ public T? cast(XmppStreamModule module) {
+ return (T?) module;
+ }
+
+ public bool matches(XmppStreamModule module) {
+ return module.get_ns() == ns && module.get_id() == id;
+ }
+}
+
public abstract class XmppStreamModule : Object {
public abstract void attach(XmppStream stream);
public abstract void detach(XmppStream stream);
diff --git a/xmpp-vala/src/module/bind.vala b/xmpp-vala/src/module/bind.vala
index d01fda7a..388a907e 100644
--- a/xmpp-vala/src/module/bind.vala
+++ b/xmpp-vala/src/module/bind.vala
@@ -6,6 +6,7 @@ namespace Xmpp.Bind {
/** The parties to a stream MUST consider resource binding as mandatory-to-negotiate. (RFC6120 7.3.1) */
public class Module : XmppStreamNegotiationModule {
public const string ID = "bind_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
private string requested_resource;
@@ -55,7 +56,7 @@ namespace Xmpp.Bind {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala
index 2e9ffa5d..d5dbdca2 100644
--- a/xmpp-vala/src/module/iq/module.vala
+++ b/xmpp-vala/src/module/iq/module.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Iq {
public class Module : XmppStreamNegotiationModule {
public const string ID = "iq_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
private HashMap<string, ResponseListener> responseListeners = new HashMap<string, ResponseListener>();
private HashMap<string, ArrayList<Handler>> namespaceRegistrants = new HashMap<string, ArrayList<Handler>>();
@@ -38,7 +39,7 @@ namespace Xmpp.Iq {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala
index 10d83693..8aad08df 100644
--- a/xmpp-vala/src/module/message/module.vala
+++ b/xmpp-vala/src/module/message/module.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Message {
public class Module : XmppStreamModule {
public const string ID = "message_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void pre_send_message(XmppStream stream, Message.Stanza message);
public signal void pre_received_message(XmppStream stream, Message.Stanza message);
@@ -27,7 +28,7 @@ namespace Xmpp.Message {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/presence/module.vala b/xmpp-vala/src/module/presence/module.vala
index 6c9d183c..c69f1e3a 100644
--- a/xmpp-vala/src/module/presence/module.vala
+++ b/xmpp-vala/src/module/presence/module.vala
@@ -5,6 +5,7 @@ namespace Xmpp.Presence {
public class Module : XmppStreamModule {
public const string ID = "presence_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_presence(XmppStream stream, Presence.Stanza presence);
public signal void pre_send_presence_stanza(XmppStream stream, Presence.Stanza presence);
@@ -96,7 +97,7 @@ namespace Xmpp.Presence {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/roster/module.vala b/xmpp-vala/src/module/roster/module.vala
index c8b09710..7bf8917c 100644
--- a/xmpp-vala/src/module/roster/module.vala
+++ b/xmpp-vala/src/module/roster/module.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Roster {
public class Module : XmppStreamModule, Iq.Handler {
public const string ID = "roster_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_roster(XmppStream stream, Collection<Item> roster);
public signal void item_removed(XmppStream stream, Item roster_item);
@@ -72,7 +73,7 @@ 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(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/sasl.vala b/xmpp-vala/src/module/sasl.vala
index 07e3f5c4..af9087cd 100644
--- a/xmpp-vala/src/module/sasl.vala
+++ b/xmpp-vala/src/module/sasl.vala
@@ -5,6 +5,7 @@ namespace Xmpp.PlainSasl {
public class Module : XmppStreamNegotiationModule {
public const string ID = "plain_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
private const string MECHANISM = "PLAIN";
private string name;
@@ -89,7 +90,7 @@ namespace Xmpp.PlainSasl {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/stream_error.vala b/xmpp-vala/src/module/stream_error.vala
index 73e2bb36..d47ddc60 100644
--- a/xmpp-vala/src/module/stream_error.vala
+++ b/xmpp-vala/src/module/stream_error.vala
@@ -8,6 +8,7 @@ namespace Xmpp.StreamError {
public class Module : XmppStreamModule {
public const string ID = "stream_error_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public override void attach(XmppStream stream) {
stream.received_nonza.connect(on_received_nonstanza);
@@ -18,7 +19,7 @@ namespace Xmpp.StreamError {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/tls.vala b/xmpp-vala/src/module/tls.vala
index 06535319..0d4a7e73 100644
--- a/xmpp-vala/src/module/tls.vala
+++ b/xmpp-vala/src/module/tls.vala
@@ -5,6 +5,7 @@ namespace Xmpp.Tls {
public class Module : XmppStreamNegotiationModule {
public const string ID = "tls_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public bool require { get; set; default = true; }
public bool server_supports_tls = false;
@@ -67,7 +68,7 @@ namespace Xmpp.Tls {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public override bool mandatory_outstanding(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0027_pgp/module.vala b/xmpp-vala/src/module/xep/0027_pgp/module.vala
index 63177f4d..3fcd6559 100644
--- a/xmpp-vala/src/module/xep/0027_pgp/module.vala
+++ b/xmpp-vala/src/module/xep/0027_pgp/module.vala
@@ -9,6 +9,7 @@ namespace Xmpp.Xep.Pgp {
public class Module : XmppStreamModule {
public const string ID = "0027_current_pgp_usage";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_jid_key_id(XmppStream stream, string jid, string key_id);
@@ -52,7 +53,7 @@ namespace Xmpp.Xep.Pgp {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
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 109da897..163f8cfc 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
@@ -9,6 +9,7 @@ namespace Xmpp.Xep.ServiceDiscovery {
public class Module : XmppStreamModule, Iq.Handler {
public const string ID = "0030_service_discovery_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public ArrayList<Identity> identities = new ArrayList<Identity>();
@@ -83,7 +84,7 @@ namespace Xmpp.Xep.ServiceDiscovery {
public override void detach(XmppStream stream) { }
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index f9ed9539..cb7f0d85 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -30,6 +30,7 @@ public enum MucEnterError {
public class Module : XmppStreamModule {
public const string ID = "0045_muc_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_occupant_affiliation(XmppStream stream, string jid, string? affiliation);
public signal void received_occupant_jid(XmppStream stream, string jid, string? real_jid);
@@ -97,7 +98,7 @@ public class Module : XmppStreamModule {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
index d7767208..25a4678e 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
@@ -7,6 +7,7 @@ private const string NS_URI = "storage:bookmarks";
public class Module : XmppStreamModule {
public const string ID = "0048_bookmarks_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void conferences_updated(XmppStream stream, ArrayList<Conference> conferences);
@@ -110,7 +111,7 @@ public class Module : XmppStreamModule {
public override void detach(XmppStream stream) { }
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
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 c57acdde..0472296c 100644
--- a/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
+++ b/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
@@ -5,6 +5,7 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public class Module : XmppStreamModule {
public const string ID = "0049_private_xml_storage";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public void store(XmppStream stream, StanzaNode node, StoreResponseListener listener) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
@@ -44,7 +45,7 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public override void detach(XmppStream stream) { }
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0054_vcard/module.vala b/xmpp-vala/src/module/xep/0054_vcard/module.vala
index 58b71d2c..d0b23db5 100644
--- a/xmpp-vala/src/module/xep/0054_vcard/module.vala
+++ b/xmpp-vala/src/module/xep/0054_vcard/module.vala
@@ -6,6 +6,7 @@ private const string NS_URI_UPDATE = NS_URI + ":x:update";
public class Module : XmppStreamModule {
public const string ID = "0027_current_pgp_usage";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_avatar(XmppStream stream, string jid, string id);
@@ -26,7 +27,7 @@ public class Module : XmppStreamModule {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index 600ddded..f9379c45 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -8,6 +8,7 @@ namespace Xmpp.Xep.Pubsub {
public class Module : XmppStreamModule {
public const string ID = "0060_pubsub_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
private HashMap<string, EventListenerDelegate> event_listeners = new HashMap<string, EventListenerDelegate>();
@@ -70,7 +71,7 @@ namespace Xmpp.Xep.Pubsub {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index 575b5d78..3654509c 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Xep.UserAvatars {
public class Module : XmppStreamModule {
public const string ID = "0084_user_avatars";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void received_avatar(XmppStream stream, string jid, string id);
@@ -73,7 +74,7 @@ namespace Xmpp.Xep.UserAvatars {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
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 cefc7a18..3e92cd44 100644
--- a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
+++ b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
@@ -15,6 +15,7 @@ private const string[] STATES = {STATE_ACTIVE, STATE_INACTIVE, STATE_GONE, STATE
public class Module : XmppStreamModule {
public const string ID = "0085_chat_state_notifications";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void chat_state_received(XmppStream stream, string jid, string state);
@@ -42,7 +43,7 @@ public class Module : XmppStreamModule {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
index 472eb9bd..c39f9cad 100644
--- a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
+++ b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Xep.EntityCapabilities {
public class Module : XmppStreamModule {
public const string ID = "0115_entity_capabilities";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
private string own_ver_hash;
private Storage storage;
@@ -36,7 +37,7 @@ namespace Xmpp.Xep.EntityCapabilities {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
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 489592fa..bd0fe98a 100644
--- a/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
+++ b/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
public class Module : XmppStreamModule {
public const string ID = "0184_message_delivery_receipts";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void receipt_received(XmppStream stream, string jid, string id);
@@ -25,7 +26,7 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index 82da1d23..800ccfd8 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -7,6 +7,7 @@ namespace Xmpp.Xep.Ping {
public class Module : XmppStreamModule {
public const string ID = "0199_ping";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
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());
@@ -32,7 +33,7 @@ namespace Xmpp.Xep.Ping {
public override void detach(XmppStream stream) { }
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
index 9f9761f2..4dd8a0cb 100644
--- a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
+++ b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
@@ -5,6 +5,7 @@ namespace Xmpp.Xep.DelayedDelivery {
public class Module : XmppStreamModule {
public const string ID = "0203_delayed_delivery";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public static void set_message_delay(Message.Stanza message, DateTime datetime) {
StanzaNode delay_node = (new StanzaNode.build("delay", NS_URI)).add_self_xmlns();
@@ -29,7 +30,7 @@ namespace Xmpp.Xep.DelayedDelivery {
public override void detach(XmppStream stream) { }
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0280_message_carbons.vala b/xmpp-vala/src/module/xep/0280_message_carbons.vala
index 18b2ecdf..097a4a76 100644
--- a/xmpp-vala/src/module/xep/0280_message_carbons.vala
+++ b/xmpp-vala/src/module/xep/0280_message_carbons.vala
@@ -5,6 +5,7 @@ namespace Xmpp.Xep.MessageCarbons {
public class Module : XmppStreamModule {
public const string ID = "0280_message_carbons_module";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public void enable(XmppStream stream) {
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("enable", NS_URI).add_self_xmlns());
@@ -33,7 +34,7 @@ namespace Xmpp.Xep.MessageCarbons {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0333_chat_markers.vala b/xmpp-vala/src/module/xep/0333_chat_markers.vala
index 0dc0e637..64388e47 100644
--- a/xmpp-vala/src/module/xep/0333_chat_markers.vala
+++ b/xmpp-vala/src/module/xep/0333_chat_markers.vala
@@ -13,6 +13,7 @@ private const string[] MARKERS = {MARKER_RECEIVED, MARKER_DISPLAYED, MARKER_ACKN
public class Module : XmppStreamModule {
public const string ID = "0333_chat_markers";
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, ID);
public signal void marker_received(XmppStream stream, string jid, string marker, string id);
@@ -45,7 +46,7 @@ public class Module : XmppStreamModule {
}
public static Module? get_module(XmppStream stream) {
- return (Module?) stream.get_module(NS_URI, ID);
+ return (Module?) stream.get_module(IDENTITY);
}
public static void require(XmppStream stream) {