From 7333de7a8a26b5aa731aa04b517d7780f2dcc07c Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Fri, 23 Jun 2006 16:09:22 +0000 Subject: [PATCH] Take callbacks to providet and opset during construction so that they could be available for all unresolved contacts (created before registration) --- .../icq/ServerStoredContactListIcqImpl.java | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java index 6cba02781..0dc8cdbed 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ServerStoredContactListIcqImpl.java @@ -93,12 +93,24 @@ public class ServerStoredContactListIcqImpl /** * Creates a ServerStoredContactList wrapper for the specified BuddyList. + * + * @param parentOperationSet the operation set that created us and that + * we could use for dispatching subscription events + * @param icqProvider the icqProvider that has instantiated us. */ - ServerStoredContactListIcqImpl() + ServerStoredContactListIcqImpl( + OperationSetPersistentPresenceIcqImpl parentOperationSet, + ProtocolProviderServiceIcqImpl icqProvider) { //don't add the sub ICQ groups to rootGroup here as we'll be having //event notifications for every one of them through the //RetroactiveBuddyListListener + + //We need to init these as early as possible to ensure that the provider + //and the operationsset would not be null in the incoming events. + this.parentOperationSet = parentOperationSet; + + this.icqProvider = icqProvider; } /** @@ -144,6 +156,12 @@ void removeGroupListener(ServerStoredGroupListener l) */ private void fireGroupEvent(ContactGroupIcqImpl group, int eventID) { + //bail out if no one's listening + if(parentOperationSet == null){ + logger.debug("No presence op. set available. Bailing out."); + return; + } + ServerStoredGroupEvent evt = new ServerStoredGroupEvent( group , eventID @@ -611,21 +629,9 @@ public void moveContact(ContactIcqImpl contact, * server stored information * @param joustSimSsiService a valid reference to the currently active JoustSIM * SsiService. - * @param parentOperationSet the operation set that created us and that - * we could use for dispatching subscription events - * @param icqProvider the icqProvider that has instantiated us. */ - void init( SsiService joustSimSsiService, - OperationSetPersistentPresenceIcqImpl parentOperationSet, - - ProtocolProviderServiceIcqImpl icqProvider) + void init( SsiService joustSimSsiService ) { - //We need to keep this on top to ensure that the provider - //and the operationsset would not be null in the incoming events. - this.parentOperationSet = parentOperationSet; - - this.icqProvider = icqProvider; - this.rootGroup.setOwnerProvider(icqProvider); this.jSimSsiService = joustSimSsiService; @@ -1001,6 +1007,7 @@ public void groupNameChanged(Group group, String oldName, logger.debug( "group name changed event received for unknown group" + group); + return; } //check whether the name has really changed (the joust sim stack