From b6c43dac746ed2425e16173bc69838a436f3094d Mon Sep 17 00:00:00 2001 From: Danny van Heumen Date: Tue, 14 Oct 2014 23:32:26 +0200 Subject: Unknown commands now result in failed message delivery. To, for one, protect users from accidents and, for two, don't accidentally send "stupid messages" we do no longer send any messages starting with '/'. Instead it shows a message delivery failed message for error UNSUPPORTED_OPERATION. Reasoning is that the intended operation is either unsupported or unknown. In both cases there is no support for it, so let the user know. --- .../event/ChatRoomMessageDeliveryFailedEvent.java | 7 +++ .../protocol/event/MessageDeliveryFailedEvent.java | 62 ++++++++++++---------- 2 files changed, 42 insertions(+), 27 deletions(-) (limited to 'src/net/java/sip/communicator/service') 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 2ac7fcf..0d86d76 100644 --- a/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java +++ b/src/net/java/sip/communicator/service/protocol/event/ChatRoomMessageDeliveryFailedEvent.java @@ -66,6 +66,13 @@ public class ChatRoomMessageDeliveryFailedEvent public static final int FORBIDDEN = 6; /** + * Set when delivery fails because of dependency on an operation that is + * unsupported. For example, because it is unknown or not supported at that + * particular moment. + */ + public static final int UNSUPPORTED_OPERATION = 7; + + /** * An error code indicating the reason for the failure of this delivery. */ private int errorCode = UNKNOWN_ERROR; diff --git a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java index 85fc5e8..fc973b5 100644 --- a/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java +++ b/src/net/java/sip/communicator/service/protocol/event/MessageDeliveryFailedEvent.java @@ -25,38 +25,46 @@ public class MessageDeliveryFailedEvent private static final long serialVersionUID = 0L; /** - * The contact that this message has been sent to. - */ - private Contact to = null; + * The contact that this message has been sent to. + */ + private Contact to = null; - /** - * Set when no other error code can describe the exception that occurred. - */ - public static final int UNKNOWN_ERROR = 1; + /** + * Set when no other error code can describe the exception that occurred. + */ + public static final int UNKNOWN_ERROR = 1; - /** - * Set when delivery fails due to a failure in network communications or - * a transport error. - */ - public static final int NETWORK_FAILURE = 2; + /** + * Set when delivery fails due to a failure in network communications or + * a transport error. + */ + public static final int NETWORK_FAILURE = 2; - /** - * Set to indicate that delivery has failed because the provider was not - * registered. - */ - public static final int PROVIDER_NOT_REGISTERED = 3; + /** + * Set to indicate that delivery has failed because the provider was not + * registered. + */ + public static final int PROVIDER_NOT_REGISTERED = 3; - /** - * Set when delivery fails for implementation specific reasons. - */ - public static final int INTERNAL_ERROR = 4; + /** + * Set when delivery fails for implementation specific reasons. + */ + public static final int INTERNAL_ERROR = 4; - /** - * Set when delivery fails because we're trying to send a message to a - * contact that is currently offline and the server does not support - * offline messages. - */ - public static final int OFFLINE_MESSAGES_NOT_SUPPORTED = 5; + /** + * Set when delivery fails because we're trying to send a message to a + * contact that is currently offline and the server does not support + * offline messages. + */ + public static final int OFFLINE_MESSAGES_NOT_SUPPORTED = 5; + + /** + * Set when delivery fails because of dependency on an operation that is + * unsupported. For example, because it is unknown or not supported at that + * particular moment. (Skipped value 6 just in case, since it is used in + * ChatRoomMessageDeliveryFailedEvent.) + */ + public static final int UNSUPPORTED_OPERATION = 7; /** * An error code indicating the reason for the failure of this delivery. -- cgit v1.1