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/ConferenceDetailsActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/MucConfiguration.java47
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java14
3 files changed, 44 insertions, 19 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index 646ab8027..3d9e87b0d 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -166,7 +166,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
public void onClick(View v) {
final MucOptions mucOptions = mConversation.getMucOptions();
AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
- MucConfiguration configuration = MucConfiguration.get(ConferenceDetailsActivity.this, mucOptions);
+ MucConfiguration configuration = MucConfiguration.get(ConferenceDetailsActivity.this, mAdvancedMode, mucOptions);
builder.setTitle(configuration.title);
final boolean[] values = configuration.values;
builder.setMultiChoiceItems(configuration.names, values, (dialog, which, isChecked) -> values[which] = isChecked);
diff --git a/src/main/java/de/pixart/messenger/ui/util/MucConfiguration.java b/src/main/java/de/pixart/messenger/ui/util/MucConfiguration.java
index 4630a5a93..6c3235d5a 100644
--- a/src/main/java/de/pixart/messenger/ui/util/MucConfiguration.java
+++ b/src/main/java/de/pixart/messenger/ui/util/MucConfiguration.java
@@ -22,7 +22,7 @@ public class MucConfiguration {
this.options = options;
}
- public static MucConfiguration get(Context context, MucOptions mucOptions) {
+ public static MucConfiguration get(Context context, boolean advanced, MucOptions mucOptions) {
if (mucOptions.isPrivateAndNonAnonymous()) {
String[] names = new String[]{
context.getString(R.string.allow_participants_to_edit_subject),
@@ -38,18 +38,39 @@ public class MucConfiguration {
};
return new MucConfiguration(R.string.conference_options, names, values, options);
} else {
- String[] names = new String[]{
- context.getString(R.string.non_anonymous),
- context.getString(R.string.allow_participants_to_edit_subject),
- };
- boolean[] values = new boolean[]{
- mucOptions.nonanonymous(),
- mucOptions.participantsCanChangeSubject()
- };
- final Option[] options = new Option[]{
- new Option("muc#roomconfig_whois", "anyone", "moderators"),
- new Option("muc#roomconfig_changesubject")
- };
+ final String[] names;
+ final boolean[] values;
+ final Option[] options;
+ if (advanced) {
+ names = new String[]{
+ context.getString(R.string.non_anonymous),
+ context.getString(R.string.allow_participants_to_edit_subject),
+ context.getString(R.string.moderated)
+ };
+ values = new boolean[]{
+ mucOptions.nonanonymous(),
+ mucOptions.participantsCanChangeSubject(),
+ mucOptions.moderated()
+ };
+ options = new Option[]{
+ new Option("muc#roomconfig_whois", "anyone", "moderators"),
+ new Option("muc#roomconfig_changesubject"),
+ new Option("muc#roomconfig_moderatedroom")
+ };
+ } else {
+ names = new String[]{
+ context.getString(R.string.non_anonymous),
+ context.getString(R.string.allow_participants_to_edit_subject),
+ };
+ values = new boolean[]{
+ mucOptions.nonanonymous(),
+ mucOptions.participantsCanChangeSubject()
+ };
+ options = new Option[]{
+ new Option("muc#roomconfig_whois", "anyone", "moderators"),
+ new Option("muc#roomconfig_changesubject")
+ };
+ }
return new MucConfiguration(R.string.channel_options, names, values, options);
}
}
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 c5c69577d..69de24d58 100644
--- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
+++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
@@ -62,7 +62,7 @@ public final class MucDetailsContextMenuHelper {
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 managePermisisons = menu.findItem(R.id.manage_permissions);
+ MenuItem managePermissions = menu.findItem(R.id.manage_permissions);
removeFromRoom.setTitle(isGroupChat ? R.string.remove_from_room : R.string.remove_from_channel);
MenuItem banFromConference = menu.findItem(R.id.ban_from_conference);
banFromConference.setTitle(isGroupChat ? R.string.ban_from_conference : R.string.ban_from_channel);
@@ -85,13 +85,15 @@ public final class MucDetailsContextMenuHelper {
boolean managePermissionsVisible = false;
if ((self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && self.getAffiliation().outranks(user.getAffiliation())) || self.getAffiliation() == MucOptions.Affiliation.OWNER) {
if (advancedMode) {
- managePermissionsVisible = true;
if (!user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
+ managePermissionsVisible = true;
giveMembership.setVisible(true);
} else if (user.getAffiliation() == MucOptions.Affiliation.MEMBER) {
+ managePermissionsVisible = true;
removeMembership.setVisible(true);
}
if (!Config.DISABLE_BAN) {
+ managePermissionsVisible = true;
banFromConference.setVisible(true);
}
} else {
@@ -103,23 +105,25 @@ public final class MucDetailsContextMenuHelper {
}
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
if (isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.OWNER) {
- managePermissionsVisible = true;
if (!user.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
+ managePermissionsVisible = true;
giveOwnerPrivileges.setVisible(true);
} else if (user.getAffiliation() == MucOptions.Affiliation.OWNER) {
+ managePermissionsVisible = true;
removeOwnerPrivileges.setVisible(true);
}
}
if (!isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
- managePermissionsVisible = true;
if (!user.getAffiliation().ranks(MucOptions.Affiliation.ADMIN)) {
+ managePermissionsVisible = true;
giveAdminPrivileges.setVisible(true);
} else if (user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
+ managePermissionsVisible = true;
removeAdminPrivileges.setVisible(true);
}
}
}
- managePermisisons.setVisible(managePermissionsVisible);
+ managePermissions.setVisible(managePermissionsVisible);
sendPrivateMessage.setVisible(true);
sendPrivateMessage.setEnabled(mucOptions.allowPm());
} else {