Java Code Examples for org.jivesoftware.smackx.muc.MultiUserChat#destroy()

The following examples show how to use org.jivesoftware.smackx.muc.MultiUserChat#destroy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoomMembersPanel.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
   * 删除MucRoom,即解散群
   *
   * @param roomId
   * @throws XmppStringprepException 
   */
  private void deleteGroup(String roomId) throws XmppStringprepException
  {
      JOptionPane.showMessageDialog(null, "删除群聊:" + roomId, "删除群聊", JOptionPane.INFORMATION_MESSAGE);
      MultiUserChat muc = 
		MultiUserChatManager.getInstanceFor(Launcher.connection).getMultiUserChat(JidCreate.entityBareFrom(roomId));
      
      //发送删除消息
      List<Jid> memberForKick = new ArrayList<Jid>();

if (room.getMember()!=null && !room.getMember().isEmpty()){
	String[] oldMembers = room.getMember().split(",");
	for (String user : oldMembers){
		memberForKick.add(JidCreate.from(user + "@" + Launcher.DOMAIN) );
	} 
	MucChatService.sendKickMessage(memberForKick,room.getRoomId(),room.getName());
}
    	      
      try {
	muc.destroy("解散群组", JidCreate.entityBareFrom(roomId));
} catch (NoResponseException | XMPPErrorException | NotConnectedException | InterruptedException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
      
      //自我删除Room数据
      Launcher.roomService.delete(roomId);
      DebugUtil.debug("解散群组:"+roomId);
      //更新左侧房间UI
      RoomsPanel.getContext().notifyDataSetChanged(false);
  }
 
Example 2
Source File: XmppConnection.java    From Zom-Android-XMPP with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void deleteChatGroupAsync(ChatGroup group) {

    String chatRoomJid = group.getAddress().getAddress();

    if (mMUCs.containsKey(chatRoomJid))
    {
        MultiUserChat muc = mMUCs.get(chatRoomJid);

        try {

            muc.destroy("", null);

            mMUCs.remove(chatRoomJid);

        } catch (Exception e) {
            debug(TAG,"error destroying MUC",e);
        }

    }

}