aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/generator
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-26 16:42:24 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-26 16:42:24 +0200
commit3a57f6df897202010e1de242445b0f65763946d2 (patch)
treed39f982311baeee07b2216285b71e5b2c46999f3 /src/eu/siacs/conversations/generator
parent3bb585c020f6b21e41de7ce6d8ee9cb0675a9b54 (diff)
faulty otr messages now generate an error
Diffstat (limited to 'src/eu/siacs/conversations/generator')
-rw-r--r--src/eu/siacs/conversations/generator/MessageGenerator.java18
1 files changed, 18 insertions, 0 deletions
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;
+ }
}