diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-12-01 12:22:47 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-12-01 12:22:47 +0100 |
commit | d42c82abf21d92ae1e8c7d12510d376800a2b363 (patch) | |
tree | 4170b94578e18fb18db2cce2ee8970ac27375bab /src/main/java/eu/siacs/conversations/generator | |
parent | 2225b0b6d5586d608b15d4e1ac13faa99b8971bf (diff) |
combine multiple message receipts into single message
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/MessageGenerator.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java index 573049c79..9c847d0e0 100644 --- a/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/MessageGenerator.java @@ -4,6 +4,7 @@ import net.java.otr4j.OtrException; import net.java.otr4j.session.Session; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.Locale; import java.util.TimeZone; @@ -72,9 +73,9 @@ public class MessageGenerator extends AbstractGenerator { Element html = packet.addChild("html","http://jabber.org/protocol/xhtml-im"); Element body = html.addChild("body","http://www.w3.org/1999/xhtml"); Element img = body.addChild("img"); - img.setAttribute("src",params.url.toString()); - img.setAttribute("height",params.height); - img.setAttribute("width",params.width); + img.setAttribute("src", params.url.toString()); + img.setAttribute("height", params.height); + img.setAttribute("width", params.width); } public static void addMessageHints(MessagePacket packet) { @@ -188,13 +189,14 @@ public class MessageGenerator extends AbstractGenerator { return packet; } - public MessagePacket received(Account account, MessagePacket originalMessage, String namespace, int type) { + public MessagePacket received(Account account, MessagePacket originalMessage, ArrayList<String> namespaces, int type) { MessagePacket receivedPacket = new MessagePacket(); receivedPacket.setType(type); receivedPacket.setTo(originalMessage.getFrom()); receivedPacket.setFrom(account.getJid()); - Element received = receivedPacket.addChild("received", namespace); - received.setAttribute("id", originalMessage.getId()); + for(String namespace : namespaces) { + receivedPacket.addChild("received", namespace).setAttribute("id", originalMessage.getId()); + } return receivedPacket; } |