separate PM fixes

This commit is contained in:
kosyak 2023-09-15 14:11:43 +02:00
parent 1ca354c208
commit 6770f7de61
3 changed files with 7 additions and 5 deletions

View file

@ -1256,7 +1256,7 @@ public class ConversationFragment extends XmppFragment
if (conversation != null) { if (conversation != null) {
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
menuContactDetails.setVisible(false); menuContactDetails.setVisible(false);
menuInviteContact.setVisible(conversation.getMucOptions().canInvite()); menuInviteContact.setVisible(conversation.getMucOptions().canInvite() && conversation.getNextCounterpart() == null);
menuMucDetails.setTitle( menuMucDetails.setTitle(
conversation.getMucOptions().isPrivateAndNonAnonymous() conversation.getMucOptions().isPrivateAndNonAnonymous()
? R.string.action_muc_details ? R.string.action_muc_details
@ -2410,8 +2410,10 @@ public class ConversationFragment extends XmppFragment
public void privateMessageWith(final Jid counterpart) { public void privateMessageWith(final Jid counterpart) {
Conversation c = activity.xmppConnectionService.findOrCreateConversation(conversation.getAccount(), conversation.getJid(), null, true, true, false, counterpart); Conversation c = activity.xmppConnectionService.findOrCreateConversation(conversation.getAccount(), conversation.getJid(), null, true, true, false, counterpart);
if (c != conversation) {
activity.switchToConversation(c); activity.switchToConversation(c);
} }
}
private void correctMessage(Message message) { private void correctMessage(Message message) {
this.conversation.setCorrectingMessage(message); this.conversation.setCorrectingMessage(message);

View file

@ -561,7 +561,8 @@ public abstract class XmppActivity extends ActionBarActivity {
} }
public void privateMsgInMuc(Conversation conversation, String nick) { public void privateMsgInMuc(Conversation conversation, String nick) {
switchToConversation(conversation, null, false, nick, true, false); Conversation c = xmppConnectionService.findOrCreateConversation(conversation.getAccount(), conversation.getJid(), null, true, true, false, conversation.getJid().withResource(nick));
switchToConversation(c, null, false, nick, true, false);
} }
public void switchToConversation(Conversation conversation, String text, boolean asQuote, String nick, boolean pm, boolean doNotAppend) { public void switchToConversation(Conversation conversation, String text, boolean asQuote, String nick, boolean pm, boolean doNotAppend) {

View file

@ -120,8 +120,7 @@ public final class MucDetailsContextMenuHelper {
} }
} }
managePermissions.setVisible(managePermissionsVisible); managePermissions.setVisible(managePermissionsVisible);
sendPrivateMessage.setVisible(true); sendPrivateMessage.setVisible(!isGroupChat && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
sendPrivateMessage.setEnabled(true);
} else { } else {
sendPrivateMessage.setVisible(true); sendPrivateMessage.setVisible(true);
sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR)); sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));