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

项目:VASSAL-src    文件:JabberRoom.java   
public synchronized JabberRoom getRoomByJID(JabberClient client, String jid, String defaultName) {
  if (jid == null) {
    return null;
  }
  JabberRoom newRoom = jidToRoom.get(jid);
  if (newRoom == null) {
    String roomName = defaultName == null ? "" : defaultName; //$NON-NLS-1$
    RoomInfo info = null;
    try {
      info = MultiUserChat.getRoomInfo(client.getConnection(), jid);
    }
    // FIXME: review error message
    catch (XMPPException e) {
      e.printStackTrace();
    }
    newRoom = new JabberRoom(roomName, jid, info, client);
    jidToRoom.put(jid, newRoom);
  }
  return newRoom;
}
项目:vassal    文件:JabberRoom.java   
public synchronized JabberRoom getRoomByJID(JabberClient client, String jid, String defaultName) {
  if (jid == null) {
    return null;
  }
  JabberRoom newRoom = jidToRoom.get(jid);
  if (newRoom == null) {
    String roomName = defaultName == null ? "" : defaultName; //$NON-NLS-1$
    RoomInfo info = null;
    try {
      info = MultiUserChat.getRoomInfo(client.getConnection(), jid);
    }
    // FIXME: review error message
    catch (XMPPException e) {
      e.printStackTrace();
    }
    newRoom = new JabberRoom(roomName, jid, info, client);
    jidToRoom.put(jid, newRoom);
  }
  return newRoom;
}
项目:yiim_v2    文件:YiIMUtils.java   
public static boolean isRoomExist(String roomJid) throws Exception {
    XMPPConnection connection = XmppConnectionUtils.getInstance()
            .getRawConnection();
    if (connection == null || !connection.isAuthenticated()) {
        throw new Exception("no connections");
    }
    try {
        RoomInfo roomInfo = MultiUserChat.getRoomInfo(connection, roomJid);
        if (roomInfo != null) {
            return true;
        }
        return false;
    } catch (Exception e) {
        return false;
    }
}
项目:aceim    文件:XMPPChatListener.java   
List<MultiChatRoom> getJoinedChatRooms() {
    Iterator<String> joinedRooms = MultiUserChat.getJoinedRooms(getInternalService().getConnection(), getInternalService().getService().getProtocolUid());
    List<MultiChatRoom> multiChatBuddies = new ArrayList<MultiChatRoom>();
    for (; joinedRooms.hasNext();) {
        String roomJid = joinedRooms.next();
        try {
            RoomInfo info = MultiUserChat.getRoomInfo(getInternalService().getConnection(), roomJid);
            multiChatBuddies.add(getInternalService().getService().getEntityAdapter().chatRoomInfo2Buddy(info, getInternalService().getService().getProtocolUid(), getInternalService().getService().getServiceId(), true));
        } catch (XMPPException e) {
            Logger.log(e);
        }
    }

    for (final Buddy room : multiChatBuddies) {
        MultiUserChat chat = new MultiUserChat(getInternalService().getConnection(), room.getProtocolUid());
        fillWithListeners(chat);
        multichats.put(room.getProtocolUid(), chat);
    }

    return multiChatBuddies;
}
项目:spark-svn-mirror    文件:RoomBrowser.java   
public void displayRoomInformation(final String roomJID) {
    SwingWorker worker = new SwingWorker() {
        RoomInfo roomInfo = null;
        DiscoverItems items = null;

        public Object construct() {
            try {
                roomInfo = MultiUserChat.getRoomInfo(SparkManager.getConnection(), roomJID);


                ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
                items = manager.discoverItems(roomJID);
            }
            catch (XMPPException e) {
                Log.error(e);
            }
            return "ok";
        }

        public void finished() {
            setupRoomInformationUI(roomJID, roomInfo, items);
        }
    };

    worker.start();
}
项目:VASSAL-src    文件:JabberRoom.java   
private JabberRoom(String name, String jid, RoomInfo info, JabberClient client) {
  super(name);
  this.jid = jid;
  this.info = info;
  this.client = client;
  config.clear();
  config.put(CONFIG_NAME, name);
}
项目: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    文件:JabberRoom.java   
private JabberRoom(String name, String jid, RoomInfo info, JabberClient client) {
  super(name);
  this.jid = jid;
  this.info = info;
  this.client = client;
  config.clear();
  config.put(CONFIG_NAME, name);
}
项目:yiim_v2    文件:MultiRoomDiscoverActivity.java   
public void onSearchClick(View view) {
    if (isStringInvalid(mSearchEditText.getText())) {
        showMsgDialog(getString(R.string.err_empty_search_content),
                getString(R.string.str_ok));
        return;
    }

    ArrayList<TabContactsModel> models = new ArrayList<TabContactsModel>();
    try {
        String roomJid = YiHanziToPinyin.getPinYin(mSearchEditText
                .getText().toString())
                + "@conference."
                + XmppConnectionUtils.getXmppHost();
        RoomInfo roomInfo = MultiUserChat.getRoomInfo(getXmppBinder()
                .getXmppConnection(), roomJid);
        if (roomInfo != null) {
            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);
        }
    } catch (Exception e) {
        // TODO: handle exception
    }finally {
        Message message = getHandler().obtainMessage(MSG_UPDATE_LIST,
                models);
        message.sendToTarget();
    }
}
项目:aceim    文件:XMPPEntityAdapter.java   
public MultiChatRoom chatRoomInfo2Buddy(RoomInfo info, String ownerJid, byte serviceId, boolean joined) {
    MultiChatRoom chat = new MultiChatRoom(info.getRoom(), ownerJid, XMPPApiConstants.PROTOCOL_NAME, serviceId);
    chat.setName((info.getSubject()!= null && info.getSubject().length() > 0) ? info.getSubject() : info.getRoom());
    chat.getOnlineInfo().setXstatusName(info.getDescription());
    chat.setId(chat.getProtocolUid().hashCode());

    if (joined){
        chat.getOnlineInfo().getFeatures().putByte(ApiConstants.FEATURE_STATUS, (byte) 0);
    }

    return chat;
}
项目:VASSAL-src    文件:JabberRoom.java   
public void setInfo(RoomInfo info) {
  this.info = info;
}
项目:vassal    文件:JabberRoom.java   
public void setInfo(RoomInfo info) {
  this.info = info;
}
项目: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 xmppRoomInfo2MultiChatRoom(RoomInfo info, String ownerJid, byte serviceId) {
    MultiChatRoom chat = new MultiChatRoom(info.getRoom(), ownerJid, XMPPApiConstants.PROTOCOL_NAME, serviceId);
    chat.setName(info.getDescription());
    return chat;
}
项目:spark-svn-mirror    文件:ConferenceRoomBrowser.java   
/**
    * Returns true if the room is password protected or Members only
    *
    * @param roomjid
    * @return
    */
   private boolean isPasswordProtected(String roomjid) {
boolean result = false;
try {

    RoomInfo rif = MultiUserChat.getRoomInfo(
        SparkManager.getConnection(), roomjid);

    result = rif.isMembersOnly() || rif.isPasswordProtected();

} catch (XMPPException e) {

} catch (NumberFormatException nfe) {

}

return result;
   }