aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-09-13 17:13:46 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-09-13 17:13:46 +0200
commit96575d6290d3fc28c79ec37c493e1062735cbf41 (patch)
tree797e1a77044498f1d12503d86d6faca6470b3a45 /src/main/java/eu/siacs/conversations/ui
parentadd4302385257a07fdf234d5ab8ae675040a6aea (diff)
added possibiltiy to set conferences as moderated (only visible in advanced mode)
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java37
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java9
3 files changed, 39 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 12b66c35..2f9d567e 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -102,11 +102,29 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
final MucOptions mucOptions = mConversation.getMucOptions();
AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
builder.setTitle(R.string.conference_options);
- String[] options = {getString(R.string.members_only),
- getString(R.string.non_anonymous)};
- final boolean[] values = new boolean[options.length];
- values[0] = mucOptions.membersOnly();
- values[1] = mucOptions.nonanonymous();
+ final String[] options;
+ final boolean[] values;
+ if (mAdvancedMode) {
+ options = new String[]{
+ getString(R.string.members_only),
+ getString(R.string.moderated),
+ getString(R.string.non_anonymous)
+ };
+ values = new boolean[]{
+ mucOptions.membersOnly(),
+ mucOptions.moderated(),
+ mucOptions.nonanonymous()
+ };
+ } else {
+ options = new String[]{
+ getString(R.string.members_only),
+ getString(R.string.non_anonymous)
+ };
+ values = new boolean[]{
+ mucOptions.membersOnly(),
+ mucOptions.nonanonymous()
+ };
+ }
builder.setMultiChoiceItems(options,values,new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
@@ -124,7 +142,12 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
Bundle options = new Bundle();
options.putString("muc#roomconfig_membersonly", values[0] ? "1" : "0");
- options.putString("muc#roomconfig_whois", values[1] ? "anyone" : "moderators");
+ if (values.length == 2) {
+ options.putString("muc#roomconfig_whois", values[1] ? "anyone" : "moderators");
+ } else if (values.length == 3) {
+ options.putString("muc#roomconfig_moderatedroom", values[1] ? "1" : "0");
+ options.putString("muc#roomconfig_whois", values[2] ? "anyone" : "moderators");
+ }
options.putString("muc#roomconfig_persistentroom", "1");
xmppConnectionService.pushConferenceConfiguration(mConversation,
options,
@@ -193,6 +216,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
});
}
});
+ this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false);
}
@Override
@@ -215,6 +239,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
case R.id.action_advanced_mode:
this.mAdvancedMode = !menuItem.isChecked();
menuItem.setChecked(this.mAdvancedMode);
+ getPreferences().edit().putBoolean("advanced_muc_mode", mAdvancedMode).commit();
invalidateOptionsMenu();
updateView();
break;
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 552587ee..913190b4 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -399,7 +399,7 @@ public class ConversationActivity extends XmppActivity
}
if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) {
menuContactDetails.setVisible(false);
- menuAttach.setVisible(getSelectedConversation().getAccount().httpUploadAvailable());
+ menuAttach.setVisible(getSelectedConversation().getAccount().httpUploadAvailable() && getSelectedConversation().getMucOptions().participating());
menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite());
menuSecure.setVisible(!Config.HIDE_PGP_IN_UI); //if pgp is hidden conferences have no choice of encryption
} else {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 244487fd..aced2798 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -320,11 +320,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
public void updateChatMsgHint() {
- if (conversation.getMode() == Conversation.MODE_MULTI
- && conversation.getNextCounterpart() != null) {
+ final boolean multi = conversation.getMode() == Conversation.MODE_MULTI;
+ if (multi && conversation.getNextCounterpart() != null) {
this.mEditMessage.setHint(getString(
R.string.send_private_message_to,
conversation.getNextCounterpart().getResourcepart()));
+ } else if (multi && !conversation.getMucOptions().participating()) {
+ this.mEditMessage.setHint(R.string.you_are_not_participating);
} else {
switch (conversation.getNextEncryption()) {
case Message.ENCRYPTION_NONE:
@@ -664,6 +666,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
if (this.conversation.getMode() == Conversation.MODE_MULTI) {
this.conversation.setNextCounterpart(null);
}
+ boolean canWrite = this.conversation.getMode() == Conversation.MODE_SINGLE || this.conversation.getMucOptions().participating();
+ this.mEditMessage.setEnabled(canWrite);
+ this.mSendButton.setEnabled(canWrite);
this.mEditMessage.setKeyboardListener(null);
this.mEditMessage.setText("");
this.mEditMessage.append(this.conversation.getNextMessage());