From 5c7fc1f8d85f8db6979ccf64236e115197b970ec Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Sun, 28 May 2006 15:51:02 +0000 Subject: [PATCH] Added a method for dispatching SubscriptionMovedEvent-s --- ...OperationSetPersistentPresenceIcqImpl.java | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java index 0785512e1..989db1d0d 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java @@ -391,13 +391,15 @@ public void subscribe(String contactIdentifier) /** * Creates a non persistent contact for the specified address. This would * also create (if necessary) a group for volatile contacts that would not - * be added to the server stored contact list. - * @param screenname the UIN/Screenname of the contact to create. + * be added to the server stored contact list. The volatile contact would + * remain in the list until it is really added to the contact list or + * until the application is terminated. + * @param uin the UIN/Screenname of the contact to create. * @return the newly created volatile ContactIcqImpl */ - public ContactIcqImpl createVolatileContact(Screenname screenname) + public ContactIcqImpl createVolatileContact(String uin) { - return ssContactList.createVolatileContact(screenname); + return ssContactList.createVolatileContact(new Screenname(uin)); } /** @@ -1047,6 +1049,40 @@ else if (evt.getEventID() == SubscriptionEvent.SUBSCRIPTION_FAILED) } } + /** + * Notify all subscription listeners of the corresponding event. + * + * @param sourceContact the ContactIcqImpl instance that this event is + * pertaining to. + * @param oldParentGroup the group that was previously a parent of the + * source contact. + * @param newParentGroup the group under which the corresponding + * subscription is currently located. + */ + void fireSubscriptionMovedEvent( ContactIcqImpl sourceContact, + ContactGroupIcqImpl oldParentGroup, + ContactGroupIcqImpl newParentGroup) + { + SubscriptionMovedEvent evt = + new SubscriptionMovedEvent(sourceContact, icqProvider + , oldParentGroup, newParentGroup); + + logger.debug("Dispatching a Subscription Event to" + +subscriptionListeners.size() + " listeners. Evt="+evt); + + synchronized(subscriptionListeners){ + Iterator listeners = subscriptionListeners.iterator(); + + while (listeners.hasNext()) + { + SubscriptionListener listener = + (SubscriptionListener) listeners.next(); + listener.subscriptionMoved(evt); + } + } + } + + /** * Notify all contact presence listeners of the corresponding event change * @param contact the contact that changed its status