Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
760 additions
and 175 deletions.
- +1 −0 libdino/CMakeLists.txt
- +1 −0 libdino/src/service/module_manager.vala
- +42 −0 libdino/src/service/registration.vala
- +1 −0 main/CMakeLists.txt
- +366 −112 main/data/manage_accounts/add_account_dialog.ui
- +1 −49 main/src/ui/contact_details/muc_config_form_provider.vala
- +219 −11 main/src/ui/manage_accounts/add_account_dialog.vala
- +57 −0 main/src/ui/util/data_forms.vala
- +1 −0 xmpp-vala/CMakeLists.txt
- +5 −1 xmpp-vala/src/module/stanza_error.vala
- +2 −2 xmpp-vala/src/module/xep/0004_data_forms.vala
- +64 −0 xmpp-vala/src/module/xep/0077_in_band_registration.vala
@@ -0,0 +1,42 @@ | ||
using Gee; | ||
|
||
using Xmpp; | ||
using Dino.Entities; | ||
|
||
namespace Dino { | ||
|
||
public class Register { | ||
|
||
public static async Xep.InBandRegistration.Form get_registration_form(Jid jid) { | ||
XmppStream stream = new XmppStream(); | ||
stream.add_module(new Tls.Module()); | ||
stream.add_module(new Iq.Module()); | ||
stream.add_module(new Xep.InBandRegistration.Module()); | ||
stream.connect.begin(jid.bare_jid.to_string()); | ||
|
||
Xep.InBandRegistration.Form? form = null; | ||
SourceFunc callback = get_registration_form.callback; | ||
stream.stream_negotiated.connect(() => { | ||
if (callback != null) { | ||
Idle.add((owned)callback); | ||
} | ||
}); | ||
Timeout.add_seconds(5, () => { | ||
if (callback != null) { | ||
Idle.add((owned)callback); | ||
} | ||
return false; | ||
}); | ||
yield; | ||
if (stream.negotiation_complete) { | ||
form = yield stream.get_module(Xep.InBandRegistration.Module.IDENTITY).get_from_server(stream, jid); | ||
} | ||
return form; | ||
} | ||
|
||
public static async string submit_form(Jid jid, Xep.InBandRegistration.Form form) { | ||
return yield form.stream.get_module(Xep.InBandRegistration.Module.IDENTITY).submit_to_server(form.stream, jid, form); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.