diff options
author | Yana Stamcheva <yana@jitsi.org> | 2010-09-02 13:30:05 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2010-09-02 13:30:05 +0000 |
commit | ee6ed1fc66f652700394ca09f2d7b06a30c70a30 (patch) | |
tree | 2b17184fe90f98578f6fdaa107693eee59318cc0 /src/net/java/sip/communicator | |
parent | 0091a6a444c72786db5d7cfa3b4de0467df49b20 (diff) | |
download | jitsi-ee6ed1fc66f652700394ca09f2d7b06a30c70a30.zip jitsi-ee6ed1fc66f652700394ca09f2d7b06a30c70a30.tar.gz jitsi-ee6ed1fc66f652700394ca09f2d7b06a30c70a30.tar.bz2 |
Show protocol specific error messages in the chat window.
Diffstat (limited to 'src/net/java/sip/communicator')
5 files changed, 59 insertions, 11 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 18c5e20..60d5e56 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 @@ -1242,10 +1242,17 @@ public class ChatPanel messageText, mimeType); + String protocolError = ""; + if (ex.getMessage() != null) + protocolError = " " + GuiActivator.getResources().getI18NString( + "service.gui.ERROR_WAS", + new String[]{ex.getMessage()}); + this.addErrorMessage( chatSession.getCurrentChatTransport().getName(), GuiActivator.getResources().getI18NString( - "service.gui.MSG_SEND_CONNECTION_PROBLEM")); + "service.gui.MSG_SEND_CONNECTION_PROBLEM") + + protocolError); } catch (Exception ex) { @@ -1260,11 +1267,17 @@ public class ChatPanel messageText, mimeType); + String protocolError = ""; + if (ex.getMessage() != null) + protocolError = " " + GuiActivator.getResources().getI18NString( + "service.gui.ERROR_WAS", + new String[]{ex.getMessage()}); + this.addErrorMessage( chatSession.getCurrentChatTransport().getName(), GuiActivator.getResources().getI18NString( "service.gui.MSG_DELIVERY_ERROR", - new String[]{ex.getMessage()})); + new String[]{protocolError})); } if (chatSession.getCurrentChatTransport().allowsTypingNotifications()) @@ -1404,6 +1417,12 @@ public class ChatPanel "service.gui.MSG_DELIVERY_UNKNOWN_ERROR"); } + String reason = evt.getReason(); + if (reason != null) + errorMsg += " " + GuiActivator.getResources().getI18NString( + "service.gui.ERROR_WAS", + new String[]{reason}); + addMessage( metaContact.getDisplayName(), System.currentTimeMillis(), 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 dc486b5..87a6a5c 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 @@ -378,6 +378,12 @@ public class ConferenceChatManager "service.gui.MSG_DELIVERY_UNKNOWN_ERROR"); } + String reason = evt.getReason(); + if (reason != null) + errorMsg += " " + GuiActivator.getResources().getI18NString( + "service.gui.ERROR_WAS", + new String[]{reason}); + ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); ChatPanel chatPanel 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 c02e3d7..3cf95d1 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java @@ -382,8 +382,7 @@ public class ContactListPane == MessageDeliveryFailedEvent.NETWORK_FAILURE) { errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_NOT_DELIVERED", - new String[]{evt.getReason()}); + "service.gui.MSG_NOT_DELIVERED"); } else if (evt.getErrorCode() == MessageDeliveryFailedEvent.PROVIDER_NOT_REGISTERED) @@ -395,16 +394,20 @@ public class ContactListPane == MessageDeliveryFailedEvent.INTERNAL_ERROR) { errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_DELIVERY_INTERNAL_ERROR", - new String[]{evt.getReason()}); + "service.gui.MSG_DELIVERY_INTERNAL_ERROR"); } else { errorMsg = GuiActivator.getResources().getI18NString( - "service.gui.MSG_DELIVERY_ERROR", - new String[]{evt.getReason()}); + "service.gui.MSG_DELIVERY_ERROR"); } + String reason = evt.getReason(); + if (reason != null) + errorMsg += " " + GuiActivator.getResources().getI18NString( + "service.gui.ERROR_WAS", + new String[]{reason}); + ChatPanel chatPanel = chatWindowManager.getContactChat(metaContact, sourceContact); 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 9215e6c..280fffb 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ChatRoomJabberImpl.java @@ -1587,9 +1587,11 @@ public class ChatRoomJabberImpl if (logger.isInfoEnabled()) logger.info("Message error received from " + fromUserName); - int errorCode = packet.getError().getCode(); + XMPPError error = packet.getError(); + int errorCode = error.getCode(); int errorResultCode = ChatRoomMessageDeliveryFailedEvent.UNKNOWN_ERROR; + String errorReason = error.getMessage(); if(errorCode == 503) { @@ -1608,6 +1610,7 @@ public class ChatRoomJabberImpl ChatRoomJabberImpl.this, member, errorResultCode, + errorReason, new Date(), newMessage); diff --git a/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java b/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java index e593639..f3243fe 100644 --- a/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java +++ b/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.service.protocol.*; * instant message. * * @author Emil Ivov + * @author Yana Stamcheva */ public class ChatRoomMessageDeliveryFailedEvent extends EventObject @@ -59,6 +60,11 @@ public class ChatRoomMessageDeliveryFailedEvent private int errorCode = UNKNOWN_ERROR; /** + * The reason of the delivery failure + */ + private final String reason; + + /** * A timestamp indicating the exact date when the event occurred. */ private Date timestamp = null; @@ -76,6 +82,7 @@ public class ChatRoomMessageDeliveryFailedEvent * @param source the <tt>ChatRoom</tt> in which the message was sent * @param to the <tt>ChatRoomMember</tt> that this message was sent to. * @param errorCode an errorCode indicating the reason of the failure. + * @param reason the reason of the failure * @param timestamp the exacte Date when it was determined that delivery * had failed. * @param message the received <tt>Message</tt>. @@ -83,6 +90,7 @@ public class ChatRoomMessageDeliveryFailedEvent public ChatRoomMessageDeliveryFailedEvent(ChatRoom source, ChatRoomMember to, int errorCode, + String reason, Date timestamp, Message message) { @@ -92,14 +100,15 @@ public class ChatRoomMessageDeliveryFailedEvent this.errorCode = errorCode; this.timestamp = timestamp; this.message = message; + this.reason = reason; } /** * Returns a reference to the <tt>ChatRoomMember</tt> that the source * (failed) <tt>Message</tt> was sent to. * - * @return a reference to the <tt>ChatRoomMember</tt> that the source failed - * <tt>Message</tt> was sent to. + * @return a reference to the <tt>ChatRoomMember</tt> that the source + * failed <tt>Message</tt> was sent to. */ public ChatRoomMember getDestinationChatRoomMember() { @@ -126,6 +135,14 @@ public class ChatRoomMessageDeliveryFailedEvent return errorCode; } + /** + * Returns the reason of the delivery failure. + * @return the reason of the delivery failure + */ + public String getReason() + { + return reason; + } /** * A timestamp indicating the exact date when the event ocurred (in this |