本文整理汇总了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++;
}
}
}
示例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;
}
示例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();
}
示例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());
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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>();
}
}
示例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());
}
}
示例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);
}
}
示例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;
}