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


Java Roster.getGroups方法代码示例

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


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

示例1: findFriends

import org.jivesoftware.smack.Roster; //导入方法依赖的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();
	}
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:26,代码来源:ConstactFragment.java

示例2: getGroups

import org.jivesoftware.smack.Roster; //导入方法依赖的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;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:23,代码来源:ContacterManager.java

示例3: getRosterGroups

import org.jivesoftware.smack.Roster; //导入方法依赖的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;
}
 
开发者ID:jingshauizh,项目名称:androidsummary,代码行数:19,代码来源:IMUtil.java

示例4: getGroups

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 返回所有组信息 <RosterGroup>
 * @return List(RosterGroup)
 */
public static List<RosterGroup> getGroups(Roster roster) {
	List<RosterGroup> groupsList = new ArrayList<RosterGroup>();
	Collection<RosterGroup> rosterGroup = roster.getGroups();
	Iterator<RosterGroup> i = rosterGroup.iterator();
	while (i.hasNext())
		groupsList.add(i.next());
	return groupsList;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:13,代码来源:XmppUtil.java

示例5: getGroupNames

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * �����������
 * 
 * @return
 */
public static List<String> getGroupNames(Roster roster) {

	List<String> groupNames = new ArrayList<String>();
	for (RosterGroup group : roster.getGroups()) {
		groupNames.add(group.getName());
	}
	return groupNames;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:14,代码来源:ContacterManager.java

示例6: getGroupNames

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 获得所有组名
 * @return
 */
public static List<String> getGroupNames(Roster roster) {

	List<String> groupNames = new ArrayList<String>();
	for (RosterGroup group : roster.getGroups()) {
		groupNames.add(group.getName());
	}
	return groupNames;
}
 
开发者ID:jingshauizh,项目名称:androidsummary,代码行数:13,代码来源:IMUtil.java

示例7: getAllRosterGroup

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 获取所有分组
 * @param xmppConnection
 * @return
 */
public static List<RosterGroup> getAllRosterGroup(XMPPConnection xmppConnection){
	Roster roster=xmppConnection.getRoster();
	Collection<RosterGroup> rosterGroups=roster.getGroups();
	return rosterGroups.stream().collect(Collectors.toList());
}
 
开发者ID:FanHuaRan,项目名称:SmackStudy,代码行数:11,代码来源:XMPPUtil.java

示例8: addContactItem

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
private void addContactItem(final ContactGroup contactGroup, final ContactItem item) {
    ContactItem newContact = UIComponentRegistry.createContactItem(Res.getString("group.empty"), null, null);
    newContact.setPresence(item.getPresence());
    newContact.setIcon(item.getIcon());
    newContact.getNicknameLabel().setFont(item.getNicknameLabel().getFont());

    if (!PresenceManager.isOnline(item.getJID())) {
        contactGroup.addOfflineContactItem(item.getAlias(), item.getNickname(), item.getJID(), null);
    }
    else {
        contactGroup.addContactItem(newContact);
    }
    contactGroup.clearSelection();
    contactGroup.fireContactGroupUpdated(); //Updating group title

    final ContactGroup oldGroup = getContactGroup(item.getGroupName());

    SwingWorker worker = new SwingWorker() {
        public Object construct() {
            Roster roster = SparkManager.getConnection().getRoster();
            RosterEntry entry = roster.getEntry(item.getJID());

            RosterGroup groupFound = null;

            for (RosterGroup group : roster.getGroups()) {
                if (group.getName().equals(contactGroup.getGroupName())) {
                    try {
                        groupFound = group;
                        group.addEntry(entry);
                    }
                    catch (XMPPException e1) {
                        Log.error(e1);
                        return false;
                    }
                }
            }

            // This is a new group
            if (groupFound == null) {
                groupFound = roster.createGroup(contactGroup.getGroupName());
                try {
                    groupFound.addEntry(entry);
                }
                catch (XMPPException e) {
                    Log.error(e);
                }
            }
            return true;
        }

        public void finished() {
            if ((Boolean)get()) {
                // Now try and remove the group from the old one.
                removeContactItem(oldGroup, item);
            }
        }

    };

    worker.start();
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:62,代码来源:ContactGroupTransferHandler.java

示例9: removeContactItem

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
public boolean removeContactItem(ContactGroup contactGroup, ContactItem item) {
    if (contactGroup.isSharedGroup()) {
        return false;
    }

    if (contactGroup.isUnfiledGroup()) {
        contactGroup.removeContactItem(item);
        contactGroup.fireContactGroupUpdated();
        return true;
    }

    // Remove entry from Roster Group
    Roster roster = SparkManager.getConnection().getRoster();
    RosterEntry entry = roster.getEntry(item.getJID());

    RosterGroup rosterGroup = null;

    for (RosterGroup group : roster.getGroups()) {
        if (group.getName().equals(contactGroup.getGroupName())) {
            try {
                rosterGroup = group;
                group.removeEntry(entry);
            }
            catch (XMPPException e1) {
                return false;
            }
        }
    }

    if (rosterGroup == null) {
        return false;
    }

    if (!rosterGroup.contains(entry)) {
        contactGroup.removeContactItem(item);
        contactGroup.fireContactGroupUpdated(); //Updating group title
        return true;
    }

    return false;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:42,代码来源:ContactGroupTransferHandler.java

示例10: getUsers

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
public List<UserInfo> getUsers(){
	
	Roster roster = getConnection().getRoster();
	Collection<RosterGroup> groups = roster.getGroups();
	Collection<RosterEntry> entries = roster.getEntries();
	
	List<UserInfo> users = null;
	
	if(entries != null && !entries.isEmpty()){
		users = new ArrayList<UserInfo>();
		for (RosterEntry rosterEntry : entries) {
			
			Presence presence = roster.getPresence(rosterEntry.getUser()); 
			
			UserInfo user = new UserInfo();
			user.setName(rosterEntry.getName());
			user.setUser(rosterEntry.getUser());
			user.setStatus(presence.getStatus());
			user.setFrom(presence.getFrom());
			
			users.add(user);
		}
	}
	
	
	return users;
	
}
 
开发者ID:phoenixNirvana,项目名称:NewCommunication-Android,代码行数:29,代码来源:XmppManager.java


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