aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-10-04 17:49:16 +0200
committerMarvin W <git@larma.de>2026-10-23 17:01:41 +0200
commit630b1368331ef0034b343bd2f00b116c8cd90391 (patch)
tree30afc5a4471d084d7f074fce24df9a8d945b5084 /xmpp-vala/src
parentec4ca2a4642552b8424e7703840cd37e371e9e00 (diff)
Fix some warnings
Diffstat (limited to 'xmpp-vala/src')
-rw-r--r--xmpp-vala/src/core/stanza_attribute.vala16
-rw-r--r--xmpp-vala/src/core/stanza_node.vala92
-rw-r--r--xmpp-vala/src/core/stream_connect.vala10
-rw-r--r--xmpp-vala/src/module/bookmarks_provider.vala8
-rw-r--r--xmpp-vala/src/module/iq/module.vala2
-rw-r--r--xmpp-vala/src/module/sasl.vala14
-rw-r--r--xmpp-vala/src/module/session.vala10
-rw-r--r--xmpp-vala/src/module/xep/0004_data_forms.vala3
-rw-r--r--xmpp-vala/src/module/xep/0030_service_discovery/module.vala4
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala24
-rw-r--r--xmpp-vala/src/module/xep/0048_bookmarks.vala10
-rw-r--r--xmpp-vala/src/module/xep/0049_private_xml_storage.vala4
-rw-r--r--xmpp-vala/src/module/xep/0054_vcard/module.vala2
-rw-r--r--xmpp-vala/src/module/xep/0060_pubsub.vala10
-rw-r--r--xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala2
-rw-r--r--xmpp-vala/src/module/xep/0077_in_band_registration.vala6
-rw-r--r--xmpp-vala/src/module/xep/0082_date_time_profiles.vala4
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala2
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/component.vala12
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/content.vala12
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala7
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/session.vala7
-rw-r--r--xmpp-vala/src/module/xep/0176_jingle_ice_udp/transport_parameters.vala6
-rw-r--r--xmpp-vala/src/module/xep/0191_blocking_command.vala8
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala2
-rw-r--r--xmpp-vala/src/module/xep/0215_external_service_discovery.vala2
-rw-r--r--xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala2
-rw-r--r--xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala10
-rw-r--r--xmpp-vala/src/module/xep/0272_muji.vala7
-rw-r--r--xmpp-vala/src/module/xep/0280_message_carbons.vala12
-rw-r--r--xmpp-vala/src/module/xep/0313_2_message_archive_management.vala4
-rw-r--r--xmpp-vala/src/module/xep/0313_message_archive_management.vala2
-rw-r--r--xmpp-vala/src/module/xep/0392_consistent_color/hsluv.vala6
-rw-r--r--xmpp-vala/src/module/xep/0402_bookmarks2.vala6
-rw-r--r--xmpp-vala/src/module/xep/0461_replies.vala1
35 files changed, 208 insertions, 121 deletions
diff --git a/xmpp-vala/src/core/stanza_attribute.vala b/xmpp-vala/src/core/stanza_attribute.vala
index 6c6ac579..ba1616a5 100644
--- a/xmpp-vala/src/core/stanza_attribute.vala
+++ b/xmpp-vala/src/core/stanza_attribute.vala
@@ -56,7 +56,13 @@ public class StanzaAttribute : StanzaEntry {
if (ns_uri == state.current_ns_uri || (ns_uri == XMLNS_URI && name == "xmlns")) {
return printf(ATTRIBUTE_XML_NO_NS_FORMAT, true);
} else {
- return printf(ATTRIBUTE_XML_FORMAT, false, state.find_name((!)ns_uri));
+ string ns_name = "_";
+ try {
+ ns_name = state.find_name((!)ns_uri);
+ } catch (IOError e) {
+ warning("Error finding name: %s", e.message);
+ }
+ return printf(ATTRIBUTE_XML_FORMAT, false, ns_name);
}
}
@@ -65,7 +71,13 @@ public class StanzaAttribute : StanzaEntry {
if (ns_uri == state.current_ns_uri || (ns_uri == XMLNS_URI && name == "xmlns")) {
return printf(ATTRIBUTE_XML_ANSI_NO_NS_FORMAT, true);
} else {
- return printf(ATTRIBUTE_XML_ANSI_FORMAT, false, state.find_name((!)ns_uri));
+ string ns_name = "_";
+ try {
+ ns_name = state.find_name((!)ns_uri);
+ } catch (IOError e) {
+ warning("Error finding name: %s", e.message);
+ }
+ return printf(ATTRIBUTE_XML_ANSI_FORMAT, false, ns_name);
}
}
}
diff --git a/xmpp-vala/src/core/stanza_node.vala b/xmpp-vala/src/core/stanza_node.vala
index f44657f1..7a68da62 100644
--- a/xmpp-vala/src/core/stanza_node.vala
+++ b/xmpp-vala/src/core/stanza_node.vala
@@ -18,54 +18,62 @@ public abstract class StanzaEntry {
public string? encoded_val {
owned get {
if (val == null) return null;
- return ENCODABLE_VALUE_CHARS.replace_eval(val, -1, 0, 0, (match_info, result_builder) => {
- int start;
- match_info.fetch_pos(0, out start, null);
- unowned string src = match_info.get_string();
- switch (src[start]) {
- case '&': result_builder.append("&amp;"); break;
- case '"': result_builder.append("&quot;"); break;
- case '\'': result_builder.append("&apos;"); break;
- case '<': result_builder.append("&lt;"); break;
- case '>': result_builder.append("&gt;"); break;
- default: error("Unreachable"); break;
- }
- return false;
- });
+ try {
+ return ENCODABLE_VALUE_CHARS.replace_eval(val, -1, 0, 0, (match_info, result_builder) => {
+ int start;
+ match_info.fetch_pos(0, out start, null);
+ unowned string src = match_info.get_string();
+ switch (src[start]) {
+ case '&': result_builder.append("&amp;"); break;
+ case '"': result_builder.append("&quot;"); break;
+ case '\'': result_builder.append("&apos;"); break;
+ case '<': result_builder.append("&lt;"); break;
+ case '>': result_builder.append("&gt;"); break;
+ default: error("Unreachable"); break;
+ }
+ return false;
+ });
+ } catch (RegexError e) {
+ error("Error encoding entities in string \"%s\": %s", val, e.message);
+ }
}
set {
if (value == null) {
val = null;
return;
}
- val = DECODABLE_VALUE_SEQUENCES.replace_eval(value, -1, 0, 0, (match_info, result_builder) => {
- int start, end;
- match_info.fetch_pos(0, out start, out end);
- unowned string src = match_info.get_string();
- switch (src[start+1]) {
- case 'g': result_builder.append_c('>'); break;
- case 'l': result_builder.append_c('<'); break;
- case 'q': result_builder.append_c('"'); break;
- case 'a':
- switch (src[start+2]) {
- case 'p': result_builder.append_c('\''); break;
- case 'm': result_builder.append_c('&'); break;
- default: critical("Invalid encoding: %s in %s", match_info.fetch(0), src); break;
- }
- break;
- case '#':
- unichar num = -1;
- if (src[start+2] == 'x') {
- src.substring(start+3, start-end-3).scanf("%x", &num);
- } else {
- num = int.parse(src.substring(start+2, start-end-2));
- }
- result_builder.append_unichar(num);
- break;
- default: critical("Invalid encoding: %s in %s", match_info.fetch(0), src); break;
- }
- return false;
- });
+ try {
+ val = DECODABLE_VALUE_SEQUENCES.replace_eval(value, -1, 0, 0, (match_info, result_builder) => {
+ int start, end;
+ match_info.fetch_pos(0, out start, out end);
+ unowned string src = match_info.get_string();
+ switch (src[start + 1]) {
+ case 'g': result_builder.append_c('>'); break;
+ case 'l': result_builder.append_c('<'); break;
+ case 'q': result_builder.append_c('"'); break;
+ case 'a':
+ switch (src[start + 2]) {
+ case 'p': result_builder.append_c('\''); break;
+ case 'm': result_builder.append_c('&'); break;
+ default: critical("Invalid encoding: %s in %s", match_info.fetch(0), src); break;
+ }
+ break;
+ case '#':
+ unichar num = -1;
+ if (src[start + 2] == 'x') {
+ src.substring(start + 3, start - end - 3).scanf("%x", &num);
+ } else {
+ num = int.parse(src.substring(start + 2, start - end - 2));
+ }
+ result_builder.append_unichar(num);
+ break;
+ default: critical("Invalid encoding: %s in %s", match_info.fetch(0), src); break;
+ }
+ return false;
+ });
+ } catch (RegexError e) {
+ error("Error decoding entities in string \"%s\": %s", value, e.message);
+ }
}
}
diff --git a/xmpp-vala/src/core/stream_connect.vala b/xmpp-vala/src/core/stream_connect.vala
index 7e3843fa..a496fc3c 100644
--- a/xmpp-vala/src/core/stream_connect.vala
+++ b/xmpp-vala/src/core/stream_connect.vala
@@ -15,7 +15,7 @@ namespace Xmpp {
public async XmppStreamResult establish_stream(Jid bare_jid, Gee.List<XmppStreamModule> modules, string? log_options, owned TlsXmppStream.OnInvalidCert on_invalid_cert) {
Jid remote = bare_jid.domain_jid;
- TlsXmppStream.OnInvalidCertWrapper on_invalid_cert_wrapper = new TlsXmppStream.OnInvalidCertWrapper(on_invalid_cert);
+ TlsXmppStream.OnInvalidCertWrapper on_invalid_cert_wrapper = new TlsXmppStream.OnInvalidCertWrapper((owned) on_invalid_cert);
//Lookup xmpp-client and xmpps-client SRV records
GLib.List<SrvTargetInfo>? targets = new GLib.List<SrvTargetInfo>();
@@ -72,7 +72,13 @@ namespace Xmpp {
connection_timeout_id = Timeout.add_seconds(30, () => {
warning("Connection attempt timed out");
- stream.disconnect();
+ stream.disconnect.begin((_, res) => {
+ try {
+ stream.disconnect.end(res);
+ } catch (IOError e) {
+ debug("Error while disconnecting: %s", e.message);
+ }
+ });
connection_timeout_id = 0;
return Source.REMOVE;
});
diff --git a/xmpp-vala/src/module/bookmarks_provider.vala b/xmpp-vala/src/module/bookmarks_provider.vala
index 6ddcc5af..458ff183 100644
--- a/xmpp-vala/src/module/bookmarks_provider.vala
+++ b/xmpp-vala/src/module/bookmarks_provider.vala
@@ -8,10 +8,10 @@ public interface BookmarksProvider : Object {
public signal void conference_changed(XmppStream stream, Conference conferences);
public signal void received_conferences(XmppStream stream, Set<Conference> conferences);
- public async abstract async Set<Conference>? get_conferences(XmppStream stream);
- public async abstract void add_conference(XmppStream stream, Conference conference);
- public async abstract void remove_conference(XmppStream stream, Conference conference);
- public async abstract void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference);
+ public async abstract async Set<Conference>? get_conferences(XmppStream stream) throws IOError;
+ public async abstract void add_conference(XmppStream stream, Conference conference) throws IOError;
+ public async abstract void remove_conference(XmppStream stream, Conference conference) throws IOError;
+ public async abstract void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) throws IOError;
}
}
diff --git a/xmpp-vala/src/module/iq/module.vala b/xmpp-vala/src/module/iq/module.vala
index bb9260c9..917f6660 100644
--- a/xmpp-vala/src/module/iq/module.vala
+++ b/xmpp-vala/src/module/iq/module.vala
@@ -23,7 +23,7 @@ namespace Xmpp.Iq {
Idle.add(send_iq_async.callback);
}
});
- stream.write_async(iq.stanza, io_priority, cancellable);
+ yield stream.write_async(iq.stanza, io_priority, cancellable);
ulong cancelled_handler_id = 0;
if (cancellable != null) {
cancelled_handler_id = cancellable.cancelled.connect(() => Idle.add(send_iq_async.callback));
diff --git a/xmpp-vala/src/module/sasl.vala b/xmpp-vala/src/module/sasl.vala
index 035cc723..f0c2d6ed 100644
--- a/xmpp-vala/src/module/sasl.vala
+++ b/xmpp-vala/src/module/sasl.vala
@@ -73,10 +73,14 @@ namespace Xmpp.Sasl {
} else if (node.name == "challenge" && stream.has_flag(Flag.IDENTITY)) {
Flag flag = stream.get_flag(Flag.IDENTITY);
if (flag.mechanism == Mechanism.SCRAM_SHA_1) {
- var challenge_response = compute_challenge_response(node.get_string_content(), flag.password, flag.client_nonce, flag.name);
- flag.server_signature = challenge_response.expected_server_signature;
- stream.write(new StanzaNode.build("response", NS_URI).add_self_xmlns()
- .put_node(new StanzaNode.text(Base64.encode((uchar[]) (challenge_response.response).to_utf8()))));
+ try {
+ var challenge_response = compute_challenge_response(node.get_string_content(), flag.password, flag.client_nonce, flag.name);
+ flag.server_signature = challenge_response.expected_server_signature;
+ stream.write(new StanzaNode.build("response", NS_URI).add_self_xmlns()
+ .put_node(new StanzaNode.text(Base64.encode((uchar[]) (challenge_response.response).to_utf8()))));
+ } catch (Error e) {
+ warning("Failed processing challenge: %s", e.message);
+ }
}
}
}
@@ -165,7 +169,7 @@ namespace Xmpp.Sasl {
public string response { get; set; }
}
- public static ChallengeResponse compute_challenge_response(string challenge, string password, string client_nonce, string name) {
+ public static ChallengeResponse compute_challenge_response(string challenge, string password, string client_nonce, string name) throws Error {
string challenge_base64 = (string) Base64.decode(challenge);
string? server_nonce = null;
uint8[] salt = null;
diff --git a/xmpp-vala/src/module/session.vala b/xmpp-vala/src/module/session.vala
index b1436d1e..fa947624 100644
--- a/xmpp-vala/src/module/session.vala
+++ b/xmpp-vala/src/module/session.vala
@@ -28,9 +28,13 @@ public class Module : XmppStreamNegotiationModule {
stream.add_flag(new Flag());
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("session", NS_URI).add_self_xmlns()) { to=stream.remote_name };
- Iq.Stanza result_iq = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
- if (!result_iq.is_error()) {
- stream.get_flag(Flag.IDENTITY).finished = true;
+ try {
+ Iq.Stanza result_iq = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ if (!result_iq.is_error()) {
+ stream.get_flag(Flag.IDENTITY).finished = true;
+ }
+ } catch (IOError e) {
+ warning("Error establishing legacy session: %s", e.message);
}
}
}
diff --git a/xmpp-vala/src/module/xep/0004_data_forms.vala b/xmpp-vala/src/module/xep/0004_data_forms.vala
index 6b5624da..f481e174 100644
--- a/xmpp-vala/src/module/xep/0004_data_forms.vala
+++ b/xmpp-vala/src/module/xep/0004_data_forms.vala
@@ -18,6 +18,7 @@ public class DataForm {
}
public enum Type {
+ UNKNOWN,
BOOLEAN,
FIXED,
HIDDEN,
@@ -44,7 +45,7 @@ public class DataForm {
get { return node.get_attribute("label", NS_URI); }
set { node.set_attribute("label", value); }
}
- public virtual Type? type_ { get; internal set; default=null; }
+ public virtual Type type_ { get; internal set; default=Type.UNKNOWN; }
public string? var {
get { return node.get_attribute("var", NS_URI); }
set { node.set_attribute("var", value); }
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 537e460b..1ba8ac3a 100644
--- a/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
+++ b/xmpp-vala/src/module/xep/0030_service_discovery/module.vala
@@ -45,7 +45,7 @@ public class Module : XmppStreamModule, Iq.Handler {
return yield this.cache.get_entity_identities(jid);
}
- public async InfoResult? request_info(XmppStream stream, Jid jid) {
+ public async InfoResult? request_info(XmppStream stream, Jid jid) throws IOError {
var future = active_info_requests[jid];
if (future == null) {
var promise = new Promise<InfoResult?>();
@@ -69,7 +69,7 @@ public class Module : XmppStreamModule, Iq.Handler {
}
}
- public async ItemsResult? request_items(XmppStream stream, Jid jid) {
+ public async ItemsResult? request_items(XmppStream stream, Jid jid) throws IOError {
StanzaNode query_node = new StanzaNode.build("query", NS_URI_ITEMS).add_self_xmlns();
Iq.Stanza iq = new Iq.Stanza.get(query_node) { to=jid };
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index 76045172..e4c066f0 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -215,7 +215,7 @@ public class Module : XmppStreamModule {
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq);
}
- public async void change_affiliation(XmppStream stream, Jid muc_jid, Jid? user_jid, string? nick, string new_affiliation) {
+ public async void change_affiliation(XmppStream stream, Jid muc_jid, Jid? user_jid, string? nick, string new_affiliation) throws IOError {
StanzaNode item_node = new StanzaNode.build("item", NS_URI_ADMIN)
.put_attribute("affiliation", new_affiliation, NS_URI_ADMIN);
if (user_jid != null) {
@@ -229,7 +229,7 @@ public class Module : XmppStreamModule {
yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
}
- public async DataForms.DataForm? get_config_form(XmppStream stream, Jid jid) {
+ public async DataForms.DataForm? get_config_form(XmppStream stream, Jid jid) throws IOError {
Iq.Stanza get_iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_OWNER).add_self_xmlns()) { to=jid };
Iq.Stanza result_iq = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, get_iq);
@@ -241,7 +241,7 @@ public class Module : XmppStreamModule {
return null;
}
- public async void set_config_form(XmppStream stream, Jid jid, DataForms.DataForm data_form) {
+ public async void set_config_form(XmppStream stream, Jid jid, DataForms.DataForm data_form) throws IOError {
StanzaNode stanza_node = new StanzaNode.build("query", NS_URI_OWNER);
stanza_node.add_self_xmlns().put_node(data_form.get_submit_node());
Iq.Stanza set_iq = new Iq.Stanza.set(stanza_node) { to=jid };
@@ -420,7 +420,7 @@ public class Module : XmppStreamModule {
yield query_affiliation(stream, muc_jid, "owner");
}
- private async Gee.List<Jid>? query_affiliation(XmppStream stream, Jid jid, string affiliation) {
+ private async Gee.List<Jid>? query_affiliation(XmppStream stream, Jid jid, string affiliation) throws IOError {
Iq.Stanza iq = new Iq.Stanza.get(
new StanzaNode.build("query", NS_URI_ADMIN)
.add_self_xmlns()
@@ -538,14 +538,18 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> {
if (item_nodes.size > 0) {
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 = 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);
+ try {
+ string jid_str = item_node.get_attribute("jid", Muc.NS_URI_USER);
+ 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);
- affiliations[real_jid] = affiliation;
+ affiliations[real_jid] = affiliation;
- stream.get_flag(Flag.IDENTITY).set_offline_member(message.from, real_jid, affiliation);
+ stream.get_flag(Flag.IDENTITY).set_offline_member(message.from, real_jid, affiliation);
+ } catch (InvalidJidError e) {
+ warning("Received invalid affiliation update: %s", e.message);
+ }
}
string? mav_since = MucAffiliationsVersioning.get_mav_since(x_node);
diff --git a/xmpp-vala/src/module/xep/0048_bookmarks.vala b/xmpp-vala/src/module/xep/0048_bookmarks.vala
index 46814e4a..dc009a1e 100644
--- a/xmpp-vala/src/module/xep/0048_bookmarks.vala
+++ b/xmpp-vala/src/module/xep/0048_bookmarks.vala
@@ -6,7 +6,7 @@ private const string NS_URI = "storage:bookmarks";
public class Module : BookmarksProvider, XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0048_bookmarks_module");
- public async Set<Conference>? get_conferences(XmppStream stream) {
+ public async Set<Conference>? get_conferences(XmppStream stream) throws IOError {
StanzaNode get_node = new StanzaNode.build("storage", NS_URI).add_self_xmlns();
StanzaNode? result_node = yield stream.get_module(PrivateXmlStorage.Module.IDENTITY).retrieve(stream, get_node);
if (result_node == null) return null;
@@ -20,7 +20,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
return ret;
}
- private async void set_conferences(XmppStream stream, Set<Conference> conferences) {
+ private async void set_conferences(XmppStream stream, Set<Conference> conferences) throws IOError {
StanzaNode storage_node = (new StanzaNode.build("storage", NS_URI)).add_self_xmlns();
foreach (Conference conference in conferences) {
Bookmarks1Conference? bookmarks1conference = conference as Bookmarks1Conference;
@@ -45,13 +45,13 @@ public class Module : BookmarksProvider, XmppStreamModule {
stream.get_module(Module.IDENTITY).received_conferences(stream, conferences);
}
- public async void add_conference(XmppStream stream, Conference conference) {
+ public async void add_conference(XmppStream stream, Conference conference) throws IOError {
Set<Conference>? conferences = yield get_conferences(stream);
conferences.add(conference);
yield set_conferences(stream, conferences);
}
- public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) {
+ public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) throws IOError {
Set<Conference>? conferences = yield get_conferences(stream);
foreach (Conference conference in conferences) {
if (conference.jid.equals(muc_jid)) {
@@ -64,7 +64,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
yield set_conferences(stream, conferences);
}
- public async void remove_conference(XmppStream stream, Conference conference_remove) {
+ public async void remove_conference(XmppStream stream, Conference conference_remove) throws IOError {
Set<Conference>? conferences = yield get_conferences(stream);
conferences.remove(conference_remove);
yield set_conferences(stream, conferences);
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 81ccde9b..a6501505 100644
--- a/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
+++ b/xmpp-vala/src/module/xep/0049_private_xml_storage.vala
@@ -6,13 +6,13 @@ namespace Xmpp.Xep.PrivateXmlStorage {
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0049_private_xml_storage");
- public async void store(XmppStream stream, StanzaNode node) {
+ public async void store(XmppStream stream, StanzaNode node) throws IOError {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.set(queryNode);
yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
}
- public async StanzaNode? retrieve(XmppStream stream, StanzaNode node) {
+ public async StanzaNode? retrieve(XmppStream stream, StanzaNode node) throws IOError {
StanzaNode queryNode = new StanzaNode.build("query", NS_URI).add_self_xmlns().put_node(node);
Iq.Stanza iq = new Iq.Stanza.get(queryNode);
Iq.Stanza iq_result = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
diff --git a/xmpp-vala/src/module/xep/0054_vcard/module.vala b/xmpp-vala/src/module/xep/0054_vcard/module.vala
index 4df1d9a5..4c02a2d1 100644
--- a/xmpp-vala/src/module/xep/0054_vcard/module.vala
+++ b/xmpp-vala/src/module/xep/0054_vcard/module.vala
@@ -2,7 +2,7 @@ namespace Xmpp.Xep.VCard {
private const string NS_URI = "vcard-temp";
private const string NS_URI_UPDATE = NS_URI + ":x:update";
-public async Bytes? fetch_image(XmppStream stream, Jid jid, string hash) {
+public async Bytes? fetch_image(XmppStream stream, Jid jid, string hash) throws IOError {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("vCard", NS_URI).add_self_xmlns()) { to=jid };
Iq.Stanza iq_res = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
diff --git a/xmpp-vala/src/module/xep/0060_pubsub.vala b/xmpp-vala/src/module/xep/0060_pubsub.vala
index c9af4263..88b9cd31 100644
--- a/xmpp-vala/src/module/xep/0060_pubsub.vala
+++ b/xmpp-vala/src/module/xep/0060_pubsub.vala
@@ -41,7 +41,7 @@ namespace Xmpp.Xep.Pubsub {
retract_listeners.unset(node);
}
- public async Gee.List<StanzaNode>? request_all(XmppStream stream, Jid? jid, string node) { // TODO multiple nodes gehen auch
+ public async Gee.List<StanzaNode>? request_all(XmppStream stream, Jid? jid, string node) throws IOError { // 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)));
if (jid != null) request_iq.to = jid;
@@ -72,7 +72,7 @@ namespace Xmpp.Xep.Pubsub {
XmppStream stream, Jid? jid, string node_id, string? item_id, StanzaNode content,
PublishOptions? publish_options = null,
bool try_reconfiguring = true
- ) {
+ ) throws IOError {
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);
@@ -142,7 +142,7 @@ namespace Xmpp.Xep.Pubsub {
stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, null);
}
- public async DataForms.DataForm? request_node_config(XmppStream stream, Jid? jid, string node_id) {
+ public async DataForms.DataForm? request_node_config(XmppStream stream, Jid? jid, string node_id) throws IOError {
StanzaNode pubsub_node = new StanzaNode.build("pubsub", NS_URI_OWNER).add_self_xmlns();
StanzaNode publish_node = new StanzaNode.build("configure", NS_URI_OWNER).put_attribute("node", node_id);
pubsub_node.put_node(publish_node);
@@ -154,7 +154,7 @@ namespace Xmpp.Xep.Pubsub {
return DataForms.DataForm.create_from_node(data_form_node);
}
- public async bool submit_node_config(XmppStream stream, DataForms.DataForm data_form, string node_id) {
+ public async bool submit_node_config(XmppStream stream, DataForms.DataForm data_form, string node_id) throws IOError {
StanzaNode submit_node = data_form.get_submit_node();
StanzaNode pubsub_node = new StanzaNode.build("pubsub", Pubsub.NS_URI_OWNER).add_self_xmlns();
@@ -222,7 +222,7 @@ namespace Xmpp.Xep.Pubsub {
}
}
- private async bool change_node_config(XmppStream stream, Jid jid, string node, PublishOptions publish_options) {
+ private async bool change_node_config(XmppStream stream, Jid jid, string node, PublishOptions publish_options) throws IOError {
DataForms.DataForm? data_form = yield stream.get_module(Pubsub.Module.IDENTITY).request_node_config(stream, jid, node);
if (data_form == null) return false;
diff --git a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
index 9cfb4afc..4bb46837 100644
--- a/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
+++ b/xmpp-vala/src/module/xep/0065_socks5_bytestreams.vala
@@ -50,7 +50,7 @@ public class Module : XmppStreamModule, Iq.Handler {
return get_local_ip_addresses_impl();
}
- private async void query_availability(XmppStream stream) {
+ private async void query_availability(XmppStream stream) throws IOError {
ServiceDiscovery.ItemsResult? items_result = yield stream.get_module(ServiceDiscovery.Module.IDENTITY).request_items(stream, stream.remote_name);
if (items_result == null) return;
diff --git a/xmpp-vala/src/module/xep/0077_in_band_registration.vala b/xmpp-vala/src/module/xep/0077_in_band_registration.vala
index 12ed2f1c..0d2dae40 100644
--- a/xmpp-vala/src/module/xep/0077_in_band_registration.vala
+++ b/xmpp-vala/src/module/xep/0077_in_band_registration.vala
@@ -7,7 +7,7 @@ public const string NS_URI = "jabber:iq:register";
public class Module : XmppStreamNegotiationModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0077_in_band_registration");
- public async Form? get_from_server(XmppStream stream, Jid jid) {
+ public async Form? get_from_server(XmppStream stream, Jid jid) throws IOError {
StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns();
Iq.Stanza request_form_iq = new Iq.Stanza.get(query_node) { to=jid };
request_form_iq.to = jid;
@@ -16,7 +16,7 @@ public class Module : XmppStreamNegotiationModule {
return new Form.from_node(stream, iq_result);
}
- public async string? submit_to_server(XmppStream stream, Jid jid, Form form) {
+ public async string? submit_to_server(XmppStream stream, Jid jid, Form form) throws IOError {
StanzaNode query_node = new StanzaNode.build("query", NS_URI).add_self_xmlns();
query_node.put_node(form.get_submit_node());
Iq.Stanza iq = new Iq.Stanza.set(query_node) { to=jid };
@@ -30,7 +30,7 @@ public class Module : XmppStreamNegotiationModule {
return null;
}
- public async ErrorStanza? change_password(XmppStream stream, Jid bare_jid, string new_pw) {
+ public async ErrorStanza? change_password(XmppStream stream, Jid bare_jid, string new_pw) throws IOError {
StanzaNode pw_change_node = new StanzaNode.build("query", NS_URI).add_self_xmlns();
StanzaNode username_node = new StanzaNode.build("username", NS_URI);
StanzaNode pw_node = new StanzaNode.build("password", NS_URI);
diff --git a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
index 3237208e..8cd3cfb1 100644
--- a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
+++ b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
@@ -15,8 +15,8 @@ public TimeZone? parse_tzd(string tzd) {
} else {
return null;
}
- int h_offset = unprefixed.substring(0, 2).to_int();
- int m_offset = unprefixed.substring(3, 2).to_int();
+ int h_offset = int.parse(unprefixed.substring(0, 2));
+ int m_offset = int.parse(unprefixed.substring(3, 2));
int offset = h_offset * 60 * 60 + m_offset * 60;
if (tzd.has_prefix("-")) {
offset = -offset;
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index 680c8e78..76ad824b 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -25,7 +25,7 @@ namespace Xmpp.Xep.UserAvatars {
stream.get_module(Pubsub.Module.IDENTITY).delete_node(stream, null, NS_URI_METADATA);
}
- public async Bytes? fetch_image(XmppStream stream, Jid jid, string hash) {
+ public async Bytes? fetch_image(XmppStream stream, Jid jid, string hash) throws IOError {
Gee.List<StanzaNode>? items = yield stream.get_module(Pubsub.Module.IDENTITY).request_all(stream, jid, NS_URI_DATA);
if (items == null || items.size == 0 || items[0].sub_nodes.size == 0) return null;
diff --git a/xmpp-vala/src/module/xep/0166_jingle/component.vala b/xmpp-vala/src/module/xep/0166_jingle/component.vala
index e30175d5..f08ffbce 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/component.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/component.vala
@@ -41,7 +41,11 @@ namespace Xmpp.Xep.Jingle {
assert(!this.stream.ready);
promise.set_value(stream);
if (terminated != null) {
- yield stream.close_async();
+ try {
+ yield stream.close_async();
+ } catch (IOError e) {
+ warning("Failed closing stream provided for terminated connection: %s", e.message);
+ }
}
}
@@ -53,7 +57,11 @@ namespace Xmpp.Xep.Jingle {
if (terminated == null) {
terminated = (reason_name ?? "") + " - " + (reason_text ?? "") + @"we terminated? $we_terminated";
if (stream.ready) {
- yield stream.value.close_async();
+ try {
+ yield stream.value.close_async();
+ } catch (IOError e) {
+ warning("Failed closing stream when terminating connection: %s", e.message);
+ }
} else {
promise.set_exception(new IOError.FAILED("Jingle connection failed"));
}
diff --git a/xmpp-vala/src/module/xep/0166_jingle/content.vala b/xmpp-vala/src/module/xep/0166_jingle/content.vala
index f6af1b17..07cadc36 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/content.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/content.vala
@@ -67,7 +67,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
ContentType content_type, ContentParameters content_params,
Transport transport, TransportParameters? transport_params,
SecurityPrecondition? security_precondition, SecurityParameters? security_params,
- Jid local_full_jid, Jid peer_full_jid) throws Error {
+ Jid local_full_jid, Jid peer_full_jid) {
this.content_name = content_name;
this.senders = senders;
this.role = Role.RESPONDER;
@@ -142,7 +142,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
this.content_params.accept(stream, session, this);
}
- internal void handle_accept(XmppStream stream, ContentNode content_node) {
+ internal void handle_accept(XmppStream stream, ContentNode content_node) throws IqError {
this.transport_params.handle_transport_accept(content_node.transport);
this.transport_params.create_transport_connection(stream, this);
this.content_params.handle_accept(stream, this.session, this, content_node.description);
@@ -157,7 +157,13 @@ public class Xmpp.Xep.Jingle.Content : Object {
return;
}
tried_transport_methods.add(new_transport.ns_uri);
- transport_params = new_transport.create_transport_parameters(stream, transport_params.components, local_full_jid, peer_full_jid);
+ try {
+ transport_params = new_transport.create_transport_parameters(stream, transport_params.components, local_full_jid, peer_full_jid);
+ } catch (Error e) {
+ session.terminate(ReasonElement.FAILED_TRANSPORT, null, e.message);
+ // TODO should we only terminate this content or really the whole session?
+ return;
+ }
set_transport_params(transport_params);
session.send_transport_replace(this, transport_params);
state = State.REPLACING_TRANSPORT;
diff --git a/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala b/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
index 9f0acd27..f451f4c9 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/jingle_flag.vala
@@ -24,7 +24,12 @@ public class Xmpp.Xep.Jingle.Flag : XmppStreamFlag {
public async Session? get_session(string sid) {
if (promises.has_key(sid)) {
- return yield promises[sid].future.wait_async();
+ try {
+ return yield promises[sid].future.wait_async();
+ } catch (FutureError e) {
+ warning("Failed waiting for session: %s", e.message);
+ return null;
+ }
}
return sessions[sid];
}
diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala
index 22e8e978..aa8d6656 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/session.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala
@@ -222,7 +222,12 @@ public class Xmpp.Xep.Jingle.Session : Object {
.put_node(content.transport_params.to_transport_stanza_node("content-add")));
Iq.Stanza iq = new Iq.Stanza.set(content_add_node) { to=peer_full_jid };
- yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ try {
+ yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ } catch (IOError e) {
+ warning("Error adding content: %s", e.message);
+ // FIXME: Probably need to clean up some state
+ }
}
private void handle_content_accept(ContentNode content_node) throws IqError {
diff --git a/xmpp-vala/src/module/xep/0176_jingle_ice_udp/transport_parameters.vala b/xmpp-vala/src/module/xep/0176_jingle_ice_udp/transport_parameters.vala
index 490cc125..53057d9e 100644
--- a/xmpp-vala/src/module/xep/0176_jingle_ice_udp/transport_parameters.vala
+++ b/xmpp-vala/src/module/xep/0176_jingle_ice_udp/transport_parameters.vala
@@ -39,7 +39,11 @@ public abstract class Xmpp.Xep.JingleIceUdp.IceUdpTransportParameters : Jingle.T
remote_pwd = node.get_attribute("pwd");
remote_ufrag = node.get_attribute("ufrag");
foreach (StanzaNode candidateNode in node.get_subnodes("candidate")) {
- remote_candidates.add(Candidate.parse(candidateNode));
+ try {
+ remote_candidates.add(Candidate.parse(candidateNode));
+ } catch (Jingle.IqError e) {
+ warning("Ignoring invalid candidate %s: %s", candidateNode.to_string(), e.message);
+ }
}
StanzaNode? fingerprint_node = node.get_subnode("fingerprint", DTLS_NS_URI);
diff --git a/xmpp-vala/src/module/xep/0191_blocking_command.vala b/xmpp-vala/src/module/xep/0191_blocking_command.vala
index 9e5ede78..c037c480 100644
--- a/xmpp-vala/src/module/xep/0191_blocking_command.vala
+++ b/xmpp-vala/src/module/xep/0191_blocking_command.vala
@@ -88,11 +88,15 @@ public class Module : XmppStreamModule, Iq.Handler {
bool has_feature = yield stream.get_module(ServiceDiscovery.Module.IDENTITY).has_entity_feature(stream, stream.remote_name, NS_URI);
if (has_feature) {
stream.add_flag(new Flag());
- stream.get_flag(Flag.IDENTITY).blocklist = yield get_blocklist(stream);
+ try {
+ stream.get_flag(Flag.IDENTITY).blocklist = yield get_blocklist(stream);
+ } catch (IOError e) {
+ warning("Failed to retrieve blocklist: %s", e.message);
+ }
}
}
- private async Gee.List<string> get_blocklist(XmppStream stream) {
+ private async Gee.List<string> get_blocklist(XmppStream stream) throws IOError {
StanzaNode blocklist_node = new StanzaNode.build("blocklist", NS_URI).add_self_xmlns();
Iq.Stanza iq = new Iq.Stanza.get(blocklist_node);
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index 18fa538c..7bc234bc 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -6,7 +6,7 @@ namespace Xmpp.Xep.Ping {
public class Module : XmppStreamModule, Iq.Handler {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0199_ping");
- public async Iq.Stanza send_ping(XmppStream stream, Jid jid) {
+ public async Iq.Stanza send_ping(XmppStream stream, Jid jid) throws IOError {
StanzaNode ping_node = new StanzaNode.build("ping", NS_URI).add_self_xmlns();
Iq.Stanza iq = new Iq.Stanza.get(ping_node) { to=jid };
return yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq, Priority.HIGH);
diff --git a/xmpp-vala/src/module/xep/0215_external_service_discovery.vala b/xmpp-vala/src/module/xep/0215_external_service_discovery.vala
index 5bad71cd..67f67c05 100644
--- a/xmpp-vala/src/module/xep/0215_external_service_discovery.vala
+++ b/xmpp-vala/src/module/xep/0215_external_service_discovery.vala
@@ -4,7 +4,7 @@ namespace Xmpp.Xep.ExternalServiceDiscovery {
private const string NS_URI = "urn:xmpp:extdisco:2";
- public static async Gee.List<Service> request_services(XmppStream stream) {
+ public static async Gee.List<Service> request_services(XmppStream stream) throws IOError {
Iq.Stanza request_iq = new Iq.Stanza.get((new StanzaNode.build("services", NS_URI)).add_self_xmlns()) { to=stream.remote_name };
Iq.Stanza response_iq = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, request_iq);
diff --git a/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala b/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala
index f85049ac..43edefad 100644
--- a/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala
+++ b/xmpp-vala/src/module/xep/0234_jingle_file_transfer.vala
@@ -42,7 +42,7 @@ public class Module : Jingle.ContentType, XmppStreamModule {
return yield stream.get_module(Jingle.Module.IDENTITY).is_available(stream, required_transport_type, required_components, full_jid);
}
- public async void offer_file_stream(XmppStream stream, Jid receiver_full_jid, InputStream input_stream, string basename, int64 size, string? precondition_name = null, Object? precondition_options = null) throws Jingle.Error {
+ public async void offer_file_stream(XmppStream stream, Jid receiver_full_jid, InputStream input_stream, string basename, int64 size, string? precondition_name = null, Object? precondition_options = null) throws Jingle.Error, Jingle.IqError {
StanzaNode file_node;
StanzaNode description = new StanzaNode.build("description", NS_URI)
.add_self_xmlns()
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 852cc7eb..7f44bda2 100644
--- a/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala
+++ b/xmpp-vala/src/module/xep/0260_jingle_socks5_bytestreams.vala
@@ -328,9 +328,13 @@ class LocalListener {
}
} catch (Error e) {
warning("Jingle SOCKS5 bytestream establish error cid %s: %s", cid, e.message);
- // Send a "general SOCKS server failure" (0x01)
- yield conn.output_stream.write_all_async({0x05, 0x01}, GLib.Priority.DEFAULT, null, out written);
- yield conn.output_stream.close_async();
+ try {
+ // Send a "general SOCKS server failure" (0x01)
+ yield conn.output_stream.write_all_async({0x05, 0x01}, GLib.Priority.DEFAULT, null, out written);
+ yield conn.output_stream.close_async();
+ } catch (Error sub) {
+ // Ignoring
+ }
}
}
diff --git a/xmpp-vala/src/module/xep/0272_muji.vala b/xmpp-vala/src/module/xep/0272_muji.vala
index 8226da10..7fd0da19 100644
--- a/xmpp-vala/src/module/xep/0272_muji.vala
+++ b/xmpp-vala/src/module/xep/0272_muji.vala
@@ -86,7 +86,12 @@ namespace Xmpp.Xep.Muji {
GroupCall group_call = stream.get_flag(Flag.IDENTITY).calls[muc_jid];
group_call.waiting_for_finish_prepares[promise] = preparing_peers;
- return yield promise.future.wait_async();
+ try {
+ return yield promise.future.wait_async();
+ } catch (FutureError e) {
+ warning("Failed waiting for preparing peers: %s", e.message);
+ return new ArrayList<Presence.Stanza>();
+ }
}
private async void compute_payload_intersection(XmppStream stream, GroupCall group_call, string media) {
diff --git a/xmpp-vala/src/module/xep/0280_message_carbons.vala b/xmpp-vala/src/module/xep/0280_message_carbons.vala
index b396ee54..f8008bfe 100644
--- a/xmpp-vala/src/module/xep/0280_message_carbons.vala
+++ b/xmpp-vala/src/module/xep/0280_message_carbons.vala
@@ -10,13 +10,21 @@ public class Module : XmppStreamModule {
public async void enable(XmppStream stream) {
if (stream.get_flag(Flag.IDENTITY) == null) {
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("enable", NS_URI).add_self_xmlns());
- yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ try {
+ yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ } catch (IOError e) {
+ warning("Failed enabling carbons: %s", e.message);
+ }
}
}
public async void disable(XmppStream stream) {
Iq.Stanza iq = new Iq.Stanza.set(new StanzaNode.build("disable", NS_URI).add_self_xmlns());
- yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ try {
+ yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, iq);
+ } catch (IOError e) {
+ warning("Failed enabling carbons: %s", e.message);
+ }
}
public override void attach(XmppStream stream) {
diff --git a/xmpp-vala/src/module/xep/0313_2_message_archive_management.vala b/xmpp-vala/src/module/xep/0313_2_message_archive_management.vala
index 298a1c61..17b93d55 100644
--- a/xmpp-vala/src/module/xep/0313_2_message_archive_management.vala
+++ b/xmpp-vala/src/module/xep/0313_2_message_archive_management.vala
@@ -61,7 +61,7 @@ namespace Xmpp.MessageArchiveManagement.V2 {
return MessageArchiveManagement.create_base_query(stream, mam_params.query_id, fields);
}
- public async QueryResult query_archive(XmppStream stream, MamQueryParams mam_params, Cancellable? cancellable = null) {
+ public async QueryResult query_archive(XmppStream stream, MamQueryParams mam_params, Cancellable? cancellable = null) throws IOError {
var query_node = create_base_query(stream, mam_params);
if (!mam_params.use_ns2_extended) {
query_node.put_node(ResultSetManagement.create_set_rsm_node_before(mam_params.end_id));
@@ -70,7 +70,7 @@ namespace Xmpp.MessageArchiveManagement.V2 {
return yield MessageArchiveManagement.query_archive(stream, mam_params.mam_server, query_node, cancellable);
}
- public async QueryResult page_through_results(XmppStream stream, MamQueryParams mam_params, QueryResult prev_result, Cancellable? cancellable = null) {
+ public async QueryResult page_through_results(XmppStream stream, MamQueryParams mam_params, QueryResult prev_result, Cancellable? cancellable = null) throws IOError {
var query_node = create_base_query(stream, mam_params);
query_node.put_node(ResultSetManagement.create_set_rsm_node_before(prev_result.first));
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 a9149d4e..f054a047 100644
--- a/xmpp-vala/src/module/xep/0313_message_archive_management.vala
+++ b/xmpp-vala/src/module/xep/0313_message_archive_management.vala
@@ -57,7 +57,7 @@ public class Module : XmppStreamModule {
return query_node;
}
- internal async QueryResult query_archive(XmppStream stream, Jid? mam_server, StanzaNode query_node, Cancellable? cancellable = null) {
+ internal async QueryResult query_archive(XmppStream stream, Jid? mam_server, StanzaNode query_node, Cancellable? cancellable = null) throws IOError {
var res = new QueryResult();
Flag flag = Flag.get_flag(stream);
diff --git a/xmpp-vala/src/module/xep/0392_consistent_color/hsluv.vala b/xmpp-vala/src/module/xep/0392_consistent_color/hsluv.vala
index b45d84de..10aa5d9f 100644
--- a/xmpp-vala/src/module/xep/0392_consistent_color/hsluv.vala
+++ b/xmpp-vala/src/module/xep/0392_consistent_color/hsluv.vala
@@ -340,9 +340,9 @@ internal string rgb_to_hex(double[] tuple) {
internal double[] hex_to_tgb(string hex) {
return new double[] {
- hex.substring(1, 2).to_long(null, 16) / 255.0,
- hex.substring(3, 2).to_long(null, 16) / 255.0,
- hex.substring(5, 2).to_long(null, 16) / 255.0
+ long.parse(hex.substring(1, 2), 16) / 255.0,
+ long.parse(hex.substring(3, 2), 16) / 255.0,
+ long.parse(hex.substring(5, 2), 16) / 255.0
};
}
diff --git a/xmpp-vala/src/module/xep/0402_bookmarks2.vala b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
index 938af0e9..3a7e5211 100644
--- a/xmpp-vala/src/module/xep/0402_bookmarks2.vala
+++ b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
@@ -8,7 +8,7 @@ public const string NS_URI_COMPAT = NS_URI + "#compat";
public class Module : BookmarksProvider, XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0402_bookmarks2");
- public async Set<Conference>? get_conferences(XmppStream stream) {
+ public async Set<Conference>? get_conferences(XmppStream stream) throws IOError {
HashMap<Jid, Conference>? hm = null;
Flag? flag = stream.get_flag(Flag.IDENTITY);
@@ -35,7 +35,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
return ret;
}
- public async void add_conference(XmppStream stream, Conference conference) {
+ public async void add_conference(XmppStream stream, Conference conference) throws IOError {
StanzaNode conference_node = new StanzaNode.build("conference", NS_URI).add_self_xmlns()
.put_attribute("autojoin", conference.autojoin.to_string());
if (conference.name != null) {
@@ -56,7 +56,7 @@ public class Module : BookmarksProvider, XmppStreamModule {
yield stream.get_module(Pubsub.Module.IDENTITY).publish(stream, stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid, NS_URI, conference.jid.to_string(), conference_node, publish_options);
}
- public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) {
+ public async void replace_conference(XmppStream stream, Jid muc_jid, Conference modified_conference) throws IOError {
yield add_conference(stream, modified_conference);
}
diff --git a/xmpp-vala/src/module/xep/0461_replies.vala b/xmpp-vala/src/module/xep/0461_replies.vala
index af84aa3d..23849d69 100644
--- a/xmpp-vala/src/module/xep/0461_replies.vala
+++ b/xmpp-vala/src/module/xep/0461_replies.vala
@@ -36,6 +36,5 @@ namespace Xmpp.Xep.Replies {
} catch (InvalidJidError e) {
return null;
}
- return null;
}
} \ No newline at end of file