本文整理汇总了Java中org.jivesoftware.smack.RosterEntry.getUser方法的典型用法代码示例。如果您正苦于以下问题:Java RosterEntry.getUser方法的具体用法?Java RosterEntry.getUser怎么用?Java RosterEntry.getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.RosterEntry
的用法示例。
在下文中一共展示了RosterEntry.getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: namesToJIDs
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Names to ji ds.
*
* @param devices
* the devices
* @return the string[]
*/
public String[] namesToJIDs(String... devices)
{
String[] jids = new String[devices.length];
for (RosterEntry re : xmpp.getRoster().getEntries())
{
for (int i = 0; i < devices.length; i++)
{
if (re.getName().equals(devices[i]))
{
jids[i] = re.getUser();
}
}
}
return jids;
}
示例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: 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);
}
示例4: entriesAdded
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public void entriesAdded(Collection<String> addresses) {
for (String addr : addresses) {
RosterEntry entry = getSession().conn.getRoster().getEntry(addr);
getSession().getBuddyManager().storeBuddy(new XMPPBuddy(getSession().getBuddyManager(), entry.getUser(), entry.getName(), entry.getGroups(), entry));
// Facebook does not support presence probes in their XMPP implementation. See http://developers.facebook.com/docs/chat#features
if (!TransportType.facebook.equals(getSession().getTransport().getType())) {
//ProbePacket probe = new ProbePacket(getSession().getJID()+"/"+getSession().xmppResource, entry.getUser());
ProbePacket probe = new ProbePacket(null, entry.getUser());
Log.debug("XMPP: Sending the following probe packet: "+probe.toXML());
try {
getSession().conn.sendPacket(probe);
}
catch (IllegalStateException e) {
Log.debug("XMPP: Not connected while trying to send probe.");
}
}
}
}
示例5: 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();
}
}
示例6: getContactFromRosterEntry
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Get a contact from a RosterEntry.
* @param entry a roster entry containing information for the contact.
* @return a contact for this entry.
*/
private Contact getContactFromRosterEntry(RosterEntry entry) {
String user = entry.getUser();
Contact c = new Contact(user);
Presence p = mAdaptee.getPresence(user);
if (p.getStatus() == null || "".equals(p.getStatus()))
p.setStatus(mDefaultStatusMessages.get(Status.getStatusFromPresence(p)));
c.setStatus(p);
try {
c.setGroups(entry.getGroups());
} catch (NullPointerException e) {
Log.d(TAG, "Group list not ready", e);
}
Iterator<Presence> iPres = mAdaptee.getPresences(user);
while (iPres.hasNext()) {
p = iPres.next();
if (!p.getType().equals(Presence.Type.unavailable))
c.addRes(StringUtils.parseResource(p.getFrom()));
}
c.setName(entry.getName());
c.setAvatarId(mAvatarIdmap.get(user));
return c;
}
示例7: addAuditor
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public boolean addAuditor(String id) {
RosterEntry entry = getEntry(id);
if (entry == null) {
error("can not add auditor %s", id);
return false;
}
String jabberID = entry.getUser();
auditors.add(jabberID);
broadcast(String.format("added buddy %s", entry.getName()));
return true;
}
示例8: getJabberID
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public String getJabberID(String id) {
RosterEntry entry = getEntry(id);
String jabberID;
if (entry == null) {
// error("could not get entry for id - using %s", id);
jabberID = id;
} else {
jabberID = entry.getUser();
}
return jabberID;
}
示例9: removeAuditor
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public boolean removeAuditor(String id) {
RosterEntry entry = getEntry(id);
if (entry == null) {
error("can not remove auditor %s", id);
return false;
}
String jabberID = entry.getUser();
auditors.remove(jabberID);
return true;
}
示例10: getNickname
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的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;
}
示例11: getName
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* 获取联系人名称
*
* @param rosterEntry
* @return
*/
private String getName(RosterEntry rosterEntry) {
String name = rosterEntry.getName();
if (name != null && name.length() > 0) {
return name;
}
name = StringUtils.parseName(rosterEntry.getUser());
if (name.length() > 0) {
return name;
}
return rosterEntry.getUser();
}
示例12: fetchRosterEntries
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/** fetchRosterEntries
*
*/
private void fetchRosterEntries() {
Collection<RosterEntry> rosterEntries = roster.getEntries();
for (RosterEntry entry : rosterEntries) {
Presence presence = roster.getPresence(entry.getUser());
Contact contact;
contact = new Contact(entry.getUser(), presence.isAvailable());
eventbus.contactEvent(contact);
}
}
示例13: nicknameToJID
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Converts a nickname to a JID by looking it up in the roster.
*
* @param nickname the nickname to convert
* @return the JID of the nickname in the roster, or the nickname if it wasn't found
*/
private String nicknameToJID(String nickname) {
for (RosterEntry r : connection.getRoster().getEntries()) {
if (r.getName().equals(nickname))
return r.getUser();
}
return nickname;
}
示例14: getRosterEntries
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的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>();
}
}
示例15: getName
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
private String getName(RosterEntry rosterEntry) {
String name = rosterEntry.getName();
if (name != null && name.length() > 0) {
return name;
}
name = StringUtils.parseName(rosterEntry.getUser());
if (name.length() > 0) {
return name;
}
return rosterEntry.getUser();
}