当前位置: 首页>>代码示例>>Java>>正文


Java SessionImpl类代码示例

本文整理汇总了Java中net.java.otr4j.session.SessionImpl的典型用法代码示例。如果您正苦于以下问题:Java SessionImpl类的具体用法?Java SessionImpl怎么用?Java SessionImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionImpl类属于net.java.otr4j.session包,在下文中一共展示了SessionImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl startOtrSession(String presence, boolean sendStart) {
	if (this.otrSession != null) {
		return this.otrSession;
	} else {
		final SessionID sessionId = new SessionID(this.getJid().toBareJid().toString(),
				presence,
				"xmpp");
		this.otrSession = new SessionImpl(sessionId, getAccount().getOtrService());
		try {
			if (sendStart) {
				this.otrSession.startSession();
				return this.otrSession;
			}
			return this.otrSession;
		} catch (OtrException e) {
			return null;
		}
	}

}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:21,代码来源:Conversation.java

示例2: startOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl startOtrSession(String presence, boolean sendStart) {
    if (this.otrSession != null) {
        return this.otrSession;
    } else {
        final SessionID sessionId = new SessionID(this.getJid().toBareJid().toString(),
                presence,
                "xmpp");
        this.otrSession = new SessionImpl(sessionId, getAccount().getOtrService());
        try {
            if (sendStart) {
                this.otrSession.startSession();
                return this.otrSession;
            }
            return this.otrSession;
        } catch (OtrException e) {
            return null;
        }
    }

}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:21,代码来源:Conversation.java

示例3: startOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl startOtrSession(String presence, boolean sendStart) {
	if (this.otrSession != null) {
		return this.otrSession;
	} else {
		final SessionID sessionId = new SessionID(this.getJid().toBareJid().toString(),
				presence,
				"xmpp");
		this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine());
		try {
			if (sendStart) {
				this.otrSession.startSession();
				return this.otrSession;
			}
			return this.otrSession;
		} catch (OtrException e) {
			return null;
		}
	}

}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:21,代码来源:Conversation.java

示例4: startOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl startOtrSession(Context context, String presence,
		boolean sendStart) {
	if (this.otrSession != null) {
		return this.otrSession;
	} else {
		SessionID sessionId = new SessionID(this.getContactJid(), presence,
				"xmpp");
		this.otrSession = new SessionImpl(sessionId, getAccount()
				.getOtrEngine(context));
		try {
			if (sendStart) {
				this.otrSession.startSession();
				this.otrSessionNeedsStarting = false;
				return this.otrSession;
			} else {
				this.otrSessionNeedsStarting = true;
			}
			return this.otrSession;
		} catch (OtrException e) {
			return null;
		}
	}

}
 
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:25,代码来源:Conversation.java

示例5: newSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
@Override
public Send<Bytestring> newSession(Session<Address, Bytestring> session) throws InterruptedException {
    final SessionID sessionID = new SessionID("", "", "");
    OtrPolicy policy = new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ALLOW_V3
            | OtrPolicy.ERROR_START_AKE); // this assumes the user wants either v2 or v3
    SessionImpl sessionImpl = new SessionImpl(sessionID, new SendOtrEngineHost(policy, session));
    return new OtrSendBob(this.l, session, sessionImpl);
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:9,代码来源:OtrChannel.java

示例6: openSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
/**
 * The openSession() method starts the OTR protocol.  It creates a BasicChan object
 * that is passed into OtrSendAlice and when the key exchange is complete, this Chan
 * "chan" is notified and an OtrSession object is returned.  We also create a SessionImpl
 * object for handling messages and pass that into both our OtrSendAlice object and the
 * returned OtrSession object.  To start the actual protocol, a specific string needs to
 * be crafted.  In our implementation, we used "?OTRv23?" which means we are initializing
 * OTR version 3, with version 2 as a backup if version 3 is not available.  Other protocol
 * strings are possible.  We then call chan.receive(), and when the key exchange in
 * OtrSendAlice returns, we check to see if the key exchange was successful or not.
 * If it is, we return a new OtrSession object.  Else, we shut everything down.
 *
 * Note: The OtrPolicy variable allows OTRv2 and OTRv3.  This can be changed if the user
 * desires different versions of OTR.
 */

@Override
public synchronized OtrSession openSession(Send<Bytestring> send) throws InterruptedException, IOException {
    if (send == null) throw new NullPointerException();
    Chan<Boolean> chan = new BasicChan<>(1);

    final SessionID sessionID = new SessionID("", "", "");
    OtrPolicy policy = new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ALLOW_V3
            | OtrPolicy.ERROR_START_AKE); // this assumes the user wants either v2 or v3
    SendOtrEngineHost otrEngineHost = new SendOtrEngineHost(policy);
    SessionImpl sessionImpl = new SessionImpl(sessionID, otrEngineHost);
    
    OtrSendAlice alice = new OtrSendAlice(send, chan, sessionImpl);
    Session<Address, Bytestring> session = peer.openSession(alice);
    if (session == null) return null;
    
    otrEngineHost.setSession(session);

    // This string depends on the version / type of OTR encryption that the user wants.
    String query = "?OTRv23?";
    session.send(new Bytestring(query.getBytes()));

    /**
     * Waiting for the final OTR initialization message from Bob.
     */

    Boolean result = chan.receive();
    if (result == null || !result) {
        chan.close();
        session.close();
        return null;
    }

    return new OtrSession(session, sessionImpl);
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:51,代码来源:OtrChannel.java

示例7: getOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl getOtrSession() {
	return this.otrSession;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:4,代码来源:Conversation.java

示例8: OtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
/**
 * @param s -- Tells OtrSession which inner Session to use.
 * @param sessionImpl -- Tells OtrSession which SessionImpl to use in the send() message.
 */

private OtrSession(Session<Address, Bytestring> s, SessionImpl sessionImpl) {
    this.s = s;
    this.sessionImpl = sessionImpl;
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:10,代码来源:OtrChannel.java

示例9: OtrSendAlice

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
private OtrSendAlice(Send<Bytestring> z, Send<Boolean> chan, SessionImpl sessionImpl) {
    this.z = z;
    this.chan = chan;
    this.sessionImpl = sessionImpl;
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:6,代码来源:OtrChannel.java

示例10: OtrSendBob

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
private OtrSendBob(Listener<Address, Bytestring> l, Session<Address, Bytestring> s, SessionImpl sessionImpl) {
    this.l = l;
    this.s = s;
    this.sessionImpl = sessionImpl;
}
 
开发者ID:DanielKrawisz,项目名称:Shufflepuff,代码行数:6,代码来源:OtrChannel.java

示例11: getOtrSession

import net.java.otr4j.session.SessionImpl; //导入依赖的package包/类
public SessionImpl getOtrSession() {
    return this.otrSession;
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:4,代码来源:Conversation.java


注:本文中的net.java.otr4j.session.SessionImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。