本文整理汇总了Java中org.jivesoftware.smackx.muc.MultiUserChat.getOccupants方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChat.getOccupants方法的具体用法?Java MultiUserChat.getOccupants怎么用?Java MultiUserChat.getOccupants使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.muc.MultiUserChat
的用法示例。
在下文中一共展示了MultiUserChat.getOccupants方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customerIsTyping
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public static void customerIsTyping(String chatID) {
ChatSession chatSession = getChatSession(chatID);
if (chatSession == null) {
return;
}
final MultiUserChat chat = chatSession.getGroupChat();
final Iterator iter = chat.getOccupants();
while (iter.hasNext()) {
String from = (String)iter.next();
String tFrom = StringUtils.parseResource(from);
String nickname = chat.getNickname();
if (tFrom != null && !tFrom.equals(nickname)) {
MessageEventManager messageEventManager = chatSession.getMessageEventManager();
messageEventManager.sendComposingNotification(from, "l0k1");
}
}
}
示例2: getRoomMembers
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public Iterator<String> getRoomMembers(String roomJid) {
MultiUserChat chat = null;
synchronized (mService.get().mLocker) {
chat = mService.get().mMultiUserChats.get(roomJid);
}
if (chat == null) {
chat = mService.get().initMultiUserChat(roomJid, false);
}
if (chat != null) {
try {
return chat.getOccupants();
} catch (Exception e) {
// TODO: handle exception
}
}
return null;
}
示例3: findUsersInMultiUserChat
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
* 查询聊天室所有成员的用户名
* @param multiUserChat
* @return
*/
public static List<String> findUsersInMultiUserChat( MultiUserChat multiUserChat){
List<String> listUser = new ArrayList<String>();
Iterator<String> it = multiUserChat.getOccupants();
// 遍历出聊天室人员名称
while (it.hasNext()) {
// 聊天室成员名字
String name = StringUtils.parseResource(it.next());
listUser.add(name);
}
return listUser;
}
示例4: getMUCMembers
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
* ��ȡ�����ҳ�Ա����
*
* @param muc
* @return
*/
public List<String> getMUCMembers(MultiUserChat muc) {
List<String> members = new ArrayList<String>();
Iterator<String> it = muc.getOccupants();
while (it.hasNext()) {
String name = StringUtils.parseResource(it.next());
SLog.i("��Ա����", name);
members.add(name);
}
return members;
}
示例5: customerIsTyping
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
/**
* Notifies all MessageEventHandlers that the customer is typing a message.
*/
public void customerIsTyping() {
final MultiUserChat chat = chatSession.getGroupChat();
final Iterator iter = chat.getOccupants();
while (iter.hasNext()) {
String from = (String) iter.next();
String tFrom = StringUtils.parseResource(from);
String nickname = chat.getNickname();
if (tFrom != null && !tFrom.equals(nickname)) {
MessageEventManager messageEventManager = chatSession.getMessageEventManager();
messageEventManager.sendComposingNotification(from, "l0k1");
}
}
}
示例6: xmppMUCOccupants2mcrOccupants
import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public List<BuddyGroup> xmppMUCOccupants2mcrOccupants(XMPPServiceInternal service, MultiUserChat muc, boolean loadIcons) {
List<BuddyGroup> groups = new ArrayList<BuddyGroup>();
String ownerJid = service.getOnlineInfo().getProtocolUid();
BuddyGroup moderators = new BuddyGroup(Integer.toString(2), ownerJid, service.getOnlineInfo().getServiceId());
BuddyGroup participants = new BuddyGroup(Integer.toString(5), ownerJid, service.getOnlineInfo().getServiceId());
BuddyGroup other = new BuddyGroup(Integer.toString(7), ownerJid, service.getOnlineInfo().getServiceId());
BuddyGroup all = new BuddyGroup(Integer.toString(8), ownerJid, service.getOnlineInfo().getServiceId());
//TODO
moderators.setName("Moderators");
participants.setName("Participants");
other.setName("Other");
all.setName("All");
Map<String, Buddy> buddies = new HashMap<String, Buddy>();
Iterator<String> it = muc.getOccupants();
for (;it.hasNext();){
String occupant = it.next();
String buddyId;
Occupant occu = muc.getOccupant(occupant);
if (occu != null && occu.getJid() != null){
buddyId = normalizeJID(occu.getJid());
if (loadIcons){
try {
service.loadCard(buddyId);
} catch (Exception e) {
Logger.log(e);
}
}
} else {
buddyId = occupant;
}
Buddy buddy = new Buddy(buddyId, ownerJid, XMPPApiConstants.PROTOCOL_NAME, service.getOnlineInfo().getServiceId());
buddy.setName(buddyId.equals(occupant) ? StringUtils.parseResource(occupant) : occu.getNick());
buddy.getOnlineInfo().getFeatures().putByte(ApiConstants.FEATURE_STATUS, xmppPresence2UserStatus(muc.getOccupantPresence(occupant)));
buddies.put(buddy.getProtocolUid(), buddy);
buddy.setId(buddyId.hashCode());
all.getBuddyList().add(buddy);
}
try {
fillMUCGroup(muc.getParticipants(), participants, buddies);
fillMUCGroup(muc.getModerators(), moderators, buddies);
other.getBuddyList().addAll(buddies.values());
groups.add(moderators);
groups.add(participants);
groups.add(other);
} catch (Exception e1) {
Logger.log(e1);
}
if (groups.size() < 1){
groups.add(all);
}
return groups;
}