aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r--xmpp-vala/src/module/xep/0004_data_forms.vala2
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/flag.vala20
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/info_result.vala2
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/item.vala4
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala4
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/module.vala8
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/flag.vala119
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala101
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/conference.vala13
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks/module.vala16
-rw-r--r--xmpp-vala/src/module/xep/0049_private_xml_storage.vala4
-rw-r--r--xmpp-vala/src/module/xep/0054_vcard/module.vala8
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala16
-rw-r--r--xmpp-vala/src/module/xep/0066_out_of_band_data.vala6
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala8
-rw-r--r--xmpp-vala/src/module/xep/0085_chat_state_notifications.vala28
-rw-r--r--xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala2
-rw-r--r--xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala28
-rw-r--r--xmpp-vala/src/module/xep/0191_blocking_command.vala2
-rw-r--r--xmpp-vala/src/module/xep/0198_stream_management.vala2
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala4
-rw-r--r--xmpp-vala/src/module/xep/0203_delayed_delivery.vala94
-rw-r--r--xmpp-vala/src/module/xep/0280_message_carbons.vala96
-rw-r--r--xmpp-vala/src/module/xep/0313_message_archive_management.vala22
-rw-r--r--xmpp-vala/src/module/xep/0333_chat_markers.vala30
-rw-r--r--xmpp-vala/src/module/xep/0368_srv_records_tls.vala6
26 files changed, 313 insertions, 332 deletions
diff --git a/xmpp-vala/src/module/xep/0004_data_forms.vala b/xmpp-vala/src/module/xep/0004_data_forms.vala
index 57ff834a..69c14b08 100644
--- a/xmpp-vala/src/module/xep/0004_data_forms.vala
+++ b/xmpp-vala/src/module/xep/0004_data_forms.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.DataForms {
public const string NS_URI = "jabber:x:data";
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala b/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala
index 4f3e5eea..4661fede 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/flag.vala
@@ -1,22 +1,20 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ServiceDiscovery {
public class Flag : XmppStreamFlag {
public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "service_discovery");
- private HashMap<string, Gee.List<string>?> entity_features = new HashMap<string, Gee.List<string>?>();
- private HashMap<string, Gee.List<Identity>?> entity_identities = new HashMap<string, Gee.List<Identity>?>();
- private HashMap<string, Gee.List<Item>?> entity_items = new HashMap<string, Gee.List<Item>?>();
+ private HashMap<Jid, Gee.List<string>?> entity_features = new HashMap<Jid, Gee.List<string>?>(Jid.hash_func, Jid.equals_func);
+ private HashMap<Jid, Gee.List<Identity>?> entity_identities = new HashMap<Jid, Gee.List<Identity>?>(Jid.hash_func, Jid.equals_func);
+ private HashMap<Jid, Gee.List<Item>?> entity_items = new HashMap<Jid, Gee.List<Item>?>(Jid.hash_func, Jid.equals_func);
public Gee.List<string> features = new ArrayList<string>();
- public Gee.List<Identity>? get_entity_categories(string jid) {
+ public Gee.List<Identity>? get_entity_categories(Jid jid) {
return entity_identities.has_key(jid) ? entity_identities[jid] : null; // TODO isn’t this default for hashmap
}
- public bool? has_entity_identity(string jid, string category, string type) {
+ public bool? has_entity_identity(Jid jid, string category, string type) {
if (!entity_identities.has_key(jid)) return null;
if (entity_identities[jid] == null) return false;
foreach (Identity identity in entity_identities[jid]) {
@@ -25,21 +23,21 @@ public class Flag : XmppStreamFlag {
return false;
}
- public bool? has_entity_feature(string jid, string feature) {
+ public bool? has_entity_feature(Jid jid, string feature) {
if (!entity_features.has_key(jid)) return null;
if (entity_features[jid] == null) return false;
return entity_features[jid].contains(feature);
}
- public void set_entity_identities(string jid, Gee.List<Identity>? identities) {
+ public void set_entity_identities(Jid jid, Gee.List<Identity>? identities) {
entity_identities[jid] = identities;
}
- public void set_entity_features(string jid, Gee.List<string>? features) {
+ public void set_entity_features(Jid jid, Gee.List<string>? features) {
entity_features[jid] = features;
}
- public void set_entity_items(string jid, Gee.List<Item>? features) {
+ public void set_entity_items(Jid jid, Gee.List<Item>? features) {
entity_items[jid] = features;
}
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 ca0fba5b..dc7f1e48 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
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ServiceDiscovery {
public class InfoResult {
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/item.vala b/xmpp-vala/src/module/xep/0030_service_discovery/item.vala
index 9d8f1f3e..84445db0 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/item.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/item.vala
@@ -1,11 +1,11 @@
namespace Xmpp.Xep.ServiceDiscovery {
public class Item {
- public string jid;
+ public Jid jid;
public string? name;
public string? node;
- public Item(string jid, string? name = null, string? node = null) {
+ public Item(Jid jid, string? name = null, string? node = null) {
this.jid = jid;
this.name = name;
this.node = node;
diff --git a/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala b/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
index 52de5efc..16a9f5ec 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/items_result.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ServiceDiscovery {
public class ItemsResult {
@@ -11,7 +9,7 @@ public class ItemsResult {
owned get {
ArrayList<Item> ret = new ArrayList<Item>();
foreach (StanzaNode feature_node in iq.stanza.get_subnode("query", NS_URI_ITEMS).get_subnodes("item", NS_URI_ITEMS)) {
- ret.add(new Item(feature_node.get_attribute("jid", NS_URI_ITEMS),
+ ret.add(new Item(Jid.parse(feature_node.get_attribute("jid", NS_URI_ITEMS)),
feature_node.get_attribute("name", NS_URI_ITEMS),
feature_node.get_attribute("node", NS_URI_ITEMS)));
}
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 011a1f36..2b955738 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ServiceDiscovery {
private const string NS_URI = "http://jabber.org/protocol/disco";
@@ -30,7 +28,7 @@ public class Module : XmppStreamModule, Iq.Handler {
}
public delegate void HasEntryCategoryRes(XmppStream stream, Gee.List<Identity>? identities);
- public void get_entity_categories(XmppStream stream, string jid, owned HasEntryCategoryRes listener) {
+ public void get_entity_categories(XmppStream stream, Jid jid, owned HasEntryCategoryRes listener) {
Gee.List<Identity>? res = stream.get_flag(Flag.IDENTITY).get_entity_categories(jid);
if (res != null) listener(stream, res);
request_info(stream, jid, (stream, query_result) => {
@@ -39,7 +37,7 @@ public class Module : XmppStreamModule, Iq.Handler {
}
public delegate void OnInfoResult(XmppStream stream, InfoResult? query_result);
- public void request_info(XmppStream stream, string jid, owned OnInfoResult listener) {
+ public void request_info(XmppStream stream, Jid jid, owned OnInfoResult listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_INFO).add_self_xmlns());
iq.to = jid;
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, (stream, iq) => {
@@ -51,7 +49,7 @@ public class Module : XmppStreamModule, Iq.Handler {
}
public delegate void OnItemsResult(XmppStream stream, ItemsResult query_result);
- public void request_items(XmppStream stream, string jid, owned OnItemsResult listener) {
+ public void request_items(XmppStream stream, Jid jid, owned OnItemsResult listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_ITEMS).add_self_xmlns());
iq.to = jid;
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, (stream, iq) => {
diff --git a/xmpp-vala/src/module/xep/0045_muc/flag.vala b/xmpp-vala/src/module/xep/0045_muc/flag.vala
index da469a41..87e0930f 100644
--- a/xmpp-vala/src/module/xep/0045_muc/flag.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/flag.vala
@@ -1,128 +1,123 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Muc {
public class Flag : XmppStreamFlag {
public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "muc");
- private HashMap<string, Gee.List<Feature>> room_features = new HashMap<string, Gee.List<Feature>>();
- private HashMap<string, string> room_names = new HashMap<string, string>();
+ private HashMap<Jid, Gee.List<Feature>> room_features = new HashMap<Jid, Gee.List<Feature>>(Jid.hash_bare_func, Jid.equals_bare_func);
+ private HashMap<Jid, string> room_names = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
- private HashMap<string, string> enter_ids = new HashMap<string, string>();
- private HashMap<string, string> own_nicks = new HashMap<string, string>();
- private HashMap<string, string> subjects = new HashMap<string, string>();
- private HashMap<string, string> subjects_by = new HashMap<string, string>();
+ private HashMap<Jid, string> enter_ids = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
+ private HashMap<Jid, string> own_nicks = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
+ private HashMap<Jid, string> subjects = new HashMap<Jid, string>(Jid.hash_bare_func, Jid.equals_bare_func);
+ private HashMap<Jid, Jid> subjects_by = new HashMap<Jid, Jid>(Jid.hash_bare_func, Jid.equals_bare_func);
- private HashMap<string, string> occupant_real_jids = new HashMap<string, string>();
- private HashMap<string, HashMap<string, Affiliation>> affiliations = new HashMap<string, HashMap<string, Affiliation>>();
- private HashMap<string, Role> occupant_role = new HashMap<string, Role>();
+ private HashMap<Jid, Jid> occupant_real_jids = new HashMap<Jid, Jid>(Jid.hash_func, Jid.equals_bare_func);
+ private HashMap<Jid, HashMap<Jid, Affiliation>> affiliations = new HashMap<Jid, HashMap<Jid, Affiliation>>(Jid.hash_bare_func, Jid.equals_bare_func);
+ private HashMap<Jid, Role> occupant_role = new HashMap<Jid, Role>(Jid.hash_func, Jid.equals_func);
- public string? get_room_name(string jid) { return room_names.has_key(jid) ? room_names[jid] : null; }
+ public string? get_room_name(Jid muc_jid) { return room_names.has_key(muc_jid.bare_jid) ? room_names[muc_jid.bare_jid] : null; }
- public bool has_room_feature(string jid, Feature feature) {
- return room_features.has_key(jid) && room_features[jid].contains(feature);
+ public bool has_room_feature(Jid muc_jid, Feature feature) {
+ return room_features.has_key(muc_jid.bare_jid) && room_features[muc_jid.bare_jid].contains(feature);
}
- public string? get_real_jid(string full_jid) { return occupant_real_jids[full_jid]; }
+ public Jid? get_real_jid(Jid full_jid) { return occupant_real_jids[full_jid]; }
- public Gee.List<string> get_offline_members(string muc_jid) {
- Gee.List<string> ret = new ArrayList<string>();
- HashMap<string, Affiliation>? muc_affiliations = affiliations[muc_jid];
+ public Gee.List<Jid> get_offline_members(Jid muc_jid) {
+ Gee.List<Jid> ret = new ArrayList<Jid>(Jid.equals_func);
+ HashMap<Jid, Affiliation>? muc_affiliations = affiliations[muc_jid.bare_jid];
if (muc_affiliations != null) {
- foreach (string jid in muc_affiliations.keys) {
- if (!jid.has_prefix(muc_jid)) ret.add(jid);
+ foreach (Jid jid in muc_affiliations.keys) {
+ if (!jid.equals_bare(muc_jid)) ret.add(jid);
}
}
return ret;
}
- public Affiliation get_affiliation(string muc_jid, string full_jid) {
- HashMap<string, Affiliation>? muc_affiliations = affiliations[muc_jid];
+ public Affiliation get_affiliation(Jid muc_jid, Jid full_jid) {
+ HashMap<Jid, Affiliation>? muc_affiliations = affiliations[muc_jid.bare_jid];
if (muc_affiliations != null) return muc_affiliations[full_jid];
return Affiliation.NONE;
}
- public Role? get_occupant_role(string full_jid) {
+ public Role? get_occupant_role(Jid full_jid) {
if (occupant_role.has_key(full_jid)) return occupant_role[full_jid];
return Role.NONE;
}
- public string? get_muc_nick(string bare_jid) { return own_nicks[bare_jid]; }
+ public string? get_muc_nick(Jid muc_jid) { return own_nicks[muc_jid.bare_jid]; }
- public string? get_enter_id(string bare_jid) { return enter_ids[bare_jid]; }
+ public string? get_enter_id(Jid muc_jid) { return enter_ids[muc_jid.bare_jid]; }
- public bool is_muc(string jid) { return own_nicks[jid] != null; }
+ public bool is_muc(Jid jid) { return own_nicks[jid] != null; }
- public bool is_occupant(string jid) {
- string bare_jid = get_bare_jid(jid);
- return own_nicks.has_key(bare_jid) || enter_ids.has_key(bare_jid);
+ public bool is_occupant(Jid jid) {
+ return own_nicks.has_key(jid.bare_jid) || enter_ids.has_key(jid.bare_jid);
}
public bool is_muc_enter_outstanding() { return enter_ids.size != 0; }
- public string? get_muc_subject(string bare_jid) { return subjects[bare_jid]; }
+ public string? get_muc_subject(Jid muc_jid) { return subjects[muc_jid.bare_jid]; }
- internal void set_room_name(string jid, string name) {
- room_names[jid] = name;
+ internal void set_room_name(Jid muc_jid, string name) {
+ room_names[muc_jid.bare_jid] = name;
}
- internal void set_room_features(string jid, Gee.List<Feature> features) {
- room_features[jid] = features;
+ internal void set_room_features(Jid muc_jid, Gee.List<Feature> features) {
+ room_features[muc_jid.bare_jid] = features;
}
- internal void set_real_jid(string full_jid, string real_jid) { occupant_real_jids[full_jid] = real_jid; }
+ internal void set_real_jid(Jid full_jid, Jid real_jid) { occupant_real_jids[full_jid] = real_jid; }
- internal void set_offline_member(string muc_jid, string real_jid, Affiliation affiliation) {
- set_affiliation(muc_jid, real_jid, affiliation);
+ internal void set_offline_member(Jid muc_jid, Jid real_jid, Affiliation affiliation) {
+ set_affiliation(muc_jid.bare_jid, real_jid, affiliation);
}
- internal void set_affiliation(string muc_jid, string full_jid, Affiliation affiliation) {
- if (!affiliations.has_key(muc_jid)) affiliations[muc_jid] = new HashMap<string, Affiliation>();
+ internal void set_affiliation(Jid muc_jid, Jid full_jid, Affiliation affiliation) {
+ if (!affiliations.has_key(muc_jid.bare_jid)) affiliations[muc_jid.bare_jid] = new HashMap<Jid, Affiliation>(Jid.hash_func, Jid.equals_func);
if (affiliation == Affiliation.NONE) {
- affiliations[muc_jid].unset(full_jid);
+ affiliations[muc_jid.bare_jid].unset(full_jid);
} else {
- affiliations[muc_jid][full_jid] = affiliation;
+ affiliations[muc_jid.bare_jid][full_jid] = affiliation;
}
}
- internal void set_occupant_role(string full_jid, Role role) {
+ internal void set_occupant_role(Jid full_jid, Role role) {
occupant_role[full_jid] = role;
}
- internal void set_muc_subject(string full_jid, string? subject) {
- string bare_jid = get_bare_jid(full_jid);
- subjects[bare_jid] = subject;
- subjects_by[bare_jid] = full_jid;
+ internal void set_muc_subject(Jid full_jid, string? subject) {
+ subjects[full_jid.bare_jid] = subject;
+ subjects_by[full_jid.bare_jid] = full_jid;
}
- internal void start_muc_enter(string bare_jid, string presence_id) {
- enter_ids[bare_jid] = presence_id;
+ internal void start_muc_enter(Jid jid, string presence_id) {
+ enter_ids[jid.bare_jid] = presence_id;
}
- internal void finish_muc_enter(string bare_jid, string? nick = null) {
- if (nick != null) own_nicks[bare_jid] = nick;
- enter_ids.unset(bare_jid);
+ internal void finish_muc_enter(Jid jid, string? nick = null) {
+ if (nick != null) own_nicks[jid.bare_jid] = nick;
+ enter_ids.unset(jid.bare_jid);
}
- internal void left_muc(XmppStream stream, string muc) {
- own_nicks.unset(muc);
- subjects.unset(muc);
- subjects_by.unset(muc);
- Gee.List<string>? occupants = stream.get_flag(Presence.Flag.IDENTITY).get_resources(muc);
+ internal void left_muc(XmppStream stream, Jid muc_jid) {
+ own_nicks.unset(muc_jid);
+ subjects.unset(muc_jid);
+ subjects_by.unset(muc_jid);
+ Gee.List<Jid>? occupants = stream.get_flag(Presence.Flag.IDENTITY).get_resources(muc_jid);
if (occupants != null) {
- foreach (string occupant in occupants) {
+ foreach (Jid occupant in occupants) {
remove_occupant_info(occupant);
}
}
}
- internal void remove_occupant_info(string full_jid) {
- occupant_real_jids.unset(full_jid);
- string bare_jid = get_bare_jid(full_jid);
- if (affiliations.has_key(full_jid)) affiliations[bare_jid].unset(full_jid);
- occupant_role.unset(full_jid);
+ internal void remove_occupant_info(Jid jid) {
+ occupant_real_jids.unset(jid);
+ if (affiliations.has_key(jid)) affiliations[jid].unset(jid);
+ occupant_role.unset(jid);
}
internal override string get_ns() { return NS_URI; }
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index faaf1901..f0ae0ed6 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Muc {
private const string NS_URI = "http://jabber.org/protocol/muc";
@@ -58,20 +56,20 @@ public enum Feature {
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0045_muc_module");
- public signal void received_occupant_affiliation(XmppStream stream, string jid, Affiliation? affiliation);
- public signal void received_occupant_jid(XmppStream stream, string jid, string? real_jid);
- public signal void received_occupant_role(XmppStream stream, string jid, Role? role);
- public signal void subject_set(XmppStream stream, string subject, string jid);
- public signal void room_configuration_changed(XmppStream stream, string jid, StatusCode code);
+ public signal void received_occupant_affiliation(XmppStream stream, Jid jid, Affiliation? affiliation);
+ public signal void received_occupant_jid(XmppStream stream, Jid jid, Jid? real_jid);
+ public signal void received_occupant_role(XmppStream stream, Jid jid, Role? role);
+ public signal void subject_set(XmppStream stream, string? subject, Jid jid);
+ public signal void room_configuration_changed(XmppStream stream, Jid jid, StatusCode code);
- public signal void room_entered(XmppStream stream, string jid, string nick);
- public signal void room_enter_error(XmppStream stream, string jid, MucEnterError? error); // TODO "?" shoudln't be necessary (vala bug), remove someday
- public signal void self_removed_from_room(XmppStream stream, string jid, StatusCode code);
- public signal void removed_from_room(XmppStream stream, string jid, StatusCode? code);
+ public signal void room_entered(XmppStream stream, Jid jid, string nick);
+ public signal void room_enter_error(XmppStream stream, Jid jid, MucEnterError? error); // TODO "?" shoudln't be necessary (vala bug), remove someday
+ public signal void self_removed_from_room(XmppStream stream, Jid jid, StatusCode code);
+ public signal void removed_from_room(XmppStream stream, Jid jid, StatusCode? code);
- public void enter(XmppStream stream, string bare_jid, string nick, string? password, DateTime? history_since) {
+ public void enter(XmppStream stream, Jid bare_jid, string nick, string? password, DateTime? history_since) {
Presence.Stanza presence = new Presence.Stanza();
- presence.to = bare_jid + "/" + nick;
+ presence.to = bare_jid.with_resource(nick);
StanzaNode x_node = new StanzaNode.build("x", NS_URI).add_self_xmlns();
if (password != null) {
x_node.put_node(new StanzaNode.build("password", NS_URI).put_node(new StanzaNode.text(password)));
@@ -89,47 +87,47 @@ public class Module : XmppStreamModule {
stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
- public void exit(XmppStream stream, string jid) {
+ public void exit(XmppStream stream, Jid jid) {
string nick = stream.get_flag(Flag.IDENTITY).get_muc_nick(jid);
Presence.Stanza presence = new Presence.Stanza();
- presence.to = jid + "/" + nick;
+ presence.to = jid.with_resource(nick);
presence.type_ = Presence.Stanza.TYPE_UNAVAILABLE;
stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
- public void change_subject(XmppStream stream, string jid, string subject) {
- Message.Stanza message = new Message.Stanza();
+ public void change_subject(XmppStream stream, Jid jid, string subject) {
+ MessageStanza message = new MessageStanza();
message.to = jid;
- message.type_ = Message.Stanza.TYPE_GROUPCHAT;
+ message.type_ = MessageStanza.TYPE_GROUPCHAT;
message.stanza.put_node((new StanzaNode.build("subject")).put_node(new StanzaNode.text(subject)));
- stream.get_module(Message.Module.IDENTITY).send_message(stream, message);
+ stream.get_module(MessageModule.IDENTITY).send_message(stream, message);
}
- public void change_nick(XmppStream stream, string jid, string new_nick) {
+ public void change_nick(XmppStream stream, Jid jid, string new_nick) {
Presence.Stanza presence = new Presence.Stanza();
- presence.to = jid + "/" + new_nick;
+ presence.to = jid.with_resource(new_nick);
stream.get_module(Presence.Module.IDENTITY).send_presence(stream, presence);
}
- public void invite(XmppStream stream, string to_muc, string jid) {
- Message.Stanza message = new Message.Stanza();
+ public void invite(XmppStream stream, Jid to_muc, Jid jid) {
+ MessageStanza message = new MessageStanza();
message.to = to_muc;
StanzaNode invite_node = new StanzaNode.build("x", NS_URI_USER).add_self_xmlns()
- .put_node(new StanzaNode.build("invite", NS_URI_USER).put_attribute("to", jid));
+ .put_node(new StanzaNode.build("invite", NS_URI_USER).put_attribute("to", jid.to_string()));
message.stanza.put_node(invite_node);
- stream.get_module(Message.Module.IDENTITY).send_message(stream, message);
+ stream.get_module(MessageModule.IDENTITY).send_message(stream, message);
}
- public void kick(XmppStream stream, string jid, string nick) {
+ public void kick(XmppStream stream, Jid jid, string nick) {
change_role(stream, jid, nick, "none");
}
/* XEP 0046: "A user cannot be kicked by a moderator with a lower affiliation." (XEP 0045 8.2) */
- public bool kick_possible(XmppStream stream, string occupant) {
- string muc_jid = get_bare_jid(occupant);
+ public bool kick_possible(XmppStream stream, Jid occupant) {
+ Jid muc_jid = occupant.bare_jid;
Flag flag = stream.get_flag(Flag.IDENTITY);
string own_nick = flag.get_muc_nick(muc_jid);
- Affiliation my_affiliation = flag.get_affiliation(muc_jid, muc_jid + "/" + own_nick);
+ Affiliation my_affiliation = flag.get_affiliation(muc_jid, muc_jid.with_resource(own_nick));
Affiliation other_affiliation = flag.get_affiliation(muc_jid, occupant);
switch (my_affiliation) {
case Affiliation.MEMBER:
@@ -142,22 +140,22 @@ public class Module : XmppStreamModule {
return true;
}
- public void change_role(XmppStream stream, string jid, string nick, string new_role) {
+ public void change_role(XmppStream stream, Jid jid, string nick, string new_role) {
StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns();
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) { to=jid };
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
- public void change_affiliation(XmppStream stream, string jid, string nick, string new_affiliation) {
+ public void change_affiliation(XmppStream stream, Jid jid, string nick, string new_affiliation) {
StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns();
query.put_node(new StanzaNode.build("item", NS_URI_ADMIN).put_attribute("nick", nick, NS_URI_ADMIN).put_attribute("affiliation", new_affiliation, NS_URI_ADMIN));
Iq.Stanza iq = new Iq.Stanza.set(query) { to=jid };
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
- public delegate void OnConfigFormResult(XmppStream stream, string jid, DataForms.DataForm data_form);
- public void get_config_form(XmppStream stream, string jid, owned OnConfigFormResult listener) {
+ public delegate void OnConfigFormResult(XmppStream stream, Jid jid, DataForms.DataForm data_form);
+ public void get_config_form(XmppStream stream, Jid jid, owned OnConfigFormResult listener) {
Iq.Stanza get_iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_OWNER).add_self_xmlns()) { to=jid };
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, get_iq, (stream, form_iq) => {
StanzaNode? x_node = form_iq.stanza.get_deep_subnode(NS_URI_OWNER + ":query", DataForms.NS_URI + ":x");
@@ -176,7 +174,7 @@ public class Module : XmppStreamModule {
public override void attach(XmppStream stream) {
stream.add_flag(new Muc.Flag());
- stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).received_message.connect(on_received_message);
stream.get_module(Presence.Module.IDENTITY).received_presence.connect(check_for_enter_error);
stream.get_module(Presence.Module.IDENTITY).received_available.connect(on_received_available);
stream.get_module(Presence.Module.IDENTITY).received_unavailable.connect(on_received_unavailable);
@@ -192,7 +190,7 @@ public class Module : XmppStreamModule {
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).received_message.disconnect(on_received_message);
stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(check_for_enter_error);
stream.get_module(Presence.Module.IDENTITY).received_available.disconnect(on_received_available);
stream.get_module(Presence.Module.IDENTITY).received_unavailable.disconnect(on_received_unavailable);
@@ -201,8 +199,8 @@ public class Module : XmppStreamModule {
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void on_received_message(XmppStream stream, Message.Stanza message) {
- if (message.type_ == Message.Stanza.TYPE_GROUPCHAT) {
+ private void on_received_message(XmppStream stream, MessageStanza message) {
+ if (message.type_ == MessageStanza.TYPE_GROUPCHAT) {
StanzaNode? subject_node = message.stanza.get_subnode("subject");
if (subject_node != null) {
string subject = subject_node.get_string_content();
@@ -215,7 +213,7 @@ public class Module : XmppStreamModule {
private void check_for_enter_error(XmppStream stream, Presence.Stanza presence) {
Flag flag = stream.get_flag(Flag.IDENTITY);
if (presence.is_error() && flag.is_muc_enter_outstanding() && flag.is_occupant(presence.from)) {
- string bare_jid = get_bare_jid(presence.from);
+ Jid bare_jid = presence.from.bare_jid;
ErrorStanza? error_stanza = presence.get_error();
if (flag.get_enter_id(bare_jid) == presence.id) {
MucEnterError error = MucEnterError.NONE;
@@ -258,20 +256,21 @@ public class Module : XmppStreamModule {
if (x_node != null) {
ArrayList<int> status_codes = get_status_codes(x_node);
if (status_codes.contains(StatusCode.SELF_PRESENCE)) {
- string bare_jid = get_bare_jid(presence.from);
+ Jid bare_jid = presence.from.bare_jid;
if (flag.get_enter_id(bare_jid) != null) {
- room_entered(stream, bare_jid, get_resource_part(presence.from));
- flag.finish_muc_enter(bare_jid, get_resource_part(presence.from));
+ room_entered(stream, bare_jid, presence.from.resourcepart);
+ flag.finish_muc_enter(bare_jid, presence.from.resourcepart);
}
}
string? affiliation_str = x_node.get_deep_attribute("item", "affiliation");
if (affiliation_str != null) {
Affiliation affiliation = parse_affiliation(affiliation_str);
- flag.set_affiliation(get_bare_jid(presence.from), presence.from, affiliation);
+ flag.set_affiliation(presence.from.bare_jid, presence.from, affiliation);
received_occupant_affiliation(stream, presence.from, affiliation);
}
- string? jid = x_node.get_deep_attribute("item", "jid");
- if (jid != null) {
+ string? jid_ = x_node.get_deep_attribute("item", "jid");
+ if (jid_ != null) {
+ Jid? jid = Jid.parse(jid_);
flag.set_real_jid(presence.from, jid);
received_occupant_jid(stream, presence.from, jid);
}
@@ -301,10 +300,10 @@ public class Module : XmppStreamModule {
foreach (StatusCode code in USER_REMOVED_CODES) {
if (code in status_codes) {
if (StatusCode.SELF_PRESENCE in status_codes) {
- flag.left_muc(stream, get_bare_jid(presence.from));
+ flag.left_muc(stream, presence.from.bare_jid);
self_removed_from_room(stream, presence.from, code);
Presence.Flag presence_flag = stream.get_flag(Presence.Flag.IDENTITY);
- presence_flag.remove_presence(get_bare_jid(presence.from));
+ presence_flag.remove_presence(presence.from.bare_jid);
} else {
removed_from_room(stream, presence.from, code);
}
@@ -312,7 +311,7 @@ public class Module : XmppStreamModule {
}
}
- private void query_room_info(XmppStream stream, string jid) {
+ private void query_room_info(XmppStream stream, Jid jid) {
stream.get_module(ServiceDiscovery.Module.IDENTITY).request_info(stream, jid, (stream, query_result) => {
Gee.List<Feature> features = new ArrayList<Feature>();
@@ -351,8 +350,8 @@ public class Module : XmppStreamModule {
});
}
- public delegate void OnAffiliationResult(XmppStream stream, Gee.List<string> jids);
- private void query_affiliation(XmppStream stream, string jid, string affiliation, owned OnAffiliationResult? listener) {
+ public delegate void OnAffiliationResult(XmppStream stream, Gee.List<Jid> jids);
+ private void query_affiliation(XmppStream stream, Jid jid, string affiliation, owned OnAffiliationResult? listener) {
Iq.Stanza iq = new Iq.Stanza.get(
new StanzaNode.build("query", NS_URI_ADMIN)
.add_self_xmlns()
@@ -364,9 +363,9 @@ public class Module : XmppStreamModule {
StanzaNode? query_node = iq.stanza.get_subnode("query", NS_URI_ADMIN);
if (query_node == null) return;
Gee.List<StanzaNode> item_nodes = query_node.get_subnodes("item", NS_URI_ADMIN);
- Gee.List<string> ret_jids = new ArrayList<string>();
+ Gee.List<Jid> ret_jids = new ArrayList<Jid>(Jid.equals_func);
foreach (StanzaNode item in item_nodes) {
- string? jid_ = item.get_attribute("jid");
+ Jid? jid_ = Jid.parse(item.get_attribute("jid"));
string? affiliation_ = item.get_attribute("affiliation");
if (jid_ != null && affiliation_ != null) {
stream.get_flag(Muc.Flag.IDENTITY).set_offline_member(iq.from, jid_, parse_affiliation(affiliation_));
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
index 6964f83d..e5037e42 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/conference.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.Bookmarks {
public class Conference : Object {
@@ -21,9 +19,10 @@ public class Conference : Object {
set { stanza_node.set_attribute(ATTRIBUTE_AUTOJOIN, value.to_string()); }
}
- public string jid {
- get { return stanza_node.get_attribute(ATTRIBUTE_JID); }
- set { stanza_node.set_attribute(ATTRIBUTE_JID, value); }
+ private Jid jid_;
+ public Jid jid {
+ get { return jid_ ?? (jid_ = Jid.parse(stanza_node.get_attribute(ATTRIBUTE_JID))); }
+ set { stanza_node.set_attribute(ATTRIBUTE_JID, value.to_string()); }
}
public string? name {
@@ -73,7 +72,7 @@ public class Conference : Object {
}
}
- public Conference(string jid) {
+ public Conference(Jid jid) {
this.stanza_node = new StanzaNode.build("conference", NS_URI);
this.jid = jid;
}
@@ -90,4 +89,4 @@ public class Conference : Object {
}
}
-} \ No newline at end of file
+}
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
index 6b354c57..2c16f5f0 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks/module.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Bookmarks {
private const string NS_URI = "storage:bookmarks";
@@ -10,12 +8,16 @@ public class Module : XmppStreamModule {
public signal void received_conferences(XmppStream stream, Gee.List<Conference> conferences);
- public delegate void OnResult(XmppStream stream, Gee.List<Conference> conferences);
+ public delegate void OnResult(XmppStream stream, Gee.List<Conference>? conferences);
public void get_conferences(XmppStream stream, owned OnResult listener) {
StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns();
stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node, (stream, node) => {
- Gee.List<Conference> conferences = get_conferences_from_stanza(node);
- listener(stream, conferences);
+ if (node == null) {
+ listener(stream, null);
+ } else {
+ Gee.List<Conference> conferences = get_conferences_from_stanza(node);
+ listener(stream, conferences);
+ }
});
}
@@ -39,7 +41,7 @@ public class Module : XmppStreamModule {
public void replace_conference(XmppStream stream, Conference orig_conference, Conference modified_conference) {
get_conferences(stream, (stream, conferences) => {
foreach (Conference conference in conferences) {
- if (conference.autojoin == orig_conference.autojoin && conference.jid == orig_conference.jid &&
+ if (conference.autojoin == orig_conference.autojoin && conference.jid.equals(orig_conference.jid) &&
conference.name == orig_conference.name && conference.nick == orig_conference.nick) {
conference.autojoin = modified_conference.autojoin;
conference.jid = modified_conference.jid;
@@ -56,7 +58,7 @@ public class Module : XmppStreamModule {
get_conferences(stream, (stream, conferences) => {
Conference? rem = null;
foreach (Conference conference in conferences) {
- if (conference.name == conference_remove.name && conference.jid == conference_remove.jid && conference.autojoin == conference_remove.autojoin) {
+ if (conference.name == conference_remove.name && conference.jid.equals(conference_remove.jid) && conference.autojoin == conference_remove.autojoin) {
rem = conference;
break;
}
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 fd367dd8..5b3eb1b6 100644
--- a/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
+++ b/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.PrivateXmlStorage {
private const string NS_URI = "jabber:iq:private";
@@ -17,7 +15,7 @@ namespace Xmpp.Xep.PrivateXmlStorage {
});
}
- public delegate void OnResponse(XmppStream stream, StanzaNode node);
+ public delegate void OnResponse(XmppStream stream, StanzaNode? node);
public void retrieve(XmppStream stream, StanzaNode node, owned OnResponse listener) {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.get(queryNode);
diff --git a/xmpp-vala/src/module/xep/0054_vcard/module.vala b/xmpp-vala/src/module/xep/0054_vcard/module.vala
index 2fc055cf..0627c076 100644
--- a/xmpp-vala/src/module/xep/0054_vcard/module.vala
+++ b/xmpp-vala/src/module/xep/0054_vcard/module.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.VCard {
private const string NS_URI = "vcard-temp";
private const string NS_URI_UPDATE = NS_URI + ":x:update";
@@ -7,7 +5,7 @@ private const string NS_URI_UPDATE = NS_URI + ":x:update";
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0153_vcard_based_avatars");
- public signal void received_avatar(XmppStream stream, string jid, string id);
+ public signal void received_avatar(XmppStream stream, Jid jid, string id);
private PixbufStorage storage;
@@ -37,14 +35,14 @@ public class Module : XmppStreamModule {
if (stream.get_flag(Muc.Flag.IDENTITY).is_occupant(presence.from)) {
received_avatar(stream, presence.from, sha1);
} else {
- received_avatar(stream, get_bare_jid(presence.from), sha1);
+ received_avatar(stream, presence.from.bare_jid, sha1);
}
} else {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("vCard", NS_URI).add_self_xmlns());
if (stream.get_flag(Muc.Flag.IDENTITY).is_occupant(presence.from)) {
iq.to = presence.from;
} else {
- iq.to = get_bare_jid(presence.from);
+ iq.to = presence.from.bare_jid;
}
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, on_received_vcard);
}
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index 45fcb137..e887f74f 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Pubsub {
private const string NS_URI = "http://jabber.org/protocol/pubsub";
private const string NS_URI_EVENT = NS_URI + "#event";
@@ -16,8 +14,8 @@ namespace Xmpp.Xep.Pubsub {
event_listeners[node] = new EventListenerDelegate((owned)listener);
}
- public delegate void OnResult(XmppStream stream, string jid, string? id, StanzaNode? node);
- public void request(XmppStream stream, string jid, string node, owned OnResult listener) { // TODO multiple nodes gehen auch
+ public delegate void OnResult(XmppStream stream, Jid jid, string? id, StanzaNode? node);
+ public void request(XmppStream stream, Jid jid, string node, owned OnResult listener) { // TODO multiple nodes gehen auch
Iq.Stanza request_iq = 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)));
request_iq.to = jid;
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, request_iq, (stream, iq) => {
@@ -29,7 +27,7 @@ namespace Xmpp.Xep.Pubsub {
});
}
- public void publish(XmppStream stream, string? jid, string node_id, string node, string? item_id, StanzaNode content) {
+ public void publish(XmppStream stream, Jid? jid, string node_id, string node, string? item_id, StanzaNode content) {
StanzaNode pubsub_node = new StanzaNode.build("pubsub", NS_URI).add_self_xmlns();
StanzaNode publish_node = new StanzaNode.build("publish", NS_URI).put_attribute("node", node_id);
pubsub_node.put_node(publish_node);
@@ -42,17 +40,17 @@ namespace Xmpp.Xep.Pubsub {
}
public override void attach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).received_message.disconnect(on_received_message);
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void on_received_message(XmppStream stream, Message.Stanza message) {
+ private void on_received_message(XmppStream stream, MessageStanza message) {
StanzaNode event_node = message.stanza.get_subnode("event", NS_URI_EVENT); if (event_node == null) return;
StanzaNode items_node = event_node.get_subnode("items", NS_URI_EVENT); if (items_node == null) return;
StanzaNode item_node = items_node.get_subnode("item", NS_URI_EVENT); if (item_node == null) return;
@@ -65,7 +63,7 @@ namespace Xmpp.Xep.Pubsub {
}
public class EventListenerDelegate {
- public delegate void ResultFunc(XmppStream stream, string jid, string id, StanzaNode? node);
+ public delegate void ResultFunc(XmppStream stream, Jid jid, string id, StanzaNode? node);
public ResultFunc on_result { get; private owned set; }
public EventListenerDelegate(owned ResultFunc on_result) {
diff --git a/xmpp-vala/src/module/xep/0066_out_of_band_data.vala b/xmpp-vala/src/module/xep/0066_out_of_band_data.vala
index 804d406a..97a82104 100644
--- a/xmpp-vala/src/module/xep/0066_out_of_band_data.vala
+++ b/xmpp-vala/src/module/xep/0066_out_of_band_data.vala
@@ -1,14 +1,12 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.OutOfBandData {
public const string NS_URI = "jabber:x:oob";
-public static void add_url_to_message(Message.Stanza message, string url, string? desc = null) {
+public static void add_url_to_message(MessageStanza message, string url, string? desc = null) {
message.stanza.put_node(new StanzaNode.build("x", NS_URI).add_self_xmlns().put_node(new StanzaNode.build("url", NS_URI).put_node(new StanzaNode.text(url))));
}
-public static string? get_url_from_message(Message.Stanza message) {
+public static string? get_url_from_message(MessageStanza message) {
return message.stanza.get_deep_string_content(NS_URI + ":x", NS_URI + ":url");
}
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index 2b37f485..92ac54e2 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.UserAvatars {
private const string NS_URI = "urn:xmpp:avatar";
private const string NS_URI_DATA = NS_URI + ":data";
@@ -8,7 +6,7 @@ namespace Xmpp.Xep.UserAvatars {
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0084_user_avatars");
- public signal void received_avatar(XmppStream stream, string jid, string id);
+ public signal void received_avatar(XmppStream stream, Jid jid, string id);
private PixbufStorage storage;
@@ -40,7 +38,7 @@ namespace Xmpp.Xep.UserAvatars {
public override void detach(XmppStream stream) { }
- public void on_pupsub_event(XmppStream stream, string jid, string id, StanzaNode? node) {
+ public void on_pupsub_event(XmppStream stream, Jid jid, string id, StanzaNode? node) {
StanzaNode? info_node = node.get_subnode("info", NS_URI_METADATA);
if (info_node == null || info_node.get_attribute("type") != "image/png") return;
if (storage.has_image(id)) {
@@ -53,7 +51,7 @@ namespace Xmpp.Xep.UserAvatars {
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void on_pubsub_data_response(XmppStream stream, string jid, string? id, StanzaNode? node) {
+ private void on_pubsub_data_response(XmppStream stream, Jid jid, string? id, StanzaNode? node) {
if (node == null) return;
storage.store(id, Base64.decode(node.get_string_content()));
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
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 e92763fb..cc18c52f 100644
--- a/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
+++ b/xmpp-vala/src/module/xep/0085_chat_state_notifications.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ChatStateNotifications {
private const string NS_URI = "http://jabber.org/protocol/chatstates";
@@ -16,36 +14,36 @@ private const string[] STATES = {STATE_ACTIVE, STATE_INACTIVE, STATE_GONE, STATE
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0085_chat_state_notifications");
- public signal void chat_state_received(XmppStream stream, string jid, string state);
+ public signal void chat_state_received(XmppStream stream, Jid jid, string state);
private SendPipelineListener send_pipeline_listener = new SendPipelineListener();
/**
* "A message stanza that does not contain standard messaging content [...] SHOULD be a state other than <active/>" (0085, 5.6)
*/
- public void send_state(XmppStream stream, string jid, string state) {
- Message.Stanza message = new Message.Stanza();
+ public void send_state(XmppStream stream, Jid jid, string state) {
+ MessageStanza message = new MessageStanza();
message.to = jid;
- message.type_ = Message.Stanza.TYPE_CHAT;
+ message.type_ = MessageStanza.TYPE_CHAT;
message.stanza.put_node(new StanzaNode.build(state, NS_URI).add_self_xmlns());
- stream.get_module(Message.Module.IDENTITY).send_message(stream, message);
+ stream.get_module(MessageModule.IDENTITY).send_message(stream, message);
}
public override void attach(XmppStream stream) {
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
- stream.get_module(Message.Module.IDENTITY).send_pipeline.connect(send_pipeline_listener);
- stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.connect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
- stream.get_module(Message.Module.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.disconnect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void on_received_message(XmppStream stream, Message.Stanza message) {
+ private void on_received_message(XmppStream stream, MessageStanza message) {
if (!message.is_error()) {
Gee.List<StanzaNode> nodes = message.stanza.get_all_subnodes();
foreach (StanzaNode node in nodes) {
@@ -58,16 +56,16 @@ public class Module : XmppStreamModule {
}
}
-public class SendPipelineListener : StanzaListener<Message.Stanza> {
+public class SendPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {"MODIFY_BODY"};
public override string action_group { get { return "ADD_NODES"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
if (message.body == null) return;
- if (message.type_ != Message.Stanza.TYPE_CHAT) return;
+ if (message.type_ != MessageStanza.TYPE_CHAT) return;
message.stanza.put_node(new StanzaNode.build(STATE_ACTIVE, NS_URI).add_self_xmlns());
}
}
diff --git a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
index cba58883..19b0be3e 100644
--- a/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
+++ b/xmpp-vala/src/module/xep/0115_entitiy_capabilities.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.EntityCapabilities {
private const string NS_URI = "http://jabber.org/protocol/caps";
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 826b8726..5e3cb320 100644
--- a/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
+++ b/xmpp-vala/src/module/xep/0184_message_delivery_receipts.vala
@@ -1,41 +1,39 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.MessageDeliveryReceipts {
private const string NS_URI = "urn:xmpp:receipts";
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0184_message_delivery_receipts");
- public signal void receipt_received(XmppStream stream, string jid, string id);
+ public signal void receipt_received(XmppStream stream, Jid jid, string id);
private SendPipelineListener send_pipeline_listener = new SendPipelineListener();
- public void send_received(XmppStream stream, string from, string message_id) {
- Message.Stanza received_message = new Message.Stanza();
+ public void send_received(XmppStream stream, Jid from, string message_id) {
+ MessageStanza received_message = new MessageStanza();
received_message.to = from;
received_message.stanza.put_node(new StanzaNode.build("received", NS_URI).add_self_xmlns().put_attribute("id", message_id));
- stream.get_module(Message.Module.IDENTITY).send_message(stream, received_message);
+ stream.get_module(MessageModule.IDENTITY).send_message(stream, received_message);
}
- public static bool requests_receipt(Message.Stanza message) {
+ public static bool requests_receipt(MessageStanza message) {
return message.stanza.get_subnode("request", NS_URI) != null;
}
public override void attach(XmppStream stream) {
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).send_pipeline.connect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.connect(received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.connect(send_pipeline_listener);
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.disconnect(received_message);
- stream.get_module(Message.Module.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.disconnect(received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void received_message(XmppStream stream, Message.Stanza message) {
+ private void received_message(XmppStream stream, MessageStanza message) {
StanzaNode? received_node = message.stanza.get_subnode("received", NS_URI);
if (received_node != null) {
receipt_received(stream, message.from, received_node.get_attribute("id", NS_URI));
@@ -43,18 +41,18 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
}
}
-public class SendPipelineListener : StanzaListener<Message.Stanza> {
+public class SendPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {};
public override string action_group { get { return "ADD_NODES"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
StanzaNode? received_node = message.stanza.get_subnode("received", NS_URI);
if (received_node != null) return;
if (message.body == null) return;
- if (message.type_ == Message.Stanza.TYPE_GROUPCHAT) return;
+ if (message.type_ == MessageStanza.TYPE_GROUPCHAT) return;
message.stanza.put_node(new StanzaNode.build("request", NS_URI).add_self_xmlns());
}
}
diff --git a/xmpp-vala/src/module/xep/0191_blocking_command.vala b/xmpp-vala/src/module/xep/0191_blocking_command.vala
index 1520577f..4b78ed33 100644
--- a/xmpp-vala/src/module/xep/0191_blocking_command.vala
+++ b/xmpp-vala/src/module/xep/0191_blocking_command.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.BlockingCommand {
private const string NS_URI = "urn:xmpp:blocking";
diff --git a/xmpp-vala/src/module/xep/0198_stream_management.vala b/xmpp-vala/src/module/xep/0198_stream_management.vala
index 266e94c9..8ac41eb7 100644
--- a/xmpp-vala/src/module/xep/0198_stream_management.vala
+++ b/xmpp-vala/src/module/xep/0198_stream_management.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.StreamManagement {
public const string NS_URI = "urn:xmpp:sm:3";
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index ac467b35..661ad253 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.Ping {
private const string NS_URI = "urn:xmpp:ping";
@@ -9,7 +7,7 @@ namespace Xmpp.Xep.Ping {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0199_ping");
public delegate void OnResult(XmppStream stream);
- public void send_ping(XmppStream stream, string jid, owned OnResult? listener) {
+ public void send_ping(XmppStream stream, Jid jid, owned OnResult? listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("ping", NS_URI).add_self_xmlns());
iq.to = jid;
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, (stream) => {
diff --git a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
index b36932b0..8581ed93 100644
--- a/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
+++ b/xmpp-vala/src/module/xep/0203_delayed_delivery.vala
@@ -1,70 +1,82 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.DelayedDelivery {
- private const string NS_URI = "urn:xmpp:delay";
- public class Module : XmppStreamModule {
- public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0203_delayed_delivery");
+private const string NS_URI = "urn:xmpp:delay";
- private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener();
+public class Module : XmppStreamModule {
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0203_delayed_delivery");
- public static void set_message_delay(Message.Stanza message, DateTime datetime) {
- StanzaNode delay_node = (new StanzaNode.build("delay", NS_URI)).add_self_xmlns();
- delay_node.put_attribute("stamp", DateTimeProfiles.to_datetime(datetime));
- message.stanza.put_node(delay_node);
- }
+ private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener();
- public static DateTime? get_time_for_message(Message.Stanza message) {
- StanzaNode? delay_node = message.stanza.get_subnode("delay", NS_URI);
- if (delay_node != null) {
- return get_time_for_node(delay_node);
- }
- return null;
- }
+ public static void set_message_delay(MessageStanza message, DateTime datetime) {
+ StanzaNode delay_node = (new StanzaNode.build("delay", NS_URI)).add_self_xmlns();
+ delay_node.put_attribute("stamp", DateTimeProfiles.to_datetime(datetime));
+ message.stanza.put_node(delay_node);
+ }
- public static DateTime? get_time_for_node(StanzaNode node) {
- string? time = node.get_attribute("stamp");
- if (time != null) return DateTimeProfiles.parse_string(time);
- return null;
+ public static DateTime? get_time_for_message(MessageStanza message) {
+ StanzaNode? delay_node = message.stanza.get_subnode("delay", NS_URI);
+ if (delay_node != null) {
+ return get_time_for_node(delay_node);
}
+ return null;
+ }
- public override void attach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_listener);
- }
+ public static DateTime? get_time_for_node(StanzaNode node) {
+ string? time = node.get_attribute("stamp");
+ if (time != null) return DateTimeProfiles.parse_string(time);
+ return null;
+ }
- public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
- }
+ public override void attach(XmppStream stream) {
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_listener);
+ }
- public override string get_ns() { return NS_URI; }
- public override string get_id() { return IDENTITY.id; }
+ public override void detach(XmppStream stream) {
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
}
-public class ReceivedPipelineListener : StanzaListener<Message.Stanza> {
+ public override string get_ns() {
+ return NS_URI;
+ }
+
+ public override string get_id() {
+ return IDENTITY.id;
+ }
+}
+
+public class ReceivedPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {};
public override string action_group { get { return "ADD_NODE"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
DateTime? datetime = Module.get_time_for_message(message);
if (datetime != null) message.add_flag(new MessageFlag(datetime));
}
}
- public class MessageFlag : Message.MessageFlag {
- public const string ID = "delayed_delivery";
+public class MessageFlag : Xmpp.MessageFlag {
+ public const string ID = "delayed_delivery";
- public DateTime datetime { get; private set; }
+ public DateTime datetime { get; private set; }
- public MessageFlag(DateTime datetime) {
- this.datetime = datetime;
- }
+ public MessageFlag(DateTime datetime) {
+ this.datetime = datetime;
+ }
- public static MessageFlag? get_flag(Message.Stanza message) { return (MessageFlag) message.get_flag(NS_URI, ID); }
+ public static MessageFlag? get_flag(MessageStanza message) {
+ return (MessageFlag) message.get_flag(NS_URI, ID);
+ }
+
+ public override string get_ns() {
+ return NS_URI;
+ }
- public override string get_ns() { return NS_URI; }
- public override string get_id() { return ID; }
+ public override string get_id() {
+ return ID;
}
}
+
+}
diff --git a/xmpp-vala/src/module/xep/0280_message_carbons.vala b/xmpp-vala/src/module/xep/0280_message_carbons.vala
index 8dc4e00c..9e85a607 100644
--- a/xmpp-vala/src/module/xep/0280_message_carbons.vala
+++ b/xmpp-vala/src/module/xep/0280_message_carbons.vala
@@ -1,56 +1,60 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.MessageCarbons {
- private const string NS_URI = "urn:xmpp:carbons:2";
- public class Module : XmppStreamModule {
- public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0280_message_carbons_module");
+private const string NS_URI = "urn:xmpp:carbons:2";
- private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener();
+public class Module : XmppStreamModule {
+ public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0280_message_carbons_module");
- public void enable(XmppStream stream) {
- Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("enable", NS_URI).add_self_xmlns());
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
- }
+ private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener();
- public void disable(XmppStream stream) {
- Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("disable", NS_URI).add_self_xmlns());
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
- }
+ public void enable(XmppStream stream) {
+ Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("enable", NS_URI).add_self_xmlns());
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
+ }
- public override void attach(XmppStream stream) {
- stream.stream_negotiated.connect(enable);
- stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_listener);
- stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
- }
+ public void disable(XmppStream stream) {
+ Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("disable", NS_URI).add_self_xmlns());
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
+ }
- public override void detach(XmppStream stream) {
- stream.stream_negotiated.disconnect(enable);
- stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
- }
+ public override void attach(XmppStream stream) {
+ stream.stream_negotiated.connect(enable);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_listener);
+ stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
+ }
- public override string get_ns() { return NS_URI; }
- public override string get_id() { return IDENTITY.id; }
+ public override void detach(XmppStream stream) {
+ stream.stream_negotiated.disconnect(enable);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
}
-public class ReceivedPipelineListener : StanzaListener<Message.Stanza> {
+ public override string get_ns() {
+ return NS_URI;
+ }
+
+ public override string get_id() {
+ return IDENTITY.id;
+ }
+}
+
+public class ReceivedPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {"EXTRACT_MESSAGE_1"};
public override string action_group { get { return "EXTRACT_MESSAGE_2"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
StanzaNode? received_node = message.stanza.get_subnode("received", NS_URI);
StanzaNode? sent_node = received_node == null ? message.stanza.get_subnode("sent", NS_URI) : null;
StanzaNode? carbons_node = received_node != null ? received_node : sent_node;
if (carbons_node != null) {
StanzaNode? forwarded_node = carbons_node.get_subnode("forwarded", "urn:xmpp:forward:0");
if (forwarded_node != null) {
- StanzaNode? message_node = forwarded_node.get_subnode("message", Message.NS_URI);
- string? from_attribute = message_node.get_attribute("from", Message.NS_URI);
+ StanzaNode? message_node = forwarded_node.get_subnode("message", Xmpp.NS_URI);
+ string? from_attribute = message_node.get_attribute("from", Xmpp.NS_URI);
// Any forwarded copies received by a Carbons-enabled client MUST be from that user's bare JID; any copies that do not meet this requirement MUST be ignored.
- if (from_attribute != null && from_attribute == get_bare_jid(stream.get_flag(Bind.Flag.IDENTITY).my_jid)) {
+ if (from_attribute != null && from_attribute == stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid.to_string()) {
if (received_node != null) {
message.add_flag(new MessageFlag(MessageFlag.TYPE_RECEIVED));
} else if (sent_node != null) {
@@ -66,22 +70,28 @@ public class ReceivedPipelineListener : StanzaListener<Message.Stanza> {
}
}
- public class MessageFlag : Message.MessageFlag {
- public const string ID = "message_carbons";
+public class MessageFlag : Xmpp.MessageFlag {
+ public const string ID = "message_carbons";
- public const string TYPE_RECEIVED = "received";
- public const string TYPE_SENT = "sent";
- private string type_;
+ public const string TYPE_RECEIVED = "received";
+ public const string TYPE_SENT = "sent";
+ private string type_;
- public MessageFlag(string type) {
- this.type_ = type;
- }
+ public MessageFlag(string type) {
+ this.type_ = type;
+ }
- public static MessageFlag? get_flag(Message.Stanza message) {
- return (MessageFlag) message.get_flag(NS_URI, ID);
- }
+ public static MessageFlag? get_flag(MessageStanza message) {
+ return (MessageFlag) message.get_flag(NS_URI, ID);
+ }
+
+ public override string get_ns() {
+ return NS_URI;
+ }
- public override string get_ns() { return NS_URI; }
- public override string get_id() { return ID; }
+ public override string get_id() {
+ return ID;
}
}
+
+}
diff --git a/xmpp-vala/src/module/xep/0313_message_archive_management.vala b/xmpp-vala/src/module/xep/0313_message_archive_management.vala
index 0e3ac0c7..1c1b51e3 100644
--- a/xmpp-vala/src/module/xep/0313_message_archive_management.vala
+++ b/xmpp-vala/src/module/xep/0313_message_archive_management.vala
@@ -1,5 +1,3 @@
-using Xmpp.Core;
-
namespace Xmpp.Xep.MessageArchiveManagement {
public const string NS_URI = "urn:xmpp:mam:2";
@@ -44,12 +42,12 @@ public class Module : XmppStreamModule {
}
public override void attach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_pipeline.connect(received_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_listener);
stream.stream_negotiated.connect(query_availability);
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_pipeline.disconnect(received_pipeline_listener);
}
public override string get_ns() { return NS_URI; }
@@ -73,29 +71,31 @@ public class Module : XmppStreamModule {
}
private void query_availability(XmppStream stream) {
- stream.get_module(Xep.ServiceDiscovery.Module.IDENTITY).request_info(stream, get_bare_jid(stream.get_flag(Bind.Flag.IDENTITY).my_jid), (stream, info_result) => {
+ stream.get_module(Xep.ServiceDiscovery.Module.IDENTITY).request_info(stream, stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid, (stream, info_result) => {
+ if (info_result == null) return;
if (info_result.features.contains(NS_URI)) {
stream.add_flag(new Flag(NS_URI));
+ feature_available(stream);
} else if (info_result.features.contains(NS_URI_1)) {
stream.add_flag(new Flag(NS_URI_1));
+ feature_available(stream);
}
- if (stream.get_flag(Flag.IDENTITY) != null) feature_available(stream);
});
}
}
-public class ReceivedPipelineListener : StanzaListener<Message.Stanza> {
+public class ReceivedPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {};
public override string action_group { get { return "EXTRACT_MESSAGE_1"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
// if (message.from != stream.remote_name) return;
if (stream.get_flag(Flag.IDENTITY) == null) return;
- StanzaNode? message_node = message.stanza.get_deep_subnode(NS_VER(stream) + ":result", "urn:xmpp:forward:0:forwarded", Message.NS_URI + ":message");
+ StanzaNode? message_node = message.stanza.get_deep_subnode(NS_VER(stream) + ":result", "urn:xmpp:forward:0:forwarded", Xmpp.NS_URI + ":message");
if (message_node != null) {
StanzaNode? forward_node = message.stanza.get_deep_subnode(NS_VER(stream) + ":result", "urn:xmpp:forward:0:forwarded", DelayedDelivery.NS_URI + ":delay");
DateTime? datetime = DelayedDelivery.Module.get_time_for_node(forward_node);
@@ -120,7 +120,7 @@ public class Flag : XmppStreamFlag {
public override string get_id() { return IDENTITY.id; }
}
-public class MessageFlag : Message.MessageFlag {
+public class MessageFlag : Xmpp.MessageFlag {
public const string ID = "message_archive_management";
public DateTime? server_time { get; private set; }
@@ -129,7 +129,7 @@ public class MessageFlag : Message.MessageFlag {
this.server_time = server_time;
}
- public static MessageFlag? get_flag(Message.Stanza message) { return (MessageFlag) message.get_flag(NS_URI, ID); }
+ public static MessageFlag? get_flag(MessageStanza message) { return (MessageFlag) message.get_flag(NS_URI, ID); }
public override string get_ns() { return NS_URI; }
public override string get_id() { return ID; }
diff --git a/xmpp-vala/src/module/xep/0333_chat_markers.vala b/xmpp-vala/src/module/xep/0333_chat_markers.vala
index 27cbd107..2cba957a 100644
--- a/xmpp-vala/src/module/xep/0333_chat_markers.vala
+++ b/xmpp-vala/src/module/xep/0333_chat_markers.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.ChatMarkers {
private const string NS_URI = "urn:xmpp:chat-markers:0";
@@ -14,39 +12,39 @@ private const string[] MARKERS = {MARKER_RECEIVED, MARKER_DISPLAYED, MARKER_ACKN
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0333_chat_markers");
- public signal void marker_received(XmppStream stream, string jid, string marker, string id);
+ public signal void marker_received(XmppStream stream, Jid jid, string marker, string id);
private SendPipelineListener send_pipeline_listener = new SendPipelineListener();
- public void send_marker(XmppStream stream, string jid, string message_id, string type_, string marker) {
- Message.Stanza received_message = new Message.Stanza();
+ public void send_marker(XmppStream stream, Jid jid, string message_id, string type_, string marker) {
+ MessageStanza received_message = new MessageStanza();
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));
- stream.get_module(Message.Module.IDENTITY).send_message(stream, received_message);
+ stream.get_module(MessageModule.IDENTITY).send_message(stream, received_message);
}
- public static bool requests_marking(Message.Stanza message) {
+ public static bool requests_marking(MessageStanza message) {
StanzaNode markable_node = message.stanza.get_subnode("markable", NS_URI);
return markable_node != null;
}
public override void attach(XmppStream stream) {
stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI);
- stream.get_module(Message.Module.IDENTITY).send_pipeline.connect(send_pipeline_listener);
- stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.connect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.connect(on_received_message);
}
public override void detach(XmppStream stream) {
- stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
- stream.get_module(Message.Module.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
+ stream.get_module(MessageModule.IDENTITY).received_message.disconnect(on_received_message);
+ stream.get_module(MessageModule.IDENTITY).send_pipeline.disconnect(send_pipeline_listener);
}
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }
- private void on_received_message(XmppStream stream, Message.Stanza message) {
- if (message.type_ != Message.Stanza.TYPE_CHAT) return;
+ private void on_received_message(XmppStream stream, MessageStanza message) {
+ if (message.type_ != MessageStanza.TYPE_CHAT) return;
Gee.List<StanzaNode> nodes = message.stanza.get_all_subnodes();
foreach (StanzaNode node in nodes) {
if (node.ns_uri == NS_URI && node.name in MARKERS) {
@@ -56,18 +54,18 @@ public class Module : XmppStreamModule {
}
}
-public class SendPipelineListener : StanzaListener<Message.Stanza> {
+public class SendPipelineListener : StanzaListener<MessageStanza> {
private const string[] after_actions_const = {};
public override string action_group { get { return "ADD_NODES"; } }
public override string[] after_actions { get { return after_actions_const; } }
- public override async void run(Core.XmppStream stream, Message.Stanza message) {
+ public override async void run(XmppStream stream, MessageStanza message) {
StanzaNode? received_node = message.stanza.get_subnode("received", NS_URI);
if (received_node != null) return;
if (message.body == null) return;
- if (message.type_ != Message.Stanza.TYPE_CHAT) return;
+ if (message.type_ != MessageStanza.TYPE_CHAT) return;
message.stanza.put_node(new StanzaNode.build("markable", NS_URI).add_self_xmlns());
}
}
diff --git a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
index 4d34e750..8ec299aa 100644
--- a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
+++ b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
@@ -1,7 +1,5 @@
using Gee;
-using Xmpp.Core;
-
namespace Xmpp.Xep.SrvRecordsTls {
public class Module : XmppStreamNegotiationModule {
@@ -22,11 +20,11 @@ public class Module : XmppStreamNegotiationModule {
public class TlsConnectionProvider : ConnectionProvider {
private SrvTarget? srv_target;
- public async override int? get_priority(string remote_name) {
+ public async override int? get_priority(Jid remote_name) {
GLib.List<SrvTarget>? xmpp_target = null;
try {
GLibFixes.Resolver resolver = GLibFixes.Resolver.get_default();
- xmpp_target = yield resolver.lookup_service_async("xmpps-client", "tcp", remote_name, null);
+ xmpp_target = yield resolver.lookup_service_async("xmpps-client", "tcp", remote_name.to_string(), null);
} catch (Error e) {
return null;
}