本文整理汇总了Java中org.jivesoftware.smack.RosterEntry.getGroups方法的典型用法代码示例。如果您正苦于以下问题:Java RosterEntry.getGroups方法的具体用法?Java RosterEntry.getGroups怎么用?Java RosterEntry.getGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.RosterEntry
的用法示例。
在下文中一共展示了RosterEntry.getGroups方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRosterEntry
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Adds a roster entry to the packet.
*
* @param rosterEntry a roster entry to add.
*/
public void addRosterEntry(RosterEntry rosterEntry) {
// Obtain a String[] from the roster entry groups name
List<String> groupNamesList = new ArrayList<String>();
String[] groupNames;
for (RosterGroup group : rosterEntry.getGroups()) {
groupNamesList.add(group.getName());
}
groupNames = groupNamesList.toArray(new String[groupNamesList.size()]);
// Create a new Entry based on the rosterEntry and add it to the packet
RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry(rosterEntry.getUser(),
rosterEntry.getName(), groupNames);
addRosterEntry(remoteRosterEntry);
}
示例2: addRosterEntry
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Adds a roster entry to the packet.
*
* @param rosterEntry
* a roster entry to add.
*/
public void addRosterEntry(RosterEntry rosterEntry) {
// Obtain a String[] from the roster entry groups name
List<String> groupNamesList = new ArrayList<String>();
String[] groupNames;
for (RosterGroup group : rosterEntry.getGroups()) {
groupNamesList.add(group.getName());
}
groupNames = groupNamesList.toArray(new String[groupNamesList.size()]);
// Create a new Entry based on the rosterEntry and add it to the packet
RemoteRosterEntry remoteRosterEntry = new RemoteRosterEntry(
rosterEntry.getUser(), rosterEntry.getName(), groupNames);
addRosterEntry(remoteRosterEntry);
}
示例3: ParcelableRoster
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public ParcelableRoster(RosterEntry entry, Presence presence) {
if(entry != null) {
// entry data 파싱
this.userID = entry.getUser();
this.userName = entry.getName();
for(RosterGroup rosterGroup : entry.getGroups()) { this.group = rosterGroup.getName(); }
}
if(presence != null) {
// 접속상태 확인
this.availablity = presence.getType().toString();
if(availablity.equals("available")) parseStatusString( presence.getStatus() );
if(presence.getMode() != null) this.mode = presence.getMode().toString();
}
}
示例4: removeRosterEntryFromGroups
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
private void removeRosterEntryFromGroups(RosterEntry rosterEntry)
throws XXException {// 从对应组中删除联系人,供外部服务调用
Collection<RosterGroup> oldGroups = rosterEntry.getGroups();
for (RosterGroup group : oldGroups) {
tryToRemoveUserFromGroup(group, rosterEntry);
}
}
示例5: removeRosterEntryFromGroups
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
private void removeRosterEntryFromGroups(RosterEntry rosterEntry)
throws AppException {// 从对应组中删除联系人,供外部服务调用
Collection<RosterGroup> oldGroups = rosterEntry.getGroups();
for (RosterGroup group : oldGroups) {
tryToRemoveUserFromGroup(group, rosterEntry);
}
}
示例6: removeRosterEntryFromGroups
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
private void removeRosterEntryFromGroups(RosterEntry rosterEntry)
throws YaximXMPPException {
Collection<RosterGroup> oldGroups = rosterEntry.getGroups();
for (RosterGroup group : oldGroups) {
tryToRemoveUserFromGroup(group, rosterEntry);
}
}
示例7: addUser
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Adds a single user to the ContactList.
*
* @param entry the <code>RosterEntry</code> of the the user.
*/
private void addUser(RosterEntry entry) {
ContactItem newContactItem = UIComponentRegistry.createContactItem(entry.getName(), null, entry.getUser());
if (entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from) {
// Ignore, since the new user is pending to be added.
for (RosterGroup group : entry.getGroups()) {
ContactGroup contactGroup = getContactGroup(group.getName());
if (contactGroup == null) {
contactGroup = addContactGroup(group.getName());
}
boolean isPending = entry.getType() == RosterPacket.ItemType.none || entry.getType() == RosterPacket.ItemType.from
&& RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus();
if (isPending) {
contactGroup.setVisible(true);
}
contactGroup.addContactItem(newContactItem);
}
return;
}
else {
moveToOffline(newContactItem);
}
// Update users icon
Presence presence = SparkManager.getConnection().getRoster().getPresence(entry.getUser());
try {
updateUserPresence(presence);
}
catch (Exception e) {
Log.error(e);
}
}