Java 类org.jivesoftware.smackx.muc.HostedRoom 实例源码

项目:SmackStudy    文件:XMPPUtil.java   
/**
 * 获取用户的所有聊天室
 * @param xmppConnection
 * @return
 */
public static List<HostedRoom>  getHostRooms(XMPPConnection xmppConnection){
    List<HostedRoom> roominfos = new ArrayList<HostedRoom>();
    try {
        new ServiceDiscoveryManager(xmppConnection);
        Collection<HostedRoom> hostrooms = MultiUserChat.getHostedRooms(xmppConnection,xmppConnection.getServiceName());
        for (HostedRoom entry : hostrooms) {
            roominfos.add(entry);
            Log.i("room", "名字:" + entry.getName() + " - ID:" + entry.getJid());
        }
        Log.i("room", "服务会议数量:" + roominfos.size());
    } catch (XMPPException e) {
        Log.e("getHostRooms",e.getMessage());
        e.printStackTrace();
    }
    return roominfos;
}
项目:VASSAL-src    文件:JabberClient.java   
public ModuleSummary[] getStatus() {
  ArrayList<ModuleSummary> entries = new ArrayList<ModuleSummary>();
  try {
    for (Iterator<HostedRoom> iter = MultiUserChat.getHostedRooms(conn, conferenceService).iterator(); iter.hasNext();) {
      HostedRoom room = iter.next();
      MultiUserChat.getRoomInfo(conn, room.getJid());
    }
  }
  // FIXME: review error message
  catch (XMPPException e) {
    e.printStackTrace();
  }
  return entries.toArray(new ModuleSummary[entries.size()]);
}
项目:SmackStudy    文件:XMPPUtil.java   
/**
 * 获取用户的所有聊天室
 * @param xmppConnection
 * @return
 */
public static List<HostedRoom>  getHostRooms(XMPPConnection xmppConnection){
    try {
        new ServiceDiscoveryManager(xmppConnection);
        Collection<HostedRoom> hostrooms = MultiUserChat.getHostedRooms(xmppConnection,xmppConnection.getServiceName());
        return hostrooms.stream().collect(Collectors.toList());
    } catch (XMPPException e) {
        e.printStackTrace();
        return null;
    }
}
项目:EIM    文件:XmppConnectionManager.java   
/**
 * ��ȡHostedrooms
 * 
 * @return
 */
public List<MucRoom> getAllHostedRooms() {
    List<MucRoom> rooms = new ArrayList<MucRoom>();
    try {
        new ServiceDiscoveryManager(connection);
        Collection<HostedRoom> hrooms = MultiUserChat.getHostedRooms(
                connection, connection.getServiceName());
        if (!hrooms.isEmpty()) {
            for (HostedRoom r : hrooms) {
                RoomInfo roominfo = MultiUserChat.getRoomInfo(connection,
                        r.getJid());
                SLog.i("������Info", roominfo.toString());
                MucRoom mr = new MucRoom();
                mr.setDescription(roominfo.getDescription());
                mr.setName(r.getName());
                mr.setJid(r.getJid());
                mr.setOccupants(roominfo.getOccupantsCount());
                mr.setSubject(roominfo.getSubject());
                rooms.add(mr);
            }
        }
    } catch (XMPPException e) {
        SLog.e(tag, " ��ȡHosted Rooms ����");
        SLog.e(tag, Log.getStackTraceString(e));
    }
    return rooms;
}
项目:EIM    文件:XmppConnectionManager.java   
/** 
 * ��ȡ�����������л����� 
 * @return 
 * @throws XMPPException 
 */  
public  List<MucRoom> getConferenceRoom() throws XMPPException {  
    List<MucRoom> list = new ArrayList<MucRoom>();  
    new ServiceDiscoveryManager(connection);  
    if (!MultiUserChat.getHostedRooms(connection,  
            connection.getServiceName()).isEmpty()) {  
        for (HostedRoom k : MultiUserChat.getHostedRooms(connection,  
                connection.getServiceName())) {  

            for (HostedRoom j : MultiUserChat.getHostedRooms(connection,  
                    k.getJid())) {  
                RoomInfo info2 = MultiUserChat.getRoomInfo(connection,  
                        j.getJid());  
                if (j.getJid().indexOf("@") > 0) {  

                    MucRoom friendrooms = new MucRoom();  
                    friendrooms.setName(j.getName());//�����ҵ�����  
                    friendrooms.setJid(j.getJid());//������JID  
                    friendrooms.setOccupants(info2.getOccupantsCount());//��������ռ��������  
                    friendrooms.setDescription(info2.getDescription());//�����ҵ�����  
                    friendrooms.setSubject(info2.getSubject());//�����ҵ�����  
                    list.add(friendrooms);  
                }  
            }  
        }  
    }  
    return list;  
}
项目:vassal    文件:JabberClient.java   
public ModuleSummary[] getStatus() {
  ArrayList<ModuleSummary> entries = new ArrayList<ModuleSummary>();
  try {
    for (Iterator<HostedRoom> iter = MultiUserChat.getHostedRooms(conn, conferenceService).iterator(); iter.hasNext();) {
      HostedRoom room = iter.next();
      MultiUserChat.getRoomInfo(conn, room.getJid());
    }
  }
  // FIXME: review error message
  catch (XMPPException e) {
    e.printStackTrace();
  }
  return entries.toArray(new ModuleSummary[entries.size()]);
}
项目:aceim    文件:XMPPEntityAdapter.java   
public List<PersonalInfo> xmppHostedRooms2MultiChatRooms(Collection<HostedRoom> hostedRooms, String ownerJid, byte serviceId) {
    if (hostedRooms == null){
        return Collections.emptyList();
    }

    List<PersonalInfo> chats = new ArrayList<PersonalInfo>(hostedRooms.size());
    for (HostedRoom room: hostedRooms){
        chats.add(xmppHostedRoom2PersonalInfo(room, serviceId));
    }
    return chats;
}
项目:aceim    文件:XMPPEntityAdapter.java   
private PersonalInfo xmppHostedRoom2PersonalInfo(HostedRoom room, byte serviceId) {
    if (room == null) {
        return null;
    }

    PersonalInfo info = new PersonalInfo(serviceId);
    info.setProtocolUid(room.getJid());
    info.setMultichat(true);
    info.getProperties().putString(PersonalInfo.INFO_NICK, room.getName()); 

    return info;
}
项目:SmackStudy    文件:XMPPConnectionWrapper.java   
@Override
public List<HostedRoom> getHostRooms() {
    return XMPPUtil.getHostRooms(xmppConnection);
}
项目:SmackStudy    文件:XMPPConnectionWrapper.java   
@Override
public List<HostedRoom> getHostRooms() {
    return XMPPUtil.getHostRooms(xmppConnection);
}
项目:yiim_v2    文件:MultiRoomDiscoverActivity.java   
private void loadRooms() {
    getXmppBinder().execute(new Runnable() {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            try {
                Collection<HostedRoom> hostedRooms = MultiUserChat
                        .getHostedRooms(
                                getXmppBinder().getXmppConnection(),
                                "conference."
                                        + XmppConnectionUtils.getXmppHost());
                if (!hostedRooms.isEmpty()) {
                    ArrayList<TabContactsModel> models = new ArrayList<TabContactsModel>();
                    for (HostedRoom hostedRoom : hostedRooms) {
                        RoomInfo roomInfo = MultiUserChat.getRoomInfo(
                                getXmppBinder().getXmppConnection(),
                                hostedRoom.getJid());
                        TabContactsModel model = new TabContactsModel();

                        MultiChatDesc desc = MultiChatDesc
                                .fromString(roomInfo.getDescription());

                        if (!YiUtils.isStringInvalid(roomInfo.getSubject())) {
                            model.setMsg(roomInfo.getSubject());
                        } else if (!YiUtils.isStringInvalid(desc.getName())) {
                            model.setMsg(desc.getName());
                        } else {
                            model.setMsg(roomInfo.getRoom());
                        }
                        model.setUser(roomInfo.getRoom());
                        model.setSubMsg(roomInfo.getDescription());
                        models.add(model);
                    }
                    Message message = getHandler().obtainMessage(
                            MSG_UPDATE_LIST, models);
                    message.sendToTarget();
                }
            } catch (Exception e) {
                // TODO: handle exception
                YiLog.getInstance().e(e, "load rooms failed");
            }
        }
    });
}
项目:aceim    文件:XMPPEntityAdapter.java   
public MultiChatRoom xmppHostedRoom2MultiChatRoom(HostedRoom room, String ownerJid, byte serviceId) {
    MultiChatRoom chat = new MultiChatRoom(room.getJid(), ownerJid, XMPPApiConstants.PROTOCOL_NAME, serviceId);
    chat.setName(room.getName());
    return chat;
}
项目:SmackStudy    文件:IXMPConnectionWrapper.java   
/**
 * 获取用户的所有聊天室
 * @return
 */
List<HostedRoom> getHostRooms();
项目:SmackStudy    文件:IXMPConnectionWrapper.java   
/**
 * 获取用户的所有聊天室
 * @return
 */
List<HostedRoom> getHostRooms();
项目:spark-svn-mirror    文件:ConferenceRoomBrowser.java   
/**
    * Returns a Collection of all rooms in the specified Conference Service.
    *
    * @param serviceName
    *            the name of the conference service.
    * @return a Collection of all rooms in the Conference service.
    * @throws Exception
    *             if a problem occurs while getting the room list
    */
   private static Collection<HostedRoom> getRoomList(String serviceName)
    throws Exception {
return MultiUserChat.getHostedRooms(SparkManager.getConnection(),
    serviceName);
   }