Java 类org.jivesoftware.smackx.packet.ChatStateExtension 实例源码

项目:EIM    文件:ChatStateManager.java   
/**
 * 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);
}
项目:EIM    文件:ChatStateManager.java   
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));
    }
}
项目:androidPN-client.    文件:ChatStateManager.java   
/**
 * 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);
}
项目:androidPN-client.    文件:ChatStateManager.java   
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));
    }
}
项目:xmppsupport_v2    文件:ChatStateManager.java   
/**
 * 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);
}
项目:xmppsupport_v2    文件:ChatStateManager.java   
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));
    }
}
项目:Openfire    文件:XMPPSession.java   
/**
 * @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
    }
}
项目:g3server    文件:XMPPSession.java   
/**
 * @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
    }
}
项目:openfire    文件:XMPPSession.java   
/**
 * @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
    }
}
项目:java-bells    文件:ChatStateManager.java   
/**
 * 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);
}
项目:java-bells    文件:ChatStateManager.java   
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));
    }
}
项目:telegraph    文件:ChatStateManager.java   
/**
 * 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);
}
项目:telegraph    文件:ChatStateManager.java   
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));
    }
}
项目:NewCommunication-Android    文件:ChatStateManager.java   
/**
 * 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);
}
项目:NewCommunication-Android    文件:ChatStateManager.java   
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));
    }
}
项目:openfire-bespoke    文件:XMPPSession.java   
/**
 * @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
    }
}