aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
index 448a9a478..6e596637c 100644
--- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
+++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
@@ -50,6 +50,7 @@ public final class MucDetailsContextMenuHelper {
public static void configureMucDetailsContextMenu(Activity activity, Menu menu, Conversation conversation, User user) {
final boolean advancedMode = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("advanced_muc_mode", false);
final MucOptions mucOptions = conversation.getMucOptions();
+ final boolean isGroupChat = mucOptions.isPrivateAndNonAnonymous();
MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message);
if (user != null && user.getRealJid() != null) {
MenuItem showContactDetails = menu.findItem(R.id.action_contact_details);
@@ -58,6 +59,8 @@ public final class MucDetailsContextMenuHelper {
MenuItem removeMembership = menu.findItem(R.id.remove_membership);
MenuItem giveAdminPrivileges = menu.findItem(R.id.give_admin_privileges);
MenuItem removeAdminPrivileges = menu.findItem(R.id.remove_admin_privileges);
+ MenuItem giveOwnerPrivileges = menu.findItem(R.id.give_owner_privileges);
+ MenuItem removeOwnerPrivileges = menu.findItem(R.id.revoke_owner_privileges);
MenuItem removeFromRoom = menu.findItem(R.id.remove_from_room);
MenuItem banFromConference = menu.findItem(R.id.ban_from_conference);
MenuItem invite = menu.findItem(R.id.invite);
@@ -76,12 +79,11 @@ public final class MucDetailsContextMenuHelper {
} else if (activity instanceof ConferenceDetailsActivity) {
highlightInMuc.setVisible(true);
}
- if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) &&
- self.getAffiliation().outranks(user.getAffiliation())) {
+ if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && self.getAffiliation().outranks(user.getAffiliation())) {
if (advancedMode) {
- if (user.getAffiliation() == MucOptions.Affiliation.NONE) {
+ if (!user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
giveMembership.setVisible(true);
- } else {
+ } else if (user.getAffiliation() == MucOptions.Affiliation.MEMBER) {
removeMembership.setVisible(true);
}
if (!Config.DISABLE_BAN) {
@@ -92,17 +94,28 @@ public final class MucDetailsContextMenuHelper {
removeFromRoom.setVisible(true);
}
}
- if (user.getAffiliation() != MucOptions.Affiliation.ADMIN) {
- giveAdminPrivileges.setVisible(true);
- } else {
- removeAdminPrivileges.setVisible(true);
+ }
+ if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
+ if (isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.OWNER) {
+ if (!user.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
+ giveOwnerPrivileges.setVisible(true);
+ } else if (user.getAffiliation() == MucOptions.Affiliation.OWNER) {
+ removeOwnerPrivileges.setVisible(true);
+ }
+ }
+ if (!isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
+ if (!user.getAffiliation().ranks(MucOptions.Affiliation.ADMIN)) {
+ giveAdminPrivileges.setVisible(true);
+ } else if (user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
+ removeAdminPrivileges.setVisible(true);
+ }
}
}
sendPrivateMessage.setVisible(true);
sendPrivateMessage.setEnabled(mucOptions.allowPm());
} else {
sendPrivateMessage.setVisible(true);
- sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
+ sendPrivateMessage.setVisible(!isGroupChat && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
}
}
@@ -130,10 +143,14 @@ public final class MucDetailsContextMenuHelper {
case R.id.give_membership:
activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.MEMBER, onAffiliationChanged);
return true;
+ case R.id.give_owner_privileges:
+ activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.OWNER, onAffiliationChanged);
+ return true;
case R.id.remove_membership:
activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.NONE, onAffiliationChanged);
return true;
case R.id.remove_admin_privileges:
+ case R.id.revoke_owner_privileges:
activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.MEMBER, onAffiliationChanged);
return true;
case R.id.remove_from_room: