src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java
/**
         * Called by smack when the state of a chat changes.
         *
         * @param state the new state of the chat.
         * @param message the message containing the new chat state
         */
Called by smack when the state of a chat changes.
@param state the new state of the chat.
@param message the message containing the new chat state
Called by smack when the state of a chat changes . @param state the new state of the chat . @param message the message containing the new chat state
public void stateChanged(ChatState state,
                                 org.jivesoftware.smack.packet.Message message)
        {
            Jid fromJID = message.getFrom();
            if (logger.isTraceEnabled())
                logger.trace(fromJID + " entered the "
                + state.name()+ " state.");
            BareJid fromID = fromJID.asBareJid();
            boolean isPrivateMessagingAddress = false;
            OperationSetMultiUserChat mucOpSet = parentProvider
                .getOperationSet(OperationSetMultiUserChat.class);
            if(mucOpSet != null)
            {
                List<ChatRoom> chatRooms
                    = mucOpSet.getCurrentlyJoinedChatRooms();
                for(ChatRoom chatRoom : chatRooms)
                {
                    if(chatRoom.getName().equals(fromID.toString()))
                    {
                        isPrivateMessagingAddress = true;
                        break;
                    }
                }
            }
            Contact sourceContact = opSetPersPresence.findContactByID(
                (isPrivateMessagingAddress? message.getFrom() : fromID));
            if(sourceContact == null)
            {
                if(message.getError() != null)
                    sourceContact = opSetPersPresence.findContactByID(
                        message.getFrom());
                if(sourceContact == null)
                {
                    sourceContact = opSetPersPresence.createVolatileContact(
                        message.getFrom(), isPrivateMessagingAddress);
                }
            }
            int evtCode = STATE_UNKNOWN;
            if (ChatState.composing.equals(state))
            {
                evtCode = STATE_TYPING;
            }
            else if (ChatState.paused.equals(state)
                || ChatState.active.equals(state) )
            {
                evtCode = STATE_PAUSED;
            }
            else if (ChatState.inactive.equals(state)
                || ChatState.gone.equals(state) )
            {
                evtCode = STATE_STOPPED;
            }
            if(message.getError() != null)
                fireTypingNotificationsDeliveryFailedEvent(
                    sourceContact, evtCode);
            else  if(evtCode != STATE_UNKNOWN)
                fireTypingNotificationsEvent(sourceContact, evtCode);
            else
                logger.warn("Unknown typing state!");
        }
public void stateChanged ( ChatState state , org . jivesoftware . smack . packet . Message message ) { Jid fromJID = message . getFrom ( ) ; if ( logger . isTraceEnabled ( ) ) logger . trace ( fromJID + " entered the " + state . name ( ) + " state." ) ; BareJid fromID = fromJID . asBareJid ( ) ; boolean isPrivateMessagingAddress = false ; OperationSetMultiUserChat mucOpSet = parentProvider . getOperationSet ( OperationSetMultiUserChat . class ) ; if ( mucOpSet != null ) { List < ChatRoom > chatRooms = mucOpSet . getCurrentlyJoinedChatRooms ( ) ; for ( ChatRoom chatRoom : chatRooms ) { if ( chatRoom . getName ( ) . equals ( fromID . toString ( ) ) ) { isPrivateMessagingAddress = true ; break ; } } } Contact sourceContact = opSetPersPresence . findContactByID ( ( isPrivateMessagingAddress ? message . getFrom ( ) : fromID ) ) ; if ( sourceContact == null ) { if ( message . getError ( ) != null ) sourceContact = opSetPersPresence . findContactByID ( message . getFrom ( ) ) ; if ( sourceContact == null ) { sourceContact = opSetPersPresence . createVolatileContact ( message . getFrom ( ) , isPrivateMessagingAddress ) ; } } int evtCode = STATE_UNKNOWN ; if ( ChatState . composing . equals ( state ) ) { evtCode = STATE_TYPING ; } else if ( ChatState . paused . equals ( state ) || ChatState . active . equals ( state ) ) { evtCode = STATE_PAUSED ; } else if ( ChatState . inactive . equals ( state ) || ChatState . gone . equals ( state ) ) { evtCode = STATE_STOPPED ; } if ( message . getError ( ) != null ) fireTypingNotificationsDeliveryFailedEvent ( sourceContact , evtCode ) ; else if ( evtCode != STATE_UNKNOWN ) fireTypingNotificationsEvent ( sourceContact , evtCode ) ; else logger . warn ( "Unknown typing state!" ) ; }
Called by smack when the state of a chat changes.
Called by smack when the state of a chat changes .
// in private messaging we can receive some errors // when we left room (isPrivateMessagingAddress == false) // and we try to send some message //create the volatile contact