src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java
/**
     * Cleans the contactsMap when <tt>ProtocolProviderService</tt>
     * gets unregistered.
     */
Cleans the contactsMap when ProtocolProviderService
gets unregistered.
Cleans the contactsMap when ProtocolProviderService gets unregistered .
@Override
    public void serviceChanged(ServiceEvent ev)
    {
        Object service
            = OtrActivator.bundleContext.getService(ev.getServiceReference());
        if (!(service instanceof ProtocolProviderService))
            return;
        if (ev.getType() == ServiceEvent.UNREGISTERING)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug(
                        "Unregistering a ProtocolProviderService, cleaning"
                            + " OTR's ScSessionID to Contact map.");
                logger.debug(
                        "Unregistering a ProtocolProviderService, cleaning"
                            + " OTR's Contact to SpmProgressDialog map.");
            }
            ProtocolProviderService provider
                = (ProtocolProviderService) service;
            synchronized(contactsMap)
            {
                Iterator<OtrContact> i = contactsMap.values().iterator();
                while (i.hasNext())
                {
                    OtrContact otrContact = i.next();
                    if (provider.equals(
                        otrContact.contact.getProtocolProvider()))
                    {
                        scSessionStatusMap.remove(getSessionID(otrContact));
                        i.remove();
                    }
                }
            }
            Iterator<OtrContact> i = progressDialogMap.keySet().iterator();
            while (i.hasNext())
            {
                if (provider.equals(i.next().contact.getProtocolProvider()))
                    i.remove();
            }
            scheduler.serviceChanged(ev);
        }
    }
@ Override public void serviceChanged ( ServiceEvent ev ) { Object service = OtrActivator . bundleContext . getService ( ev . getServiceReference ( ) ) ; if ( ! ( service instanceof ProtocolProviderService ) ) return ; if ( ev . getType ( ) == ServiceEvent . UNREGISTERING ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Unregistering a ProtocolProviderService, cleaning" + " OTR's ScSessionID to Contact map." ) ; logger . debug ( "Unregistering a ProtocolProviderService, cleaning" + " OTR's Contact to SpmProgressDialog map." ) ; } ProtocolProviderService provider = ( ProtocolProviderService ) service ; synchronized ( contactsMap ) { Iterator < OtrContact > i = contactsMap . values ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { OtrContact otrContact = i . next ( ) ; if ( provider . equals ( otrContact . contact . getProtocolProvider ( ) ) ) { scSessionStatusMap . remove ( getSessionID ( otrContact ) ) ; i . remove ( ) ; } } } Iterator < OtrContact > i = progressDialogMap . keySet ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { if ( provider . equals ( i . next ( ) . contact . getProtocolProvider ( ) ) ) i . remove ( ) ; } scheduler . serviceChanged ( ev ) ; } }
Cleans the contactsMap when <tt>ProtocolProviderService</tt>
 gets unregistered.
Cleans the contactsMap when <tt > ProtocolProviderService< / tt > gets unregistered .