diff options
author | George Politis <gp@jitsi.org> | 2014-06-09 20:44:46 +0200 |
---|---|---|
committer | George Politis <gp@jitsi.org> | 2014-06-09 20:44:46 +0200 |
commit | 2482a0b91fe2d877dfbd6f343f2ead0cc310149c (patch) | |
tree | 99c9c8ebd25ab55ddbf3e9b83931301529b98d9d /src | |
parent | d3db0d29a166e91a096f6e8daa959107811a0b84 (diff) | |
parent | 30b92dfe536f75f4c343e1ec612565f373279e93 (diff) | |
download | jitsi-2482a0b91fe2d877dfbd6f343f2ead0cc310149c.zip jitsi-2482a0b91fe2d877dfbd6f343f2ead0cc310149c.tar.gz jitsi-2482a0b91fe2d877dfbd6f343f2ead0cc310149c.tar.bz2 |
Merge branch 'master' of https://github.com:/jitsi/jitsi
Diffstat (limited to 'src')
7 files changed, 186 insertions, 72 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java index bf325c6..a4f50c5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java @@ -64,7 +64,6 @@ public class ChatPanel ChatRoomLocalUserRoleListener, ChatRoomMemberPropertyChangeListener, FileTransferStatusListener, - KeyEventDispatcher, Skinnable { /** @@ -229,9 +228,6 @@ public class ChatPanel } this.addComponentListener(new TabSelectionComponentListener()); - - KeyboardFocusManager.getCurrentKeyboardFocusManager() - .addKeyEventDispatcher(this); } /** @@ -449,9 +445,6 @@ public class ChatPanel */ public void dispose() { - KeyboardFocusManager.getCurrentKeyboardFocusManager() - .removeKeyEventDispatcher(this); - writeMessagePanel.dispose(); chatSession.dispose(); conversationPanel.dispose(); @@ -3122,27 +3115,4 @@ public class ChatPanel chatConferencesDialog.setCreatePanelEnabled(!available); chatConferencesDialog.setEndConferenceButtonEnabled(available); } - - /** - * Dispatches key events and process those that were generated when - * conversationPanel ChatTextPane is focused and they were targeting the - * write message panel. - * @param e the <tt>KeyEvent</tt> to dispatch. - * @return <tt>true</tt> if the KeyboardFocusManager should take no - * further action with regard to the KeyEvent; <tt>false</tt> - * otherwise. - */ - public boolean dispatchKeyEvent(KeyEvent e) - { - if(e.getSource() != conversationPanel.getChatTextPane() - || writeMessagePanel.getEditorPane().isFocusOwner()) - return false; - - writeMessagePanel.getEditorPane().requestFocusInWindow(); - - KeyboardFocusManager.getCurrentKeyboardFocusManager() - .redispatchEvent(writeMessagePanel.getEditorPane(), e); - - return true; - } } diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java index f2e1725..ac0fea7 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -1288,7 +1288,8 @@ public class ChatWindow // Don't re-dispatch any events if the menu is active. Fixes the // navigation in the menu. - if (menuBar.isSelected()) + if (menuBar.getSelectedMenu() != null + && menuBar.getSelectedMenu().isPopupMenuVisible()) { return false; } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java index dab2988..4f4b0dc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java @@ -21,6 +21,7 @@ import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.customcontactactions.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.*; import org.osgi.framework.*; @@ -873,7 +874,7 @@ public class ExternalContactSource @Override public boolean isGroupCollapsed() { - return false; + return ConfigurationUtils.isContactListGroupCollapsed(getId()); } /** @@ -923,7 +924,7 @@ public class ExternalContactSource @Override public String getId() { - return null; + return getDisplayName(); } /** @@ -997,7 +998,8 @@ public class ExternalContactSource * Class for the external contact sources right button menu. It shows only * the defined custom actions. */ - private class SourceGroupRightButtonMenu extends SIPCommPopupMenu + private class SourceGroupRightButtonMenu + extends SIPCommPopupMenu { /** * Serial version UID. @@ -1006,9 +1008,8 @@ public class ExternalContactSource /** * Creates an instance of <tt>SourceContactRightButtonMenu</tt> by - * specifying the <tt>SourceUIContact</tt>, for which this menu is created. - * @param sourceUIContact the <tt>SourceUIContact</tt>, for which this menu - * is created + * specifying the <tt>SourceUIContact</tt>, for which this menu is + * created. */ public SourceGroupRightButtonMenu() { diff --git a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java index bd9d181..c6ed3cc 100644 --- a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java @@ -2956,6 +2956,9 @@ public class MessageHistoryServiceImpl HistoryID historyId = HistoryID.createFromRawID( new String[] { "messages" }); historyService.purgeLocallyStoredHistory(historyId); + + if(this.messageSourceService != null) + this.messageSourceService.eraseLocallyStoredHistory(); } /** @@ -2975,6 +2978,9 @@ public class MessageHistoryServiceImpl History history = this.getHistory(null, item); historyService.purgeLocallyStoredHistory(history.getID()); } + + if(this.messageSourceService != null) + this.messageSourceService.eraseLocallyStoredHistory(contact); } /** @@ -2988,6 +2994,9 @@ public class MessageHistoryServiceImpl { History history = this.getHistoryForMultiChat(room); historyService.purgeLocallyStoredHistory(history.getID()); + + if(this.messageSourceService != null) + this.messageSourceService.eraseLocallyStoredHistory(room); } /** diff --git a/src/net/java/sip/communicator/impl/msghistory/MessageSourceService.java b/src/net/java/sip/communicator/impl/msghistory/MessageSourceService.java index cef4618..8e0cb70 100644 --- a/src/net/java/sip/communicator/impl/msghistory/MessageSourceService.java +++ b/src/net/java/sip/communicator/impl/msghistory/MessageSourceService.java @@ -12,6 +12,7 @@ import java.text.*; import java.util.*; import java.util.regex.*; +import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.history.*; import net.java.sip.communicator.service.history.records.*; @@ -1212,6 +1213,100 @@ public class MessageSourceService } /** + * Permanently removes all locally stored message history, + * remove recent contacts. + */ + public void eraseLocallyStoredHistory() + throws IOException + { + synchronized(recentMessages) + { + List<MessageSourceContact> toRemove + = new ArrayList<MessageSourceContact>(recentMessages); + + recentMessages.clear(); + + if(recentQuery != null) + { + for(MessageSourceContact msc : toRemove) + { + recentQuery.fireContactRemoved(msc); + } + } + } + } + + /** + * Permanently removes locally stored message history for the metacontact, + * remove any recent contacts if any. + */ + public void eraseLocallyStoredHistory(MetaContact contact) + throws IOException + { + synchronized(recentMessages) + { + List<MessageSourceContact> toRemove + = new ArrayList<MessageSourceContact>(); + Iterator<Contact> iter = contact.getContacts(); + while(iter.hasNext()) + { + Contact item = iter.next(); + String id = item.getAddress(); + ProtocolProviderService provider = item.getProtocolProvider(); + + for(MessageSourceContact msc : recentMessages) + { + if(msc.getProtocolProviderService().equals(provider) + && msc.getContactAddress().equals(id)) + { + toRemove.add(msc); + } + } + } + + recentMessages.removeAll(toRemove); + + if(recentQuery != null) + { + for(MessageSourceContact msc : toRemove) + { + recentQuery.fireContactRemoved(msc); + } + } + } + + } + + /** + * Permanently removes locally stored message history for the chatroom, + * remove any recent contacts if any. + */ + public void eraseLocallyStoredHistory(ChatRoom room) + { + synchronized(recentMessages) + { + MessageSourceContact toRemove = null; + for(MessageSourceContact msg : recentMessages) + { + if(msg.getRoom() != null + && msg.getRoom().equals(room)) + { + toRemove = msg; + break; + } + } + + if(toRemove == null) + return; + + recentMessages.remove(toRemove); + + if(recentQuery != null) + recentQuery.fireContactRemoved(toRemove); + } + } + + /** * The contact query implementation. */ private class MessageHistoryContactQuery diff --git a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java index aa4e5ab..e69d9cf 100644 --- a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java +++ b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java @@ -23,6 +23,7 @@ import org.jitsi.util.*; import org.osgi.framework.*; /** + * * @author George Politis * @author Pawel Domas */ @@ -165,7 +166,7 @@ public class OtrActivator private static Map<Object, ProtocolProviderFactory> getProtocolProviderFactories() { - ServiceReference[] serRefs = null; + ServiceReference[] serRefs; try { // get all registered provider factories @@ -235,6 +236,7 @@ public class OtrActivator /* * Implements ServiceListener#serviceChanged(ServiceEvent). */ + @Override public void serviceChanged(ServiceEvent serviceEvent) { Object sService = @@ -266,7 +268,6 @@ public class OtrActivator { this.handleProviderRemoved((ProtocolProviderService) sService); } - } /** @@ -379,19 +380,22 @@ public class OtrActivator OtrActionHandler.class.getName(), new SwingOtrActionHandler(), null); - containerFilter.put(Container.CONTAINER_ID, - Container.CONTAINER_CHAT_WRITE_PANEL.getID()); - bundleContext.registerService( - PluginComponentFactory.class.getName(), - new PluginComponentFactory( Container.CONTAINER_CHAT_WRITE_PANEL) - { - protected PluginComponent getPluginInstance() + containerFilter.put(Container.CONTAINER_ID, + Container.CONTAINER_CHAT_WRITE_PANEL.getID()); + bundleContext.registerService( + PluginComponentFactory.class.getName(), + new PluginComponentFactory(Container.CONTAINER_CHAT_WRITE_PANEL) { - return new OTRv3OutgoingSessionSwitcher( - getContainer(), this); - } - }, - containerFilter); + @Override + protected PluginComponent getPluginInstance() + { + return + new OTRv3OutgoingSessionSwitcher( + getContainer(), + this); + } + }, + containerFilter); } // If the general configuration form is disabled don't register it. @@ -405,19 +409,20 @@ public class OtrActivator ConfigurationForm.SECURITY_TYPE); // Register the configuration form. bundleContext.registerService(ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.otr.authdialog." + - "OtrConfigurationPanel", - getClass().getClassLoader(), - "plugin.otr.configform.ICON", - "service.gui.CHAT", 1), - properties); + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.otr.authdialog." + + "OtrConfigurationPanel", + getClass().getClassLoader(), + "plugin.otr.configform.ICON", + "service.gui.CHAT", 1), + properties); } } /* * Implements BundleActivator#stop(BundleContext). */ + @Override public void stop(BundleContext bc) throws Exception { // Unregister transformation layer. @@ -426,7 +431,7 @@ public class OtrActivator bundleContext.removeServiceListener(scOtrEngine); bundleContext.removeServiceListener(otrContactManager); - ServiceReference[] protocolProviderRefs = null; + ServiceReference[] protocolProviderRefs; try { protocolProviderRefs = @@ -481,16 +486,20 @@ public class OtrActivator public static MessageHistoryService getMessageHistoryService() { if (messageHistoryService == null) - messageHistoryService = ServiceUtils.getService(bundleContext, - MessageHistoryService.class); + { + messageHistoryService + = ServiceUtils.getService( + bundleContext, + MessageHistoryService.class); + } return messageHistoryService; } /** - * The factory that will be registered in OSGi and will create - * otr menu instances. + * The factory that will be registered in OSGi and will create OTR menu + * instances. */ - private class OtrPluginComponentFactory + private static class OtrPluginComponentFactory extends PluginComponentFactory { OtrPluginComponentFactory(Container c) diff --git a/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java b/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java index 171fc78..a06b61d 100644 --- a/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java +++ b/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java @@ -36,9 +36,10 @@ public class ScOtrEngineImpl ChatLinkClickedListener,
ServiceListener
{
- class ScOtrEngineHost
+ private class ScOtrEngineHost
implements OtrEngineHost
{
+ @Override
public KeyPair getLocalKeyPair(SessionID sessionID)
{
AccountID accountID =
@@ -51,11 +52,13 @@ public class ScOtrEngineImpl return OtrActivator.scOtrKeyManager.loadKeyPair(accountID);
}
+ @Override
public OtrPolicy getSessionPolicy(SessionID sessionID)
{
return getContactPolicy(getOtrContact(sessionID).contact);
}
+ @Override
public void injectMessage(SessionID sessionID, String messageText)
{
OtrContact otrContact = getOtrContact(sessionID);
@@ -109,6 +112,7 @@ public class ScOtrEngineImpl imOpSet.sendInstantMessage(contact, resource, message);
}
+ @Override
public void showError(SessionID sessionID, String err)
{
ScOtrEngineImpl.this.showError(sessionID, err);
@@ -504,7 +508,7 @@ public class ScOtrEngineImpl */
private final Logger logger = Logger.getLogger(ScOtrEngineImpl.class);
- final OtrEngineHost otrEngineHost = new ScOtrEngineHost();
+ private final OtrEngineHost otrEngineHost = new ScOtrEngineHost();
private final OtrEngine otrEngine;
@@ -519,6 +523,7 @@ public class ScOtrEngineImpl this.otrEngine.addOtrEngineListener(new OtrEngineListener()
{
+ @Override
public void sessionStatusChanged(SessionID sessionID)
{
OtrContact otrContact = getOtrContact(sessionID);
@@ -696,6 +701,7 @@ public class ScOtrEngineImpl l.sessionStatusChanged(otrContact);
}
+ @Override
public void multipleInstancesDetected(SessionID sessionID)
{
OtrContact otrContact = getOtrContact(sessionID);
@@ -706,6 +712,7 @@ public class ScOtrEngineImpl l.multipleInstancesDetected(otrContact);
}
+ @Override
public void outgoingSessionChanged(SessionID sessionID)
{
OtrContact otrContact = getOtrContact(sessionID);
@@ -736,6 +743,7 @@ public class ScOtrEngineImpl return true;
}
+ @Override
public void addListener(ScOtrEngineListener l)
{
synchronized (listeners)
@@ -745,6 +753,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public void chatLinkClicked(URI url)
{
String action = url.getPath();
@@ -773,6 +782,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public void endSession(OtrContact otrContact)
{
SessionID sessionID = getSessionID(otrContact);
@@ -788,6 +798,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public OtrPolicy getContactPolicy(Contact contact)
{
ProtocolProviderService pps = contact.getProtocolProvider();
@@ -805,6 +816,7 @@ public class ScOtrEngineImpl return new OtrPolicyImpl(policy);
}
+ @Override
public OtrPolicy getGlobalPolicy()
{
/*
@@ -851,13 +863,15 @@ public class ScOtrEngineImpl {
cancel(otrContact);
- TimerTask task = new TimerTask() {
- @Override
- public void run()
+ TimerTask task
+ = new TimerTask()
{
- setSessionStatus(otrContact, status);
- }
- };
+ @Override
+ public void run()
+ {
+ setSessionStatus(otrContact, status);
+ }
+ };
timer.schedule(task, SESSION_TIMEOUT);
tasks.put(otrContact, task);
}
@@ -908,6 +922,7 @@ public class ScOtrEngineImpl l.sessionStatusChanged(contact);
}
+ @Override
public ScSessionStatus getSessionStatus(OtrContact contact)
{
SessionID sessionID = getSessionID(contact);
@@ -932,11 +947,13 @@ public class ScOtrEngineImpl return scSessionStatusMap.get(sessionID);
}
+ @Override
public boolean isMessageUIDInjected(String mUID)
{
return injectedMessageUIDs.contains(mUID);
}
+ @Override
public void launchHelp()
{
ServiceReference ref =
@@ -953,6 +970,7 @@ public class ScOtrEngineImpl .getI18NString("plugin.otr.authbuddydialog.HELP_URI"));
}
+ @Override
public void refreshSession(OtrContact otrContact)
{
SessionID sessionID = getSessionID(otrContact);
@@ -967,6 +985,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public void removeListener(ScOtrEngineListener l)
{
synchronized (listeners)
@@ -979,6 +998,7 @@ public class ScOtrEngineImpl * Cleans the contactsMap when <tt>ProtocolProviderService</tt>
* gets unregistered.
*/
+ @Override
public void serviceChanged(ServiceEvent ev)
{
Object service
@@ -1029,6 +1049,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public void setContactPolicy(Contact contact, OtrPolicy policy)
{
ProtocolProviderService pps = contact.getProtocolProvider();
@@ -1048,6 +1069,7 @@ public class ScOtrEngineImpl l.contactPolicyChanged(contact);
}
+ @Override
public void setGlobalPolicy(OtrPolicy policy)
{
if (policy == null)
@@ -1072,6 +1094,7 @@ public class ScOtrEngineImpl OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE);
}
+ @Override
public void startSession(OtrContact otrContact)
{
SessionID sessionID = getSessionID(otrContact);
@@ -1098,6 +1121,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public String transformReceiving(OtrContact otrContact, String msgText)
{
SessionID sessionID = getSessionID(otrContact);
@@ -1113,6 +1137,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public String transformSending(OtrContact otrContact, String msgText)
{
SessionID sessionID = getSessionID(otrContact);
@@ -1215,6 +1240,7 @@ public class ScOtrEngineImpl }
}
+ @Override
public PublicKey getRemotePublicKey(OtrContact otrContact)
{
if (otrContact == null)
@@ -1225,6 +1251,7 @@ public class ScOtrEngineImpl return session.getRemotePublicKey();
}
+ @Override
public List<Session> getSessionInstances(OtrContact otrContact)
{
if (otrContact == null)
@@ -1233,6 +1260,7 @@ public class ScOtrEngineImpl return getSession(otrContact).getInstances();
}
+ @Override
public boolean setOutgoingSession(OtrContact contact, InstanceTag tag)
{
if (contact == null)
@@ -1244,6 +1272,7 @@ public class ScOtrEngineImpl return session.setOutgoingInstance(tag);
}
+ @Override
public Session getOutgoingSession(OtrContact contact)
{
if (contact == null)
|