blob: 7c011449d56e6ef824b69a450bb4ba03f49f3a51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete;
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.filetransfer.http.FileTransferHttp;
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;
}
}
|