本文整理汇总了Java中org.jivesoftware.smackx.ChatState.active方法的典型用法代码示例。如果您正苦于以下问题:Java ChatState.active方法的具体用法?Java ChatState.active怎么用?Java ChatState.active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.ChatState
的用法示例。
在下文中一共展示了ChatState.active方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseExtension
import org.jivesoftware.smackx.ChatState; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
ChatState state;
try {
state = ChatState.valueOf(parser.getName());
}
catch (Exception ex) {
state = ChatState.active;
}
return new ChatStateExtension(state);
}
示例2: parseExtension
import org.jivesoftware.smackx.ChatState; //导入方法依赖的package包/类
public PacketExtension parseExtension(XmlPullParser parser)
throws Exception {
ChatState state;
try {
state = ChatState.valueOf(parser.getName());
} catch (Exception ex) {
state = ChatState.active;
}
return new ChatStateExtension(state);
}
示例3: sendChatState
import org.jivesoftware.smackx.ChatState; //导入方法依赖的package包/类
/**
* @see net.sf.kraken.session.TransportSession#sendChatState(org.xmpp.packet.JID, net.sf.kraken.type.ChatStateType)
*/
@Override
public void sendChatState(JID jid, ChatStateType chatState) {
final Presence presence = conn.getRoster().getPresence(jid.toString());
if (presence == null || presence.getType().equals(Presence.Type.unavailable)) {
// don't send chat state to contacts that are offline.
return;
}
Chat chat = conn.getChatManager().createChat(getTransport().convertJIDToID(jid), listener);
try {
ChatState state = ChatState.active;
switch (chatState) {
case active: state = ChatState.active; break;
case composing: state = ChatState.composing; break;
case paused: state = ChatState.paused; break;
case inactive: state = ChatState.inactive; break;
case gone: state = ChatState.gone; break;
}
Message message = new Message();
message.addExtension(new ChatStateExtension(state));
chat.sendMessage(message);
}
catch (XMPPException e) {
// Ignore
}
}