aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/crypto
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/crypto/OtrEngine.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/crypto/OtrEngine.java b/src/eu/siacs/conversations/crypto/OtrEngine.java
index 01ba5e497..7960aa2be 100644
--- a/src/eu/siacs/conversations/crypto/OtrEngine.java
+++ b/src/eu/siacs/conversations/crypto/OtrEngine.java
@@ -154,13 +154,16 @@ public class OtrEngine implements OtrEngineHost {
@Override
public void injectMessage(SessionID session, String body) throws OtrException {
MessagePacket packet = new MessagePacket();
- packet.setFrom(account.getFullJid()); //sender
- packet.setTo(session.getAccountID()+"/"+session.getUserID()); //reciepient
+ packet.setFrom(account.getFullJid());
+ if (session.getUserID().isEmpty()) {
+ packet.setTo(session.getAccountID());
+ } else {
+ packet.setTo(session.getAccountID()+"/"+session.getUserID());
+ }
packet.setBody(body);
packet.addChild("private","urn:xmpp:carbons:2");
packet.addChild("no-copy","urn:xmpp:hints");
packet.setType(MessagePacket.TYPE_CHAT);
- //Log.d(LOGTAG,packet.toString());
account.getXmppConnection().sendMessagePacket(packet);
}