aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-27 21:29:06 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-27 21:29:06 +0100
commit824ec7efe93b33fd825c67715b02ee16515b17cb (patch)
tree3116f774e4c13664a7bf49a16eb1774333950637 /src/main/java/de/pixart
parent68d8a7cf455517c34f90d1c721aa859d1fe25225 (diff)
allow sending pm via context menu from ConferenceDetailsActivity
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index f0b20bfa4..5d8a9c03c 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -419,6 +419,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
getMenuInflater().inflate(R.menu.muc_details_context, menu);
final User user = (User) tag;
final User self = mConversation.getMucOptions().getSelf();
+ final Jid jid = user.getFullJid();
this.mSelectedUser = user;
String name;
final Contact contact = user.getContact();
@@ -432,6 +433,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
menu.setHeaderTitle(name);
if (user.getRealJid() != null) {
MenuItem highlightInMuc = menu.findItem(R.id.highlight_in_muc);
+ MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message);
MenuItem startConversation = menu.findItem(R.id.start_conversation);
MenuItem giveMembership = menu.findItem(R.id.give_membership);
MenuItem removeMembership = menu.findItem(R.id.remove_membership);
@@ -445,6 +447,13 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
if (user.getRole() == MucOptions.Role.NONE) {
invite.setVisible(true);
}
+ if (jid != null && !jid.isBareJid()) {
+ if (mConversation.getMucOptions().isUserInRoom(jid)) {
+ sendPrivateMessage.setVisible(true);
+ } else {
+ sendPrivateMessage.setVisible(false);
+ }
+ }
if (self.getAffiliation().ranks(MucOptions.Affiliation.ADMIN) &&
self.getAffiliation().outranks(user.getAffiliation())) {
if (mAdvancedMode) {
@@ -479,6 +488,13 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
case R.id.highlight_in_muc:
highlightInMuc(mConversation, mSelectedUser.getName());
return true;
+ case R.id.send_private_message:
+ if (mConversation.getMucOptions().allowPm()) {
+ privateMsgInMuc(mConversation, mSelectedUser.getName());
+ } else {
+ Toast.makeText(this, R.string.private_messages_are_disabled, Toast.LENGTH_SHORT).show();
+ }
+ return true;
case R.id.start_conversation:
startConversation(mSelectedUser);
return true;
@@ -503,13 +519,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
xmppConnectionService.changeRoleInConference(mConversation, mSelectedUser.getName(), MucOptions.Role.NONE, this);
}
return true;
- case R.id.send_private_message:
- if (mConversation.getMucOptions().allowPm()) {
- privateMsgInMuc(mConversation, mSelectedUser.getName());
- } else {
- Toast.makeText(this, R.string.private_messages_are_disabled, Toast.LENGTH_SHORT).show();
- }
- return true;
case R.id.invite:
xmppConnectionService.directInvite(mConversation, jid);
return true;