/**
  * Open chat with specified contact and enter text to be sent.
  *
  * @param baseEntity
  * @param text can be <code>null</code>.
  */
 private void openChat(BaseEntity baseEntity, String text) {
   if (text == null) {
     startActivity(
         ChatViewer.createSendIntent(this, baseEntity.getAccount(), baseEntity.getUser(), null));
   } else {
     startActivity(
         ChatViewer.createSendIntent(this, baseEntity.getAccount(), baseEntity.getUser(), text));
   }
   finish();
 }
 @Override
 public void onContactClick(AbstractContact abstractContact) {
   if (action == null) {
     startActivity(
         ChatViewer.createSpecificChatIntent(
             this, abstractContact.getAccount(), abstractContact.getUser()));
     return;
   }
   switch (action) {
     case ACTION_ROOM_INVITE:
       {
         action = null;
         Intent intent = getIntent();
         String account = getRoomInviteAccount(intent);
         String user = getRoomInviteUser(intent);
         if (account != null && user != null) {
           try {
             MUCManager.getInstance().invite(account, user, abstractContact.getUser());
           } catch (NetworkException e) {
             Application.getInstance().onError(e);
           }
         }
         finish();
         break;
       }
     case Intent.ACTION_SEND:
       action = null;
       startActivity(
           ChatViewer.createSendIntent(
               this, abstractContact.getAccount(), abstractContact.getUser(), sendText));
       finish();
       break;
     case Intent.ACTION_CREATE_SHORTCUT:
       {
         createShortcut(abstractContact);
         finish();
         break;
       }
     default:
       startActivity(
           ChatViewer.createSpecificChatIntent(
               this, abstractContact.getAccount(), abstractContact.getUser()));
       break;
   }
 }