diff options
Diffstat (limited to 'libdino/src/service/registration.vala')
-rw-r--r-- | libdino/src/service/registration.vala | 22 |
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) { |