private void notifyFriendAboutInvitation(QBDialog dialog, Integer friendId) throws Exception {
   long time = DateUtilsCore.getCurrentTime();
   QBPrivateChat chat = chatService.getPrivateChatManager().getChat(friendId);
   if (chat == null) {
     chat = chatService.getPrivateChatManager().createChat(friendId, null);
   }
   QBChatMessage chatMessage = ChatUtils.createRoomNotificationMessage(context, dialog);
   chatMessage.setProperty(ChatUtils.PROPERTY_DATE_SENT, time + ConstsCore.EMPTY_STRING);
   chat.sendMessage(chatMessage);
 }
 private void notifyFriendOnUpdateChat(QBDialog dialog, Integer friendId)
     throws QBResponseException, XMPPException, SmackException.NotConnectedException {
   long time = DateUtilsCore.getCurrentTime();
   QBPrivateChat chat = chatService.getPrivateChatManager().getChat(friendId);
   if (chat == null) {
     chat = chatService.getPrivateChatManager().createChat(friendId, null);
   }
   QBChatMessage chatMessage = ChatUtils.createUpdateChatNotificationMessage(dialog);
   chatMessage.setProperty(ChatUtils.PROPERTY_DATE_SENT, time + ConstsCore.EMPTY_STRING);
   chat.sendMessage(chatMessage);
 }
 private void createDialogByNotification(QBChatMessage chatMessage) {
   long time;
   String roomJidId;
   time = DateUtilsCore.getCurrentTime();
   QBDialog dialog =
       ChatUtils.parseDialogFromMessage(context, chatMessage, chatMessage.getBody(), time);
   roomJidId = dialog.getRoomJid();
   if (roomJidId != null && !QBDialogType.PRIVATE.equals(dialog.getType())) {
     tryJoinRoomChat(dialog);
     new FindUnknownFriendsTask(context).execute(null, dialog);
     saveDialogToCache(context, dialog);
   }
 }
  public void sendOccupantStatusGroup(String sendStr) {
    long time = DateUtilsCore.getCurrentTime();

    QBChatMessage chatMessage = new QBChatMessage();
    chatMessage.setBody(sendStr);
    chatMessage.setProperty(
        ChatUtils.PROPERTY_NOTIFICATION_TYPE, ChatUtils.PROPERTY_NOTIFICATION_TYPE_CREATE_CHAT);
    chatMessage.setProperty(ChatUtils.PROPERTY_DIALOG_ID, currentDialog.getDialogId());
    chatMessage.setProperty(ChatUtils.PROPERTY_ROOM_JID, currentDialog.getRoomJid());
    chatMessage.setProperty(
        ChatUtils.PROPERTY_OCCUPANTS_IDS,
        TextUtils.join(ChatUtils.OCCUPANT_IDS_DIVIDER, currentDialog.getOccupants()));
    chatMessage.setProperty(ChatUtils.PROPERTY_ROOM_NAME, currentDialog.getName());
    chatMessage.setProperty(
        ChatUtils.PROPERTY_DIALOG_TYPE_CODE, String.valueOf(currentDialog.getType().getCode()));
    chatMessage.setProperty(ChatUtils.PROPERTY_DATE_SENT, time + ConstsCore.EMPTY_STRING);
    chatMessage.setProperty(ChatUtils.PROPERTY_SAVE_TO_HISTORY, ChatUtils.VALUE_SAVE_TO_HISTORY);

    try {
      sendRoomMessage(chatMessage, currentDialog.getRoomJid(), currentDialog.getDialogId());
    } catch (QBResponseException e) {
      ErrorUtils.showError(context, e);
    }
  }