diff options
author | Sam Whited <sam@samwhited.com> | 2014-12-23 17:19:00 -0500 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-12-25 21:38:55 +0100 |
commit | e4d9dca2fe6a75960d24f8af4dadba9a1a42845c (patch) | |
tree | 71ee843312cc2ede584e523832a74ced950fd789 /src/main/java/eu/siacs/conversations/generator | |
parent | 2081c1bef767907479bbad1971f4cb0e0074bfbd (diff) |
Add ability to change password on server
Fixes #260
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/IqGenerator.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 4b28e484..4bfc0963 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.Xmlns; @@ -117,7 +118,6 @@ public class IqGenerator extends AbstractGenerator { } return packet; } - public IqPacket generateGetBlockList() { final IqPacket iq = new IqPacket(IqPacket.TYPE_GET); iq.addChild("blocklist", Xmlns.BLOCKING); @@ -138,4 +138,14 @@ public class IqGenerator extends AbstractGenerator { block.addChild("item").setAttribute("jid", jid.toBareJid().toString()); return iq; } + + public IqPacket generateSetPassword(final Account account, final String newPassword) { + final IqPacket packet = new IqPacket(IqPacket.TYPE_SET); + packet.setTo(account.getServer()); + final Element query = packet.addChild("query", Xmlns.REGISTER); + final Jid jid = account.getJid(); + query.addChild("username").setContent(jid.isDomainJid() ? jid.toString() : jid.getLocalpart()); + query.addChild("password").setContent(newPassword); + return packet; + } } |