Search in sources :

Example 6 with SessionImpl

use of net.java.otr4j.session.SessionImpl in project xabber-android by redsolution.

the class OTRManager method transformReceivingIfSessionExist.

public String transformReceivingIfSessionExist(AccountJid account, UserJid user, String content) throws OtrException {
    LogManager.i(this, "transform incoming message... " + content, "transform incoming message... ***");
    Session session = getSession(account.toString(), user.toString());
    SecurityLevel securityLevel = OTRManager.getInstance().getSecurityLevel(account, user);
    if (session != null && (securityLevel == SecurityLevel.encrypted || securityLevel == SecurityLevel.verified)) {
        try {
            String s = ((SessionImpl) session).transformReceivingWithoutInject(content);
            LogManager.i(this, "transformed incoming message: " + s + " session status: " + session.getSessionStatus(), "transformed incoming message: " + "***" + " session status: " + session.getSessionStatus());
            return s;
        } catch (UnsupportedOperationException e) {
            throw new OtrException(e);
        }
    } else {
        return content;
    }
}
Also used : SessionImpl(net.java.otr4j.session.SessionImpl) OtrException(net.java.otr4j.OtrException) Session(net.java.otr4j.session.Session)

Aggregations

SessionImpl (net.java.otr4j.session.SessionImpl)6 SessionID (net.java.otr4j.session.SessionID)4 OtrException (net.java.otr4j.OtrException)3 Session (net.java.otr4j.session.Session)3 XmppAxolotlMessage (de.pixart.messenger.crypto.axolotl.XmppAxolotlMessage)1 Account (de.pixart.messenger.entities.Account)1 Conversation (de.pixart.messenger.entities.Conversation)1 Message (de.pixart.messenger.entities.Message)1 InvalidJidException (de.pixart.messenger.xmpp.jid.InvalidJidException)1 MessagePacket (de.pixart.messenger.xmpp.stanzas.MessagePacket)1