src/net/java/sip/communicator/service/protocol/AbstractOperationSetBasicInstantMessaging.java
/**
     * Delivers the specified event to all registered message listeners.
     *
     * @param evt the <tt>EventObject</tt> that we'd like delivered to all
     *            registered message listeners.
     */
Delivers the specified event to all registered message listeners.
@param evt the EventObject that we'd like delivered to all
registered message listeners.
Delivers the specified event to all registered message listeners . @param evt the EventObject that we ' d like delivered to all registered message listeners .
protected void fireMessageEvent(EventObject evt)
    {
        Collection<MessageListener> listeners = null;
        synchronized (this.messageListeners)
        {
            listeners = new ArrayList<MessageListener>(this.messageListeners);
        }
        if (logger.isDebugEnabled())
            logger.debug("Dispatching Message Listeners=" + listeners.size()
            + " evt=" + evt);
        /*
         * TODO Create a super class like this MessageEventObject that would
         * contain the MessageEventType. Also we could fire an event for the
         * MessageDeliveryPending event type (modify MessageListener and
         * OperationSetInstantMessageTransform).
         */
        MessageEventType eventType = MessageEventType.None;
        if (evt instanceof MessageDeliveredEvent)
        {
            eventType = MessageEventType.MessageDelivered;
        }
        else if (evt instanceof MessageReceivedEvent)
        {
            eventType = MessageEventType.MessageReceived;
        }
        else if (evt instanceof MessageDeliveryFailedEvent)
        {
            eventType = MessageEventType.MessageDeliveryFailed;
        }
        EventObject[] events = messageTransform(evt, eventType);
        for (EventObject event : events)
        {
            try
            {
                if (event == null)
                    return;
                for (MessageListener listener : listeners)
                {
                    switch (eventType)
                    {
                    case MessageDelivered:
                        listener.messageDelivered((MessageDeliveredEvent) event);
                        break;
                    case MessageDeliveryFailed:
                        listener
                            .messageDeliveryFailed((MessageDeliveryFailedEvent) event);
                        break;
                    case MessageReceived:
                        listener.messageReceived((MessageReceivedEvent) event);
                        break;
                    default:
                        /*
                         * We either have nothing to do or we do not know what
                         * to do. Anyway, we'll silence the compiler.
                         */
                        break;
                    }
                }
            }
            catch (Throwable e)
            {
                logger.error("Error delivering message", e);
            }
        }
    }
protected void fireMessageEvent ( EventObject evt ) { Collection < MessageListener > listeners = null ; synchronized ( this . messageListeners ) { listeners = new ArrayList < MessageListener > ( this . messageListeners ) ; } if ( logger . isDebugEnabled ( ) ) logger . debug ( "Dispatching Message Listeners=" + listeners . size ( ) + " evt=" + evt ) ; /*
         * TODO Create a super class like this MessageEventObject that would
         * contain the MessageEventType. Also we could fire an event for the
         * MessageDeliveryPending event type (modify MessageListener and
         * OperationSetInstantMessageTransform).
         */ MessageEventType eventType = MessageEventType . None ; if ( evt instanceof MessageDeliveredEvent ) { eventType = MessageEventType . MessageDelivered ; } else if ( evt instanceof MessageReceivedEvent ) { eventType = MessageEventType . MessageReceived ; } else if ( evt instanceof MessageDeliveryFailedEvent ) { eventType = MessageEventType . MessageDeliveryFailed ; } EventObject [ ] events = messageTransform ( evt , eventType ) ; for ( EventObject event : events ) { try { if ( event == null ) return ; for ( MessageListener listener : listeners ) { switch ( eventType ) { case MessageDelivered : listener . messageDelivered ( ( MessageDeliveredEvent ) event ) ; break ; case MessageDeliveryFailed : listener . messageDeliveryFailed ( ( MessageDeliveryFailedEvent ) event ) ; break ; case MessageReceived : listener . messageReceived ( ( MessageReceivedEvent ) event ) ; break ; default : /*
                         * We either have nothing to do or we do not know what
                         * to do. Anyway, we'll silence the compiler.
                         */ break ; } } } catch ( Throwable e ) { logger . error ( "Error delivering message" , e ) ; } } }
Delivers the specified event to all registered message listeners.
Delivers the specified event to all registered message listeners .
// Transform the event.