diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/DeleteSlotPacketParser.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/DeleteSlotPacketParser.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/DeleteSlotPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/DeleteSlotPacketParser.java new file mode 100644 index 00000000..d7e136fc --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/filetransfer/http/DeleteSlotPacketParser.java @@ -0,0 +1,28 @@ +package de.thedevstack.conversationsplus.xmpp.filetransfer.http; + +import de.thedevstack.conversationsplus.xml.Element; +import de.thedevstack.conversationsplus.xmpp.IqPacketParser; +import de.thedevstack.conversationsplus.xmpp.exceptions.UnexpectedIqPacketTypeException; +import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; +import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import de.thedevstack.conversationsplus.xmpp.utils.ErrorIqPacketExceptionHelper; + +/** + * Created by steckbrief on 21.08.2016. + */ +public class DeleteSlotPacketParser extends IqPacketParser { + public static String parseDeleteToken(IqPacket packet) throws XmppException { + String deletetoken = null; + if (packet.getType() == IqPacket.TYPE.RESULT) { + Element slot = findRequiredChild(packet, "slot", FileTransferHttp.NAMESPACE); + + deletetoken = findRequiredChildContent(slot, "deletetoken"); + } else if (packet.getType() == IqPacket.TYPE.ERROR) { + ErrorIqPacketExceptionHelper.throwIqErrorException(packet); + } else { + throw new UnexpectedIqPacketTypeException(packet, packet.getType(), IqPacket.TYPE.RESULT, IqPacket.TYPE.ERROR); + } + + return deletetoken; + } +} |