@Override
  public void injectMessage(SessionID session, String body) throws OtrException {
    MessagePacket packet = new MessagePacket();
    packet.setFrom(account.getJid());
    if (session.getUserID().isEmpty()) {
      packet.setAttribute("to", session.getAccountID());
    } else {
      packet.setAttribute("to", session.getAccountID() + "/" + session.getUserID());
    }
    packet.setBody(body);
    MessageGenerator.addMessageHints(packet);
    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);
  }