本文整理汇总了Java中org.jivesoftware.smackx.muc.Occupant类的典型用法代码示例。如果您正苦于以下问题:Java Occupant类的具体用法?Java Occupant怎么用?Java Occupant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Occupant类属于org.jivesoftware.smackx.muc包,在下文中一共展示了Occupant类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: joined
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的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.Occupant; //导入依赖的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: fillMUCGroup
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
private void fillMUCGroup(Collection<Occupant> occupants, BuddyGroup group, Map<String, Buddy> map) {
for (Occupant occu : occupants){
String occupantJid = normalizeJID(occu.getJid());
Buddy occupant = map.remove(occupantJid);
if (occupant != null) {
group.getBuddyList().add(occupant);
}
}
}
开发者ID:snuk182,项目名称:aceim,代码行数:10,代码来源:XMPPEntityAdapter.java
示例4: isOwner
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Checks to see if the user is an owner of the specified room.
*
* @param groupChatRoom the group chat room.
* @param nickname the user's nickname.
* @return true if the user is an owner.
*/
public boolean isOwner(GroupChatRoom groupChatRoom, String nickname) {
Occupant occupant = getOccupant(groupChatRoom, nickname);
if (occupant != null) {
String affiliation = occupant.getAffiliation();
if ("owner".equals(affiliation)) {
return true;
}
}
return false;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:18,代码来源:UserManager.java
示例5: isMember
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Checks if the Occupant is a Member in this Room<br>
* <b>admins and owners are also members!!!</b>
* @param occupant
* @return true if member, else false
*/
public boolean isMember(Occupant occupant) {
if (occupant != null) {
String affiliation = occupant.getAffiliation();
if ("member".equals(affiliation) || affiliation.equals("owner")
|| affiliation.equals("admin")) {
return true;
}
}
return false;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:17,代码来源:UserManager.java
示例6: isModerator
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Checks to see if the Occupant is a moderator.
*
* @param groupChatRoom the group chat room.
* @param nickname the nickname of the user.
* @return true if the user is a moderator.
*/
public boolean isModerator(GroupChatRoom groupChatRoom, String nickname) {
Occupant occupant = getOccupant(groupChatRoom, nickname);
if (occupant != null) {
String role = occupant.getRole();
if ("moderator".equals(role)) {
return true;
}
}
return false;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:18,代码来源:UserManager.java
示例7: isOwnerOrAdmin
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Checks to see if the user is either an owner or admin of a room.
*
* @param groupChatRoom the group chat room.
* @param nickname the user's nickname.
* @return true if the user is either an owner or admin of the room.
*/
public boolean isOwnerOrAdmin(GroupChatRoom groupChatRoom, String nickname) {
Occupant occupant = getOccupant(groupChatRoom, nickname);
if (occupant != null) {
String affiliation = occupant.getAffiliation();
if ("owner".equals(affiliation) || "admin".equals(affiliation)) {
return true;
}
}
return false;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:18,代码来源:UserManager.java
示例8: getOccupant
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Returns the occupant of the room identified by their nickname.
*
* @param groupChatRoom the GroupChatRoom.
* @param nickname the users nickname.
* @return the Occupant found.
*/
public Occupant getOccupant(GroupChatRoom groupChatRoom, String nickname) {
String userJID = groupChatRoom.getRoomname() + "/" + nickname;
Occupant occ = null;
try {
occ = groupChatRoom.getMultiUserChat().getOccupant(userJID);
}
catch (Exception e) {
Log.error(e);
}
return occ;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:19,代码来源:UserManager.java
示例9: isAdmin
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
/**
* Checks the nickname of a user in a room and determines if they are an
* administrator of the room.
*
* @param groupChatRoom the GroupChatRoom.
* @param nickname the nickname of the user. Note: In MultiUserChats, users nicknames
* are defined by the resource([email protected]/derek) would have
* derek as a nickname.
* @return true if the user is an admin.
*/
public boolean isAdmin(GroupChatRoom groupChatRoom, String nickname) {
Occupant occupant = getOccupant(groupChatRoom, nickname);
if (occupant != null) {
String affiliation = occupant.getAffiliation();
if ("admin".equals(affiliation)) {
return true;
}
}
return false;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:21,代码来源:UserManager.java
示例10: hasVoice
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
public boolean hasVoice(GroupChatRoom groupChatRoom, String nickname) {
Occupant occupant = getOccupant(groupChatRoom, nickname);
if (occupant != null) {
String role = occupant.getRole();
if ("visitor".equals(role)) {
return false;
}
}
return true;
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:UserManager.java
示例11: banUser
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void banUser(String displayName) {
try {
Occupant occupant = chat.getOccupant(userMap.get(displayName));
if (occupant != null) {
String bareJID = StringUtils
.parseBareAddress(occupant.getJid());
chat.banUser(bareJID, Res
.getString("message.you.have.been.banned"));
}
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().
insertNotificationMessage("No can do "+e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:15,代码来源:GroupChatParticipantList.java
示例12: grantMember
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void grantMember(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.grantMembership(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:12,代码来源:GroupChatParticipantList.java
示例13: revokeMember
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void revokeMember(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.revokeMembership(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:GroupChatParticipantList.java
示例14: grantAdmin
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void grantAdmin(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.grantAdmin(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:GroupChatParticipantList.java
示例15: revokeAdmin
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void revokeAdmin(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.revokeAdmin(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:GroupChatParticipantList.java
示例16: grantOwner
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void grantOwner(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.grantOwnership(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:GroupChatParticipantList.java
示例17: revokeOwner
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void revokeOwner(String nickname) {
try {
Occupant o = userManager.getOccupant(groupChatRoom,nickname);
nickname = StringUtils.parseBareAddress(o.getJid());
chat.revokeOwnership(nickname);
} catch (XMPPException e) {
groupChatRoom.getTranscriptWindow().insertNotificationMessage(
"No can do " + e.getMessage(), ChatManager.ERROR_COLOR);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:11,代码来源:GroupChatParticipantList.java
示例18: xmppMUCOccupants2mcrOccupants
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的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
示例19: addParticipant
import org.jivesoftware.smackx.muc.Occupant; //导入依赖的package包/类
protected void addParticipant(final String participantJID, Presence presence, String userJID) {
// Remove reference to invitees
for (String displayName : invitees.keySet()) {
String jid = SparkManager.getUserManager().getJIDFromDisplayName(
displayName);
Occupant occ = chat.getOccupant(participantJID);
if (occ != null) {
String actualJID = occ.getJid();
if (actualJID.equals(jid)) {
removeUser(displayName);
}
}
}
String nickname = StringUtils.parseResource(participantJID);
String affiliation = parseRoleFromPacket(presence)[0];
String userRole = parseRoleFromPacket(presence)[1];
usersandRoles.put(participantJID, affiliation+","+userRole);
Icon icon = null;
if (_localPreferences.isShowingRoleIcons()) {
icon = getIconForRole(userRole, affiliation);
} else {
Presence jidPresence = PresenceManager.getPresence(userJID);
icon = PresenceManager.getIconFromPresence(jidPresence);
if (icon == null) {
icon = SparkRes.getImageIcon(SparkRes.GREEN_BALL);
}
}
if (!exists(nickname)) {
addUser(icon, nickname);
} else {
int index = getIndex(nickname);
if (index != -1) {
final JLabel userLabel = new JLabel(nickname, icon,
JLabel.HORIZONTAL);
model.setElementAt(userLabel, index);
}
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:46,代码来源:GroupChatParticipantList.java
注:本文中的org.jivesoftware.smackx.muc.Occupant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论