public void joinRoomChat(QBDialog dialog) throws XMPPException, SmackException, QBResponseException { QBGroupChat roomChat = createChatIfNotExist(dialog); if (!roomChat.isJoined()) { DiscussionHistory history = new DiscussionHistory(); history.setMaxStanzas(0); roomChat.join(history); } }
public static MultiUserChat joinRoom(ImConnection talkConnection, String roomName, String user) { try { // 使用XMPPConnection创建一个MultiUserChat窗口 MultiUserChat muc = getMultiUserChat(talkConnection, roomName); // 聊天室服务将会决定要接受的历史记录数量 DiscussionHistory history = new DiscussionHistory(); history.setMaxStanzas(0); // 用户加入聊天室 muc.join(user); System.out.println("会议室加入成功........"); return muc; } catch (Exception e) { e.printStackTrace(); System.out.println("会议室加入失败........"); return null; } }