aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/generator/MessageGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/generator/MessageGenerator.java')
-rw-r--r--src/eu/siacs/conversations/generator/MessageGenerator.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/generator/MessageGenerator.java b/src/eu/siacs/conversations/generator/MessageGenerator.java
index 77ac55f1..b9728952 100644
--- a/src/eu/siacs/conversations/generator/MessageGenerator.java
+++ b/src/eu/siacs/conversations/generator/MessageGenerator.java
@@ -46,17 +46,21 @@ public class MessageGenerator {
return generateOtrChat(message, false);
}
- public MessagePacket generateOtrChat(Message message, boolean addDelay) throws OtrException {
+ public MessagePacket generateOtrChat(Message message, boolean addDelay) {
Session otrSession = message.getConversation().getOtrSession();
if (otrSession==null) {
- throw new OtrException(null);
+ return null;
}
MessagePacket packet = preparePacket(message,addDelay);
packet.addChild("private", "urn:xmpp:carbons:2");
packet.addChild("no-copy", "urn:xmpp:hints");
- packet.setBody(otrSession.transformSending(message
- .getBody()));
- return packet;
+ try {
+ packet.setBody(otrSession.transformSending(message
+ .getBody()));
+ return packet;
+ } catch (OtrException e) {
+ return null;
+ }
}
public MessagePacket generateChat(Message message) {