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


Java Mode类代码示例

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


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

示例1: setStatusFromConfig

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
@Override
public void setStatusFromConfig() {// 设置自己的当前状态,供外部服务调用
	boolean messageCarbons = PreferenceUtils.getPrefBoolean(mService,
			PreferenceConstants.MESSAGE_CARBONS, true);
	String statusMode = PreferenceUtils.getPrefString(mService,
			PreferenceConstants.STATUS_MODE, PreferenceConstants.AVAILABLE);
	String statusMessage = PreferenceUtils.getPrefString(mService,
			PreferenceConstants.STATUS_MESSAGE,
			mService.getString(R.string.status_online));
	int priority = PreferenceUtils.getPrefInt(mService,
			PreferenceConstants.PRIORITY, 0);
	if (messageCarbons)
		CarbonManager.getInstanceFor(mXMPPConnection).sendCarbonsEnabled(
				true);

	Presence presence = new Presence(Presence.Type.available);
	Mode mode = Mode.valueOf(statusMode);
	presence.setMode(mode);
	presence.setStatus(statusMessage);
	presence.setPriority(priority);
	mXMPPConnection.sendPacket(presence);
}
 
开发者ID:victoryckl,项目名称:XmppTest,代码行数:23,代码来源:SmackImpl.java

示例2: xmppPresence2UserStatus

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
public byte xmppPresence2UserStatus(Presence presence) {
	if (presence == null || presence.getType() != Type.available){
		return -1;
	}
	
	if (presence.getMode() == null || presence.getMode() == Mode.available){
		return 0;
	}
	
	for (byte i=0; i<presenceModes.length; i++) {
		Mode m = presenceModes[i];
		if (m == presence.getMode()){
			return i;
		}
	}
	
	return -1;
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:19,代码来源:XMPPEntityAdapter.java

示例3: getPresenceModeFromStatus

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
/**
    * Get the smack presence mode for a status.
    * @param status the status in beem
    * @return the presence mode to use in presence packet or null if there is no mode to use
    */
   public static Presence.Mode getPresenceModeFromStatus(final int status) {
Presence.Mode res;
switch (status) {
    case CONTACT_STATUS_AVAILABLE:
	res = Presence.Mode.available;
	break;
    case CONTACT_STATUS_AVAILABLE_FOR_CHAT:
	res = Presence.Mode.chat;
	break;
    case CONTACT_STATUS_AWAY:
	res = Presence.Mode.away;
	break;
    case CONTACT_STATUS_BUSY:
	res = Presence.Mode.dnd;
	break;
    case CONTACT_STATUS_UNAVAILABLE:
	res = Presence.Mode.xa;
	break;
    default:
	return null;
}
return res;
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:29,代码来源:Status.java

示例4: updateContactInformations

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
/**
    * Update the contact informations.
    */
   private void updateContactInformations() {
// Check for a contact name update
String name = mContact.getName();
String res = mContact.getSelectedRes();
if (!"".equals(res))
    name += "(" + res + ")";
if (!mCompact) {
    if (!(mContactNameTextView.getText().toString().equals(name)))
	mContactNameTextView.setText(name);
    //Check for a contact status message update
    if (!(mContactStatusMsgTextView.getText().toString().equals(mContact.getMsgState()))) {
	mContactStatusMsgTextView.setText(mContact.getMsgState());
	Linkify.addLinks(mContactStatusMsgTextView, Linkify.WEB_URLS);
    }
} else {
    Mode m = Status.getPresenceModeFromStatus(mContact.getStatus());
    if (m == null)
	setTitle(getString(R.string.chat_name) + " " + name + " ("
		+ getString(R.string.contact_status_msg_offline) + ")");
    else
	setTitle(getString(R.string.chat_name) + " " + name + " (" + m.name() + ")");
}
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:27,代码来源:Chat.java

示例5: sendPresence

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
@Override
public void sendPresence(JID jabberId, PresenceType type, PresenceShow show, String status, JID fromJid)
{
    checkNotNull(jabberId);
    
    final Type presenceType = type == null ? Type.available : Type.valueOf(type.name().toLowerCase());
    final Mode presenceMode = show == null ? null : Mode.valueOf(show.name().toLowerCase());
    
    org.jivesoftware.smack.packet.Presence presence = new org.jivesoftware.smack.packet.Presence(presenceType, status, 1, presenceMode);
    presence.setFrom(fromJid == null ? null : fromJid.getId());
    presence.setTo(jabberId.getId());
    this.session_.getConnection().sendPacket(presence);
}
 
开发者ID:alessandroleite,项目名称:dohko,代码行数:14,代码来源:XMPPServiceImpl.java

示例6: setStatusFromConfig

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
public void setStatusFromConfig() {
	// TODO: only call this when carbons changed, not on every presence change
	CarbonManager.getInstanceFor(mXMPPConnection).sendCarbonsEnabled(mConfig.messageCarbons);

	Presence presence = new Presence(Presence.Type.available);
	Mode mode = Mode.valueOf(mConfig.statusMode);
	presence.setMode(mode);
	presence.setStatus(mConfig.statusMessage);
	presence.setPriority(mConfig.priority);
	mXMPPConnection.sendPacket(presence);
	mConfig.presence_required = false;
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:13,代码来源:SmackableImp.java

示例7: parsePresence

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
protected static int parsePresence(org.jivesoftware.smack.packet.Presence presence) {
    int type = Presence.AVAILABLE;
    Mode rmode = presence.getMode();
    Type rtype = presence.getType();

    if (rmode == Mode.away || rmode == Mode.xa)
        type = Presence.AWAY;
    else if (rmode == Mode.dnd)
        type = Presence.DO_NOT_DISTURB;
    else if (rtype == Type.unavailable || rtype == Type.error)
        type = Presence.OFFLINE;

    return type;
}
 
开发者ID:prive,项目名称:prive-android,代码行数:15,代码来源:XmppConnection.java

示例8: getStatusFromPresence

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
/**
    * Get the status of from a presence packet.
    * @param presence the presence containing status
    * @return an int representing the status
    */
   public static int getStatusFromPresence(final Presence presence) {
int res = Status.CONTACT_STATUS_DISCONNECT;
if (presence.getType().equals(Presence.Type.unavailable)) {
    res = Status.CONTACT_STATUS_DISCONNECT;
} else {
    Mode mode = presence.getMode();
    if (mode == null) {
	res = Status.CONTACT_STATUS_AVAILABLE;
    } else {
	switch (mode) {
	    case available:
		res = Status.CONTACT_STATUS_AVAILABLE;
		break;
	    case away:
		res = Status.CONTACT_STATUS_AWAY;
		break;
	    case chat:
		res = Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
		break;
	    case dnd:
		res = Status.CONTACT_STATUS_BUSY;
		break;
	    case xa:
		res = Status.CONTACT_STATUS_UNAVAILABLE;
		break;
	    default:
		res = Status.CONTACT_STATUS_DISCONNECT;
		break;
	}
    }
}
return res;
   }
 
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:39,代码来源:Status.java

示例9: XmppLoginRunnable

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
public XmppLoginRunnable(XmppListener listener) {
	super(listener);
	mType = Type.available;
	mMode = Mode.available;
	mStatus = null;
}
 
开发者ID:ikantech,项目名称:yiim_v2,代码行数:7,代码来源:XmppLoginRunnable.java

示例10: setMode

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
public void setMode(Mode mode) {
	this.mMode = mode;
}
 
开发者ID:ikantech,项目名称:yiim_v2,代码行数:4,代码来源:XmppLoginRunnable.java

示例11: sendPresence

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
/**
 * @param type
 * @param status
 * @param priority
 * @param mode
 */
public void sendPresence(final Type type, final String status, final int priority, final Mode mode) {
    imc.sendPresence(type, status, priority, mode);
}
 
开发者ID:huihoo,项目名称:olat,代码行数:10,代码来源:ClientHelper.java

示例12: sendPresenceAvailable

import org.jivesoftware.smack.packet.Presence.Mode; //导入依赖的package包/类
/**
 * send a presence packet "available" with a certain mode e.g. "away" to all buddies
 * 
 * @param mode
 */
public void sendPresenceAvailable(final Presence.Mode mode) {
    imc.sendPresence(Presence.Type.available, null, 0, mode);
}
 
开发者ID:huihoo,项目名称:olat,代码行数:9,代码来源:ClientHelper.java


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