aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java3
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java16
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;