From 3a57f6df897202010e1de242445b0f65763946d2 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 26 Jun 2014 16:42:24 +0200 Subject: faulty otr messages now generate an error --- .../conversations/generator/MessageGenerator.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/eu/siacs/conversations/generator') diff --git a/src/eu/siacs/conversations/generator/MessageGenerator.java b/src/eu/siacs/conversations/generator/MessageGenerator.java index b9728952..28504b21 100644 --- a/src/eu/siacs/conversations/generator/MessageGenerator.java +++ b/src/eu/siacs/conversations/generator/MessageGenerator.java @@ -88,4 +88,22 @@ public class MessageGenerator { } return packet; } + + public MessagePacket generateNotAcceptable(MessagePacket origin) { + MessagePacket packet = generateError(origin); + Element error = packet.addChild("error"); + error.setAttribute("type", "modify"); + error.setAttribute("code", "406"); + error.addChild("not-acceptable"); + return packet; + } + + private MessagePacket generateError(MessagePacket origin) { + MessagePacket packet = new MessagePacket(); + packet.setId(origin.getId()); + packet.setTo(origin.getFrom()); + packet.setBody(origin.getBody()); + packet.setType(MessagePacket.TYPE_ERROR); + return packet; + } } -- cgit v1.2.3