[sip-comm-dev] Re: svn commit: r5885 - trunk/src/net/java/sip/communicator: impl/gui/main/chatroomslist/joinforms impl/gui/main/contactlist/addcontact impl/notificati...


#1

Hi devs,

Emil alerted me that Valentin MARTINET is working on the multi-user
chat and thus an explanation of the changes is appropriate.

Since there are multiple implementations of OperationSetMultiUserChat
and they all have three types of listeners, each type of listener
requires at least three methods (to add a listener, to remove a
listener and to fire an event), I've introduces an abstract base
implementation of OperationSetMultiUserChat which takes care of the
listeners in question and their related methods so that the actual
implementations don't have to repeat them. Now all
OperationSetMultiUserChat implementations extend
AbstractOperationSetMultiUserChat instead of directly implementing all
OperationSetMultiUserChat methods.

The merging should be pretty straightforward because for each
OperationSetMultiUserChat the base is changed to
AbstractOperationSetMultiUserChat, three fields (the list of the three
types of listeners) and at least six methods are removed.

I hope I haven't caused too much trouble with these changes.

Regards,
Lubomir

ยทยทยท

On Sun, Aug 30, 2009 at 10:32 PM, <lubomir_m@dev.java.net> wrote:

Author: lubomir_m
Date: 2009-08-30 19:31:58+0000
New Revision: 5885

Added:
trunk/src/net/java/sip/communicator/service/protocol/AbstractOperationSetMultiUserChat.java
Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java
trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java
trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java
trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java
trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java
trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java
trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java
trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java
trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java

Log:
Introduces a default implementation of OperationSetMultiUserChat which removes duplications from extenders and fixes warnings.

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chatroomslist/joinforms/ChatRoomAuthenticationWindow.java 2009-08-30 19:31:58+0000
@@ -201,11 +201,6 @@
this.bgImage = bgImage;
}

- public LoginWindowBackground()
- {
- this.bgImage = null;
- }
-
protected void paintComponent(Graphics g)
{
super.paintComponent(g);

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/contactlist/addcontact/SelectGroupPanel.java 2009-08-30 19:31:58+0000
@@ -188,11 +188,10 @@

    public GroupWrapper\(MetaContactGroup group\)
    \{

- this.group = group;
- this.groupName = group.getGroupName();
+ this(group, group.getGroupName());
}

- public GroupWrapper(String groupName, MetaContactGroup group)
+ public GroupWrapper(MetaContactGroup group, String groupName)
{
this.group = group;
this.groupName = groupName;

Modified: trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java&p2=trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java (original)
+++ trunk/src/net/java/sip/communicator/impl/notification/EventNotification.java 2009-08-30 19:31:58+0000
@@ -32,7 +32,8 @@
* Contains all actions which will be executed when this event notification
* is fired.
*/
- private final Hashtable<String, Action> actionsTable = new Hashtable<String, Action>();
+ private final Hashtable<String, Action> actionsTable
+ = new Hashtable<String, Action>();

/\*\*
 \* Creates an instance of &lt;tt&gt;EventNotification&lt;/tt&gt; by specifying the

@@ -55,11 +56,10 @@
* @return the previous value of the actionHandler for the given actionType,
* if one existed, NULL if the actionType is a new one
*/
- public Object addAction( String actionType,
+ public Object addAction(String actionType,
NotificationActionHandler actionHandler)
{
- Action action
- = new Action(actionType, actionHandler);
+ Action action = new Action(actionType, actionHandler);

    return actionsTable\.put\(actionType, action\);
\}

Modified: trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/icq/ContactGroupIcqImpl.java 2009-08-30 19:31:58+0000
@@ -79,7 +79,7 @@
* resolved against the server.
*/
ContactGroupIcqImpl(MutableGroup joustSimGroup,
- List<Buddy> groupMembers,
+ Iterable<Buddy> groupMembers,
ServerStoredContactListIcqImpl ssclCallback,
boolean isResolved)
{
@@ -95,24 +95,29 @@
//their real addresses and we can only get a list of copies from the
//group itself.

- Iterator<Buddy> buddies = groupMembers.iterator();
- while(buddies.hasNext())
- {
- Buddy buddy = buddies.next();
- //only add the buddy if it doesn't already exist in some other group
- //this is necessary because AIM would allow having one and the
- //same buddy in more than one group.
- if(ssclCallback.findContactByJoustSimBuddy(buddy) != null)
+ if (groupMembers != null)
+ for (Buddy buddy : groupMembers)
{
- continue;
+ /*
+ * Only add the buddy if it doesn't already exist in some other
+ * group this is necessary because AIM would allow having one
+ * and the same buddy in more than one group.
+ */
+ if(ssclCallback.findContactByJoustSimBuddy(buddy) != null)
+ {
+ continue;
+ }
+
+ /*
+ * Here we are not checking for AwaitingAuthorization buddies as
+ * we are creating group with list of buddies these checks must
+ * have been made already.
+ */
+ addContact( new ContactIcqImpl(buddy,
+ ssclCallback,
+ true,
+ true) );
}
-
- // here we are not checking for AwaitingAuthorization buddies
- // as we are creating group with list of buddies
- // these checks must have been made already
- addContact( new ContactIcqImpl(buddy,
- ssclCallback, true, true) );
- }
}

/\*\*

Modified: trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java 2009-08-30 19:31:58+0000
@@ -158,7 +158,7 @@
getImConversation(
new Screenname(to.getAddress()));

- String messageContent = null;
+ String messageContent;
if (message.getContentType().equals(HTML_MIME_TYPE)
&& !message.getContent().startsWith(defaultHtmlStartTag))
{
@@ -169,8 +169,8 @@
else
messageContent = message.getContent();

- MessageDeliveredEvent msgDeliveryPendingEvt = new MessageDeliveredEvent(
- message, to, System.currentTimeMillis());
+ MessageDeliveredEvent msgDeliveryPendingEvt
+ = new MessageDeliveredEvent(message, to);

    msgDeliveryPendingEvt = this\.messageDeliveryPendingTransform\(msgDeliveryPendingEvt\);

@@ -188,8 +188,8 @@
else
imConversation.sendMessage(new SimpleMessage(transformedContent), true);

- MessageDeliveredEvent msgDeliveredEvt = new MessageDeliveredEvent(
- message, to, System.currentTimeMillis());
+ MessageDeliveredEvent msgDeliveredEvt
+ = new MessageDeliveredEvent(message, to);

    // msgDeliveredEvt = this\.messageDeliveredTransform\(msgDeliveredEvt\);

Modified: trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java 2009-08-30 19:31:58+0000
@@ -7,10 +7,11 @@
package net.java.sip.communicator.impl.protocol.icq;

import java.util.*;
+
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.Logger;
-import net.kano.joscar.OscarTools;
+import net.java.sip.communicator.util.*;
+import net.kano.joscar.*;
import net.kano.joustsim.oscar.oscar.service.chatrooms.*;

/**
@@ -19,8 +20,8 @@
* @author Rupert Burchardi
*/
public class OperationSetMultiUserChatIcqImpl
- implements OperationSetMultiUserChat,
- SubscriptionListener
+ extends AbstractOperationSetMultiUserChat
+ implements SubscriptionListener
{
private static final Logger logger = Logger
.getLogger(OperationSetMultiUserChatIcqImpl.class);
@@ -31,23 +32,6 @@
private ProtocolProviderServiceIcqImpl icqProvider = null;

/**
- * A list of listeners subscribed for invitations multi user chat events.
- */
- private Vector invitationListeners = new Vector();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a
- * multi user chat invitation sent by us.
- */
- private Vector invitationRejectionListeners = new Vector();
-
- /**
- * Listeners that will be notified of changes in our status in the
- * room such as us being kicked, banned, or granted admin permissions.
- */
- private Vector presenceListeners = new Vector();
-
- /**
* A list of the rooms that are currently open by this account. Note that
* we have not necessarily joined these rooms, we might have simply been
* searching through them.
@@ -97,52 +81,6 @@
}

/**
- * Adds a listener to invitation notifications.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
- }
-
- /**
- * Subscribes <tt>listener</tt> so that it would receive events indicating
- * rejection of a multi user chat invitation that we've sent earlier.
- *
- * @param listener the listener that we'll subscribe for invitation
- * rejection events.
- */
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- if (!presenceListeners.contains(listener))
- presenceListeners.add(listener);
- }
- }
-
- /**
* Returns a reference to a chatRoom by an given chat invitation. This method
* is called, when the user received a chat invitation. The chat room will be
* created and the chatInvitation will be saved in the created chat room. This
@@ -370,50 +308,6 @@
}

/**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation rejection events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in
- * a room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- presenceListeners.remove(listener);
- }
- }
-
- /**
* Delivers a <tt>ChatRoomInvitationReceivedEvent</tt> to all
* registered <tt>ChatRoomInvitationListener</tt>s.
*
@@ -425,56 +319,14 @@
public void fireInvitationEvent(ChatRoom targetChatRoom, String inviter,
String reason, byte[] password)
{
- ChatRoomInvitationIcqImpl invitation = new ChatRoomInvitationIcqImpl(
- targetChatRoom, inviter, reason, password);
+ ChatRoomInvitationIcqImpl invitation
+ = new ChatRoomInvitationIcqImpl(
+ targetChatRoom,
+ inviter,
+ reason,
+ password);

- ChatRoomInvitationReceivedEvent evt
- = new ChatRoomInvitationReceivedEvent(
- this, invitation, new Date(System.currentTimeMillis()));
-
- Iterator listeners = null;
- synchronized (invitationListeners)
- {
- listeners = new ArrayList(invitationListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationListener listener
- = (ChatRoomInvitationListener) listeners.next();
-
- listener.invitationReceived(evt);
- }
- }
-
- /**
- * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason the reason
- */
- public void fireLocalUserPresenceEvent(ChatRoom chatRoom, String eventType,
- String reason)
- {
- LocalUserChatRoomPresenceChangeEvent evt = new LocalUserChatRoomPresenceChangeEvent(
- this, chatRoom, eventType, reason);
-
- Iterator listeners = null;
- synchronized (presenceListeners)
- {
- listeners = new ArrayList(presenceListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- LocalUserChatRoomPresenceListener listener
- = (LocalUserChatRoomPresenceListener) listeners.next();
-
- listener.localUserPresenceChanged(evt);
- }
+ fireInvitationReceived(invitation);
}

/**
@@ -485,7 +337,7 @@
RegistrationStateChangeListener
{
/**
- * The method is called by a ProtocolProvider implementation whenver
+ * The method is called by a ProtocolProvider implementation whenever
* a change in the registration state of the corresponding provider had
* occurred.
* @param evt ProviderStatusChangeEvent the event describing the status

Modified: trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java 2009-08-30 19:31:58+0000
@@ -111,7 +111,7 @@
/**
* Buddies seen availabel
*/
- private Vector buddiesSeenAvailable = new Vector();
+ private final List<String> buddiesSeenAvailable = new Vector<String>();

/\*\*
 \* The array list we use when returning from the getSupportedStatusSet\(\)

@@ -1109,14 +1109,13 @@
//offline. The icq protocol does not implement top level buddies
//nor subgroups for top level groups so a simple nested loop
//would be enough.
- Iterator groupsIter = getServerStoredContactListRoot()
- .subgroups();
+ Iterator<ContactGroup> groupsIter
+ = getServerStoredContactListRoot().subgroups();
+
while(groupsIter.hasNext())
{
- ContactGroupIcqImpl group
- = (ContactGroupIcqImpl)groupsIter.next();
-
- Iterator contactsIter = group.contacts();
+ ContactGroup group = groupsIter.next();
+ Iterator<Contact> contactsIter = group.contacts();

                while\(contactsIter\.hasNext\(\)\)
                \{

@@ -1151,7 +1150,6 @@
}
}
}
-
}

/\*\*

@@ -1298,12 +1296,11 @@
ContactGroupIcqImpl parent
= ssContactList.findContactGroup(sourceContact);

- List extraInfoBlocks = info.getExtraInfoBlocks();
+ Iterable<ExtraInfoBlock> extraInfoBlocks
+ = info.getExtraInfoBlocks();
if(extraInfoBlocks != null){
- for (int i = 0; i < extraInfoBlocks.size(); i++)
+ for (ExtraInfoBlock block : extraInfoBlocks)
{
- ExtraInfoBlock block
- = ( (ExtraInfoBlock) extraInfoBlocks.get(i));
if (block.getType() == ExtraInfoBlock.TYPE_AVAILMSG)
{
String status = ExtraInfoData.readAvailableMessage(
@@ -1467,11 +1464,14 @@

            if\(theAwaitingAuthorizationGroup == null\)
            \{

- List emptyBuddies = new LinkedList();
- theAwaitingAuthorizationGroup = new ContactGroupIcqImpl(
- new VolatileGroup(
- ServerStoredContactListIcqImpl.awaitingAuthorizationGroupName),
- emptyBuddies, ssContactList, false);
+ theAwaitingAuthorizationGroup
+ = new ContactGroupIcqImpl(
+ new VolatileGroup(
+ ServerStoredContactListIcqImpl
+ .awaitingAuthorizationGroupName),
+ null,
+ ssContactList,
+ false);

                \(\(RootContactGroupIcqImpl\)ssContactList\.getRootGroup\(\)\)\.
                    addSubGroup\(theAwaitingAuthorizationGroup\);

@@ -1538,7 +1538,7 @@
Screenname screenname,
ExtraInfoData extraInfoData)
{
- updateBuddyyIcon(screenname, null);
+ updateBuddyIcon(screenname, null);
}

    public void buddyIconUpdated\(IconService iconService,

@@ -1548,7 +1548,7 @@
{
if(byteBlock != null)
{
- updateBuddyyIcon(screenname, byteBlock.toByteArray());
+ updateBuddyIcon(screenname, byteBlock.toByteArray());
}
}

@@ -1557,21 +1557,22 @@
* @param screenname the contact screenname
* @param icon byte array representing the image
*/
- private void updateBuddyyIcon(Screenname screenname, byte[] icon)
+ private void updateBuddyIcon(Screenname screenname, byte[] icon)
{
ContactIcqImpl contact = ssContactList.findContactByScreenName(
screenname.getFormatted());

        if\(contact \!= null\)
        \{

- byte[] oldImage = contact.getImage();
+ byte[] oldIcon = contact.getImage();

            contact\.setImage\(icon\);

+
fireContactPropertyChangeEvent(
- ContactPropertyChangeEvent.PROPERTY_IMAGE,
- contact,
- null,
- icon);
+ ContactPropertyChangeEvent.PROPERTY_IMAGE,
+ contact,
+ oldIcon,
+ icon);
}
}
}
@@ -1590,34 +1591,37 @@
if(theAwaitingAuthorizationGroup == null)
return;

- Iterator iter = theAwaitingAuthorizationGroup.contacts();
+ Iterator<Contact> iter = theAwaitingAuthorizationGroup.contacts();
while (iter.hasNext())
{
ContactIcqImpl sourceContact = (ContactIcqImpl)iter.next();
-
- PresenceStatus newStatus = queryContactStatus(sourceContact.getAddress());
-
- PresenceStatus oldStatus
- = sourceContact.getPresenceStatus();
+ String sourceContactAddress = sourceContact.getAddress();
+ PresenceStatus newStatus
+ = queryContactStatus(sourceContactAddress);
+ PresenceStatus oldStatus = sourceContact.getPresenceStatus();

            if\(newStatus\.equals\(oldStatus\)\)
               continue;

            sourceContact\.updatePresenceStatus\(newStatus\);

- fireContactPresenceStatusChangeEvent(sourceContact, theAwaitingAuthorizationGroup,
- oldStatus, newStatus);
+ fireContactPresenceStatusChangeEvent(
+ sourceContact,
+ theAwaitingAuthorizationGroup,
+ oldStatus,
+ newStatus);

- if( !newStatus.equals(IcqStatusEnum.OFFLINE) &&
- !buddiesSeenAvailable.contains(sourceContact.getAddress()))
+ if (!newStatus.equals(IcqStatusEnum.OFFLINE)
+ && !buddiesSeenAvailable.contains(sourceContactAddress))
{
- buddiesSeenAvailable.add(sourceContact.getAddress());
+ buddiesSeenAvailable.add(sourceContactAddress);
try
{
AuthorizationRequest req = new AuthorizationRequest();
req.setReason("I'm resending my request. Please authorize me!");

- opSetExtendedAuthorizations.reRequestAuthorization(req, sourceContact);
+ opSetExtendedAuthorizations
+ .reRequestAuthorization(req, sourceContact);
} catch (OperationFailedException ex)
{
logger.error("failed to reRequestAuthorization", ex);

Modified: trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java 2009-08-30 19:31:58+0000
@@ -22,7 +22,7 @@
* @author Lubomir Marinov
*/
public class OperationSetMultiUserChatIrcImpl
- implements OperationSetMultiUserChat
+ extends AbstractOperationSetMultiUserChat
{
private static final Logger logger
= Logger.getLogger(OperationSetMultiUserChatIrcImpl.class);
@@ -33,23 +33,6 @@
private ProtocolProviderServiceIrcImpl ircProvider = null;

/\*\*

- * A list of listeners subscribed for invitations multi-user chat events.
- */
- private List invitationListeners = new LinkedList();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a
- * multi user chat invitation sent by us.
- */
- private List invitationRejectionListeners = new LinkedList();
-
- /**
- * list of this chat room local user status listener
- */
- private final List<LocalUserChatRoomPresenceListener> localUserPresenceListeners
- = new ArrayList<LocalUserChatRoomPresenceListener>();
-
- /**
* A list of the rooms that are currently open by this account. Note that
* we have not necessarily joined these rooms, we might have simply been
* searching through them.
@@ -196,66 +179,6 @@
}

/\*\*

- * Adds a listener to invitation notifications. The listener will be fired
- * anytime an invitation is received.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized(invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized(invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener to invitation notifications. The listener will be fired
- * anytime an invitation is received.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized(invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation rejection events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized(invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
* Returns true if <tt>contact</tt> supports multi-user chat sessions.
*
* @param contact reference to the contact whose support for chat rooms
@@ -270,71 +193,6 @@
}

/\*\*

- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
- {
- synchronized (localUserPresenceListeners)
- {
- if (!localUserPresenceListeners.contains(listener))
- localUserPresenceListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in
- * a room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- synchronized (localUserPresenceListeners)
- {
- localUserPresenceListeners.remove(listener);
- }
- }
-
- /**
- * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason the reason
- */
- protected void fireLocalUserPresenceEvent( ChatRoom chatRoom,
- String eventType,
- String reason)
- {
- LocalUserChatRoomPresenceChangeEvent evt
- = new LocalUserChatRoomPresenceChangeEvent( this,
- chatRoom,
- eventType,
- reason);
-
- logger.trace(
- "Will dispatch the following OperationSetMultiUserChatIrcImpl event: "
- + evt);
-
- List<LocalUserChatRoomPresenceListener> listeners;
- synchronized (localUserPresenceListeners)
- {
- listeners
- = new ArrayList<LocalUserChatRoomPresenceListener>(
- localUserPresenceListeners);
- }
-
- for (LocalUserChatRoomPresenceListener listener : listeners)
- listener.localUserPresenceChanged(evt);
- }
-
- /**
* Returns a reference to the chat room named <tt>chatRoomName</tt> or
* null if the room hasn't been cached yet.
*
@@ -425,23 +283,7 @@
reason,
password);

- ChatRoomInvitationReceivedEvent evt
- = new ChatRoomInvitationReceivedEvent(this, invitation,
- new Date(System.currentTimeMillis()));
-
- Iterator listeners = null;
- synchronized (invitationListeners)
- {
- listeners = new ArrayList(invitationListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationListener listener
- = (ChatRoomInvitationListener) listeners.next();
-
- listener.invitationReceived(evt);
- }
+ fireInvitationReceived(invitation);
}

/\*\*

Modified: trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetMultiUserChatJabberImpl.java 2009-08-30 19:31:58+0000
@@ -24,8 +24,8 @@
* @author Yana Stamcheva
*/
public class OperationSetMultiUserChatJabberImpl
- implements OperationSetMultiUserChat,
- SubscriptionListener
+ extends AbstractOperationSetMultiUserChat
+ implements SubscriptionListener
{
private static final Logger logger
= Logger.getLogger(OperationSetMultiUserChatJabberImpl.class);
@@ -36,23 +36,6 @@
private final ProtocolProviderServiceJabberImpl jabberProvider;

/\*\*

- * A list of listeners subscribed for invitations multi user chat events.
- */
- private final Vector invitationListeners = new Vector();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a
- * multi user chat invitation sent by us.
- */
- private final Vector invitationRejectionListeners = new Vector();
-
- /**
- * Listeners that will be notified of changes in our status in the
- * room such as us being kicked, banned, or granted admin permissions.
- */
- private final Vector presenceListeners = new Vector();
-
- /**
* A list of the rooms that are currently open by this account. Note that
* we have not necessarily joined these rooms, we might have simply been
* searching through them.
@@ -87,96 +70,6 @@
}

/\*\*

- * Adds a listener to invitation notifications.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized(invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized(invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
- {
- synchronized(presenceListeners)
- {
- if (!presenceListeners.contains(listener))
- presenceListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in
- * a room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- synchronized(presenceListeners)
- {
- presenceListeners.remove(listener);
- }
- }
-
- /**
- * Subscribes <tt>listener</tt> so that it would receive events indicating
- * rejection of a multi user chat invitation that we've sent earlier.
- *
- * @param listener the listener that we'll subscribe for invitation
- * rejection events.
- */
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized(invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation rejection events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized(invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
* Creates a room with the named <tt>roomName</tt> and according to the
* specified <tt>roomProperties</tt> on the server that this protocol
* provider is currently connected to.
@@ -618,39 +511,6 @@
}

/\*\*

- * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason the reason
- */
- public void fireLocalUserPresenceEvent(ChatRoom chatRoom, String eventType,
- String reason)
- {
- LocalUserChatRoomPresenceChangeEvent evt
- = new LocalUserChatRoomPresenceChangeEvent( this,
- chatRoom,
- eventType,
- reason);
-
- Iterator listeners = null;
- synchronized (presenceListeners)
- {
- listeners = new ArrayList(presenceListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- LocalUserChatRoomPresenceListener listener
- = (LocalUserChatRoomPresenceListener) listeners.next();
-
- listener.localUserPresenceChanged(evt);
- }
- }
-
- /**
* Delivers a <tt>ChatRoomInvitationReceivedEvent</tt> to all
* registered <tt>ChatRoomInvitationListener</tt>s.
*
@@ -671,55 +531,7 @@
reason,
password);

- ChatRoomInvitationReceivedEvent evt
- = new ChatRoomInvitationReceivedEvent(this, invitation,
- new Date(System.currentTimeMillis()));
-
- Iterator listeners = null;
- synchronized (invitationListeners)
- {
- listeners = new ArrayList(invitationListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationListener listener
- = (ChatRoomInvitationListener) listeners.next();
-
- listener.invitationReceived(evt);
- }
- }
-
- /**
- * Delivers a <tt>ChatRoomInvitationRejectedEvent</tt> to all
- * registered <tt>ChatRoomInvitationRejectionListener</tt>s.
- *
- * @param sourceChatRoom the room that invitation refers to
- * @param invitee the name of the invitee that rejected the invitation
- * @param reason the reason of the rejection
- */
- public void fireInvitationRejectedEvent(ChatRoom sourceChatRoom,
- String invitee,
- String reason)
- {
- ChatRoomInvitationRejectedEvent evt
- = new ChatRoomInvitationRejectedEvent(
- this, sourceChatRoom, invitee, reason,
- new Date(System.currentTimeMillis()));
-
- Iterator listeners = null;
- synchronized (invitationRejectionListeners)
- {
- listeners = new ArrayList(invitationRejectionListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationRejectionListener listener
- = (ChatRoomInvitationRejectionListener) listeners.next();
-
- listener.invitationRejected(evt);
- }
+ fireInvitationReceived(invitation);
}

/\*\*

Modified: trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/mock/MockChatRoom.java 2009-08-30 19:31:58+0000
@@ -157,14 +157,12 @@
null);

    members\.add\(newMember\);

-
- LocalUserChatRoomPresenceChangeEvent evt =
- new LocalUserChatRoomPresenceChangeEvent(
- parentOpSet,
- this,
- LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,
- null);
- parentOpSet.fireLocalUserChatRoomPresenceChangeEvent(evt);
+
+ parentOpSet
+ .fireLocalUserPresenceEvent(
+ this,
+ LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,
+ null);
}

/\*\*

Modified: trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/mock/MockMultiUserChat.java 2009-08-30 19:31:58+0000
@@ -7,15 +7,16 @@
package net.java.sip.communicator.impl.protocol.mock;

import java.util.*;
+
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;

/**
- * Multiuser chat functionalites for the mock protocol.
+ * Multiuser chat functionalities for the mock protocol.
* @author Damian Minkov
*/
public class MockMultiUserChat
- implements OperationSetMultiUserChat
+ extends AbstractOperationSetMultiUserChat
{
/**
* The protocol provider that created us.
@@ -26,21 +27,6 @@
private List joinedChatRooms = new Vector();

/\*\*

- * Currently registered invitation listeners.
- */
- private Vector invitationListeners = new Vector();
-
- /**
- * Currently registered invitation reject listeners.
- */
- private Vector invitationRejectListeners = new Vector();
-
- /**
- * Currently registered local user chat room presence listeners.
- */
- private Vector localUserChatRoomPresenceListeners = new Vector();
-
- /**
* Creates an instance of this operation set keeping a reference to the
* parent protocol provider and presence operation set.
*
@@ -181,69 +167,10 @@
*/
public void rejectInvitation(ChatRoomInvitation invitation, String reason)
{
- ChatRoomInvitationRejectedEvent evt =
- new ChatRoomInvitationRejectedEvent(
- this,
- invitation.getTargetChatRoom(),
- provider.getAccountID().getUserID(),
- invitation.getReason(),
- new Date());
-
- Iterator iter = invitationRejectListeners.iterator();
- while(iter.hasNext())
- {
- ChatRoomInvitationRejectionListener elem =
- (ChatRoomInvitationRejectionListener)iter.next();
- elem.invitationRejected(evt);
- }
- }
-
- /**
- * Adds a listener to invitation notifications. The listener will be fired
- * anytime an invitation is received.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- if(!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- invitationListeners.remove(listener);
- }
-
- /**
- * Adds a listener to invitation notifications. The listener will be fired
- * anytime an invitation is received.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- if(!invitationRejectListeners.contains(listener))
- invitationRejectListeners.add(listener);
- }
-
- /**
- * Removes the given listener from the list of invitation listeners
- * registered to receive events every time an invitation has been rejected.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- invitationRejectListeners.remove(listener);
+ fireInvitationRejectedEvent(
+ invitation.getTargetChatRoom(),
+ provider.getAccountID().getUserID(),
+ invitation.getReason());
}

/\*\*

@@ -257,41 +184,4 @@
{
throw new UnsupportedOperationException("Not supported yet.");
}
-
- /**
- * Adds a listener that will be notified of changes in our participation in
- * a chat room such as us being kicked, joined, left.
- *
- * @param listener a local user participation listener.
- */
- public void addPresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- if(!localUserChatRoomPresenceListeners.contains(listener))
- localUserChatRoomPresenceListeners.add(listener);
- }
-
- /**
- * Removes a listener that was being notified of changes in our
- * participation in a room such as us being kicked, joined, left.
- *
- * @param listener a local user participation listener.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- localUserChatRoomPresenceListeners.remove(listener);
- }
-
- void fireLocalUserChatRoomPresenceChangeEvent(
- LocalUserChatRoomPresenceChangeEvent evt)
- {
- Iterator iter = localUserChatRoomPresenceListeners.iterator();
- while(iter.hasNext())
- {
- LocalUserChatRoomPresenceListener elem =
- (LocalUserChatRoomPresenceListener)iter.next();
- elem.localUserPresenceChanged(evt);
- }
- }
}

Modified: trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java 2009-08-30 19:31:58+0000
@@ -10,7 +10,7 @@

import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.Logger;
+import net.java.sip.communicator.util.*;
import net.sf.jml.*;
import net.sf.jml.event.*;
import net.sf.jml.message.*;
@@ -20,32 +20,14 @@
*
* @author Rupert Burchardi
*/
-
public class OperationSetMultiUserChatMsnImpl
- implements OperationSetMultiUserChat,
- SubscriptionListener
+ extends AbstractOperationSetMultiUserChat
+ implements SubscriptionListener
{
private static final Logger logger =
Logger.getLogger(OperationSetMultiUserChatMsnImpl.class);

/\*\*

- * A list of listeners subscribed for invitations multi user chat events.
- */
- private Vector invitationListeners = new Vector();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a multi
- * user chat invitation sent by us.
- */
- private Vector invitationRejectionListeners = new Vector();
-
- /**
- * Listeners that will be notified of changes in our status in the room such
- * as us being kicked, banned, or granted admin permissions.
- */
- private Vector presenceListeners = new Vector();
-
- /**
* A list of the rooms that are currently open by this account. Note that
* this list only contains chat rooms where the user is not the initiator.
*/
@@ -83,95 +65,6 @@
}

/\*\*

- * Adds a listener to invitation notifications.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
-
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener to invitation notifications.
- *
- * @param listener an invitation listener.
- */
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- if (!presenceListeners.contains(listener))
- presenceListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in a
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- presenceListeners.remove(listener);
- }
- }
-
- /**
* Returns true if <tt>contact</tt> supports multi user chat sessions.
*
* @param contact reference to the contact whose support for chat rooms we
@@ -489,58 +382,14 @@
protected void fireInvitationEvent(ChatRoom targetChatRoom, String inviter,
String reason, byte[] password)
{
- ChatRoomInvitationMsnImpl invitation =
- new ChatRoomInvitationMsnImpl(targetChatRoom, inviter, reason,
- password);
-
- ChatRoomInvitationReceivedEvent evt =
- new ChatRoomInvitationReceivedEvent(this, invitation, new Date(
- System.currentTimeMillis()));
+ ChatRoomInvitationMsnImpl invitation
+ = new ChatRoomInvitationMsnImpl(
+ targetChatRoom,
+ inviter,
+ reason,
+ password);

- Iterator listeners = null;
- synchronized (invitationListeners)
- {
- listeners = new ArrayList(invitationListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationListener listener =
- (ChatRoomInvitationListener) listeners.next();
-
- listener.invitationReceived(evt);
- }
- }
-
- /**
- * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason the reason
- */
- public void fireLocalUserPresenceEvent(ChatRoom chatRoom, String eventType,
- String reason)
- {
- LocalUserChatRoomPresenceChangeEvent evt =
- new LocalUserChatRoomPresenceChangeEvent(this, chatRoom, eventType,
- reason);
-
- Iterator listeners = null;
- synchronized (presenceListeners)
- {
- listeners = new ArrayList(presenceListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- LocalUserChatRoomPresenceListener listener =
- (LocalUserChatRoomPresenceListener) listeners.next();
-
- listener.localUserPresenceChanged(evt);
- }
+ fireInvitationReceived(invitation);
}

/\*\*

Modified: trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java 2009-08-30 19:31:58+0000
@@ -17,31 +17,11 @@
* @author Rupert Burchardi
*/
public class OperationSetMultiUserChatYahooImpl
- implements OperationSetMultiUserChat,
- SubscriptionListener
+ extends AbstractOperationSetMultiUserChat
+ implements SubscriptionListener
{
private static final Logger logger = Logger
.getLogger(OperationSetMultiUserChatYahooImpl.class);
- /**
- * A list of listeners subscribed for invitations multi user chat events.
- */
- private Vector<ChatRoomInvitationListener> invitationListeners
- = new Vector<ChatRoomInvitationListener>();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a multi
- * user chat invitation sent by us.
- */
- private Vector<ChatRoomInvitationRejectionListener>
- invitationRejectionListeners
- = new Vector<ChatRoomInvitationRejectionListener>();
-
- /**
- * Listeners that will be notified of changes in our status in the room such
- * as us being kicked, banned, or granted admin permissions.
- */
- private Vector<LocalUserChatRoomPresenceListener> presenceListeners
- = new Vector<LocalUserChatRoomPresenceListener>();

/**
* A list of the rooms that are currently open by this account.
@@ -93,103 +73,6 @@
}

/**
- * Adds a listener to invitation notifications.
- *
- * @param listener
- * An invitation listener.
- */
- public void addInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in a
- * room such as us being kicked, banned or dropped.
- *
- * @param listener
- * the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removeInvitationListener(ChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Subscribes <tt>listener</tt> so that it would receive events indicating
- * rejection of a multi user chat invitation that we've sent earlier.
- *
- * @param listener
- * the listener that we'll subscribe for invitation rejection
- * events.
- */
-
- public void addInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation rejection events.
- *
- * @param listener
- * the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- ChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener
- * the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- if (!presenceListeners.contains(listener))
- presenceListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in a
- * room such as us being kicked, banned or dropped.
- *
- * @param listener
- * the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- presenceListeners.remove(listener);
- }
- }
-
- /**
* Creates a room with the named <tt>roomName</tt> and according to the
* specified <tt>roomProperties</tt> on the server that this protocol
* provider is currently connected to. Note the roomProperties also contain
@@ -448,97 +331,14 @@
public void fireInvitationEvent(ChatRoom targetChatRoom, String inviter,
String reason, byte[] password)
{
- ChatRoomInvitationYahooImpl invitation = new ChatRoomInvitationYahooImpl(
- targetChatRoom, inviter, reason, password);
-
- ChatRoomInvitationReceivedEvent evt = new ChatRoomInvitationReceivedEvent(
- this, invitation, new Date(System.currentTimeMillis()));
-
- Iterator<ChatRoomInvitationListener> listeners = null;
- synchronized (invitationListeners)
- {
- listeners = new ArrayList<ChatRoomInvitationListener>(
- invitationListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- ChatRoomInvitationListener listener
- = (ChatRoomInvitationListener) listeners.next();
-
- listener.invitationReceived(evt);
- }
- }
-
- /**
- * Delivers a <tt>ChatRoomInvitationRejectedEvent</tt> to all registered
- * <tt>ChatRoomInvitationRejectionListener</tt>s.
- *
- * @param sourceChatRoom
- * the room that invitation refers to
- * @param invitee
- * the name of the invitee that rejected the invitation
- * @param reason
- * the reason of the rejection
- */
- public void fireInvitationRejectedEvent(ChatRoom sourceChatRoom,
- String invitee, String reason)
- {
- ChatRoomInvitationRejectedEvent evt = new ChatRoomInvitationRejectedEvent(
- this, sourceChatRoom, invitee, reason, new Date(System
- .currentTimeMillis()));
-
- Iterator<ChatRoomInvitationRejectionListener> listeners = null;
- synchronized (invitationRejectionListeners)
- {
- listeners = new ArrayList<ChatRoomInvitationRejectionListener>(
- invitationRejectionListeners).iterator();
- }
+ ChatRoomInvitationYahooImpl invitation
+ = new ChatRoomInvitationYahooImpl(
+ targetChatRoom,
+ inviter,
+ reason,
+ password);

- while (listeners.hasNext())
- {
- ChatRoomInvitationRejectionListener listener
- = (ChatRoomInvitationRejectionListener) listeners.next();
-
- listener.invitationRejected(evt);
- }
- }
-
- /**
- * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom
- * the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType
- * the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason
- * the reason
- */
- public void fireLocalUserPresenceEvent(ChatRoom chatRoom, String eventType,
- String reason)
- {
- LocalUserChatRoomPresenceChangeEvent evt
- = new LocalUserChatRoomPresenceChangeEvent( this,
- chatRoom,
- eventType,
- reason);
-
- Iterator<LocalUserChatRoomPresenceListener> listeners = null;
- synchronized (presenceListeners)
- {
- listeners = new ArrayList<LocalUserChatRoomPresenceListener>(
- presenceListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- LocalUserChatRoomPresenceListener listener
- = (LocalUserChatRoomPresenceListener) listeners.next();
-
- listener.localUserPresenceChanged(evt);
- }
+ fireInvitationReceived(invitation);
}

/**

Modified: trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java&p2=trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/accountinfo/AccountDetailsPanel.java 2009-08-30 19:31:58+0000
@@ -542,12 +542,11 @@
public void actionPerformed(ActionEvent e)
{
String firstName = firstNameField.getText();
- String middleName = middleNameField.getText();
+// String middleName = middleNameField.getText();
String lastName = lastNameField.getText();
String gender = genderField.getText();
String email = emailField.getText();
String phoneNumber = phoneField.getText();
- Icon avatar = avatarLabel.getIcon();

        Calendar birthDateCalendar = Calendar\.getInstance\(\);

Modified: trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java?view=diff&rev=5885&p1=trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java&p2=trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java&r1=5884&r2=5885

--- trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java (original)
+++ trunk/src/net/java/sip/communicator/plugin/icqaccregwizz/IcqAccountRegistration.java 2009-08-30 19:31:58+0000
@@ -30,8 +30,6 @@

private String proxyPassword;

- private boolean isAdvancedSettingsEnabled = false;
-
/**
* Returns the password of the icq registration account.
* @return the password of the icq registration account.

Added: trunk/src/net/java/sip/communicator/service/protocol/AbstractOperationSetMultiUserChat.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/protocol/AbstractOperationSetMultiUserChat.java?view=auto&rev=5885

--- (empty file)
+++ trunk/src/net/java/sip/communicator/service/protocol/AbstractOperationSetMultiUserChat.java 2009-08-30 19:31:58+0000
@@ -0,0 +1,226 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.protocol;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.protocol.event.*;
+
+/**
+ * Represents a default implementation of <code>OperationSetMultiUserChat</code>
+ * in order to make it easier for implementers to provide complete solutions
+ * while focusing on implementation-specific details.
+ *
+ * @author Lubomir Marinov
+ */
+public abstract class AbstractOperationSetMultiUserChat
+ implements OperationSetMultiUserChat
+{
+
+ /**
+ * The list of the currently registered
+ * <code>ChatRoomInvitationListener</code>s.
+ */
+ private final List<ChatRoomInvitationListener> invitationListeners
+ = new Vector<ChatRoomInvitationListener>();
+
+ /**
+ * The list of <code>ChatRoomInvitationRejectionListener</code>s subscribed
+ * for events indicating rejection of a multi user chat invitation sent by
+ * us.
+ */
+ private final List<ChatRoomInvitationRejectionListener> invitationRejectionListeners
+ = new Vector<ChatRoomInvitationRejectionListener>();
+
+ /**
+ * Listeners that will be notified of changes in our status in the
+ * room such as us being kicked, banned, or granted admin permissions.
+ */
+ private final List<LocalUserChatRoomPresenceListener> presenceListeners
+ = new Vector<LocalUserChatRoomPresenceListener>();
+
+ /*
+ * Implements
+ * OperationSetMultiUserChat#addInvitationListener(
+ * ChatRoomInvitationListener).
+ */
+ public void addInvitationListener(ChatRoomInvitationListener listener)
+ {
+ synchronized (invitationListeners)
+ {
+ if (!invitationListeners.contains(listener))
+ invitationListeners.add(listener);
+ }
+ }
+
+ /*
+ * ImplementsOperationSetMultiUserChat#addInvitationRejectionListener(
+ * ChatRoomInvitationRejectionListener).
+ */
+ public void addInvitationRejectionListener(
+ ChatRoomInvitationRejectionListener listener)
+ {
+ synchronized (invitationRejectionListeners)
+ {
+ if (!invitationRejectionListeners.contains(listener))
+ invitationRejectionListeners.add(listener);
+ }
+ }
+
+ /*
+ * Implements OperationSetMultiUserChat#addPresenceListener(
+ * LocalUserChatRoomPresenceListener).
+ */
+ public void addPresenceListener(LocalUserChatRoomPresenceListener listener)
+ {
+ synchronized (presenceListeners)
+ {
+ if (!presenceListeners.contains(listener))
+ presenceListeners.add(listener);
+ }
+ }
+
+ /**
+ * Fires a new <code>ChatRoomInvitationReceivedEvent</code> to all currently
+ * registered <code>ChatRoomInvitationListener</code>s to notify about the
+ * receipt of a specific <code>ChatRoomInvitation</code>.
+ *
+ * @param invitation
+ * the <code>ChatRoomInvitation</code> which has been received
+ */
+ protected void fireInvitationReceived(ChatRoomInvitation invitation)
+ {
+ ChatRoomInvitationReceivedEvent evt
+ = new ChatRoomInvitationReceivedEvent(
+ this,
+ invitation,
+ new Date(System.currentTimeMillis()));
+
+ ChatRoomInvitationListener[] listeners;
+ synchronized (invitationListeners)
+ {
+ listeners
+ = invitationListeners
+ .toArray(
+ new ChatRoomInvitationListener[
+ invitationListeners.size()]);
+ }
+
+ for (ChatRoomInvitationListener listener : listeners)
+ listener.invitationReceived(evt);
+ }
+
+ /**
+ * Delivers a <tt>ChatRoomInvitationRejectedEvent</tt> to all
+ * registered <tt>ChatRoomInvitationRejectionListener</tt>s.
+ *
+ * @param sourceChatRoom the room that invitation refers to
+ * @param invitee the name of the invitee that rejected the invitation
+ * @param reason the reason of the rejection
+ */
+ protected void fireInvitationRejectedEvent(ChatRoom sourceChatRoom,
+ String invitee,
+ String reason)
+ {
+ ChatRoomInvitationRejectedEvent evt
+ = new ChatRoomInvitationRejectedEvent(
+ this,
+ sourceChatRoom,
+ invitee,
+ reason,
+ new Date(System.currentTimeMillis()));
+
+ ChatRoomInvitationRejectionListener[] listeners;
+ synchronized (invitationRejectionListeners)
+ {
+ listeners
+ = invitationRejectionListeners
+ .toArray(
+ new ChatRoomInvitationRejectionListener[
+ invitationRejectionListeners.size()]);
+ }
+
+ for (ChatRoomInvitationRejectionListener listener : listeners)
+ listener.invitationRejected(evt);
+ }
+
+ /**
+ * Delivers a <tt>LocalUserChatRoomPresenceChangeEvent</tt> to all
+ * registered <tt>LocalUserChatRoomPresenceListener</tt>s.
+ *
+ * @param chatRoom
+ * the <tt>ChatRoom</tt> which has been joined, left, etc.
+ * @param eventType
+ * the type of this event; one of LOCAL_USER_JOINED,
+ * LOCAL_USER_LEFT, etc.
+ * @param reason
+ * the reason
+ */
+ public void fireLocalUserPresenceEvent(
+ ChatRoom chatRoom,
+ String eventType,
+ String reason)
+ {
+ LocalUserChatRoomPresenceChangeEvent evt
+ = new LocalUserChatRoomPresenceChangeEvent( this,
+ chatRoom,
+ eventType,
+ reason);
+
+ LocalUserChatRoomPresenceListener[] listeners;
+ synchronized (presenceListeners)
+ {
+ listeners
+ = presenceListeners
+ .toArray(
+ new LocalUserChatRoomPresenceListener[
+ presenceListeners.size()]);
+ }
+
+ for (LocalUserChatRoomPresenceListener listener : listeners)
+ listener.localUserPresenceChanged(evt);
+ }
+
+ /*
+ * Implements
+ * OperationSetMultiUserChat#removeInvitationListener(
+ * ChatRoomInvitationListener).
+ */
+ public void removeInvitationListener(ChatRoomInvitationListener listener)
+ {
+ synchronized (invitationListeners)
+ {
+ invitationListeners.remove(listener);
+ }
+ }
+
+ /*
+ * Implements OperationSetMultiUserChat#removeInvitationRejectionListener(
+ * ChatRoomInvitationRejectionListener).
+ */
+ public void removeInvitationRejectionListener(
+ ChatRoomInvitationRejectionListener listener)
+ {
+ synchronized (invitationRejectionListeners)
+ {
+ invitationRejectionListeners.remove(listener);
+ }
+ }
+
+ /*
+ * Implements OperationSetMultiUserChat#removePresenceListener(
+ * LocalUserChatRoomPresenceListener).
+ */
+ public void removePresenceListener(
+ LocalUserChatRoomPresenceListener listener)
+ {
+ synchronized (presenceListeners)
+ {
+ presenceListeners.remove(listener);
+ }
+ }
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net