aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-12-31 19:04:18 +0100
committerfiaxh <git@lightrise.org>2020-12-31 19:04:18 +0100
commitc7b242a72e411f54192ae74f0bebaf090c4dc17a (patch)
tree2e8452b522d76a15c559282f11a81554320335aa /libdino/src/service
parent81a55052707d460a7f437b664682817c2c99dce6 (diff)
downloaddino-c7b242a72e411f54192ae74f0bebaf090c4dc17a.tar.gz
dino-c7b242a72e411f54192ae74f0bebaf090c4dc17a.zip
Show invalid certificate screen also when registering account
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/registration.vala22
1 files changed, 17 insertions, 5 deletions
diff --git a/libdino/src/service/registration.vala b/libdino/src/service/registration.vala
index dc9ed95c..365f31b0 100644
--- a/libdino/src/service/registration.vala
+++ b/libdino/src/service/registration.vala
@@ -124,7 +124,14 @@ public class Register : StreamInteractionModule, Object{
return ret;
}
- public static async Xep.InBandRegistration.Form? get_registration_form(Jid jid) {
+ public class RegistrationFormReturn {
+ public Xep.InBandRegistration.Form? form { get; set; }
+ public TlsCertificateFlags? error_flags { get; set; }
+ }
+
+ public static async RegistrationFormReturn get_registration_form(Jid jid) {
+ RegistrationFormReturn ret = new RegistrationFormReturn();
+
Gee.List<XmppStreamModule> list = new ArrayList<XmppStreamModule>();
list.add(new Iq.Module());
list.add(new Xep.InBandRegistration.Module());
@@ -134,7 +141,13 @@ public class Register : StreamInteractionModule, Object{
);
if (stream_result.stream == null) {
- return null;
+ if (stream_result.io_error != null) {
+ debug("Error connecting to stream: %s", stream_result.io_error.message);
+ }
+ if (stream_result.tls_errors != null) {
+ ret.error_flags = stream_result.tls_errors;
+ }
+ return ret;
}
XmppStream stream = stream_result.stream;
@@ -159,15 +172,14 @@ public class Register : StreamInteractionModule, Object{
yield;
- Xep.InBandRegistration.Form? form = null;
if (stream.negotiation_complete) {
- form = yield stream.get_module(Xep.InBandRegistration.Module.IDENTITY).get_from_server(stream, jid);
+ ret.form = yield stream.get_module(Xep.InBandRegistration.Module.IDENTITY).get_from_server(stream, jid);
}
try {
yield stream.disconnect();
} catch (Error e) {}
- return form;
+ return ret;
}
public static async string? submit_form(Jid jid, Xep.InBandRegistration.Form form) {