aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java2
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java64
-rw-r--r--src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java3
-rw-r--r--src/net/java/sip/communicator/plugin/otr/authdialog/OTRv3OutgoingSessionSwitcher.java3
4 files changed, 66 insertions, 6 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 3d08edf..c1edfe0 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
@@ -705,6 +705,7 @@ public class ChatPanel
{
setChatIcon(new ImageIcon(Constants.getStatusIcon(
this.chatSession.getCurrentChatTransport().getStatus())));
+ this.writeMessagePanel.currentChatTransportChanged(chatSession);
}
/**
@@ -718,6 +719,7 @@ public class ChatPanel
setChatIcon(new ImageIcon(Constants.getStatusIcon(
this.chatSession.getCurrentChatTransport().getStatus())));
}
+ this.writeMessagePanel.currentChatTransportUpdated(eventID);
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
index 0fe3a88..83edf4a 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
@@ -55,7 +55,8 @@ public class ChatWritePanel
UndoableEditListener,
DocumentListener,
PluginComponentListener,
- Skinnable
+ Skinnable,
+ ChatSessionChangeListener
{
/**
* The <tt>Logger</tt> used by the <tt>ChatWritePanel</tt> class and its
@@ -124,6 +125,12 @@ public class ChatWritePanel
private boolean isOutdatedResource = true;
/**
+ * List of plugin components that are registered for updates.
+ */
+ private List<PluginComponent> pluginComponents = Collections
+ .synchronizedList(new ArrayList<PluginComponent>());
+
+ /**
* Creates an instance of <tt>ChatWritePanel</tt>.
*
* @param panel The parent <tt>ChatPanel</tt>.
@@ -1621,6 +1628,7 @@ public class ChatWritePanel
= GuiActivator.bundleContext.getService(serRef);
PluginComponent component
= factory.getPluginComponentInstance(this);
+ this.pluginComponents.add(component);
ChatSession chatSession = chatPanel.getChatSession();
@@ -1677,6 +1685,7 @@ public class ChatWritePanel
return;
PluginComponent component = factory.getPluginComponentInstance(this);
+ this.pluginComponents.add(component);
ChatSession chatSession = chatPanel.getChatSession();
if (chatSession != null)
@@ -1724,8 +1733,61 @@ public class ChatWritePanel
Component c =
(Component)factory.getPluginComponentInstance(this)
.getComponent();
+ this.pluginComponents.remove(c);
this.centerPanel.remove(c);
this.centerPanel.repaint();
}
+
+ @Override
+ public void currentChatTransportChanged(ChatSession chatSession)
+ {
+ List<PluginComponent> components;
+ synchronized (this.pluginComponents)
+ {
+ components = new ArrayList<PluginComponent>(this.pluginComponents);
+ }
+ final Contact contact;
+ if (chatSession.getDescriptor() instanceof MetaContact)
+ {
+ MetaContact meta = (MetaContact) chatSession.getDescriptor();
+ if (meta == null)
+ {
+ // In case of null MetaContact, just call setCurrentContact for
+ // null MetaContact and get out. Nothing else to do here.
+ for (PluginComponent c : components)
+ {
+ c.setCurrentContact((MetaContact) null);
+ }
+ return;
+ }
+ contact = meta.getDefaultContact();
+ }
+ else
+ {
+ contact = (Contact) chatSession.getDescriptor();
+ }
+ final String resourceName =
+ chatSession.getCurrentChatTransport().getResourceName();
+ for (PluginComponent c : components)
+ {
+ try
+ {
+ c.setCurrentContact(contact, resourceName);
+ }
+ catch (RuntimeException e)
+ {
+ logger.error(
+ "BUG: setCurrentContact of PluginComponent instance: "
+ + c.getClass().getCanonicalName()
+ + " throws a RuntimeException.", e);
+ }
+ }
+ }
+
+ @Override
+ public void currentChatTransportUpdated(int eventID)
+ {
+ // Nothing to do here, since we do not need to communicate update events
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java b/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java
index 88668e3..eab7c37 100644
--- a/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java
+++ b/src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java
@@ -1304,8 +1304,7 @@ public class ScOtrEngineImpl
public List<Session> getSessionInstances(OtrContact otrContact)
{
if (otrContact == null)
- return null;
-
+ return Collections.emptyList();
return getSession(otrContact).getInstances();
}
diff --git a/src/net/java/sip/communicator/plugin/otr/authdialog/OTRv3OutgoingSessionSwitcher.java b/src/net/java/sip/communicator/plugin/otr/authdialog/OTRv3OutgoingSessionSwitcher.java
index 528cbf7..ad3f37c 100644
--- a/src/net/java/sip/communicator/plugin/otr/authdialog/OTRv3OutgoingSessionSwitcher.java
+++ b/src/net/java/sip/communicator/plugin/otr/authdialog/OTRv3OutgoingSessionSwitcher.java
@@ -244,9 +244,6 @@ public class OTRv3OutgoingSessionSwitcher
*/
public void setCurrentContact(Contact contact, String resourceName)
{
- if (this.contact != null && this.contact.contact == contact)
- return;
-
if (resourceName == null)
{
this.contact =