diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index 1d5079700..784394deb 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -132,6 +132,9 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc final Message message = selectedMessageReference.get(); if (message != null) { switch (item.getItemId()) { + case R.id.open_conversation: + switchToConversation(wrap(message.getConversation())); + break; case R.id.share_with: ShareUtil.share(this, message); break; @@ -143,6 +146,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc break; case R.id.quote_message: quote(message); + break; } } return super.onContextItemSelected(item); @@ -151,17 +155,20 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc private void quote(Message message) { String text = MessageUtils.prepareQuote(message); final Conversational conversational = message.getConversation(); + switchToConversationAndQuote(wrap(message.getConversation()), text); + } + + private Conversation wrap(Conversational conversational) { final Conversation conversation; if (conversational instanceof Conversation) { - conversation = (Conversation) conversational; + return (Conversation) conversational; } else { - conversation = xmppConnectionService.findOrCreateConversation(conversational.getAccount(), + return xmppConnectionService.findOrCreateConversation(conversational.getAccount(), conversational.getJid(), conversational.getMode() == Conversational.MODE_MULTI, true, true); } - switchToConversationAndQuote(conversation, text); } @Override diff --git a/src/main/res/menu/search_result_context.xml b/src/main/res/menu/search_result_context.xml index ea32659f6..8abb22dac 100644 --- a/src/main/res/menu/search_result_context.xml +++ b/src/main/res/menu/search_result_context.xml @@ -28,7 +28,11 @@ ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> -