diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-03-21 16:07:17 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-03-21 16:07:17 +0100 |
commit | 99b2ef7e9d571dcfa386df4d0190ce626e657232 (patch) | |
tree | c3916fd5c3d9214ed26d29abbc618f7711e31d05 /src/main/java/eu/siacs/conversations/crypto | |
parent | 825278971e869012e71dedbbd0da2792c3182157 (diff) |
respond to unreadable OTR messages with error message. fixed #1021
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/OtrEngine.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java b/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java index c85864d0..20427d7b 100644 --- a/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java @@ -201,9 +201,21 @@ public class OtrEngine extends OtrCryptoEngineImpl implements OtrEngineHost { } @Override - public void messageFromAnotherInstanceReceived(SessionID id) { - Log.d(Config.LOGTAG, - "unreadable message received from " + id.getAccountID()); + public void messageFromAnotherInstanceReceived(SessionID session) { + try { + Jid jid = Jid.fromSessionID(session); + Conversation conversation = mXmppConnectionService.find(account, jid); + String id = conversation == null ? null : conversation.getLastReceivedOtrMessageId(); + if (id != null) { + MessagePacket packet = mXmppConnectionService.getMessageGenerator().generateOtrError(jid,id); + packet.setFrom(account.getJid()); + mXmppConnectionService.sendMessagePacket(account,packet); + Log.d(Config.LOGTAG,packet.toString()); + Log.d(Config.LOGTAG,account.getJid().toBareJid().toString()+": unreadable OTR message in "+conversation.getName()); + } + } catch (InvalidJidException e) { + return; + } } @Override |