当前位置: 首页>>代码示例>>Java>>正文


Java MultiUserChat.getOccupant方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.muc.MultiUserChat.getOccupant方法的典型用法代码示例。如果您正苦于以下问题:Java MultiUserChat.getOccupant方法的具体用法?Java MultiUserChat.getOccupant怎么用?Java MultiUserChat.getOccupant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.muc.MultiUserChat的用法示例。


在下文中一共展示了MultiUserChat.getOccupant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: joined

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
@Override
public void joined(EntityFullJid entityFullJid) {
     XmppAddress xa = new XmppAddress(entityFullJid.toString());
     ChatGroup chatGroup = mChatGroupManager.getChatGroup(xa);
     MultiUserChat muc = mChatGroupManager.getMultiUserChat(entityFullJid.asBareJid().toString());

     Occupant occupant = muc.getOccupant(entityFullJid);
     Jid jidSource = (occupant != null) ? occupant.getJid() : null;
     if (jidSource != null)
     xa = new XmppAddress(jidSource.toString());
     else
     xa = new XmppAddress(entityFullJid.toString());

     Contact mucContact = new Contact(xa, xa.getUser(), Imps.Contacts.TYPE_NORMAL);
     chatGroup.notifyMemberJoined(entityFullJid.toString(),mucContact);
    if (occupant != null) {
        chatGroup.notifyMemberRoleUpdate(mucContact, occupant.getRole().name(), occupant.getAffiliation().toString());
    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:XmppConnection.java

示例2: getResourcePrivileges

import org.jivesoftware.smackx.muc.MultiUserChat; //导入方法依赖的package包/类
public Privilege getResourcePrivileges(Resource resource, Resource target){
    MultiUserChat chatroom = MultiUserChatManager.getInstanceFor(connection).getMultiUserChat(resource.getAddress());
    String occupantAddress = resource.getAddress()+"/"+resource.getName();
    Occupant o = chatroom.getOccupant(occupantAddress);
    switch(o.getRole()){
        case moderator: return Privilege.MODERATOR;
        default: return Privilege.USER;
    }
}
 
开发者ID:midoricorp,项目名称:jabbot,代码行数:10,代码来源:PrivilegeMapper.java

示例3: 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;
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:62,代码来源:XMPPEntityAdapter.java


注:本文中的org.jivesoftware.smackx.muc.MultiUserChat.getOccupant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。