• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SessionStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: endOtrIfNeeded

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public boolean endOtrIfNeeded() {
	if (this.otrSession != null) {
		if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
			try {
				this.otrSession.endSession();
				this.resetOtrSession();
				return true;
			} catch (OtrException e) {
				this.resetOtrSession();
				return false;
			}
		} else {
			this.resetOtrSession();
			return false;
		}
	} else {
		return false;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:20,代码来源:Conversation.java


示例2: endOtrIfNeeded

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public boolean endOtrIfNeeded() {
    if (this.otrSession != null) {
        if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
            try {
                this.otrSession.endSession();
                this.resetOtrSession();
                return true;
            } catch (OtrException e) {
                this.resetOtrSession();
                return false;
            }
        } else {
            this.resetOtrSession();
            return false;
        }
    } else {
        return false;
    }
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:20,代码来源:Conversation.java


示例3: sendDataAsync

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
private void sendDataAsync (OtrChatManager cm, Message message, boolean isResponse, byte[] data)
{
    SessionID sId = cm.getSessionId(message.getFrom().getAddress(), message.getTo().getAddress());
    SessionStatus otrStatus = cm.getSessionStatus(sId);

    //can't send if not encrypted session
    if (otrStatus == SessionStatus.ENCRYPTED) {

        boolean verified = cm.getKeyManager().isVerified(sId);

        if (verified) {
            message.setType(Imps.MessageType.OUTGOING_ENCRYPTED_VERIFIED);
        } else {
            message.setType(Imps.MessageType.OUTGOING_ENCRYPTED);
        }

        boolean canSend = cm.transformSending(message, isResponse, data);

        if (canSend)
            mManager.sendMessageAsync(this, message);
    }


}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:25,代码来源:ChatSession.java


示例4: toggleInputMode

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
private void toggleInputMode ()
{
    if (mButtonTalk.getVisibility() == View.GONE) {
        if (mComposeMessage.getText().length() > 0 && mSendButton.getVisibility() == View.GONE) {
            mMicButton.setVisibility(View.GONE);
            mSendButton.setVisibility(View.VISIBLE);
            mSendButton.setImageResource(R.drawable.ic_send_holo_light);

            if (mLastSessionStatus == SessionStatus.ENCRYPTED)
                mSendButton.setImageResource(R.drawable.ic_send_secure);


        } else if (mComposeMessage.getText().length() == 0) {
            mMicButton.setVisibility(View.VISIBLE);
            mSendButton.setVisibility(View.GONE);

        }
    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:ConversationView.java


示例5: makeFingerprintWarning

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
protected void makeFingerprintWarning() {
	if (conversation.smpRequested()) {
		showSnackbar(R.string.smp_requested, R.string.verify, new OnClickListener() {
			@Override
			public void onClick(View view) {
				Intent intent = new Intent(activity, VerifyOTRActivity.class);
				intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
				intent.putExtra("contact", conversation.getContact().getJid().toBareJid().toString());
				intent.putExtra("account", conversation.getAccount().getJid().toBareJid().toString());
				intent.putExtra("mode",VerifyOTRActivity.MODE_ANSWER_QUESTION);
				startActivity(intent);
			}
		});
	} else if (conversation.hasValidOtrSession() && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED)
			&& (!conversation.isOtrFingerprintVerified())) {
		showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify);
			}
}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:19,代码来源:ConversationFragment.java


示例6: sessionStatusChanged

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
@Override
public void sessionStatusChanged(final SessionID sessionID) {
    Log.d(TAG, "OTR Status changed for " + sessionID + " : " + mOtrEngine.getSessionStatus(sessionID));
    if (mOtrKeyManager.loadRemotePublicKey(sessionID) == null) {
	mOtrKeyManager.savePublicKey(sessionID, mOtrEngine.getRemotePublicKey(sessionID));
    }

    SessionStatus status = mOtrEngine.getSessionStatus(sessionID);

    if (status.equals(SessionStatus.ENCRYPTED) && mOtrKeyManager.isVerified(sessionID)) {
	mChats.get(sessionID).otrStateChanged("AUTHENTICATED");
    } else {
	if (status.equals(SessionStatus.FINISHED)) {
	    try {
		mChats.get(sessionID).localEndOtrSession();
	    } catch (OtrException e) {
		Log.w(TAG, "error when closing local otr session", e);
	    }
	}
	else {
	    mChats.get(sessionID).otrStateChanged(status.toString());
	}
    }
}
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:25,代码来源:BeemOtrManager.java


示例7: startOtrIfNeeded

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public boolean startOtrIfNeeded() {
	if (this.otrSession != null && this.otrSession.getSessionStatus() != SessionStatus.ENCRYPTED) {
		try {
			this.otrSession.startSession();
			return true;
		} catch (OtrException e) {
			this.resetOtrSession();
			return false;
		}
	} else {
		return true;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:14,代码来源:Conversation.java


示例8: getOtrFingerprint

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
	if (this.otrFingerprint == null) {
		try {
			if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
				return null;
			}
			DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
			this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey).toLowerCase(Locale.US);
		} catch (final OtrCryptoException | UnsupportedOperationException ignored) {
			return null;
		}
	}
	return this.otrFingerprint;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:15,代码来源:Conversation.java


示例9: verifyOtrSessionDialog

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public void verifyOtrSessionDialog(final Conversation conversation, View view) {
	if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
		Toast.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
		return;
	}
	if (view == null) {
		return;
	}
	PopupMenu popup = new PopupMenu(this, view);
	popup.inflate(R.menu.verification_choices);
	popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem menuItem) {
			Intent intent = new Intent(ConversationActivity.this, VerifyOTRActivity.class);
			intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
			intent.putExtra("contact", conversation.getContact().getJid().toBareJid().toString());
			intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().toBareJid().toString());
			switch (menuItem.getItemId()) {
				case R.id.scan_fingerprint:
					intent.putExtra("mode", VerifyOTRActivity.MODE_SCAN_FINGERPRINT);
					break;
				case R.id.ask_question:
					intent.putExtra("mode", VerifyOTRActivity.MODE_ASK_QUESTION);
					break;
				case R.id.manual_verification:
					intent.putExtra("mode", VerifyOTRActivity.MODE_MANUAL_VERIFICATION);
					break;
			}
			startActivity(intent);
			return true;
		}
	});
	popup.show();
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:35,代码来源:ConversationActivity.java


示例10: startOtrIfNeeded

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public void startOtrIfNeeded() {
	if (this.otrSession != null
			&& this.otrSession.getSessionStatus() != SessionStatus.ENCRYPTED) {
		try {
			this.otrSession.startSession();
		} catch (OtrException e) {
			this.resetOtrSession();
		}
			}
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:11,代码来源:Conversation.java


示例11: getOtrFingerprint

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
	if (this.otrFingerprint == null) {
		try {
			if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
				return null;
			}
			DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
			this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey);
		} catch (final OtrCryptoException | UnsupportedOperationException ignored) {
			return null;
		}
	}
	return this.otrFingerprint;
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:15,代码来源:Conversation.java


示例12: verifyOtrSessionDialog

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public void verifyOtrSessionDialog(final Conversation conversation, View view) {
	if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
		Toast.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
		return;
	}
	if (view == null) {
		return;
	}
	PopupMenu popup = new PopupMenu(this, view);
	popup.inflate(R.menu.verification_choices);
	popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		@Override
		public boolean onMenuItemClick(MenuItem menuItem) {
			Intent intent = new Intent(ConversationActivity.this, VerifyOTRActivity.class);
			intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
			intent.putExtra("contact", conversation.getContact().getJid().toBareJid().toString());
			intent.putExtra("account", conversation.getAccount().getJid().toBareJid().toString());
			switch (menuItem.getItemId()) {
				case R.id.scan_fingerprint:
					intent.putExtra("mode", VerifyOTRActivity.MODE_SCAN_FINGERPRINT);
					break;
				case R.id.ask_question:
					intent.putExtra("mode", VerifyOTRActivity.MODE_ASK_QUESTION);
					break;
				case R.id.manual_verification:
					intent.putExtra("mode", VerifyOTRActivity.MODE_MANUAL_VERIFICATION);
					break;
			}
			startActivity(intent);
			return true;
		}
	});
	popup.show();
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:35,代码来源:ConversationActivity.java


示例13: startOtrIfNeeded

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public boolean startOtrIfNeeded() {
    if (this.otrSession != null && this.otrSession.getSessionStatus() != SessionStatus.ENCRYPTED) {
        try {
            this.otrSession.startSession();
            return true;
        } catch (OtrException e) {
            this.resetOtrSession();
            return false;
        }
    } else {
        return true;
    }
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:14,代码来源:Conversation.java


示例14: getOtrFingerprint

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public synchronized String getOtrFingerprint() {
    if (this.otrFingerprint == null) {
        try {
            if (getOtrSession() == null || getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
                return null;
            }
            DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
            this.otrFingerprint = getAccount().getOtrService().getFingerprint(remotePubKey).toLowerCase(Locale.US);
        } catch (final OtrCryptoException | UnsupportedOperationException ignored) {
            return null;
        }
    }
    return this.otrFingerprint;
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:15,代码来源:Conversation.java


示例15: verifyOtrSessionDialog

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public void verifyOtrSessionDialog(final Conversation conversation, View view) {
    if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
        Toast.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
        return;
    }
    if (view == null) {
        return;
    }
    PopupMenu popup = new PopupMenu(this, view);
    popup.inflate(R.menu.verification_choices);
    popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
            Intent intent = new Intent(ConversationActivity.this, VerifyOTRActivity.class);
            intent.setAction(VerifyOTRActivity.ACTION_VERIFY_CONTACT);
            intent.putExtra("contact", conversation.getContact().getJid().toBareJid().toString());
            intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().toBareJid().toString());
            switch (menuItem.getItemId()) {
                case R.id.scan_fingerprint:
                    intent.putExtra("mode", VerifyOTRActivity.MODE_SCAN_FINGERPRINT);
                    break;
                case R.id.ask_question:
                    intent.putExtra("mode", VerifyOTRActivity.MODE_ASK_QUESTION);
                    break;
                case R.id.manual_verification:
                    intent.putExtra("mode", VerifyOTRActivity.MODE_MANUAL_VERIFICATION);
                    break;
            }
            startActivity(intent);
            return true;
        }
    });
    popup.show();
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:35,代码来源:ConversationActivity.java


示例16: getHistoryMessages

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
/**
public List<Message> getHistoryMessages() {
    return Collections.unmodifiableList(mHistoryMessages);
}*/

public void sendPushWhitelistTokenAsync(@NonNull Message message,
                                        @NonNull String[] whitelistTokens) {

    OtrChatManager cm = OtrChatManager.getInstance();
    SessionID sId = cm.getSessionId(message.getFrom().getAddress(), mParticipant.getAddress().getAddress());
    SessionStatus otrStatus = cm.getSessionStatus(sId);

    message.setTo(new XmppAddress(sId.getRemoteUserId()));

    if (otrStatus == SessionStatus.ENCRYPTED) {
        boolean verified = cm.getKeyManager().isVerified(sId);

        if (verified) {
            message.setType(Imps.MessageType.OUTGOING_ENCRYPTED_VERIFIED);
        } else {
            message.setType(Imps.MessageType.OUTGOING_ENCRYPTED);
        }

        boolean canSend = cm.transformPushWhitelistTokenSending(message, whitelistTokens);

        if (canSend)
            mManager.sendMessageAsync(this, message);

    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:31,代码来源:ChatSession.java


示例17: isEncrypted

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
public boolean isEncrypted ()
{
    if (mChatSession.canOmemo())
    {
        return true;
    }
    else
    {
        IOtrChatSession otrChatSession = getDefaultOtrChatSession();
        if (otrChatSession != null)
        {
            try {

                SessionStatus chatStatus = SessionStatus.values()[otrChatSession.getChatStatus()];

                if (chatStatus == SessionStatus.ENCRYPTED) {
                    //boolean isVerified = otrChatSession.isKeyVerified(mChatSession.getParticipant().getAddress().toString());
                    // holder.mStatusIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_lock_outline_black_18dp));

                    return true;
                }
            }
            catch (Exception e)
            {

            }
        }
    }

    return false;

}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:33,代码来源:ChatSessionAdapter.java


示例18: isChatEncrypted

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
@Override
public boolean isChatEncrypted() throws RemoteException {

    if (getSessionID () != null)
        return _chatManager.getSessionStatus(getSessionID ()) == SessionStatus.ENCRYPTED;
    else
        return false;
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:9,代码来源:OtrChatSessionAdapter.java


示例19: getChatStatus

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
@Override
public int getChatStatus() throws RemoteException {

    if (_chatManager != null && getSessionID () != null)
    {
        SessionStatus sessionStatus = _chatManager.getSessionStatus(getSessionID ());
        if (sessionStatus == null)
            sessionStatus = SessionStatus.PLAINTEXT;
        return sessionStatus.ordinal();
    }
    else
    {
        return SessionStatus.PLAINTEXT.ordinal();
    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:16,代码来源:OtrChatSessionAdapter.java


示例20: getSessionStatus

import net.java.otr4j.session.SessionStatus; //导入依赖的package包/类
/**
 * Tell if the session represented by a local user account and a remote user
 * account is currently encrypted or not.
 *
 * @param localUserId
 * @param remoteUserId
 * @return state
 */
public SessionStatus getSessionStatus(String localUserId, String remoteUserId) {
    SessionID sessionId = getSessionId(localUserId, remoteUserId);
    if (sessionId == null)
        return null;

    return mOtrEngine.getSessionStatus(sessionId);

}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:17,代码来源:OtrChatManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DaemonInitException类代码示例发布时间:2022-05-21
下一篇:
Java GestureLibrary类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap