Fixes a bug in plugin.otr.ScOtrEngineImpl that caused OTR to misbehave when a protocol provider is unregistered

cusax-fix 4971
Marin 12 years ago
parent 81c8c4ee18
commit 9d4f315808

@ -688,6 +688,33 @@ public void cancel(final Contact contact)
task.cancel();
tasks.remove(contact);
}
public void serviceChanged(ServiceEvent ev)
{
Object service
= OtrActivator.bundleContext.getService(
ev.getServiceReference());
if (!(service instanceof ProtocolProviderService))
return;
if (ev.getType() == ServiceEvent.UNREGISTERING)
{
ProtocolProviderService provider
= (ProtocolProviderService) service;
Iterator<Contact> i = tasks.keySet().iterator();
while (i.hasNext())
{
Contact contact = i.next();
if (provider.equals(contact.getProtocolProvider())) {
cancel(contact);
i.remove();
}
}
}
}
}
private void setSessionStatus(Contact contact, ScSessionStatus status)
@ -797,8 +824,12 @@ public void serviceChanged(ServiceEvent ev)
while (i.hasNext())
{
if (provider.equals(i.next().getProtocolProvider()))
Contact contact = i.next();
if (provider.equals(contact.getProtocolProvider()))
{
scSessionStatusMap.remove(getSessionID(contact));
i.remove();
}
}
}
@ -809,6 +840,7 @@ public void serviceChanged(ServiceEvent ev)
if (provider.equals(i.next().getProtocolProvider()))
i.remove();
}
scheduler.serviceChanged(ev);
}
}

Loading…
Cancel
Save