diff options
Diffstat (limited to 'src/com/isode/stroke/parser/payloadparsers/MAMArchivedParser.java')
-rw-r--r-- | src/com/isode/stroke/parser/payloadparsers/MAMArchivedParser.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/com/isode/stroke/parser/payloadparsers/MAMArchivedParser.java b/src/com/isode/stroke/parser/payloadparsers/MAMArchivedParser.java new file mode 100644 index 0000000..5547a87 --- /dev/null +++ b/src/com/isode/stroke/parser/payloadparsers/MAMArchivedParser.java @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2014 Kevin Smith and Remko Tronçon +* All rights reserved. +*/ + +/* +* Copyright (c) 2014, Isode Limited, London, England. +* All rights reserved. +*/ + +package com.isode.stroke.parser.payloadparsers; + +import com.isode.stroke.elements.MAMArchived; +import com.isode.stroke.jid.JID; +import com.isode.stroke.parser.AttributeMap; +import com.isode.stroke.parser.GenericPayloadParser; + +public class MAMArchivedParser extends GenericPayloadParser<MAMArchived> { + public MAMArchivedParser() { + super(new MAMArchived()); + } + + public void handleStartElement(String element, String ns, AttributeMap attributes) { + if (level_ == 0) { + String attributeValue = attributes.getAttributeValue("by"); + if (attributeValue != null) { + getPayloadInternal().setBy(JID.fromString(attributeValue)); + } + attributeValue = attributes.getAttributeValue("id"); + if (attributeValue != null) { + getPayloadInternal().setID(attributeValue); + } + } + + ++level_; + } + + public void handleEndElement(String element, String ns) { + --level_; + } + + public void handleCharacterData(String data) { + } + + private int level_; +} |