diff options
| author | Marvin W <git@larma.de> | 2026-05-30 16:10:36 +0200 |
|---|---|---|
| committer | Marvin W <git@larma.de> | 2026-06-07 23:13:07 +0200 |
| commit | 158cff3098e9370696f9250a199c78e4f2d18ce0 (patch) | |
| tree | bd05a55e5419ef2307c7a7f4d7665f7449c8e8b1 /xmpp-vala/src/module/xep | |
| parent | afcf44928748f7ac049f1ba9f5c51c6dedbf4ec2 (diff) | |
Add JID interning
Diffstat (limited to 'xmpp-vala/src/module/xep')
13 files changed, 18 insertions, 18 deletions
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 105da893..9fdae90b 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 @@ -10,7 +10,7 @@ public class ItemsResult { 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)) { try { - ret.add(new Item(new Jid(feature_node.get_attribute("jid", NS_URI_ITEMS)), + ret.add(new Item(Jid.from_string(feature_node.get_attribute("jid", NS_URI_ITEMS)), feature_node.get_attribute("name", NS_URI_ITEMS), feature_node.get_attribute("node", NS_URI_ITEMS))); } catch (InvalidJidError e) { diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index bdaabb3e..ad929b00 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -377,7 +377,7 @@ public class Module : XmppStreamModule { string? jid_ = x_node.get_deep_attribute("item", "jid"); if (jid_ != null) { try { - Jid real_jid = new Jid(jid_); + Jid real_jid = Jid.from_string(jid_); flag.set_real_jid(presence.from, real_jid); if (affiliation != null) { stream.get_flag(Flag.IDENTITY).set_offline_member(presence.from, real_jid, affiliation); @@ -496,7 +496,7 @@ public class Module : XmppStreamModule { string? affiliation_ = item.get_attribute("affiliation"); if (jid__ != null && affiliation_ != null) { try { - Jid jid_ = new Jid(jid__); + Jid jid_ = Jid.from_string(jid__); stream.get_flag(Flag.IDENTITY).set_offline_member(iq_result.from, jid_, parse_affiliation(affiliation_)); ret_jids.add(jid_); } catch (InvalidJidError e) { @@ -574,7 +574,7 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> { Jid? from_jid = null; try { string from = invite_node.get_attribute("from"); - if (from != null) from_jid = new Jid(from); + if (from != null) from_jid = Jid.from_string(from); } catch (InvalidJidError e) { warning("Received invite from invalid jid: %s", e.message); } @@ -594,7 +594,7 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> { var affiliations = new HashMap<Jid, Affiliation>(); foreach (StanzaNode item_node in item_nodes) { string jid_str = item_node.get_attribute("jid", Muc.NS_URI_USER); - Jid real_jid = new Jid(jid_str); + Jid real_jid = Jid.from_string(jid_str); string affiliation_str = item_node.get_attribute("affiliation", Muc.NS_URI_USER); Muc.Affiliation affiliation = Muc.Module.parse_affiliation(affiliation_str); @@ -622,7 +622,7 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> { if (var_ == "muc#jid"){ StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); try { - if (value_node != null) from_jid = new Jid(value_node.get_string_content()); + if (value_node != null) from_jid = Jid.from_string(value_node.get_string_content()); } catch (InvalidJidError e) { return false; } diff --git a/xmpp-vala/src/module/xep/0048_conference.vala b/xmpp-vala/src/module/xep/0048_conference.vala index b61de1c0..ee0188de 100644 --- a/xmpp-vala/src/module/xep/0048_conference.vala +++ b/xmpp-vala/src/module/xep/0048_conference.vala @@ -23,7 +23,7 @@ public class Bookmarks1Conference : Conference { public override Jid? jid { get { try { - return jid_ ?? (jid_ = new Jid(stanza_node.get_attribute(ATTRIBUTE_JID))); + return jid_ ?? (jid_ = Jid.from_string(stanza_node.get_attribute(ATTRIBUTE_JID))); } catch (InvalidJidError e) { return null; } diff --git a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala index c184877c..97674f3f 100644 --- a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala +++ b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala @@ -69,7 +69,7 @@ public class Module : XmppStreamModule, Iq.Handler { string? jid_str = stream_host.get_attribute("jid"); Jid? jid = null; try { - jid = jid_str != null ? new Jid(jid_str) : null; + jid = jid_str != null ? Jid.from_string(jid_str) : null; } catch (InvalidJidError ignored) { } int port = stream_host.get_attribute_int("port"); if (host == null || jid == null || port <= 0 || port > 65535) { diff --git a/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala b/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala index cdcb9130..5e3b69c2 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala @@ -165,7 +165,7 @@ namespace Xmpp.Xep.Jingle { string? muji_room_str = iq.stanza.get_deep_attribute(NS_URI + ":jingle", Xep.Muji.NS_URI + ":muji", "room"); if (muji_room_str != null) { try { - session.muji_room = new Jid(muji_room_str); + session.muji_room = Jid.from_string(muji_room_str); } catch (InvalidJidError e) { // Ignore } diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala index 53a9c58d..22e8e978 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/session.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala @@ -257,7 +257,7 @@ public class Xmpp.Xep.Jingle.Session : Object { Jid responder = iq.from; if (responder_str != null) { try { - responder = new Jid(responder_str); + responder = Jid.from_string(responder_str); } catch (InvalidJidError e) { warning("Received invalid session accept: %s", e.message); } diff --git a/xmpp-vala/src/module/xep/0249_direct_muc_invitations.vala b/xmpp-vala/src/module/xep/0249_direct_muc_invitations.vala index 2ccab33d..8c2e04fd 100644 --- a/xmpp-vala/src/module/xep/0249_direct_muc_invitations.vala +++ b/xmpp-vala/src/module/xep/0249_direct_muc_invitations.vala @@ -23,7 +23,7 @@ namespace Xmpp.Xep.DirectMucInvitations { if (room_str == null) return; Jid? room_jid = null; try { - room_jid = new Jid(room_str); + room_jid = Jid.from_string(room_str); } catch (Error e) { return; } diff --git a/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala b/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala index 0fe9ce5f..852cc7eb 100644 --- a/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala +++ b/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala @@ -162,7 +162,7 @@ public class Candidate : Socks5Bytestreams.Proxy { string? jid_str = candidate.get_attribute("jid"); Jid? jid = null; try { - jid = new Jid(jid_str); + jid = Jid.from_string(jid_str); } catch (InvalidJidError ignored) { } int port = candidate.get_attribute("port") != null ? candidate.get_attribute_int("port") : 1080; diff --git a/xmpp-vala/src/module/xep/0298_coin.vala b/xmpp-vala/src/module/xep/0298_coin.vala index 1a7b6d60..a8c12e07 100644 --- a/xmpp-vala/src/module/xep/0298_coin.vala +++ b/xmpp-vala/src/module/xep/0298_coin.vala @@ -44,7 +44,7 @@ namespace Xmpp.Xep.Coin { // if (!jid_string.has_prefix("xmpp:")) continue; // silk does this wrong Jid? jid = null; try { - jid = new Jid(jid_string.substring(4)); + jid = Jid.from_string(jid_string.substring(4)); } catch (Error e) { continue; } 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 1a7789cb..a9149d4e 100644 --- a/xmpp-vala/src/module/xep/0313_message_archive_management.vala +++ b/xmpp-vala/src/module/xep/0313_message_archive_management.vala @@ -118,7 +118,7 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> { } Jid? inner_from = null; try { - inner_from = new Jid(message_node.get_attribute("from")); + inner_from = Jid.from_string(message_node.get_attribute("from")); } catch (InvalidJidError e) { warning("Received MAM message with invalid from attribute in forwarded message from %s, ignoring", message.from.to_string()); return true; diff --git a/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala b/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala index cfeeb567..f7db524d 100644 --- a/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala +++ b/xmpp-vala/src/module/xep/0388_extensible_sasl_profile.vala @@ -40,7 +40,7 @@ namespace Xmpp.Xep.ExtensibleSaslProfile { var authorisation_identifier = node.get_subnode("authorization-identifier", NS_URI); string jid_string = authorisation_identifier.get_string_content(); - Jid jid = new Jid(jid_string); + Jid jid = Jid.from_string(jid_string); foreach (var inline_provider in inline_activation_providers.values) { inline_provider.on_bound(stream, jid, node); diff --git a/xmpp-vala/src/module/xep/0402_bookmarks2.vala b/xmpp-vala/src/module/xep/0402_bookmarks2.vala index 429f26f5..938af0e9 100644 --- a/xmpp-vala/src/module/xep/0402_bookmarks2.vala +++ b/xmpp-vala/src/module/xep/0402_bookmarks2.vala @@ -88,7 +88,7 @@ public class Module : BookmarksProvider, XmppStreamModule { } try { - Jid jid_parsed = new Jid(id); + Jid jid_parsed = Jid.from_string(id); Flag? flag = stream.get_flag(Flag.IDENTITY); if (flag != null) { flag.conferences.unset(jid_parsed); @@ -102,7 +102,7 @@ public class Module : BookmarksProvider, XmppStreamModule { private Conference? parse_item_node(StanzaNode conference_node, string id) { Conference conference = new Conference(); try { - Jid jid_parsed = new Jid(id); + Jid jid_parsed = Jid.from_string(id); if (jid_parsed.resourcepart != null) return null; conference.jid = jid_parsed; } catch (InvalidJidError e) { diff --git a/xmpp-vala/src/module/xep/0461_replies.vala b/xmpp-vala/src/module/xep/0461_replies.vala index 870df295..af84aa3d 100644 --- a/xmpp-vala/src/module/xep/0461_replies.vala +++ b/xmpp-vala/src/module/xep/0461_replies.vala @@ -27,7 +27,7 @@ namespace Xmpp.Xep.Replies { string? to_str = reply_node.get_attribute("to"); if (to_str == null) return null; try { - Jid to_jid = new Jid(to_str); + Jid to_jid = Jid.from_string(to_str); string? id = reply_node.get_attribute("id"); if (id == null) return null; |
