diff options
Diffstat (limited to 'xmpp-vala')
-rw-r--r-- | xmpp-vala/src/module/xep/0077_in_band_registration.vala | 18 |
1 files changed, 18 insertions, 0 deletions
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 baaa4ee0..87b654a8 100644 --- a/xmpp-vala/src/module/xep/0077_in_band_registration.vala +++ b/xmpp-vala/src/module/xep/0077_in_band_registration.vala @@ -30,6 +30,24 @@ public class Module : XmppStreamNegotiationModule { return null; } + public async ErrorStanza? change_password(XmppStream stream, Jid jid, string new_pw) { + 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); + username_node.put_node(new StanzaNode.text(jid.localpart)); + pw_node.put_node(new StanzaNode.text(new_pw)); + pw_change_node.put_node(username_node); + pw_change_node.put_node(pw_node); + Iq.Stanza set_password_iq = new Iq.Stanza.set(pw_change_node) { to=jid.bare_jid.domain_jid }; + + Iq.Stanza chpw_result = yield stream.get_module(Iq.Module.IDENTITY).send_iq_async(stream, set_password_iq); + if (chpw_result.is_error()) { + return chpw_result.get_error(); + } + + return null; + } + public override bool mandatory_outstanding(XmppStream stream) { return false; } public override bool negotiation_active(XmppStream stream) { return false; } |