public String toXML() { return "<" + getElementName() + " xmlns=\"" + getNamespace() + "\" />"; }
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); } }
public class ChatlListener implements MessageListener, ChatStateListener{ @Override public void stateChanged(Chat paramChat, ChatState paramChatState) { // this method will call only if status change , not on same status } @Override public void processMessage(Chat paramChat, Message paramMessage) { ChatStateExtension chatStateExtension = (ChatStateExtension) paramMessage.getExtension("http://jabber.org/protocol/chatstates") ; Log(TAG,"Current chat status : " + chatStateExtension.getElementName()); } }
public String toXML() { return "<" + getElementName() + " xmlns=\"" + getNamespace() + "\" />"; }
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); } }
public String toXML() { return "<" + getElementName() + " xmlns=\"" + getNamespace() + "\" />"; }
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); } }
public void interceptPacket(Packet packet) { Message message = (Message) packet; Chat chat = connection.getChatManager().getThreadChat(message.getThread()); if (chat == null) { return; } if (updateChatState(chat, ChatState.active)) { message.addExtension(new ChatStateExtension(ChatState.active)); } } }
/** * Sets the current state of the provided chat. This method will send an empty bodied Message * packet with the state attached as a {@link org.jivesoftware.smack.packet.PacketExtension}, if * and only if the new chat state is different than the last state. * * @param newState the new state of the chat * @param chat the chat. * @throws org.jivesoftware.smack.XMPPException * when there is an error sending the message * packet. */ public void setCurrentState(ChatState newState, Chat chat) throws XMPPException { if(chat == null || newState == null) { throw new IllegalArgumentException("Arguments cannot be null."); } if(!updateChatState(chat, newState)) { return; } Message message = new Message(); ChatStateExtension extension = new ChatStateExtension(newState); message.addExtension(extension); chat.sendMessage(message); }
/** * Sets the current state of the provided chat. This method will send an empty bodied Message * packet with the state attached as a {@link org.jivesoftware.smack.packet.PacketExtension}, if * and only if the new chat state is different than the last state. * * @param newState the new state of the chat * @param chat the chat. * @throws org.jivesoftware.smack.XMPPException * when there is an error sending the message * packet. */ public void setCurrentState(ChatState newState, Chat chat) throws XMPPException { if(chat == null || newState == null) { throw new IllegalArgumentException("Arguments cannot be null."); } if(!updateChatState(chat, newState)) { return; } Message message = new Message(); ChatStateExtension extension = new ChatStateExtension(newState); message.addExtension(extension); chat.sendMessage(message); }
/** * Sets the current state of the provided chat. This method will send an empty bodied Message * packet with the state attached as a {@link PacketExtension}, if * and only if the new chat state is different than the last state. * * @param newState the new state of the chat * @param chat the chat. * @throws XMPPException * when there is an error sending the message * packet. */ public void setCurrentState(ChatState newState, Chat chat) throws XMPPException { if(chat == null || newState == null) { throw new IllegalArgumentException("Arguments cannot be null."); } if(!updateChatState(chat, newState)) { return; } Message message = new Message(); ChatStateExtension extension = new ChatStateExtension(newState); message.addExtension(extension); chat.sendMessage(message); }
public void interceptPacket(Packet packet) { Message message = (Message) packet; Chat chat = connection.getChatManager().getThreadChat(message.getThread()); if (chat == null) { return; } if (updateChatState(chat, ChatState.active)) { message.addExtension(new ChatStateExtension(ChatState.active)); } } }
public void interceptPacket(Packet packet) { Message message = (Message) packet; Chat chat = connection.getChatManager().getThreadChat(message.getThread()); if (chat == null) { return; } if (updateChatState(chat, ChatState.active)) { message.addExtension(new ChatStateExtension(ChatState.active)); } } }