本文整理汇总了Java中org.jivesoftware.smackx.muc.RoomInfo类的典型用法代码示例。如果您正苦于以下问题:Java RoomInfo类的具体用法?Java RoomInfo怎么用?Java RoomInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoomInfo类属于org.jivesoftware.smackx.muc包,在下文中一共展示了RoomInfo类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRoomByJID
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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;
}
示例2: isRoomExist
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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;
}
}
示例3: getJoinedChatRooms
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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;
}
示例4: displayRoomInformation
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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();
}
示例5: JabberRoom
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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);
}
示例6: getAllHostedRooms
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
/**
* ��ȡ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;
}
示例7: getConferenceRoom
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
/**
* ��ȡ�����������л�����
* @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;
}
示例8: onSearchClick
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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();
}
}
示例9: chatRoomInfo2Buddy
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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;
}
示例10: setInfo
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
public void setInfo(RoomInfo info) {
this.info = info;
}
示例11: loadRooms
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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");
}
}
});
}
示例12: xmppRoomInfo2MultiChatRoom
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
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;
}
示例13: isPasswordProtected
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
/**
* 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;
}
示例14: getNumberOfOccupants
import org.jivesoftware.smackx.muc.RoomInfo; //导入依赖的package包/类
/**
* Return the number of occupants in a room.
*
* @param roomJID the full JID of the conference room. (ex. [email protected])
* @return the number of occupants in the room if available.
* @throws XMPPException thrown if an error occured during retrieval of the information.
*/
public static int getNumberOfOccupants(String roomJID) throws XMPPException {
final RoomInfo roomInfo = MultiUserChat.getRoomInfo(SparkManager.getConnection(), roomJID);
return roomInfo.getOccupantsCount();
}