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


Java Roster.getEntries方法代码示例

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


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

示例1: displayfrndslist

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
public void displayfrndslist()
{
	Roster rster = conn.getRoster();
	Collection<RosterEntry> records = rster.getEntries();
	System.out.println("\nTotal friends: "+records.size());
	int i = 1;
	String status = null;
	for(RosterEntry r:records)
	{
	Presence presence = rster.getPresence(r.getUser());
	if ((presence != null)){
	if(rster.getPresence(r.getUser()).toString().contains("away"))
	status = "idle";
	else if (rster.getPresence(r.getUser()).toString().contains("unavailable"))
	status = "offline";
	else if (rster.getPresence(r.getUser()).toString().contains("dnd"))
	status = "busy";
	else
	status = "available";
	System.out.println("(#" + i + ")"+r.getUser()+"---"+status);
	i++;
	}
	}
}
 
开发者ID:Rahul-Batra,项目名称:Gmail-Plugin,代码行数:25,代码来源:GtalkConsole.java

示例2: getContactList

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
List<BuddyGroup> getContactList() {
	Roster roster = getInternalService().getConnection().getRoster();
	
	Collection<RosterEntry> entries = roster.getEntries();
	for (RosterEntry entry : entries) {
		if (entry.getName() == null) {
			try {
				VCard vc = new VCard();
				vc.load(getInternalService().getConnection(), entry.getUser());
				String nick = getNicknameFromVCard(vc);
				
				if (nick != null) {
					entry.setName(nick);
				}
			} catch (XMPPException e) {
				Logger.log(e);
			}
		}
	}
	
	List<BuddyGroup> groups = getInternalService().getService().getEntityAdapter().rosterGroupCollection2BuddyGroupList(roster.getGroups(), entries, getInternalService().getOnlineInfo().getProtocolUid(), getInternalService().getService().getContext(), getInternalService().getService().getServiceId());
	return groups;
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:24,代码来源:XMPPRosterListener.java

示例3: rosterToString

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
private String rosterToString(Roster roster) {
    StringBuilder res = new StringBuilder();
    for (RosterEntry entry : roster.getEntries()) {
        res.append(entry.toString());
        res.append(':');
        res.append(roster.getPresence(entry.getUser()).toString());
        res.append('\n');
    }
    return res.toString();
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:11,代码来源:RosterAction.java

示例4: getAllRosterEntry

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 获取所有好友
 * @param xmppConnection
 * @return
 */
public static List<RosterEntry> getAllRosterEntry(XMPPConnection xmppConnection){
	//获取花名册对象
	Roster roster=xmppConnection.getRoster();
	//获取所有好友
	Collection<RosterEntry> rosterEntries=roster.getEntries();
	return rosterEntries.stream().collect(Collectors.toList());
}
 
开发者ID:FanHuaRan,项目名称:SmackStudy,代码行数:13,代码来源:XMPPUtil.java

示例5: getAllEntries

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 返回所有用户信息 <RosterEntry>
 * @return List(RosterEntry)
 */
public static List<RosterEntry> getAllEntries(Roster roster) {
	List<RosterEntry> EntriesList = new ArrayList<RosterEntry>();
	Collection<RosterEntry> rosterEntry = roster.getEntries();
	Iterator<RosterEntry> i = rosterEntry.iterator();
	while (i.hasNext()){
		RosterEntry rosterentry=  (RosterEntry) i.next();
		Log.e("jj", "好友:"+rosterentry.getUser()+","+rosterentry.getName()+","+rosterentry.getType().name());
		EntriesList.add(rosterentry);
	}
	return EntriesList;
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:16,代码来源:XmppUtil.java

示例6: RosterExchange

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * Creates a new roster exchange package with the entries specified in roster.
 *
 * @param roster the roster to send to other XMPP entity.
 */
public RosterExchange(Roster roster) {
    // Add all the roster entries to the new RosterExchange 
    for (RosterEntry rosterEntry : roster.getEntries()) {
        this.addRosterEntry(rosterEntry);
    }
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:12,代码来源:RosterExchange.java

示例7: getNickname

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * 
 * ����jid����û��dz�
 * 
 * @param Jid
 * @param connection
 * @return
 */
public static User getNickname(String Jid, XMPPConnection connection) {
	Roster roster = connection.getRoster();
	for (RosterEntry entry : roster.getEntries()) {
		String params = entry.getUser();
		if (params.split("/")[0].equals(Jid)) {
			return transEntryToUser(entry, roster);
		}
	}
	return null;

}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:20,代码来源:ContacterManager.java

示例8: getAllEntries

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * ���������û���Ϣ <RosterEntry>
 * @return List(RosterEntry)
 */
public static List<RosterEntry> getAllEntries(Roster roster) {
	List<RosterEntry> EntriesList = new ArrayList<RosterEntry>();
	Collection<RosterEntry> rosterEntry = roster.getEntries();
	Iterator<RosterEntry> i = rosterEntry.iterator();
	while (i.hasNext())
		EntriesList.add(i.next());
	return EntriesList;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:13,代码来源:XmppService.java

示例9: isAvailable

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * Checking whether the user is avaiable online.
 *
 * @param roster
 * @param userName
 * @return
 */
private boolean isAvailable(Roster roster, String userName) {
    Collection<RosterEntry> entrySet = roster.getEntries();
    for (RosterEntry entry : entrySet) {
        if (entry.getUser().equals(userName)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:17,代码来源:MPAuthenticationProvider.java

示例10: getRosterEntries

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
private ArrayList<PRosterEntry> getRosterEntries()
{
	Log.d(TAG, "getRosterEntries");
	if (connection != null && connection.isConnected() == true)
	{
		Roster roster = connection.getRoster();
		Collection<RosterEntry> entries = roster.getEntries();

		ArrayList<PRosterEntry> data = new ArrayList<PRosterEntry>();

		for (RosterEntry rosterEntry : entries)
		{
			PRosterEntry re = new PRosterEntry();
			Presence p = roster.getPresence(rosterEntry.getUser());

			re.name = rosterEntry.getName();
			re.user = rosterEntry.getUser();
			re.presence = p.getType().name();

			data.add(re);
		}
		Log.d(TAG, "getRosterEntries " + data.size());
		return data;
	}
	else
	{
		return new ArrayList<PRosterEntry>();
	}
}
 
开发者ID:jonathangerbaud,项目名称:KlyphMessenger,代码行数:30,代码来源:MessengerService.java

示例11: loadVCards

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
private void loadVCards() {
    // Load vCard information.
    final Roster roster = SparkManager.getConnection().getRoster();
    for (RosterEntry entry : roster.getEntries()) {
        SparkManager.getVCardManager().getVCardFromMemory(entry.getUser());
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SoftPhonePlugin.java

示例12: RosterExchange

import org.jivesoftware.smack.Roster; //导入方法依赖的package包/类
/**
 * Creates a new roster exchange package with the entries specified in
 * roster.
 * 
 * @param roster
 *            the roster to send to other XMPP entity.
 */
public RosterExchange(Roster roster) {
	// Add all the roster entries to the new RosterExchange
	for (RosterEntry rosterEntry : roster.getEntries()) {
		this.addRosterEntry(rosterEntry);
	}
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:14,代码来源:RosterExchange.java

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