Search in sources :

Example 1 with RetractedElement

use of org.jivesoftware.smackx.message_retraction.element.RetractedElement in project Smack by igniterealtime.

the class RetractedElementProvider method parse.

@Override
public RetractedElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException, ParseException {
    Date date = ParserUtils.getDateFromXep82String(parser.getAttributeValue("", RetractedElement.ATTR_STAMP));
    OriginIdElement originIdElement = null;
    while (originIdElement == null) {
        XmlPullParser.TagEvent tag = parser.nextTag();
        if (tag == XmlPullParser.TagEvent.START_ELEMENT && OriginIdElement.ELEMENT.equals(parser.getName()) && StableUniqueStanzaIdManager.NAMESPACE.equals(parser.getNamespace())) {
            originIdElement = OriginIdProvider.INSTANCE.parse(parser);
        }
    }
    return new RetractedElement(date, originIdElement);
}
Also used : RetractedElement(org.jivesoftware.smackx.message_retraction.element.RetractedElement) XmlPullParser(org.jivesoftware.smack.xml.XmlPullParser) OriginIdElement(org.jivesoftware.smackx.sid.element.OriginIdElement) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 XmlPullParser (org.jivesoftware.smack.xml.XmlPullParser)1 RetractedElement (org.jivesoftware.smackx.message_retraction.element.RetractedElement)1 OriginIdElement (org.jivesoftware.smackx.sid.element.OriginIdElement)1