diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-12-14 21:19:16 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-12-14 21:19:16 +0100 |
commit | b9604621ad1e10a593889d307e390e40c7e83f5d (patch) | |
tree | 8011452a2b9819d9679e8a1a0095477ea4512807 /src/main/java/de/pixart | |
parent | 0a37d69814433d47f8b4731f4996d86f2e567b36 (diff) |
show warning snackbar before joining anon-non-private room
Diffstat (limited to 'src/main/java/de/pixart')
3 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java index fcdc358fb..da73b4630 100644 --- a/src/main/java/de/pixart/messenger/entities/MucOptions.java +++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java @@ -675,7 +675,8 @@ public class MucOptions { SHUTDOWN, DESTROYED, INVALID_NICK, - UNKNOWN + UNKNOWN, + NON_ANONYMOUS } private interface OnEventListener { diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index ba583b304..bd68bd140 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2551,6 +2551,11 @@ public class XmppConnectionService extends Service { private void join(Conversation conversation) { Account account = conversation.getAccount(); final MucOptions mucOptions = conversation.getMucOptions(); + if (mucOptions.nonanonymous() && !mucOptions.membersOnly() && !conversation.getBooleanAttribute("accept_non_anonymous", false)) { + mucOptions.setError(MucOptions.Error.NON_ANONYMOUS); + updateConversationUi(); + return; + } final Jid joinJid = mucOptions.getSelf().getFullJid(); Log.d(Config.LOGTAG, account.getJid().asBareJid().toString() + ": joining conversation " + joinJid.toString()); PresencePacket packet = mPresenceGenerator.selfPresence(account, Presence.Status.ONLINE, mucOptions.nonanonymous() || onConferenceJoined != null); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 2082c6664..d87377b72 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -179,6 +179,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.verifyOtrSessionDialog(conversation, v); } }; + private boolean reInitRequiredOnStart = true; private MediaPreviewAdapter mediaPreviewAdapter; private OnClickListener clickToMuc = new OnClickListener() { @@ -192,6 +193,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } }; + private OnClickListener leaveMuc = new OnClickListener() { @Override @@ -199,6 +201,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.xmppConnectionService.archiveConversation(conversation); } }; + private OnClickListener joinMuc = new OnClickListener() { @Override @@ -206,6 +209,16 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.xmppConnectionService.joinMuc(conversation); } }; + + private OnClickListener acceptJoin = new OnClickListener() { + @Override + public void onClick(View v) { + conversation.setAttribute("accept_non_anonymous", true); + activity.xmppConnectionService.updateConversation(conversation); + activity.xmppConnectionService.joinMuc(conversation); + } + }; + private OnClickListener enterPassword = new OnClickListener() { @Override @@ -2379,6 +2392,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case DESTROYED: showSnackbar(R.string.conference_destroyed, R.string.leave, leaveMuc); break; + case NON_ANONYMOUS: + showSnackbar(R.string.group_chat_will_make_your_jabber_id_public, R.string.join, acceptJoin); + break; default: hideSnackbar(); break; |