diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-02-21 11:06:52 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-02-21 11:06:52 +0100 |
commit | 7ee5e959597cfded524c7179b663138aca781ad8 (patch) | |
tree | 29a97c63d690a4d419a5500b1bb5a1c10f1f078b /src/main/java/eu/siacs/conversations/crypto | |
parent | 3f248e0d89af977e7f602102663be9729430f1ed (diff) |
added typing notifications through XEP-0085. fixed #210
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/OtrEngine.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java b/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java index d5c45465..c85864d0 100644 --- a/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/OtrEngine.java @@ -21,6 +21,7 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; @@ -182,6 +183,19 @@ public class OtrEngine extends OtrCryptoEngineImpl implements OtrEngineHost { packet.addChild("private", "urn:xmpp:carbons:2"); packet.addChild("no-copy", "urn:xmpp:hints"); packet.addChild("no-store", "urn:xmpp:hints"); + + try { + Jid jid = Jid.fromSessionID(session); + Conversation conversation = mXmppConnectionService.find(account,jid); + if (conversation != null && conversation.setOutgoingChatState(Config.DEFAULT_CHATSTATE)) { + if (mXmppConnectionService.sendChatStates()) { + packet.addChild(ChatState.toElement(conversation.getOutgoingChatState())); + } + } + } catch (final InvalidJidException ignored) { + + } + packet.setType(MessagePacket.TYPE_CHAT); account.getXmppConnection().sendMessagePacket(packet); } |