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/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
-rw-r--r--src/main/res/menu/muc_details_context.xml11
-rw-r--r--src/main/res/values/strings.xml9
5 files changed, 55 insertions, 28 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 {
diff --git a/src/main/res/menu/muc_details_context.xml b/src/main/res/menu/muc_details_context.xml
index 0a8ad87c4..c3d54e5c6 100644
--- a/src/main/res/menu/muc_details_context.xml
+++ b/src/main/res/menu/muc_details_context.xml
@@ -22,7 +22,8 @@
android:visible="false" />
<item
android:id="@+id/manage_permissions"
- android:title="@string/manage_permission">
+ android:title="@string/manage_permission"
+ android:visible="false">
<menu>
<item
android:id="@+id/give_membership"
@@ -52,10 +53,10 @@
android:id="@+id/ban_from_conference"
android:title="@string/ban_from_conference"
android:visible="false" />
- <item
- android:id="@+id/remove_from_room"
- android:title="@string/remove_from_room"
- android:visible="false" />
</menu>
</item>
+ <item
+ android:id="@+id/remove_from_room"
+ android:title="@string/remove_from_room"
+ android:visible="false" />
</menu>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 0678c4710..5742775e0 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -361,16 +361,17 @@
<string name="outcast">Outcast</string>
<string name="member">Member</string>
<string name="advanced_mode">Advanced mode</string>
- <string name="grant_membership">Grant membership</string>
- <string name="remove_membership">Revoke membership</string>
+ <string name="grant_membership">Grant member privileges</string>
+ <string name="remove_membership">Revoke member privileges</string>
<string name="grant_admin_privileges">Grant admin privileges</string>
<string name="remove_admin_privileges">Revoke admin privileges</string>
<string name="remove_from_room">Remove from group chat</string>
<string name="could_not_change_affiliation">Could not change affiliation of %s</string>
<string name="ban_from_conference">Ban from group chat</string>
- <string name="removing_from_public_conference">You are trying to remove %s from a public group chat. The only way to do that is to ban that user for ever.</string>
+ <string name="removing_from_public_conference">You are trying to remove %s from a public channel. The only way to do that is to ban that user for ever.</string>
<string name="ban_now">Ban now</string>
<string name="non_anonymous">Make Jabber IDs visible to anyone</string>
+ <string name="moderated">Make channel moderated</string>
<string name="you_are_not_participating">You are not participating</string>
<string name="modified_conference_options">Modified group chat options!</string>
<string name="could_not_modify_conference_options">Could not modify group chat options</string>
@@ -870,5 +871,5 @@
<string name="remove_owner_privileges">Revoke owner privileges</string>
<string name="remove_from_channel">Remove from channel</string>
<string name="ban_from_channel">Ban from channel</string>
- <string name="manage_permission">Manage permissions</string>
+ <string name="manage_permission">Manage privileges</string>
</resources>