brought back 'moderated' config in advanced mode
This commit is contained in:
parent
b648c482f3
commit
bfaf10aa72
|
@ -125,7 +125,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final MucOptions mucOptions = mConversation.getMucOptions();
|
final MucOptions mucOptions = mConversation.getMucOptions();
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
|
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);
|
builder.setTitle(configuration.title);
|
||||||
final boolean[] values = configuration.values;
|
final boolean[] values = configuration.values;
|
||||||
builder.setMultiChoiceItems(configuration.names, values, (dialog, which, isChecked) -> values[which] = isChecked);
|
builder.setMultiChoiceItems(configuration.names, values, (dialog, which, isChecked) -> values[which] = isChecked);
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class MucConfiguration {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MucConfiguration get(Context context, MucOptions mucOptions) {
|
public static MucConfiguration get(Context context, boolean advanced, MucOptions mucOptions) {
|
||||||
if (mucOptions.isPrivateAndNonAnonymous()) {
|
if (mucOptions.isPrivateAndNonAnonymous()) {
|
||||||
String[] names = new String[]{
|
String[] names = new String[]{
|
||||||
context.getString(R.string.allow_participants_to_edit_subject),
|
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);
|
return new MucConfiguration(R.string.conference_options, names, values, options);
|
||||||
} else {
|
} else {
|
||||||
String[] names = new String[]{
|
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.non_anonymous),
|
||||||
context.getString(R.string.allow_participants_to_edit_subject),
|
context.getString(R.string.allow_participants_to_edit_subject),
|
||||||
};
|
};
|
||||||
boolean[] values = new boolean[]{
|
values = new boolean[]{
|
||||||
mucOptions.nonanonymous(),
|
mucOptions.nonanonymous(),
|
||||||
mucOptions.participantsCanChangeSubject()
|
mucOptions.participantsCanChangeSubject()
|
||||||
};
|
};
|
||||||
final Option[] options = new Option[]{
|
options = new Option[]{
|
||||||
new Option("muc#roomconfig_whois", "anyone", "moderators"),
|
new Option("muc#roomconfig_whois", "anyone", "moderators"),
|
||||||
new Option("muc#roomconfig_changesubject")
|
new Option("muc#roomconfig_changesubject")
|
||||||
};
|
};
|
||||||
|
}
|
||||||
return new MucConfiguration(R.string.channel_options, names, values, options);
|
return new MucConfiguration(R.string.channel_options, names, values, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public final class MucDetailsContextMenuHelper {
|
||||||
MenuItem removeOwnerPrivileges = menu.findItem(R.id.revoke_owner_privileges);
|
MenuItem removeOwnerPrivileges = menu.findItem(R.id.revoke_owner_privileges);
|
||||||
MenuItem removeAdminPrivileges = menu.findItem(R.id.remove_admin_privileges);
|
MenuItem removeAdminPrivileges = menu.findItem(R.id.remove_admin_privileges);
|
||||||
MenuItem removeFromRoom = menu.findItem(R.id.remove_from_room);
|
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);
|
removeFromRoom.setTitle(isGroupChat ? R.string.remove_from_room : R.string.remove_from_channel);
|
||||||
MenuItem banFromConference = menu.findItem(R.id.ban_from_conference);
|
MenuItem banFromConference = menu.findItem(R.id.ban_from_conference);
|
||||||
banFromConference.setTitle(isGroupChat ? R.string.ban_from_conference : R.string.ban_from_channel);
|
banFromConference.setTitle(isGroupChat ? R.string.ban_from_conference : R.string.ban_from_channel);
|
||||||
|
@ -80,13 +80,15 @@ public final class MucDetailsContextMenuHelper {
|
||||||
boolean managePermissionsVisible = false;
|
boolean managePermissionsVisible = false;
|
||||||
if ((self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && self.getAffiliation().outranks(user.getAffiliation())) || self.getAffiliation() == MucOptions.Affiliation.OWNER) {
|
if ((self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) && self.getAffiliation().outranks(user.getAffiliation())) || self.getAffiliation() == MucOptions.Affiliation.OWNER) {
|
||||||
if (advancedMode) {
|
if (advancedMode) {
|
||||||
managePermissionsVisible = true;
|
|
||||||
if (!user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
|
if (!user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
giveMembership.setVisible(true);
|
giveMembership.setVisible(true);
|
||||||
} else if (user.getAffiliation() == MucOptions.Affiliation.MEMBER) {
|
} else if (user.getAffiliation() == MucOptions.Affiliation.MEMBER) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
removeMembership.setVisible(true);
|
removeMembership.setVisible(true);
|
||||||
}
|
}
|
||||||
if (!Config.DISABLE_BAN) {
|
if (!Config.DISABLE_BAN) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
banFromConference.setVisible(true);
|
banFromConference.setVisible(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,23 +100,25 @@ public final class MucDetailsContextMenuHelper {
|
||||||
}
|
}
|
||||||
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
|
if (self.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
|
||||||
if (isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.OWNER) {
|
if (isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.OWNER) {
|
||||||
managePermissionsVisible = true;
|
|
||||||
if (!user.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
|
if (!user.getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
giveOwnerPrivileges.setVisible(true);
|
giveOwnerPrivileges.setVisible(true);
|
||||||
} else if (user.getAffiliation() == MucOptions.Affiliation.OWNER){
|
} else if (user.getAffiliation() == MucOptions.Affiliation.OWNER){
|
||||||
|
managePermissionsVisible = true;
|
||||||
removeOwnerPrivileges.setVisible(true);
|
removeOwnerPrivileges.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
|
if (!isGroupChat || advancedMode || user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
|
||||||
managePermissionsVisible = true;
|
|
||||||
if (!user.getAffiliation().ranks(MucOptions.Affiliation.ADMIN)) {
|
if (!user.getAffiliation().ranks(MucOptions.Affiliation.ADMIN)) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
giveAdminPrivileges.setVisible(true);
|
giveAdminPrivileges.setVisible(true);
|
||||||
} else if (user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
|
} else if (user.getAffiliation() == MucOptions.Affiliation.ADMIN) {
|
||||||
|
managePermissionsVisible = true;
|
||||||
removeAdminPrivileges.setVisible(true);
|
removeAdminPrivileges.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
managePermisisons.setVisible(managePermissionsVisible);
|
managePermissions.setVisible(managePermissionsVisible);
|
||||||
sendPrivateMessage.setVisible(!isGroupChat && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
|
sendPrivateMessage.setVisible(!isGroupChat && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
|
||||||
} else {
|
} else {
|
||||||
sendPrivateMessage.setVisible(true);
|
sendPrivateMessage.setVisible(true);
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
android:id="@+id/send_private_message"
|
android:id="@+id/send_private_message"
|
||||||
android:title="@string/send_private_message"
|
android:title="@string/send_private_message"
|
||||||
android:visible="false" />
|
android:visible="false" />
|
||||||
<item android:id="@+id/manage_permissions"
|
<item
|
||||||
android:title="@string/manage_permission">
|
android:id="@+id/manage_permissions"
|
||||||
|
android:title="@string/manage_permission"
|
||||||
|
android:visible="false">
|
||||||
<menu>
|
<menu>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/give_membership"
|
android:id="@+id/give_membership"
|
||||||
|
@ -47,10 +49,10 @@
|
||||||
android:id="@+id/ban_from_conference"
|
android:id="@+id/ban_from_conference"
|
||||||
android:title="@string/ban_from_conference"
|
android:title="@string/ban_from_conference"
|
||||||
android:visible="false" />
|
android:visible="false" />
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/remove_from_room"
|
android:id="@+id/remove_from_room"
|
||||||
android:title="@string/remove_from_room"
|
android:title="@string/remove_from_room"
|
||||||
android:visible="false" />
|
android:visible="false" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
|
||||||
</menu>
|
|
||||||
|
|
|
@ -364,8 +364,8 @@
|
||||||
<string name="outcast">Outcast</string>
|
<string name="outcast">Outcast</string>
|
||||||
<string name="member">Member</string>
|
<string name="member">Member</string>
|
||||||
<string name="advanced_mode">Advanced mode</string>
|
<string name="advanced_mode">Advanced mode</string>
|
||||||
<string name="grant_membership">Grant membership</string>
|
<string name="grant_membership">Grant member privileges</string>
|
||||||
<string name="remove_membership">Revoke membership</string>
|
<string name="remove_membership">Revoke member privileges</string>
|
||||||
<string name="grant_admin_privileges">Grant admin privileges</string>
|
<string name="grant_admin_privileges">Grant admin privileges</string>
|
||||||
<string name="remove_admin_privileges">Revoke admin privileges</string>
|
<string name="remove_admin_privileges">Revoke admin privileges</string>
|
||||||
<string name="grant_owner_privileges">Grant owner privileges</string>
|
<string name="grant_owner_privileges">Grant owner privileges</string>
|
||||||
|
@ -375,14 +375,14 @@
|
||||||
<string name="could_not_change_affiliation">Could not change affiliation of %s</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="ban_from_conference">Ban from group chat</string>
|
||||||
<string name="ban_from_channel">Ban from channel</string>
|
<string name="ban_from_channel">Ban from channel</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="ban_now">Ban now</string>
|
||||||
<string name="could_not_change_role">Could not change role of %s</string>
|
<string name="could_not_change_role">Could not change role of %s</string>
|
||||||
<string name="conference_options">Private group chat configuration</string>
|
<string name="conference_options">Private group chat configuration</string>
|
||||||
<string name="channel_options">Public channel configuration</string>
|
<string name="channel_options">Public channel configuration</string>
|
||||||
<string name="members_only">Private, members only</string>
|
<string name="members_only">Private, members only</string>
|
||||||
<string name="non_anonymous">Make Jabber IDs visible to anyone</string>
|
<string name="non_anonymous">Make Jabber IDs visible to anyone</string>
|
||||||
<string name="moderated">Moderated</string>
|
<string name="moderated">Make channel moderated</string>
|
||||||
<string name="you_are_not_participating">You are not participating</string>
|
<string name="you_are_not_participating">You are not participating</string>
|
||||||
<string name="modified_conference_options">Modified group chat options!</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>
|
<string name="could_not_modify_conference_options">Could not modify group chat options</string>
|
||||||
|
@ -848,5 +848,5 @@
|
||||||
<string name="jabber_ids_are_visible_to_anyone">Jabber IDs are visible to anyone.</string>
|
<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. Invite your contacts or use the share button to distribute its XMPP address.</string>
|
<string name="no_users_hint_channel">This public channel has no participants. Invite your contacts or use the share button to distribute its XMPP address.</string>
|
||||||
<string name="no_users_hint_group_chat">This private group chat has no participants.</string>
|
<string name="no_users_hint_group_chat">This private group chat has no participants.</string>
|
||||||
<string name="manage_permission">Manage permissions</string>
|
<string name="manage_permission">Manage privileges</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue