diff options
author | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-10-14 23:32:26 +0200 |
---|---|---|
committer | Danny van Heumen <danny@dannyvanheumen.nl> | 2014-10-28 22:33:32 +0100 |
commit | b6c43dac746ed2425e16173bc69838a436f3094d (patch) | |
tree | be9fa7a6025530fc1a712d1619fff0c1dc8dbae0 /src/net/java/sip/communicator/service | |
parent | 06d5ccc2f34b1b2de7e7353dc62d948187fc8350 (diff) | |
download | jitsi-b6c43dac746ed2425e16173bc69838a436f3094d.zip jitsi-b6c43dac746ed2425e16173bc69838a436f3094d.tar.gz jitsi-b6c43dac746ed2425e16173bc69838a436f3094d.tar.bz2 |
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.
Diffstat (limited to 'src/net/java/sip/communicator/service')
2 files changed, 42 insertions, 27 deletions
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. |