本文整理汇总了Java中org.jivesoftware.smackx.muc.MultiUserChat.getRoomInfo方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChat.getRoomInfo方法的具体用法?Java MultiUserChat.getRoomInfo怎么用?Java MultiUserChat.getRoomInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.muc.MultiUserChat
的用法示例。
在下文中一共展示了MultiUserChat.getRoomInfo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRoomByJID
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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.MultiUserChat; //导入方法依赖的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.MultiUserChat; //导入方法依赖的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: createRoom
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public static Room createRoom(String name, MultiUserChat chat, XMPPConnection con) {
final Room r = new Room(name, chat);
try {
r.info = MultiUserChat.getRoomInfo(con, (name.indexOf("@") != -1 ? name : name + "@" + CONF_URL));
} catch (XMPPException e) {
e.printStackTrace();
}
r.subject = r.info.getSubject();
chat.addSubjectUpdatedListener(new SubjectUpdatedListener() {
public void subjectUpdated(String newsubject, String from) {
r.subject = newsubject;
}
});
for (String user : r.getConnectedUsers()) {
r.users.add(user);
}
r.startThread();
return r;
}
示例5: displayRoomInformation
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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();
}
示例6: getStatus
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
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()]);
}
示例7: toggleLock
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public void toggleLock(MultiUserChat muc) {
try {
if (!isLocked()) {
lock(muc);
}
else {
unlock(muc);
}
info = MultiUserChat.getRoomInfo(client.getConnection(), jid);
}
catch (XMPPException e) {
e.printStackTrace();
return;
}
}
示例8: getAllHostedRooms
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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;
}
示例9: getConferenceRoom
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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;
}
示例10: onSearchClick
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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();
}
}
示例11: isPasswordProtected
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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;
}
示例12: getNumberOfOccupants
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的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();
}