diff options
Diffstat (limited to 'src/main/java')
3 files changed, 21 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 5fd701f89..ff0c3066a 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -551,6 +551,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (conversation.getMucOptions().isSelf(counterpart)) { status = Message.STATUS_SEND_RECEIVED; isCarbon = true; //not really carbon but received from another resource + //TODO this would be the place to change the body after something like mod_pastebin if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId)) { return; } else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) { diff --git a/src/main/java/de/pixart/messenger/xml/XmlElementReader.java b/src/main/java/de/pixart/messenger/xml/XmlElementReader.java new file mode 100644 index 000000000..108822509 --- /dev/null +++ b/src/main/java/de/pixart/messenger/xml/XmlElementReader.java @@ -0,0 +1,19 @@ +package de.pixart.messenger.xml; + +import com.google.common.io.ByteSource; + +import java.io.IOException; +import java.io.InputStream; + +public class XmlElementReader { + + public static Element read(byte[] bytes) throws IOException { + return read(ByteSource.wrap(bytes).openStream()); + } + + public static Element read(InputStream inputStream) throws IOException { + final XmlReader xmlReader = new XmlReader(); + xmlReader.setInputStream(inputStream); + return xmlReader.readElement(xmlReader.readTag()); + } +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/xml/XmlReader.java b/src/main/java/de/pixart/messenger/xml/XmlReader.java index 6447f12ef..ef2a33158 100644 --- a/src/main/java/de/pixart/messenger/xml/XmlReader.java +++ b/src/main/java/de/pixart/messenger/xml/XmlReader.java @@ -87,8 +87,7 @@ public class XmlReader implements Closeable { return null; } - public Element readElement(Tag currentTag) throws XmlPullParserException, - IOException { + public Element readElement(Tag currentTag) throws IOException { Element element = new Element(currentTag.getName()); element.setAttributes(currentTag.getAttributes()); Tag nextTag = this.readTag(); |