aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java35
-rw-r--r--src/main/res/menu/muc_details_context.xml13
-rw-r--r--src/main/res/values/strings.xml2
3 files changed, 38 insertions, 12 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:
diff --git a/src/main/res/menu/muc_details_context.xml b/src/main/res/menu/muc_details_context.xml
index 94693c0a5..373397e62 100644
--- a/src/main/res/menu/muc_details_context.xml
+++ b/src/main/res/menu/muc_details_context.xml
@@ -25,6 +25,10 @@
android:title="@string/grant_membership"
android:visible="false" />
<item
+ android:id="@+id/remove_membership"
+ android:title="@string/remove_membership"
+ android:visible="false" />
+ <item
android:id="@+id/give_admin_privileges"
android:title="@string/grant_admin_privileges"
android:visible="false" />
@@ -32,10 +36,13 @@
android:id="@+id/remove_admin_privileges"
android:title="@string/remove_admin_privileges"
android:visible="false" />
-
<item
- android:id="@+id/remove_membership"
- android:title="@string/remove_membership"
+ android:id="@+id/give_owner_privileges"
+ android:title="@string/grant_owner_privileges"
+ android:visible="false" />
+ <item
+ android:id="@+id/revoke_owner_privileges"
+ android:title="@string/remove_owner_privileges"
android:visible="false" />
<item
android:id="@+id/remove_from_room"
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 6c878cc7d..2afebd663 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -899,4 +899,6 @@
<string name="jabber_ids_are_visible_to_anyone">Jabber IDs are visible to anyone.</string>
<string name="no_users_hint_channel">This public channel has no participants.</string>
<string name="no_users_hint_group_chat">This private group chat has no participants.</string>
+ <string name="grant_owner_privileges">Grant owner privileges</string>
+ <string name="remove_owner_privileges">Revoke owner privileges</string>
</resources>