diff options
author | hristoterezov <hristo@jitsi.org> | 2014-02-13 12:24:06 +0200 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2014-02-13 12:24:06 +0200 |
commit | 9ec8bbdef5292aace4a9fb4a11a674aa066ca1cf (patch) | |
tree | 3dcf79afabddb313a1f4fb35cf88419ebb321945 | |
parent | 73487644d4174b601741d2ed985edd1572c844eb (diff) | |
download | jitsi-9ec8bbdef5292aace4a9fb4a11a674aa066ca1cf.zip jitsi-9ec8bbdef5292aace4a9fb4a11a674aa066ca1cf.tar.gz jitsi-9ec8bbdef5292aace4a9fb4a11a674aa066ca1cf.tar.bz2 |
Adds configuration property to hide remove chat room right hand menu item if the property is true and the user is owner of the room.
-rw-r--r-- | src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java b/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java index c144072..154a3d5 100644 --- a/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java +++ b/src/net/java/sip/communicator/impl/muc/MUCCustomContactActionService.java @@ -38,6 +38,12 @@ public class MUCCustomContactActionService = new LinkedList<ContactAction<SourceContact>>();
/**
+ *
+ */
+ private static final String OWNER_CANT_REMOVE_CHATROOM_PROPERTY
+ = "net.sip.communicator.impl.muc.OWNER_CANT_REMOVE_CHATROOM";
+
+ /**
* Array of names for the custom actions.
*/
private String[] actionsNames = {
@@ -651,27 +657,45 @@ public class MUCCustomContactActionService if(!(actionSource instanceof ChatRoomSourceContact))
return false;
+ ChatRoomSourceContact contact
+ = (ChatRoomSourceContact) actionSource;
+ ChatRoomWrapper room = MUCActivator.getMUCService()
+ .findChatRoomWrapperFromSourceContact(contact);
if(name.equals("autojoin") || name.equals("autojoin_pressed"))
{
- ChatRoomSourceContact contact
- = (ChatRoomSourceContact) actionSource;
- ChatRoomWrapper room = MUCActivator.getMUCService()
- .findChatRoomWrapperFromSourceContact(contact);
+
if(name.equals("autojoin"))
return !room.isAutojoin();
if(name.equals("autojoin_pressed"))
return room.isAutojoin();
}
+ else if(name.equals("remove"))
+ {
+ if(room == null || room.getChatRoom() == null)
+ return true;
+
+ if(room.getChatRoom().getUserRole().equals(
+ ChatRoomMemberRole.OWNER))
+ {
+ if(MUCActivator.getConfigurationService().getBoolean(
+ OWNER_CANT_REMOVE_CHATROOM_PROPERTY, false))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ return true;
+ }
else if(name.equals("destroy_chatroom"))
{
- ChatRoomSourceContact contact
- = (ChatRoomSourceContact) actionSource;
- ChatRoomWrapper room = MUCActivator.getMUCService()
- .findChatRoomWrapperFromSourceContact(contact);
if(room == null || room.getChatRoom() == null)
return false;
- if(room.getChatRoom().getUserRole().equals(ChatRoomMemberRole.OWNER))
+ if(room.getChatRoom().getUserRole().equals(
+ ChatRoomMemberRole.OWNER))
return true;
return false;
}
|