本文整理汇总了Java中org.jivesoftware.smack.RosterGroup.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java RosterGroup.getEntries方法的具体用法?Java RosterGroup.getEntries怎么用?Java RosterGroup.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.RosterGroup
的用法示例。
在下文中一共展示了RosterGroup.getEntries方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntrysByGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* 获取某一个分组的成员
*
* @param
* @param groupName
* @return
*/
public List<RosterEntry> getEntrysByGroup(String groupName) {
Roster roster = getCon().getRoster();
List<RosterEntry> list = new ArrayList<RosterEntry>();
RosterGroup group = roster.getGroup(groupName);
Collection<RosterEntry> rosterEntiry = group.getEntries();
Iterator<RosterEntry> iter = rosterEntiry.iterator();
while (iter.hasNext()) {
RosterEntry entry = iter.next();
SLog.i("xmpptool", entry.getUser() + "\t" + entry.getName() + entry.getType().toString());
if (entry.getType().toString().equals("both")) {
list.add(entry);
}
}
return list;
}
示例2: findFriends
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
public void findFriends() {
try {
listGroup=new ArrayList<Group>();
XMPPConnection conn = QQApplication.xmppConnection;
Roster roster = conn.getRoster();
Collection<RosterGroup> groups = roster.getGroups();
for (RosterGroup group : groups) {
Group mygroup=new Group();
mygroup.setGroupName(group.getName());
Collection<RosterEntry> entries = group.getEntries();
List<Child> childList=new ArrayList<Child>();
for (RosterEntry entry : entries) {
if(entry.getType().name().equals("both")){
Child child=new Child();
child.setUsername(entry.getUser().split("@")[0]);
childList.add(child);
}
}
mygroup.setChildList(childList);
listGroup.add(mygroup);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: getGroups
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* ������з�����ϵ��
*
* @return
*/
public static List<MRosterGroup> getGroups(Roster roster) {
if (contacters == null)
throw new RuntimeException("contacters is null");
List<MRosterGroup> groups = new ArrayList<ContacterManager.MRosterGroup>();
groups.add(new MRosterGroup(Constant.ALL_FRIEND, getContacterList()));
for (RosterGroup group : roster.getGroups()) {
List<User> groupUsers = new ArrayList<User>();
for (RosterEntry entry : group.getEntries()) {
groupUsers.add(contacters.get(entry.getUser()));
}
groups.add(new MRosterGroup(group.getName(), groupUsers));
}
groups.add(new MRosterGroup(Constant.NO_GROUP_FRIEND,
getNoGroupUserList(roster)));
return groups;
}
示例4: getRosterGroups
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* 获得花名册包含的分组列表
*/
public static List<IMRosterGroup> getRosterGroups(Roster roster) {
List<IMRosterGroup> groups = new ArrayList<IMRosterGroup>();
groups.add(new IMRosterGroup(IMConstant.ALL_FRIEND, getContacterList()));
for (RosterGroup group : roster.getGroups()) {
List<IMUser> users = new ArrayList<IMUser>();
for (RosterEntry entry : group.getEntries()) {
users.add(contacters.get(entry.getUser()));
}
groups.add(new IMRosterGroup(group.getName(), users));
}
groups.add(new IMRosterGroup(IMConstant.NO_GROUP_FRIEND,
getNoGroupUserList(roster)));
return groups;
}
示例5: TransferGroupUI
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
public TransferGroupUI(String groupName) {
setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
setBackground(Color.white);
final Roster roster = SparkManager.getConnection().getRoster();
final RosterGroup rosterGroup = roster.getGroup(groupName);
final List<RosterEntry> entries = new ArrayList<RosterEntry>(rosterGroup.getEntries());
Collections.sort(entries, entryComparator);
for (RosterEntry entry : entries) {
final UserEntry userEntry = new UserEntry(entry);
userEntries.add(userEntry);
add(userEntry);
}
}
示例6: getRosterEntrysForGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* 获取某个分组下的所有好友
* @param xmppConnection
* @param groupName
* @return
*/
public static List<RosterEntry> getRosterEntrysForGroup(XMPPConnection xmppConnection,String groupName){
// 获取花名册对象
Roster roster = xmppConnection.getRoster();
// 获取所有好友
RosterGroup rosterGroup = roster.getGroup(groupName);
Collection<RosterEntry> rosterEntries = rosterGroup.getEntries();
return rosterEntries.stream().collect(Collectors.toList());
}
示例7: getRosterEntrysForGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* 获取某个组里面的所有好友
* @param xmppConnection
* @param groupName 组名
* @return
*/
public static List<RosterEntry> getRosterEntrysForGroup(XMPPConnection xmppConnection, String groupName) {
List<RosterEntry> rosterEntries = new ArrayList<RosterEntry>();
RosterGroup rosterGroup = xmppConnection.getRoster().getGroup(groupName);
Collection<RosterEntry> rosterEntry = rosterGroup.getEntries();
Iterator<RosterEntry> i = rosterEntry.iterator();
while (i.hasNext()) {
rosterEntries.add(i.next());
}
return rosterEntries;
}
示例8: getEntriesByGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* 返回相应(groupName)组里的所有用户<RosterEntry>
* @return List(RosterEntry)
*/
public static List<RosterEntry> getEntriesByGroup(Roster roster,
String groupName) {
List<RosterEntry> EntriesList = new ArrayList<RosterEntry>();
RosterGroup rosterGroup = roster.getGroup(groupName);
Collection<RosterEntry> rosterEntry = rosterGroup.getEntries();
Iterator<RosterEntry> i = rosterEntry.iterator();
while (i.hasNext())
EntriesList.add(i.next());
return EntriesList;
}
示例9: getDeviceNamesOnline
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* Gets the device names online.
*
* @param deviceType
* the device type
* @return the device names online
*/
public List<String> getDeviceNamesOnline(String deviceType)
{
List<String> list = new ArrayList<String>();
if (connection == null)
{
return list;
}
Roster roster = connection.getRoster();
if (roster == null)
{
return list;
}
try
{
RosterGroup rg = roster.getGroup(deviceType);
for (RosterEntry re : rg.getEntries())
{
Presence p = connection.getRoster().getPresence(re.getUser());
if (p.isAvailable())
{
list.add(re.getName());
}
}
}
catch (NullPointerException e)
{
}
return list;
}
示例10: send
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* Sends a roster group to userID. All the entries of the group will be sent to the
* target user.
*
* @param rosterGroup the roster group to send
* @param targetUserID the user that will receive the roster entries
*/
public void send(RosterGroup rosterGroup, String targetUserID) {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
RosterExchange rosterExchange = new RosterExchange();
for (RosterEntry entry : rosterGroup.getEntries()) {
rosterExchange.addRosterEntry(entry);
}
msg.addExtension(rosterExchange);
// Send the message that contains the roster
con.sendPacket(msg);
}
示例11: send
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
/**
* Sends a roster group to userID. All the entries of the group will be sent
* to the target user.
*
* @param rosterGroup
* the roster group to send
* @param targetUserID
* the user that will receive the roster entries
*/
public void send(RosterGroup rosterGroup, String targetUserID) {
// Create a new message to send the roster
Message msg = new Message(targetUserID);
// Create a RosterExchange Package and add it to the message
RosterExchange rosterExchange = new RosterExchange();
for (RosterEntry entry : rosterGroup.getEntries()) {
rosterExchange.addRosterEntry(entry);
}
msg.addExtension(rosterExchange);
// Send the message that contains the roster
con.sendPacket(msg);
}
示例12: rosterGroup2BuddyGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
public BuddyGroup rosterGroup2BuddyGroup(RosterGroup entry, Collection<RosterEntry> buddies, String ownerUid, Context context, byte serviceId){
if (entry == null){
return null;
}
BuddyGroup group = new BuddyGroup(entry.getName(), ownerUid, serviceId);
group.setName(entry.getName());
for (RosterEntry buddy: entry.getEntries()){
buddies.remove(buddy);
group.getBuddyList().add(rosterEntry2Buddy(buddy, ownerUid, context, serviceId));
}
return group;
}
示例13: rosterGroup2BuddyGroup
import org.jivesoftware.smack.RosterGroup; //导入方法依赖的package包/类
@Override
public BuddyGroup rosterGroup2BuddyGroup(RosterGroup entry, Collection<RosterEntry> buddies, String ownerUid, Context context, byte serviceId){
if (entry == null){
return null;
}
BuddyGroup group = new BuddyGroup(entry.getName(), ownerUid, serviceId);
group.setName(entry.getName());
for (RosterEntry buddy: entry.getEntries()){
buddies.remove(buddy);
group.getBuddyList().add(rosterEntry2Buddy(buddy, ownerUid, context, serviceId));
}
return group;
}