本文整理汇总了Java中org.jivesoftware.smackx.chatstates.ChatState类的典型用法代码示例。如果您正苦于以下问题:Java ChatState类的具体用法?Java ChatState怎么用?Java ChatState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatState类属于org.jivesoftware.smackx.chatstates包,在下文中一共展示了ChatState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateTypingStatus
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public void updateTypingStatus(final ChatState chatState, final String jid, final int chatType) {
if (!Preferences.isTesting()) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Message message = new Message(JidCreate.from(jid));
message.addExtension(new ChatStateExtension(chatState));
if (chatType == Chat.TYPE_1_T0_1) {
message.setType(Message.Type.chat);
} else {
message.setType(Message.Type.groupchat);
}
sendMessageDependingOnType(message, jid, chatType);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
开发者ID:esl,项目名称:mangosta-android,代码行数:24,代码来源:RoomManager.java
示例2: processWakefulStanza
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
@Override
protected void processWakefulStanza(Stanza packet) throws SmackException.NotConnectedException {
org.jivesoftware.smack.packet.Message m = (org.jivesoftware.smack.packet.Message) packet;
if (m.getType() == org.jivesoftware.smack.packet.Message.Type.chat) {
ExtensionElement chatstate = processChatState(m);
// non-active chat states are not to be processed as messages
if (chatstate == null || chatstate.getElementName().equals(ChatState.active.name())) {
processChatMessage(m);
}
}
// error message
else if (m.getType() == org.jivesoftware.smack.packet.Message.Type.error) {
processErrorMessage(m);
}
}
开发者ID:kontalk,项目名称:androidclient,代码行数:19,代码来源:MessageListener.java
示例3: sendGroupTextMessage
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void sendGroupTextMessage(final Context context, String groupJid,
String groupSubject, String[] to,
String text, boolean encrypt, long msgId, String packetId, long inReplyTo) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", TextComponent.MIME_TYPE);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.group.subject", groupSubject);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.body", text);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
i.putExtra("org.kontalk.message.inReplyTo", inReplyTo);
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:18,代码来源:MessageCenterService.java
示例4: addGroupMembers
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void addGroupMembers(final Context context, String groupJid,
String groupSubject, String[] to, String[] members, boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.group.subject", groupSubject);
i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_MEMBERS);
i.putExtra("org.kontalk.message.group.add", members);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:17,代码来源:MessageCenterService.java
示例5: removeGroupMembers
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void removeGroupMembers(final Context context, String groupJid,
String groupSubject, String[] to, String[] members, boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.group.subject", groupSubject);
i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_MEMBERS);
i.putExtra("org.kontalk.message.group.remove", members);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:17,代码来源:MessageCenterService.java
示例6: sendBinaryMessage
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
/**
* Sends a binary message.
*/
public static void sendBinaryMessage(final Context context,
String to,
String mime, Uri localUri, long length, String previewPath,
boolean encrypt, int compress,
long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", mime);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.media.uri", localUri.toString());
i.putExtra("org.kontalk.message.length", length);
i.putExtra("org.kontalk.message.preview.path", previewPath);
i.putExtra("org.kontalk.message.compress", compress);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:23,代码来源:MessageCenterService.java
示例7: sendGroupBinaryMessage
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void sendGroupBinaryMessage(final Context context, String groupJid, String[] to,
String mime, Uri localUri, long length, String previewPath,
boolean encrypt, int compress, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", mime);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.media.uri", localUri.toString());
i.putExtra("org.kontalk.message.length", length);
i.putExtra("org.kontalk.message.preview.path", previewPath);
i.putExtra("org.kontalk.message.compress", compress);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:19,代码来源:MessageCenterService.java
示例8: sendLocationMessage
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
/**
* Sends a location message
*/
public static void sendLocationMessage(final Context context, String to, String text,
double lat, double lon, String geoText, String geoStreet, boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", LocationComponent.MIME_TYPE);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.body", text);
i.putExtra("org.kontalk.message.geo_lat", lat);
i.putExtra("org.kontalk.message.geo_lon", lon);
if (geoText != null)
i.putExtra("org.kontalk.message.geo_text", geoText);
if (geoStreet != null)
i.putExtra("org.kontalk.message.geo_street", geoStreet);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:25,代码来源:MessageCenterService.java
示例9: sendGroupLocationMessage
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
/**
* Sends group location message
*/
public static void sendGroupLocationMessage(final Context context, String groupJid,
String groupSubject, String[] to,
String text, double lat, double lon, String geoText, String geoStreet, boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", LocationComponent.MIME_TYPE);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.group.subject", groupSubject);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.body", text);
i.putExtra("org.kontalk.message.geo_lat", lat);
i.putExtra("org.kontalk.message.geo_lon", lon);
if (geoText != null)
i.putExtra("org.kontalk.message.geo_text", geoText);
if (geoStreet != null)
i.putExtra("org.kontalk.message.geo_street", geoStreet);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:28,代码来源:MessageCenterService.java
示例10: sendGroupUploadedMedia
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void sendGroupUploadedMedia(final Context context, String groupJid, String[] to,
String mime, Uri localUri, long length, String previewPath, String fetchUrl,
boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", mime);
i.putExtra("org.kontalk.message.group.jid", groupJid);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.preview.uri", localUri.toString());
i.putExtra("org.kontalk.message.length", length);
i.putExtra("org.kontalk.message.preview.path", previewPath);
i.putExtra("org.kontalk.message.body", fetchUrl);
i.putExtra("org.kontalk.message.fetch.url", fetchUrl);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:20,代码来源:MessageCenterService.java
示例11: sendUploadedMedia
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
public static void sendUploadedMedia(final Context context, String to,
String mime, Uri localUri, long length, String previewPath, String fetchUrl,
boolean encrypt, long msgId, String packetId) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.msgId", msgId);
i.putExtra("org.kontalk.message.packetId", packetId);
i.putExtra("org.kontalk.message.mime", mime);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.preview.uri", localUri.toString());
i.putExtra("org.kontalk.message.length", length);
i.putExtra("org.kontalk.message.preview.path", previewPath);
i.putExtra("org.kontalk.message.body", fetchUrl);
i.putExtra("org.kontalk.message.fetch.url", fetchUrl);
i.putExtra("org.kontalk.message.encrypt", encrypt);
i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:19,代码来源:MessageCenterService.java
示例12: handleState
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
private void handleState(ChatState state) {
if (mScheduledStateSet != null)
// whatever we wanted to set next, thats obsolete now
mScheduledStateSet.cancel();
if (state != mCurrentState)
this.setNewState(state);
if (state == ChatState.composing) {
mScheduledStateSet = new TimerTask() {
@Override
public void run() {
// NOTE: using 'inactive' instead of 'paused' here as
// 'inactive' isn't send at all
MyChatState.this.handleState(ChatState.inactive);
}
};
mTimer.schedule(mScheduledStateSet,
TimeUnit.SECONDS.toMillis(COMPOSING_TO_PAUSED));
}
}
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:22,代码来源:ChatStateManager.java
示例13: setNewState
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
private void setNewState(ChatState state) {
// currently set states from XEP-0085: active, inactive, composing
mCurrentState = state;
if (state == ChatState.active || !(mChat instanceof SingleChat))
// don't send for groups (TODO (?))
// 'active' is send inside a message
return;
Contact contact = ((SingleChat) mChat).getMember().getContact();
if (contact.isMe() || contact.isBlocked() || contact.isDeleted())
return;
if (Config.getInstance().getBoolean(Config.NET_SEND_CHAT_STATE))
mClient.sendChatState(contact.getJID(), mChat.getXMPPID(), state);
}
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:17,代码来源:ChatStateManager.java
示例14: onChatStateNotification
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
/**
* Inform model (and view) about a received chat state notification.
*/
public void onChatStateNotification(MessageIDs ids,
Optional<Date> serverDate,
ChatState chatState) {
if (serverDate.isPresent()) {
long diff = new Date().getTime() - serverDate.get().getTime();
if (diff > TimeUnit.SECONDS.toMillis(10)) {
// too old
return;
}
}
Contact contact = mModel.contacts().get(ids.jid).orElse(null);
if (contact == null) {
LOGGER.info("can't find contact with jid: "+ids.jid);
return;
}
// NOTE: assume chat states are only send for single chats
SingleChat chat = mModel.chats().get(contact, ids.xmppThreadID).orElse(null);
if (chat == null)
// not that important
return;
chat.setChatState(contact, chatState);
}
开发者ID:kontalk,项目名称:desktopclient-java,代码行数:27,代码来源:Control.java
示例15: sendInactiveTypingStatus
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
private void sendInactiveTypingStatus() {
if (wasComposingMessage()) {
mRoomManager.updateTypingStatus(ChatState.paused, mChatJID, mChat.getType());
} else {
mRoomManager.updateTypingStatus(ChatState.inactive, mChatJID, mChat.getType());
}
}
开发者ID:esl,项目名称:mangosta-android,代码行数:8,代码来源:ChatActivity.java
示例16: mockRoomManager
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
private void mockRoomManager() {
mRoomManagerMock = mock(RoomManager.class);
RoomManager.setSpecialInstanceForTesting(mRoomManagerMock);
doNothing().when(mRoomManagerMock).updateTypingStatus(any(ChatState.class), any(String.class), any(int.class));
doNothing().when(mRoomManagerMock).addToMUCLight(any(User.class), any(String.class));
doNothing().when(mRoomManagerMock).removeFromMUCLight(any(User.class), any(String.class));
}
开发者ID:esl,项目名称:mangosta-android,代码行数:8,代码来源:BaseInstrumentedTest.java
示例17: parse
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
@Override
public ChatStateExtension parse(XmlPullParser parser, int initialDepth) {
ChatState state;
try {
state = ChatState.valueOf(parser.getName());
}
catch (Exception ex) {
state = ChatState.active;
}
return new ChatStateExtension(state);
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:12,代码来源:ChatStateExtension.java
示例18: sendTypingStatus
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
@Override
public void sendTypingStatus (final String to, final boolean isTyping)
{
if (mExecutor != null)
mExecutor.execute(new Runnable() {
public void run() {
sendChatState(to, isTyping ? ChatState.composing : ChatState.inactive);
}
});
}
开发者ID:zom,项目名称:Zom-Android,代码行数:11,代码来源:XmppConnection.java
示例19: sendChatState
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
private void sendChatState (String to, ChatState currentChatState)
{
try {
if (mConnection != null && mConnection.isConnected())
{
// findOrCreateSession(to, false);
Chat thisChat = mChatManager.createChat(JidCreate.from(to).asEntityJidIfPossible());
ChatStateManager.getInstance(mConnection).setCurrentState(currentChatState, thisChat);
}
}
catch (Exception e)
{
Log.w(ImApp.LOG_TAG,"error sending chat state: " + e.getMessage());
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:16,代码来源:XmppConnection.java
示例20: sendChatState
import org.jivesoftware.smackx.chatstates.ChatState; //导入依赖的package包/类
/**
* Sends a chat state message.
*/
public static void sendChatState(final Context context, String to, ChatState state) {
Intent i = new Intent(context, MessageCenterService.class);
i.setAction(MessageCenterService.ACTION_MESSAGE);
i.putExtra("org.kontalk.message.to", to);
i.putExtra("org.kontalk.message.chatState", state.name());
i.putExtra("org.kontalk.message.standalone", true);
context.startService(i);
}
开发者ID:kontalk,项目名称:androidclient,代码行数:12,代码来源:MessageCenterService.java
注:本文中的org.jivesoftware.smackx.chatstates.ChatState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论