diff options
author | Andrew Comminos <andrewcomminos@gmail.com> | 2014-01-26 11:04:11 +0400 |
---|---|---|
committer | Andrew Comminos <andrewcomminos@gmail.com> | 2014-01-26 11:04:11 +0400 |
commit | a73987c532874a9f235ec5d95216cb78fa426d0f (patch) | |
tree | e700e314006cbac44b719e5141e31b151236cc13 /src/main/java | |
parent | ef7a1c576080b02a5a5460558646eea0ebb3a9da (diff) |
Added proper permission denied message support.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/morlunk/jumble/protocol/UserHandler.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/com/morlunk/jumble/protocol/UserHandler.java b/src/main/java/com/morlunk/jumble/protocol/UserHandler.java index c8ac313..f48d608 100644 --- a/src/main/java/com/morlunk/jumble/protocol/UserHandler.java +++ b/src/main/java/com/morlunk/jumble/protocol/UserHandler.java @@ -274,10 +274,38 @@ public class UserHandler extends ProtocolHandler { @Override public void messagePermissionDenied(final Mumble.PermissionDenied msg) { + final String reason; + switch (msg.getType()) { + case ChannelName: + reason = getService().getString(R.string.deny_reason_channel_name); + break; + case TextTooLong: + reason = getService().getString(R.string.deny_reason_text_too_long); + break; + case TemporaryChannel: + reason = getService().getString(R.string.deny_reason_no_operation_temp); + break; + case MissingCertificate: + reason = getService().getString(R.string.deny_reason_no_certificate); + break; + case UserName: + reason = getService().getString(R.string.deny_reason_invalid_username); + break; + case ChannelFull: + reason = getService().getString(R.string.deny_reason_channel_full); + break; + case NestingLimit: + reason = getService().getString(R.string.deny_reason_channel_nesting); + break; + default: + if(msg.hasReason()) reason = getService().getString(R.string.deny_reason_other, msg.getReason()); + else reason = getService().getString(R.string.perm_denied); + + } getService().notifyObservers(new JumbleService.ObserverRunnable() { @Override public void run(IJumbleObserver observer) throws RemoteException { - observer.onPermissionDenied(msg.getReason()); + observer.onPermissionDenied(reason); } }); } |