diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-10-02 19:29:28 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-10-02 19:29:28 +0000 |
commit | 7d22a7dcb4d727a38176543dfaaaecb3463b57cc (patch) | |
tree | 79e00755600d7dfd30a70ec5b7af475be11adf75 /src/net/java | |
parent | 216ba08327fbf2434340f3382c913e37d2ff5e7c (diff) | |
download | jitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.zip jitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.tar.gz jitsi-7d22a7dcb4d727a38176543dfaaaecb3463b57cc.tar.bz2 |
- Fixes ClassCastException in ChatRoom-related code which handles failure of delivery of a message and in its respective AdHocChatRoom duplicate.
- Simplifies a bit and speeds up ChatWindowManager. Part of the approach to remove its #syncChat and prevent a deadlock with IRC.
- Removes a field or two to reduce the shallow runtime size of the instances of the affected class.
- Fixes a few redundant-cast warnings caused by ProtocolProviderService#getOperationSet(). While doing, fixes an occurrence of a double calling to the method in question while only one call suffices and is faster.
Diffstat (limited to 'src/net/java')
23 files changed, 388 insertions, 444 deletions
diff --git a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java index c59f510..a59dab9 100644 --- a/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/filehistory/FileHistoryServiceImpl.java @@ -148,9 +148,8 @@ public class FileHistoryServiceImpl logger.debug("Adding protocol provider " + provider.getProtocolName()); // check whether the provider has a file transfer operation set - OperationSetFileTransfer opSetFileTransfer = - (OperationSetFileTransfer) provider - .getOperationSet(OperationSetFileTransfer.class); + OperationSetFileTransfer opSetFileTransfer + = provider.getOperationSet(OperationSetFileTransfer.class); if (opSetFileTransfer != null) { @@ -169,9 +168,8 @@ public class FileHistoryServiceImpl */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetFileTransfer opSetFileTransfer = - (OperationSetFileTransfer) provider - .getOperationSet(OperationSetFileTransfer.class); + OperationSetFileTransfer opSetFileTransfer + = provider.getOperationSet(OperationSetFileTransfer.class); if (opSetFileTransfer != null) { diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 8d1cb9f..327c8a5 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -543,20 +543,17 @@ public class UIServiceImpl } /** - * Implements <code>getChat</code> in the UIService interface. If a - * chat for the given contact exists already - returns it, otherwise - * creates a new one. + * Implements {@link UIService#getChat(Contact)}. If a chat for the given + * contact exists already, returns it; otherwise, creates a new one. * * @param contact the contact that we'd like to retrieve a chat window for. - * - * @return a Chat corresponding to the specified contact. - * + * @return the <tt>Chat</tt> corresponding to the specified contact. * @see UIService#getChat(Contact) */ public ChatPanel getChat(Contact contact) { - MetaContact metaContact = mainFrame.getContactList() - .findMetaContactByContact(contact); + MetaContact metaContact + = mainFrame.getContactList().findMetaContactByContact(contact); return chatWindowManager.getContactChat(metaContact); } @@ -570,7 +567,7 @@ public class UIServiceImpl */ public ChatPanel getChat(ChatRoom chatRoom) { - return chatWindowManager.getMultiChat(chatRoom); + return chatWindowManager.getMultiChat(chatRoom, true); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java index d5e7eea..38ac9ee 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountList.java @@ -83,7 +83,7 @@ public class AccountList protocolProvider.addRegistrationStateChangeListener(this); OperationSetPresence presence - = (OperationSetPresence) protocolProvider + = protocolProvider .getOperationSet(OperationSetPresence.class); if (presence != null) @@ -154,7 +154,7 @@ public class AccountList // Add a presence listener in order to listen for any status // changes. OperationSetPresence presence - = (OperationSetPresence) protocolProvider + = protocolProvider .getOperationSet(OperationSetPresence.class); if (presence != null) diff --git a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java index 842316e..ae91383 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/MuteButton.java @@ -120,8 +120,10 @@ public class MuteButton CallPeer callPeer = peers.next(); OperationSetBasicTelephony telephony - = (OperationSetBasicTelephony) call.getProtocolProvider() - .getOperationSet(OperationSetBasicTelephony.class); + = call + .getProtocolProvider() + .getOperationSet( + OperationSetBasicTelephony.class); telephony.setMute( callPeer, !callPeer.isMute()); diff --git a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java index 3d68c28..c1ea7b4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/conference/ConferenceInviteDialog.java @@ -177,9 +177,10 @@ public class ConferenceInviteDialog { ProtocolProviderService protocolProvider = protocolProviders.next(); - - OperationSet opSet = protocolProvider - .getOperationSet(OperationSetTelephonyConferencing.class); + OperationSet opSet + = protocolProvider + .getOperationSet( + OperationSetTelephonyConferencing.class); if (opSet != null && protocolProvider.isRegistered()) { diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java index 9d573bc..9e4d920 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java @@ -24,6 +24,7 @@ import net.java.sip.communicator.service.protocol.*; * * @author Yana Stamcheva * @author Valentin Martinet + * @author Lubomir Marinov */ public class ChatWindowManager { @@ -33,11 +34,13 @@ public class ChatWindowManager private final Object syncChat = new Object(); /** - * Opens the specified chatPanel and brings it to the front if so specified. + * Opens the specified <tt>ChatPanel</tt> and optinally brings it to the + * front. * - * @param chatPanel the chat panel that we will be opening - * @param setSelected specifies whether we should bring the chat to front - * after creating it. + * @param chatPanel the <tt>ChatPanel</tt> to be opened + * @param setSelected <tt>true</tt> if <tt>chatPanel</tt> (and respectively + * its <tt>ChatWindow</tt>) should be brought to the front; otherwise, + * <tt>false</tt> */ public void openChat(final ChatPanel chatPanel, final boolean setSelected) { @@ -165,72 +168,6 @@ public class ChatWindowManager } /** - * Returns <tt>true</tt> if there is an opened <tt>ChatPanel</tt> for the - * given <tt>ChatRoom</tt>. - * - * @param chatRoom the <tt>ChatRoom</tt>, for which the chat is about - * @return <tt>true</tt> if there is an opened <tt>ChatPanel</tt> for the - * given <tt>ChatRoom</tt> - */ - public boolean isChatOpenedFor(ChatRoom chatRoom) - { - synchronized (syncChat) - { - String chatRoomID = chatRoom.getIdentifier(); - - for (ChatPanel chatPanel : chatPanels) - { - Object descriptor = chatPanel.getChatSession().getDescriptor(); - - if(descriptor instanceof ChatRoomWrapper) - { - ChatRoomWrapper chatRoomWrapper - = (ChatRoomWrapper) descriptor; - - if(chatRoomWrapper.getChatRoomID().equals(chatRoomID) - && chatPanel.isShown()) - return true; - } - } - return false; - } - } - - /** - * Returns <tt>true</tt> if there is an opened <tt>ChatPanel</tt> for the - * given <tt>AdHocChatRoom</tt>. - * - * @param adHocChatRoom the <tt>AdHocChatRoom</tt>, for which the ad-hoc - * chat is about - * @return <tt>true</tt> if there is an opened <tt>ChatPanel</tt> for the - * given <tt>AdHocChatRoom</tt> - */ - public boolean isChatOpenedFor(AdHocChatRoom adHocChatRoom) - { - synchronized (syncChat) - { - String adHocChatRoomID = adHocChatRoom.getIdentifier(); - - for (ChatPanel chatPanel : chatPanels) - { - Object descriptor = chatPanel.getChatSession().getDescriptor(); - - if(descriptor instanceof AdHocChatRoomWrapper) - { - AdHocChatRoomWrapper chatRoomWrapper - = (AdHocChatRoomWrapper) descriptor; - - if(chatRoomWrapper.getAdHocChatRoomID() - .equals(adHocChatRoomID) - && chatPanel.isShown()) - return true; - } - } - return false; - } - } - - /** * Closes the given chat panel. * * @param chatPanel the chat panel to close @@ -549,7 +486,7 @@ public class ChatWindowManager * ad-hoc chat room for which the chat panel is about * @return the chat panel corresponding to the given chat room */ - public ChatPanel getAdHocMultiChat(AdHocChatRoomWrapper chatRoomWrapper) + public ChatPanel getMultiChat(AdHocChatRoomWrapper chatRoomWrapper) { synchronized (syncChat) { @@ -561,49 +498,73 @@ public class ChatWindowManager } /** - * Returns the chat panel corresponding to the given ad-hoc chat room. + * Gets the <tt>ChatPanel</tt> corresponding to the specified + * <tt>AdHocChatRoom</tt> and optionally creates it if it does not exist. * - * @param adHocChatRoom the chat room, for which the chat panel is about - * @return the chat panel corresponding to the given ad-hoc chat room + * @param adHocChatRoom the <tt>AdHocChatRoom</tt> to get the corresponding + * <tt>ChatPanel</tt> of + * @param create <tt>true</tt> to create a <tt>ChatPanel</tt> corresponding + * to the specified <tt>AdHocChatRoom</tt> if such <tt>ChatPanel</tt> does + * not exist yet + * @return the <tt>ChatPanel</tt> corresponding to the specified + * <tt>AdHocChatRoom</tt>; <tt>null</tt> if there is no such + * <tt>ChatPanel</tt> and <tt>create</tt> is <tt>false</tt> */ - public ChatPanel getAdHocMultiChat(AdHocChatRoom adHocChatRoom) + public ChatPanel getMultiChat(AdHocChatRoom adHocChatRoom, boolean create) { - return getAdHocMultiChat(adHocChatRoom, null); + return getMultiChat(adHocChatRoom, create, null); } /** - * Returns the chat panel corresponding to the given chat room. + * Gets the <tt>ChatPanel</tt> corresponding to the specified + * <tt>ChatRoom</tt> and optionally creates it if it does not exist. * - * @param chatRoom the chat room, for which the chat panel is about - * @return the chat panel corresponding to the given chat room + * @param chatRoom the <tt>ChatRoom</tt> to get the corresponding + * <tt>ChatPanel</tt> of + * @param create <tt>true</tt> to create a <tt>ChatPanel</tt> corresponding + * to the specified <tt>ChatRoom</tt> if such <tt>ChatPanel</tt> does not + * exist yet + * @return the <tt>ChatPanel</tt> corresponding to the specified + * <tt>ChatRoom</tt>; <tt>null</tt> if there is no such <tt>ChatPanel</tt> + * and <tt>create</tt> is <tt>false</tt> */ - public ChatPanel getMultiChat(ChatRoom chatRoom) + public ChatPanel getMultiChat(ChatRoom chatRoom, boolean create) { - return getMultiChat(chatRoom, null); + return getMultiChat(chatRoom, create, null); } /** - * Returns the chat panel corresponding to the given chat room. + * Gets the <tt>ChatPanel</tt> corresponding to the specified + * <tt>ChatRoom</tt> and optionally creates it if it does not exist. * - * @param chatRoom the chat room, for which the chat panel is about + * @param chatRoom the <tt>ChatRoom</tt> to get the corresponding + * <tt>ChatPanel</tt> of + * @param create <tt>true</tt> to create a <tt>ChatPanel</tt> corresponding + * to the specified <tt>ChatRoom</tt> if such <tt>ChatPanel</tt> does not + * exist yet * @param escapedMessageID the message ID of the message that should be * excluded from the history when the last one is loaded in the chat - * @return the chat panel corresponding to the given chat room + * @return the <tt>ChatPanel</tt> corresponding to the specified + * <tt>ChatRoom</tt>; <tt>null</tt> if there is no such <tt>ChatPanel</tt> + * and <tt>create</tt> is <tt>false</tt> */ - public ChatPanel getMultiChat( ChatRoom chatRoom, - String escapedMessageID) + public ChatPanel getMultiChat(ChatRoom chatRoom, + boolean create, + String escapedMessageID) { synchronized (syncChat) { - ChatRoomList chatRoomList = GuiActivator.getUIService() - .getConferenceChatManager().getChatRoomList(); + ChatRoomList chatRoomList + = GuiActivator + .getUIService() + .getConferenceChatManager().getChatRoomList(); // Search in the chat room's list for a chat room that correspond // to the given one. ChatRoomWrapper chatRoomWrapper = chatRoomList.findChatRoomWrapperFromChatRoom(chatRoom); - if (chatRoomWrapper == null) + if ((chatRoomWrapper == null) && create) { ChatRoomProviderWrapper parentProvider = chatRoomList.findServerWrapperFromProvider( @@ -614,25 +575,37 @@ public class ChatWindowManager chatRoomList.addChatRoom(chatRoomWrapper); } - ChatPanel chatPanel = findChatPanelForDescriptor(chatRoomWrapper); + ChatPanel chatPanel = null; - return - (chatPanel != null) - ? chatPanel - : createChat(chatRoomWrapper, escapedMessageID); + if (chatRoomWrapper != null) + { + chatPanel = findChatPanelForDescriptor(chatRoomWrapper); + if ((chatPanel == null) && create) + chatPanel = createChat(chatRoomWrapper, escapedMessageID); + } + + return chatPanel; } } /** - * Returns the chat panel corresponding to the given ad-hoc chat room. + * Gets the <tt>ChatPanel</tt> corresponding to the specified + * <tt>AdHocChatRoom</tt> and optionally creates it if it does not exist. * - * @param chatRoom the ad-hoc chat room, for which the chat panel is about + * @param adHocChatRoom the <tt>AdHocChatRoom</tt> to get the corresponding + * <tt>ChatPanel</tt> of + * @param create <tt>true</tt> to create a <tt>ChatPanel</tt> corresponding + * to the specified <tt>AdHocChatRoom</tt> if such <tt>ChatPanel</tt> does + * not exist yet * @param escapedMessageID the message ID of the message that should be * excluded from the history when the last one is loaded in the chat - * @return the chat panel corresponding to the given ad-hoc chat room + * @return the <tt>ChatPanel</tt> corresponding to the specified + * <tt>AdHocChatRoom</tt>; <tt>null</tt> if there is no such + * <tt>ChatPanel</tt> and <tt>create</tt> is <tt>false</tt> */ - public ChatPanel getAdHocMultiChat( AdHocChatRoom chatRoom, - String escapedMessageID) + public ChatPanel getMultiChat(AdHocChatRoom adHocChatRoom, + boolean create, + String escapedMessageID) { synchronized (syncChat) { @@ -642,26 +615,31 @@ public class ChatWindowManager // Search in the chat room's list for a chat room that correspond // to the given one. AdHocChatRoomWrapper chatRoomWrapper - = chatRoomList.findChatRoomWrapperFromAdHocChatRoom(chatRoom); + = chatRoomList + .findChatRoomWrapperFromAdHocChatRoom(adHocChatRoom); - if (chatRoomWrapper == null) + if ((chatRoomWrapper == null) && create) { AdHocChatRoomProviderWrapper parentProvider = chatRoomList.findServerWrapperFromProvider( - chatRoom.getParentProvider()); + adHocChatRoom.getParentProvider()); chatRoomWrapper = - new AdHocChatRoomWrapper(parentProvider, chatRoom); + new AdHocChatRoomWrapper(parentProvider, adHocChatRoom); chatRoomList.addAdHocChatRoom(chatRoomWrapper); } - ChatPanel chatPanel = findChatPanelForDescriptor(chatRoomWrapper); + ChatPanel chatPanel = null; - return - (chatPanel != null) - ? chatPanel - : createChat(chatRoomWrapper, escapedMessageID); + if (chatRoomWrapper != null) + { + chatPanel = findChatPanelForDescriptor(chatRoomWrapper); + if ((chatPanel == null) && create) + chatPanel = createChat(chatRoomWrapper, escapedMessageID); + } + + return chatPanel; } } @@ -759,31 +737,7 @@ public class ChatWindowManager Contact protocolContact, String escapedMessageID) { - ChatWindow chatWindow; - - if(ConfigurationManager.isMultiChatWindowEnabled()) - { - Iterator<ChatPanel> chatPanelsIter = chatPanels.iterator(); - - // If we're in a tabbed window we're looking for the chat window - // through one of the already created chats. - if(chatPanelsIter.hasNext()) - { - chatWindow = chatPanelsIter.next().getChatWindow(); - } - else - { - chatWindow = new ChatWindow(); - - GuiActivator.getUIService() - .registerExportedWindow(chatWindow); - } - } - else - { - chatWindow = new ChatWindow(); - } - + ChatWindow chatWindow = getChatWindow(); ChatPanel chatPanel = new ChatPanel(chatWindow); MetaContactChatSession chatSession @@ -805,6 +759,39 @@ public class ChatWindowManager } /** + * Gets a <tt>ChatWindow</tt> instance. If there is no existing + * <tt>ChatWindow</tt> or chats are configured to be displayed in their own + * <tt>ChatWindow</tt>s instead of arranged in tabs in a single + * <tt>ChatWindow</tt>, creates a new one. + * + * @return a <tt>ChatWindow</tt> instance + */ + private ChatWindow getChatWindow() + { + ChatWindow chatWindow; + + if (ConfigurationManager.isMultiChatWindowEnabled()) + { + Iterator<ChatPanel> chatPanelsIter = chatPanels.iterator(); + + /* + * If we're in a tabbed window we're looking for the chat window + * through one of the existing chats. + */ + if (chatPanelsIter.hasNext()) + chatWindow = chatPanelsIter.next().getChatWindow(); + else + { + chatWindow = new ChatWindow(); + GuiActivator.getUIService().registerExportedWindow(chatWindow); + } + } + else + chatWindow = new ChatWindow(); + return chatWindow; + } + + /** * Creates a <tt>ChatPanel</tt> for the given <tt>ChatRoom</tt> and saves it * in the list of created <tt>ChatPanel</tt>s. * @@ -843,31 +830,7 @@ public class ChatWindowManager private ChatPanel createChat( ChatRoomWrapper chatRoomWrapper, String escapedMessageID) { - ChatWindow chatWindow; - - if(ConfigurationManager.isMultiChatWindowEnabled()) - { - Iterator<ChatPanel> chatPanelsIter = chatPanels.iterator(); - - // If we're in a tabbed window we're looking for the chat window - // through one of the already created chats. - if(chatPanelsIter.hasNext()) - { - chatWindow = chatPanelsIter.next().getChatWindow(); - } - else - { - chatWindow = new ChatWindow(); - - GuiActivator.getUIService() - .registerExportedWindow(chatWindow); - } - } - else - { - chatWindow = new ChatWindow(); - } - + ChatWindow chatWindow = getChatWindow(); ChatPanel chatPanel = new ChatPanel(chatWindow); ConferenceChatSession chatSession @@ -900,31 +863,7 @@ public class ChatWindowManager private ChatPanel createChat( AdHocChatRoomWrapper chatRoomWrapper, String escapedMessageID) { - ChatWindow chatWindow; - - if(ConfigurationManager.isMultiChatWindowEnabled()) - { - Iterator<ChatPanel> chatPanelsIter = chatPanels.iterator(); - - // If we're in a tabbed window we're looking for the chat window - // through one of the already created chats. - if(chatPanelsIter.hasNext()) - { - chatWindow = chatPanelsIter.next().getChatWindow(); - } - else - { - chatWindow = new ChatWindow(); - - GuiActivator.getUIService() - .registerExportedWindow(chatWindow); - } - } - else - { - chatWindow = new ChatWindow(); - } - + ChatWindow chatWindow = getChatWindow(); ChatPanel chatPanel = new ChatPanel(chatWindow); AdHocConferenceChatSession chatSession diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java index b2e83b1..37ede39 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatSession.java @@ -4,7 +4,6 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.gui.main.chat; import java.util.*; @@ -33,8 +32,6 @@ public class MetaContactChatSession { private final MetaContact metaContact; - private final Contact protocolContact; - private final List<ChatContact> chatParticipants = new ArrayList<ChatContact>(); @@ -47,8 +44,9 @@ public class MetaContactChatSession private final ChatSessionRenderer sessionRenderer; - private final java.util.List<ChatSessionChangeListener> chatTransportChangeListeners = - new Vector<ChatSessionChangeListener>(); + private final java.util.List<ChatSessionChangeListener> + chatTransportChangeListeners + = new Vector<ChatSessionChangeListener>(); /** * Creates an instance of <tt>MetaContactChatSession</tt> by specifying the @@ -68,13 +66,12 @@ public class MetaContactChatSession { this.sessionRenderer = sessionRenderer; this.metaContact = metaContact; - this.protocolContact = protocolContact; ChatContact chatContact = new MetaContactChatContact(metaContact); chatParticipants.add(chatContact); - this.initChatTransports(); + this.initChatTransports(protocolContact); // Obtain the MetaContactListService and add this class to it as a // listener of all events concerning the contact list. @@ -327,8 +324,12 @@ public class MetaContactChatSession /** * Initializes all chat transports for this chat session. + * + * @param protocolContact the <tt>Contact</tt> which is to be selected into + * this instance as the current i.e. its <tt>ChatTransport</tt> is to be + * selected as <tt>currentChatTransport</tt> */ - private void initChatTransports() + private void initChatTransports(Contact protocolContact) { Iterator<Contact> protocolContacts = metaContact.getContacts(); @@ -368,10 +369,9 @@ public class MetaContactChatSession public void setCurrentChatTransport(ChatTransport chatTransport) { this.currentChatTransport = chatTransport; + for (ChatSessionChangeListener l : chatTransportChangeListeners) - { l.currentChatTransportChanged(this); - } } public void childContactsReordered(MetaContactGroupEvent evt) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomProviderWrapper.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomProviderWrapper.java index b567b8d..7ae99d5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomProviderWrapper.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomProviderWrapper.java @@ -200,8 +200,7 @@ public class ChatRoomProviderWrapper public void synchronizeProvider() { final OperationSetMultiUserChat groupChatOpSet - = (OperationSetMultiUserChat) protocolProvider - .getOperationSet(OperationSetMultiUserChat.class); + = protocolProvider.getOperationSet(OperationSetMultiUserChat.class); for(final ChatRoomWrapper chatRoomWrapper : chatRoomsOrderedCopy) { diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java index df80a67..d0b6975 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatManager.java @@ -132,42 +132,42 @@ public class ConferenceChatManager { ChatRoom sourceChatRoom = (ChatRoom) evt.getSource(); - logger.trace("MESSAGE DELIVERED to chat room: " - + sourceChatRoom.getName()); - - Message msg = evt.getMessage(); - - ChatPanel chatPanel = null; + logger.trace( + "MESSAGE DELIVERED to chat room: " + sourceChatRoom.getName()); - ChatWindowManager chatWindowManager - = GuiActivator.getUIService().getChatWindowManager(); + ChatPanel chatPanel + = GuiActivator + .getUIService() + .getChatWindowManager() + .getMultiChat(sourceChatRoom, false); - if(chatWindowManager.isChatOpenedFor(sourceChatRoom)) + if(chatPanel != null) { - chatPanel = chatWindowManager.getMultiChat(sourceChatRoom); - } + String messageType; - String messageType = null; + switch (evt.getEventType()) + { + case ChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED: + messageType = Chat.OUTGOING_MESSAGE; + break; + case ChatRoomMessageDeliveredEvent.ACTION_MESSAGE_DELIVERED: + messageType = Chat.ACTION_MESSAGE; + break; + default: + messageType = null; + break; + } - if (evt.getEventType() - == ChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED) - { - messageType = Chat.OUTGOING_MESSAGE; - } - else if (evt.getEventType() - == ChatRoomMessageDeliveredEvent.ACTION_MESSAGE_DELIVERED) - { - messageType = Chat.ACTION_MESSAGE; - } + Message msg = evt.getMessage(); - if(chatPanel != null) - { - chatPanel.addMessage(sourceChatRoom.getParentProvider() - .getAccountID().getUserID(), - evt.getTimestamp(), - messageType, - msg.getContent(), - msg.getContentType()); + chatPanel + .addMessage( + sourceChatRoom + .getParentProvider().getAccountID().getUserID(), + evt.getTimestamp(), + messageType, + msg.getContent(), + msg.getContentType()); } } @@ -179,8 +179,7 @@ public class ConferenceChatManager */ public void messageReceived(ChatRoomMessageReceivedEvent evt) { - ChatRoom sourceChatRoom = (ChatRoom) evt.getSource(); - + ChatRoom sourceChatRoom = evt.getSourceChatRoom(); ChatRoomMember sourceMember = evt.getSourceChatRoomMember(); String messageType = null; @@ -223,7 +222,7 @@ public class ConferenceChatManager else { chatPanel = chatWindowManager - .getMultiChat(sourceChatRoom, message.getMessageUID()); + .getMultiChat(sourceChatRoom, true, message.getMessageUID()); } String messageContent = message.getContent(); @@ -313,11 +312,20 @@ public class ConferenceChatManager */ public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt) { - ChatRoom sourceChatRoom = (ChatRoom) evt.getSource(); + ChatRoom sourceChatRoom = evt.getSourceChatRoom(); String errorMsg = null; - Message sourceMessage = (Message) evt.getSource(); + /* + * FIXME ChatRoomMessageDeliveryFailedEvent#getSource() is not a Message + * instance at the time of this writing and the attempt "(Message) + * evt.getSource()" seems to be to get the message which failed to be + * delivered. I'm not sure it's + * ChatRoomMessageDeliveryFailedEvent#getMessage() but since it's the + * only message I can get out of ChatRoomMessageDeliveryFailedEvent, I'm + * using it. + */ + Message sourceMessage = evt.getMessage(); ChatRoomMember destMember = evt.getDestinationChatRoomMember(); @@ -353,9 +361,8 @@ public class ConferenceChatManager ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); - ChatPanel chatPanel - = chatWindowManager.getMultiChat(sourceChatRoom); + = chatWindowManager.getMultiChat(sourceChatRoom, true); chatPanel.addMessage( destMember.getName(), @@ -400,7 +407,7 @@ public class ConferenceChatManager = GuiActivator.getUIService().getChatWindowManager(); ChatPanel chatPanel - = chatWindowManager.getAdHocMultiChat(adHocChatRoomWrapper); + = chatWindowManager.getMultiChat(adHocChatRoomWrapper); // Check if we have already opened a chat window for this chat // wrapper and load the real chat room corresponding to the @@ -482,7 +489,6 @@ public class ConferenceChatManager ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); - ChatPanel chatPanel = chatWindowManager.getMultiChat(chatRoomWrapper); @@ -498,7 +504,7 @@ public class ConferenceChatManager { chatWindowManager.openChat(chatPanel, true); } - } + } if (sourceChatRoom.isSystem()) { @@ -956,8 +962,8 @@ public class ConferenceChatManager this.joinChatRoom(chatRoomWrapper); ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); - chatWindowManager.openChat( - chatWindowManager.getAdHocMultiChat(chatRoomWrapper), true); + chatWindowManager + .openChat(chatWindowManager.getMultiChat(chatRoomWrapper), true); } /** @@ -1301,7 +1307,7 @@ public class ConferenceChatManager if(chatWindowManager.isChatOpenedFor(chatRoomWrapper)) { final ChatPanel chatPanel - = chatWindowManager.getAdHocMultiChat(chatRoomWrapper); + = chatWindowManager.getMultiChat(chatRoomWrapper); // We have to be sure that we close the chat in the swing thread SwingUtilities.invokeLater(new Runnable() @@ -1761,45 +1767,45 @@ public class ConferenceChatManager * Shows the message in the conversation area and clears the write message * area. */ - public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt) { + public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt) + { AdHocChatRoom sourceChatRoom = (AdHocChatRoom) evt.getSource(); logger.info("MESSAGE DELIVERED to ad-hoc chat room: " + sourceChatRoom.getName()); - Message msg = evt.getMessage(); - - ChatPanel chatPanel = null; + ChatPanel chatPanel + = GuiActivator + .getUIService() + .getChatWindowManager() + .getMultiChat(sourceChatRoom, false); - ChatWindowManager chatWindowManager - = GuiActivator.getUIService().getChatWindowManager(); - - if(chatWindowManager.isChatOpenedFor(sourceChatRoom)) + if(chatPanel != null) { - chatPanel = chatWindowManager.getAdHocMultiChat(sourceChatRoom); - } - - String messageType = null; + String messageType; + switch (evt.getEventType()) + { + case AdHocChatRoomMessageDeliveredEvent + .CONVERSATION_MESSAGE_DELIVERED: + messageType = Chat.OUTGOING_MESSAGE; + break; + case AdHocChatRoomMessageDeliveredEvent.ACTION_MESSAGE_DELIVERED: + messageType = Chat.ACTION_MESSAGE; + break; + default: + messageType = null; + } - if (evt.getEventType() == - AdHocChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED) - { - messageType = Chat.OUTGOING_MESSAGE; - } - else if (evt.getEventType() - == AdHocChatRoomMessageDeliveredEvent.ACTION_MESSAGE_DELIVERED) - { - messageType = Chat.ACTION_MESSAGE; - } + Message msg = evt.getMessage(); - if(chatPanel != null) - { - chatPanel.addMessage(sourceChatRoom.getParentProvider() - .getAccountID().getUserID(), - evt.getTimestamp(), - messageType, - msg.getContent(), - msg.getContentType()); + chatPanel + .addMessage( + sourceChatRoom + .getParentProvider().getAccountID().getUserID(), + evt.getTimestamp(), + messageType, + msg.getContent(), + msg.getContentType()); } else { @@ -1814,63 +1820,60 @@ public class ConferenceChatManager * In the conversation area shows an error message, explaining the problem. */ public void messageDeliveryFailed( - AdHocChatRoomMessageDeliveryFailedEvent evt) { - AdHocChatRoom sourceChatRoom = (AdHocChatRoom) evt.getSource(); - - String errorMsg = null; - - Message sourceMessage = (Message) evt.getSource(); - - Contact destParticipant = evt.getDestinationParticipant(); - - if (evt.getErrorCode() - == MessageDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED) - { - errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_DELIVERY_NOT_SUPPORTED"); - } - else if (evt.getErrorCode() - == MessageDeliveryFailedEvent.NETWORK_FAILURE) - { - errorMsg = GuiActivator.getResources() - .getI18NString("service.gui.MSG_NOT_DELIVERED"); - } - else if (evt.getErrorCode() - == MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED) - { - errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_SEND_CONNECTION_PROBLEM"); - } - else if (evt.getErrorCode() - == MessageDeliveryFailedEvent.INTERNAL_ERROR) - { - errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_DELIVERY_INTERNAL_ERROR"); - } - else - { - errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_DELIVERY_UNKNOWN_ERROR"); - } + AdHocChatRoomMessageDeliveryFailedEvent evt) + { + AdHocChatRoom sourceChatRoom = evt.getSourceChatRoom(); + Message sourceMessage = evt.getMessage(); + Contact destParticipant = evt.getDestinationParticipant(); - ChatWindowManager chatWindowManager - = GuiActivator.getUIService().getChatWindowManager(); + String errorMsg = null; + if (evt.getErrorCode() + == MessageDeliveryFailedEvent.OFFLINE_MESSAGES_NOT_SUPPORTED) + { + errorMsg = GuiActivator.getResources().getI18NString( + "service.gui.MSG_DELIVERY_NOT_SUPPORTED"); + } + else if (evt.getErrorCode() + == MessageDeliveryFailedEvent.NETWORK_FAILURE) + { + errorMsg = GuiActivator.getResources() + .getI18NString("service.gui.MSG_NOT_DELIVERED"); + } + else if (evt.getErrorCode() + == MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED) + { + errorMsg = GuiActivator.getResources().getI18NString( + "service.gui.MSG_SEND_CONNECTION_PROBLEM"); + } + else if (evt.getErrorCode() + == MessageDeliveryFailedEvent.INTERNAL_ERROR) + { + errorMsg = GuiActivator.getResources().getI18NString( + "service.gui.MSG_DELIVERY_INTERNAL_ERROR"); + } + else + { + errorMsg = GuiActivator.getResources().getI18NString( + "service.gui.MSG_DELIVERY_UNKNOWN_ERROR"); + } - ChatPanel chatPanel - = chatWindowManager.getAdHocMultiChat(sourceChatRoom); + ChatWindowManager chatWindowManager + = GuiActivator.getUIService().getChatWindowManager(); + ChatPanel chatPanel + = chatWindowManager.getMultiChat(sourceChatRoom, true); - chatPanel.addMessage( - destParticipant.getDisplayName(), - System.currentTimeMillis(), - Chat.OUTGOING_MESSAGE, - sourceMessage.getContent(), - sourceMessage.getContentType()); + chatPanel.addMessage( + destParticipant.getDisplayName(), + System.currentTimeMillis(), + Chat.OUTGOING_MESSAGE, + sourceMessage.getContent(), + sourceMessage.getContentType()); - chatPanel.addErrorMessage( - destParticipant.getDisplayName(), - errorMsg); + chatPanel.addErrorMessage( + destParticipant.getDisplayName(), + errorMsg); - chatWindowManager.openChat(chatPanel, false); + chatWindowManager.openChat(chatPanel, false); } /** @@ -1882,7 +1885,7 @@ public class ConferenceChatManager */ public void messageReceived(AdHocChatRoomMessageReceivedEvent evt) { - AdHocChatRoom sourceChatRoom = (AdHocChatRoom) evt.getSource(); + AdHocChatRoom sourceChatRoom = evt.getSourceChatRoom(); Contact sourceParticipant = evt.getSourceChatRoomParticipant(); String messageType = null; @@ -1905,13 +1908,11 @@ public class ConferenceChatManager Message message = evt.getMessage(); - ChatPanel chatPanel = null; - ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); - - chatPanel = chatWindowManager - .getAdHocMultiChat(sourceChatRoom, message.getMessageUID()); + ChatPanel chatPanel + = chatWindowManager + .getMultiChat(sourceChatRoom, true, message.getMessageUID()); String messageContent = message.getContent(); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java index 1a779b8..670abae 100755 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java @@ -284,8 +284,9 @@ public class ContactListPane ChatPanel chatPanel; if(protocolContact != null) - chatPanel = chatWindowManager - .getContactChat(metaContact, protocolContact); + chatPanel + = chatWindowManager + .getContactChat(metaContact, protocolContact); else chatPanel = chatWindowManager.getContactChat(metaContact); @@ -583,8 +584,8 @@ public class ContactListPane MetaContact metaContact = mainFrame.getContactList() .findMetaContactByContact(sourceContact); - final ChatPanel chatPanel = chatWindowManager - .getContactChat(metaContact, sourceContact); + final ChatPanel chatPanel + = chatWindowManager.getContactChat(metaContact, sourceContact); chatPanel.addIncomingFileTransferRequest( event.getFileTransferOperationSet(), request, event.getTimestamp()); @@ -596,13 +597,7 @@ public class ContactListPane chatPanel.setSelectedChatTransport(chatTransport); // Opens the chat panel with the new message in the UI thread. - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - chatWindowManager.openChat(chatPanel, false); - } - }); + chatWindowManager.openChat(chatPanel, false); // Fire notification String title = GuiActivator.getResources().getI18NString( diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java index 68e2916..6a6e6a4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTransferHandler.java @@ -41,52 +41,53 @@ public class ContactListTransferHandler * Handles transfers to the contact list from the clip board or a * DND drop operation. The <tt>Transferable</tt> parameter contains the * data that needs to be imported. - * <p> - * @param comp the component to receive the transfer; + * + * @param comp the component to receive the transfer * @param t the data to import - * @return true if the data was inserted into the component and false - * otherwise - * @see #importData(TransferHandler.TransferSupport) + * @return <tt>true</tt> if the data was inserted into the component; + * <tt>false</tt>, otherwise + * @see TransferHandler#importData(JComponent. Transferable) */ @SuppressWarnings("unchecked") //taken care of public boolean importData(JComponent comp, Transferable t) { if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { + Object o = null; + try { - Object o = t.getTransferData(DataFlavor.javaFileListFlavor); + o = t.getTransferData(DataFlavor.javaFileListFlavor); + } + catch (UnsupportedFlavorException e) + { + logger.debug("Failed to drop files.", e); + } + catch (IOException e) + { + logger.debug("Failed to drop files.", e); + } + if (o instanceof Collection) + { ChatPanel chatPanel = getChatPanel(); if (chatPanel != null) { - if (o instanceof java.util.Collection) - { - Collection<File> files = (Collection<File>) o; + Collection<File> files = (Collection<File>) o; - for(File file: files) - { - if (chatPanel != null) - chatPanel.sendFile(file); - - GuiActivator.getUIService().getChatWindowManager() - .openChat(chatPanel, false); - } + for (File file : files) + { + chatPanel.sendFile(file); - // Otherwise fire files dropped event. - return true; + GuiActivator.getUIService().getChatWindowManager() + .openChat(chatPanel, false); } + + // Otherwise fire files dropped event. + return true; } } - catch (UnsupportedFlavorException e) - { - logger.debug("Failed to drop files.", e); - } - catch (IOException e) - { - logger.debug("Failed to drop files.", e); - } } return false; } @@ -101,10 +102,9 @@ public class ContactListTransferHandler private ChatPanel getChatPanel() { ChatPanel chatPanel = null; - Object selectedObject = contactList.getSelectedValue(); - if (selectedObject != null && selectedObject instanceof MetaContact) + if (selectedObject instanceof MetaContact) { MetaContact metaContact = (MetaContact) selectedObject; diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java index a8e15f5..ebd7268 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java @@ -311,7 +311,7 @@ public class ContactRightButtonMenu this.callContactMenu.add(callContactItem); } - // TODO Why is OperationSetWebContactInfo requested and not used? + // FIXME Why is OperationSetWebContactInfo requested and not used? protocolProvider.getOperationSet(OperationSetWebContactInfo.class); } diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java index 1f66784..54f48b2 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/OperationSetPersistentPresenceFacebookImpl.java @@ -654,9 +654,8 @@ public class OperationSetPersistentPresenceFacebookImpl if (fbProvider != null)
{
OperationSetPersistentPresence opSetPresence
- = (OperationSetPersistentPresence)
- fbProvider
- .getOperationSet(OperationSetPersistentPresence.class);
+ = fbProvider
+ .getOperationSet(OperationSetPersistentPresence.class);
changePresenceStatusForContact(contact,
(FacebookStatusEnum) opSetPresence.getPresenceStatus());
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java index 280a8a9..4a19a92 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java @@ -392,9 +392,11 @@ public class OperationSetBasicInstantMessagingIcqImpl icqProvider.getAimConnection().getIcbmService() .addIcbmListener(joustSimIcbmListener); - opSetPersPresence = - (OperationSetPersistentPresenceIcqImpl) icqProvider - .getOperationSet(OperationSetPersistentPresence.class); + opSetPersPresence + = (OperationSetPersistentPresenceIcqImpl) + icqProvider + .getOperationSet( + OperationSetPersistentPresence.class); } else if (evt.getNewState() == RegistrationState.REGISTERED) { diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java index b6ba91f..412559c 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -1495,19 +1495,21 @@ public class ChatRoomJabberImpl if(!(packet instanceof org.jivesoftware.smack.packet.Message)) return; - org.jivesoftware.smack.packet.Message msg = - (org.jivesoftware.smack.packet.Message)packet; + org.jivesoftware.smack.packet.Message msg + = (org.jivesoftware.smack.packet.Message) packet; + String msgBody = msg.getBody(); - if(msg.getBody() == null) + if(msgBody == null) return; - String fromUserName = StringUtils.parseResource(msg.getFrom()); - + String msgFrom = msg.getFrom(); + String fromUserName = StringUtils.parseResource(msgFrom); + if(fromUserName.equals(nickname)) return; - - ChatRoomMember member = smackParticipantToScMember(msg.getFrom()); - + + ChatRoomMember member = smackParticipantToScMember(msgFrom); + if(logger.isDebugEnabled()) { logger.debug("Received from " @@ -1516,7 +1518,7 @@ public class ChatRoomJabberImpl + msg.toXML()); } - Message newMessage = createMessage(msg.getBody()); + Message newMessage = createMessage(msgBody); if(msg.getType() == org.jivesoftware.smack.packet.Message.Type.error) { @@ -1545,11 +1547,11 @@ public class ChatRoomJabberImpl errorResultCode, new Date(), newMessage); - + fireMessageEvent(evt); return; } - + ChatRoomMessageReceivedEvent msgReceivedEvt = new ChatRoomMessageReceivedEvent( ChatRoomJabberImpl.this, @@ -1558,7 +1560,7 @@ public class ChatRoomJabberImpl newMessage, ChatRoomMessageReceivedEvent .CONVERSATION_MESSAGE_RECEIVED); - + fireMessageEvent(msgReceivedEvt); } } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/IncomingFileTransferRequestJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/IncomingFileTransferRequestJabberImpl.java index 6ec0eb4..5b5d9b4 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/IncomingFileTransferRequestJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/IncomingFileTransferRequestJabberImpl.java @@ -75,8 +75,8 @@ public class IncomingFileTransferRequestJabberImpl OperationSetPersistentPresenceJabberImpl opSetPersPresence = (OperationSetPersistentPresenceJabberImpl) - jabberProvider.getOperationSet( - OperationSetPersistentPresence.class); + jabberProvider + .getOperationSet(OperationSetPersistentPresence.class); sender = opSetPersPresence.findContactByID(fromUserID); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index af80068..99b5879 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -42,8 +42,9 @@ public class ProtocolProviderServiceJabberImpl * The name of the property that tells us whether we are supposed to start * experimental support for Jingle. */ - private static final String PNAME_ENABLE_JINGLE = "net.java.sip" - + ".communicator.impl.protocol.jabber.ENABLE_EXPERIMENTAL_JINGLE"; + private static final String PNAME_ENABLE_JINGLE + = "net.java.sip.communicator" + + ".impl.protocol.jabber.ENABLE_EXPERIMENTAL_JINGLE"; /** * Used to connect to a XMPP server. diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java index 783caf9..a69a4b5 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/UriHandlerJabberImpl.java @@ -304,8 +304,8 @@ public class UriHandlerJabberImpl if(!uri.contains("?")) { - OperationSetPersistentPresence presenceOpSet = - (OperationSetPersistentPresence) provider + OperationSetPersistentPresence presenceOpSet + = provider .getOperationSet(OperationSetPersistentPresence.class); String contactId = uri.replaceFirst(getProtocol() + ":", ""); @@ -353,8 +353,8 @@ public class UriHandlerJabberImpl if(param.equalsIgnoreCase("join")) { - OperationSetMultiUserChat mchatOpSet = - (OperationSetMultiUserChat) provider + OperationSetMultiUserChat mchatOpSet + = provider .getOperationSet(OperationSetMultiUserChat.class); try @@ -374,9 +374,9 @@ public class UriHandlerJabberImpl && !networkFailReceived) { networkFailReceived = true; - OperationSetPresence presenceOpSet = - (OperationSetPresence) provider - .getOperationSet(OperationSetPresence.class); + OperationSetPresence presenceOpSet + = provider + .getOperationSet(OperationSetPresence.class); presenceOpSet.addProviderPresenceStatusListener( new ProviderStatusListener(uri, presenceOpSet)); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java index 2c61080..ccdd8f0 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/UriHandlerSipImpl.java @@ -296,9 +296,8 @@ public class UriHandlerSipImpl return; } - OperationSetBasicTelephony telephonyOpSet = - (OperationSetBasicTelephony) provider - .getOperationSet(OperationSetBasicTelephony.class); + OperationSetBasicTelephony telephonyOpSet + = provider.getOperationSet(OperationSetBasicTelephony.class); try { diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetBasicInstantMessagingSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetBasicInstantMessagingSSHImpl.java index fa8f15f..e510b68 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetBasicInstantMessagingSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/OperationSetBasicInstantMessagingSSHImpl.java @@ -52,8 +52,10 @@ public class OperationSetBasicInstantMessagingSSHImpl { this.parentProvider = provider; - this.opSetPersPresence = (OperationSetPersistentPresenceSSHImpl) - provider.getOperationSet(OperationSetPersistentPresence.class); + this.opSetPersPresence + = (OperationSetPersistentPresenceSSHImpl) + provider + .getOperationSet(OperationSetPersistentPresence.class); } public Message createMessage(String content, String contentType, @@ -243,9 +245,10 @@ public class OperationSetBasicInstantMessagingSSHImpl if(sshProvider != null) { OperationSetBasicInstantMessagingSSHImpl opSetIM - = (OperationSetBasicInstantMessagingSSHImpl) - sshProvider.getOperationSet( - OperationSetBasicInstantMessaging.class); + = (OperationSetBasicInstantMessagingSSHImpl) + sshProvider + .getOperationSet( + OperationSetBasicInstantMessaging.class); opSetIM.deliverMessage(message, to); } else diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHReaderDaemon.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHReaderDaemon.java index 2a4cab4..180bd12 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHReaderDaemon.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHReaderDaemon.java @@ -80,9 +80,12 @@ public class SSHReaderDaemon public SSHReaderDaemon(ContactSSH sshContact) { this.sshContact = (ContactSSHImpl)sshContact; - instantMessaging = (OperationSetBasicInstantMessagingSSHImpl) sshContact - .getProtocolProvider().getOperationSet( - OperationSetBasicInstantMessaging.class); + instantMessaging = + (OperationSetBasicInstantMessagingSSHImpl) + sshContact + .getProtocolProvider() + .getOperationSet( + OperationSetBasicInstantMessaging.class); } /** diff --git a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java index 76fa2bb..5ffe8a1 100644 --- a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java +++ b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java @@ -77,9 +77,8 @@ public class ContactInfoDetailsPanel this.contact = c;
ProtocolProviderService pps = contact.getProtocolProvider();
- contactInfoOpSet =
- (OperationSetServerStoredContactInfo) pps
- .getOperationSet(OperationSetServerStoredContactInfo.class);
+ contactInfoOpSet
+ = pps.getOperationSet(OperationSetServerStoredContactInfo.class);
this.removeAll();
@@ -486,13 +485,15 @@ public class ContactInfoDetailsPanel // If the contact's protocol supports web info, give them a button to
// get it
- if (contact.getProtocolProvider().getOperationSet(
- OperationSetWebContactInfo.class) != null)
+ OperationSetWebContactInfo webContactInfo
+ = contact
+ .getProtocolProvider()
+ .getOperationSet(OperationSetWebContactInfo.class);
+
+ if (webContactInfo != null)
{
- final String urlString = ((OperationSetWebContactInfo) contact
- .getProtocolProvider().getOperationSet(
- OperationSetWebContactInfo.class))
- .getWebContactInfo(contact).toString();
+ final String urlString
+ = webContactInfo.getWebContactInfo(contact).toString();
JLabel webInfoLabel = new JLabel("Click to see web info: ");
JEditorPane webInfoValue = new JEditorPane();
diff --git a/src/net/java/sip/communicator/plugin/otr/OtrTransformLayer.java b/src/net/java/sip/communicator/plugin/otr/OtrTransformLayer.java index 660179b..07cb4bd 100644 --- a/src/net/java/sip/communicator/plugin/otr/OtrTransformLayer.java +++ b/src/net/java/sip/communicator/plugin/otr/OtrTransformLayer.java @@ -65,9 +65,10 @@ public class OtrTransformLayer return evt; // Forge a new message based on the new contents. - OperationSetBasicInstantMessaging imOpSet = - (OperationSetBasicInstantMessaging) contact.getProtocolProvider() - .getOperationSet(OperationSetBasicInstantMessaging.class); + OperationSetBasicInstantMessaging imOpSet + = contact + .getProtocolProvider() + .getOperationSet(OperationSetBasicInstantMessaging.class); Message processedMessage = imOpSet.createMessage(processedMessageContent); @@ -99,9 +100,10 @@ public class OtrTransformLayer return evt; // Forge a new message based on the new contents. - OperationSetBasicInstantMessaging imOpSet = - (OperationSetBasicInstantMessaging) contact.getProtocolProvider() - .getOperationSet(OperationSetBasicInstantMessaging.class); + OperationSetBasicInstantMessaging imOpSet + = contact + .getProtocolProvider() + .getOperationSet(OperationSetBasicInstantMessaging.class); Message processedMessage = imOpSet.createMessage(processedMessageContent); |