Fix issue #550. Patch by Sebastian Heib.

cusax-fix
Damian Minkov 17 years ago
parent 87ef625c4f
commit d8eb578f4a

@ -195,6 +195,7 @@ service.gui.MSG_DELIVERY_NOT_SUPPORTED=The protocol you are using doesn't suppor
service.gui.MSG_DELIVERY_INTERNAL_ERROR=An internal error occured. This is most probably a bug. Please report it here: http://www.sip-communicator.org/index.php/Development/BugsAndIssues. Server returned error: {0}
service.gui.MSG_DELIVERY_UNKNOWN_ERROR=Your message could not be delivered due to the following problem: {0}.
service.gui.MSG_NOT_DELIVERED=A network problem occured. Please check your network configuration and try again. Server returned error: {0}.
service.gui.MSG_NOT_POSSIBLE=Messaging is not possible for this contact (it is not supported by the protocol)
service.gui.MSG_RECEIVED={0} has sent you a message
service.gui.MSG_SEND_CONNECTION_PROBLEM=You should be connected to be able to send messages.
service.gui.MULTIPLE_LOGINS=You have logged in more than once with the same account. The following account: User name: {0}, Server name: {1} is currently disconnected.

@ -161,6 +161,7 @@ service.gui.MSG_DELIVERY_NOT_SUPPORTED=Das verwendetet Protokoll kann Nachrichte
service.gui.MSG_DELIVERY_INTERNAL_ERROR=Ein interner Fehler ist aufgetreten. Dies ist wahrscheinlich ein Bug. Bitte melden Sie ihn unter http://www.sip-communicator.org/index.php/Development/BugsAndIssues
service.gui.MSG_DELIVERY_UNKNOWN_ERROR=Ihre Nachricht konnte nicht zugestellt werden:
service.gui.MSG_NOT_DELIVERED=Ein Netzwerkproblem ist aufgetreten.
service.gui.MSG_NOT_POSSIBLE=Nachrichtenversand ist für diesen Kontakt nicht möglich (dies wird vom verwendeten Protokoll nicht unterstützt).
service.gui.MSG_RECEIVED={0} hat Ihnen eine Nachricht gesendet.
service.gui.MSG_SEND_CONNECTION_PROBLEM=Sie sollen verbunden sein, um Nachrichten zu senden.
service.gui.MULTIPLE_LOGINS=Sie sind mehrfach mit dem selben Konto verbunden. Das Konto User name: {0}, Server name: {1} ist derzeit nicht verbunden.

@ -155,6 +155,15 @@ public void setChatSession(ChatSession chatSession)
initChatTransportSelectorBox();
if (!transportSelectorBox.getMenu().isEnabled())
{
// Show a message to the user that IM is not possible.
getChatConversationPanel().appendMessageToEnd("<h5>" +
GuiActivator.getResources().
getI18NString("service.gui.MSG_NOT_POSSIBLE") +
"</h5>");
}
//Enables to change the protocol provider by simply pressing the
// CTRL-P key combination
ActionMap amap = this.getActionMap();
@ -947,10 +956,22 @@ private void initChatTransportSelectorBox()
sendPanel.add(transportSelectorBox, 0);
sendPanel.add(sendViaLabel, 0);
updateSendButtonStatus();
this.revalidate();
this.repaint();
}
/**
* Sets the send button to the same state (enabled/ disabled) as the
* transportSelectorBox.
*/
private void updateSendButtonStatus()
{
getChatSendPanel().getSendButton().
setEnabled(transportSelectorBox.getMenu().isEnabled());
}
/**
* Removes the send via selector box and label.
*/
@ -1200,11 +1221,13 @@ public void setContactName(ChatContact chatContact, String name)
public void addChatTransport(ChatTransport chatTransport)
{
transportSelectorBox.addChatTransport(chatTransport);
updateSendButtonStatus();
}
public void removeChatTransport(ChatTransport chatTransport)
{
transportSelectorBox.removeChatTransport(chatTransport);
updateSendButtonStatus();
}
public void setSelectedChatTransport(ChatTransport chatTransport)

@ -53,6 +53,10 @@ public ChatTransportSelectorBox(ChatPanel chatPanel,
this.add(menu);
// as a default disable the menu, it will be enabled as soon as we add
// a valid menu item
this.menu.setEnabled(false);
Iterator chatTransports = chatSession.getChatTransports();
while (chatTransports.hasNext())
{
@ -61,26 +65,45 @@ public ChatTransportSelectorBox(ChatPanel chatPanel,
this.addChatTransport(chatTransport);
}
this.setSelected(selectedChatTransport);
if (this.menu.getItemCount() > 0 &&
selectedChatTransport.allowsInstantMessage())
{
this.setSelected(selectedChatTransport);
}
}
/*
* Sets the menu to enabled or disabled. The menu is enabled, as soon as it
* contains one or more items. If it is empty, it is disabled.
*/
private void updateEnableStatus()
{
this.menu.setEnabled(this.menu.getItemCount() > 0);
}
/**
* Adds the given chat transport to the "send via" menu.
* Only add those that support IM.
*
* @param chatTransport The chat transport to add.
*/
public void addChatTransport(ChatTransport chatTransport)
{
Image img = createTransportStatusImage(chatTransport);
if (chatTransport.allowsInstantMessage())
{
Image img = createTransportStatusImage(chatTransport);
JMenuItem menuItem = new JMenuItem(
chatTransport.getName(),
new ImageIcon(img));
JMenuItem menuItem = new JMenuItem(
chatTransport.getName(),
new ImageIcon(img));
menuItem.addActionListener(this);
this.transportMenuItems.put(chatTransport, menuItem);
menuItem.addActionListener(this);
this.transportMenuItems.put(chatTransport, menuItem);
this.menu.add(menuItem);
this.menu.add(menuItem);
updateEnableStatus();
}
}
/**
@ -94,6 +117,8 @@ public void removeChatTransport(ChatTransport chatTransport)
{
this.menu.remove(transportMenuItems.get(chatTransport));
this.transportMenuItems.remove(chatTransport);
updateEnableStatus();
}
/**

@ -459,19 +459,22 @@ protected void initialize(String sipAddress,
OperationSetPresence.class.getName()
, opSetPersPresence);
// init instant messaging
OperationSetBasicInstantMessagingSipImpl opSetBasicIM =
new OperationSetBasicInstantMessagingSipImpl(this);
this.supportedOperationSets.put(
OperationSetBasicInstantMessaging.class.getName(),
opSetBasicIM);
// init typing notifications
OperationSetTypingNotificationsSipImpl opSetTyping =
new OperationSetTypingNotificationsSipImpl(this, opSetBasicIM);
this.supportedOperationSets.put(
OperationSetTypingNotifications.class.getName(),
opSetTyping);
if (enablePresence)
{
// init instant messaging
OperationSetBasicInstantMessagingSipImpl opSetBasicIM =
new OperationSetBasicInstantMessagingSipImpl(this);
this.supportedOperationSets.put(
OperationSetBasicInstantMessaging.class.getName(),
opSetBasicIM);
// init typing notifications
OperationSetTypingNotificationsSipImpl opSetTyping =
new OperationSetTypingNotificationsSipImpl(this, opSetBasicIM);
this.supportedOperationSets.put(
OperationSetTypingNotifications.class.getName(),
opSetTyping);
}
// OperationSetVideoTelephony
supportedOperationSets.put(

Loading…
Cancel
Save