本文整理汇总了Java中org.jivesoftware.smack.RosterEntry.getName方法的典型用法代码示例。如果您正苦于以下问题:Java RosterEntry.getName方法的具体用法?Java RosterEntry.getName怎么用?Java RosterEntry.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.RosterEntry
的用法示例。
在下文中一共展示了RosterEntry.getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: transEntryToUser
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* ����RosterEntry����һ��User
*
* @param entry
* @return
*/
public static User transEntryToUser(RosterEntry entry, Roster roster) {
User user = new User();
if (entry.getName() == null) {
user.setName(StringUtil.getUserNameByJid(entry.getUser()));
} else {
user.setName(entry.getName());
}
user.setJID(entry.getUser());
System.out.println(entry.getUser());
Presence presence = roster.getPresence(entry.getUser());
user.setFrom(presence.getFrom());
user.setStatus(presence.getStatus());
user.setSize(entry.getGroups().size());
user.setAvailable(presence.isAvailable());
user.setType(entry.getType());
return user;
}
示例3: getByUserJid
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* �����û�jid�õ��û�
*
* @param userJid
* @param nickname
*/
public static User getByUserJid(String userJId, XMPPConnection connection) {
Roster roster = connection.getRoster();
RosterEntry entry = connection.getRoster().getEntry(userJId);
if (null == entry) {
return null;
}
User user = new User();
if (entry.getName() == null) {
user.setName(StringUtil.getUserNameByJid(entry.getUser()));
} else {
user.setName(entry.getName());
}
user.setJID(entry.getUser());
System.out.println(entry.getUser());
Presence presence = roster.getPresence(entry.getUser());
user.setFrom(presence.getFrom());
user.setStatus(presence.getStatus());
user.setSize(entry.getGroups().size());
user.setAvailable(presence.isAvailable());
user.setType(entry.getType());
return user;
}
示例4: invite
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
public void invite(View v){
final List<RosterEntry> friends = XmppConnectionManager.getInstance().getAllEntrys(con.getRoster());
String[] names = new String[friends.size()];
for(int i=0;i<friends.size();i++){
RosterEntry entry = friends.get(i);
names[i] = entry.getName();
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("ѡ�����");
builder.setItems(names, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int pos) {
// TODO Auto-generated method stub
dialog.cancel();
// if(XmppTool.getInstance().isUserSupportMUC(friends.get(pos).getUser()))
muc.invite(friends.get(pos).getUser(), "�����ҵĻ����Ұ�");
// else
// Toast.makeText(MUCRoom.this, "�ú��������˲����������", Toast.LENGTH_SHORT).show();
}
});
builder.create().show();
}
示例5: 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);
}
示例6: 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();
}
}
示例7: getContactList
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的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;
}
示例8: 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();
}
示例9: transEntryToUser
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* 根据RosterEntry创建一个User
*/
public static IMUser transEntryToUser(RosterEntry entry, Roster roster) {
IMUser user = new IMUser();
if (entry.getName() == null) {
user.setName(getUserNameByJid(entry.getUser()));
} else {
user.setName(entry.getName());
}
user.setJid(entry.getUser());
Presence presence = roster.getPresence(entry.getUser());
user.setAvailable(presence.isAvailable());
return user;
}
示例10: jidToNickname
import org.jivesoftware.smack.RosterEntry; //导入方法依赖的package包/类
/**
* Convert a user's JID to a nickname using the roster.
* This does not work for JIDs from MUCs.
*
* @param jid the JID to convert to a nickname
* @return the name of the JID in the roster
*/
private String jidToNickname(String jid) {
String withoutResource = XMPP.getPlainJID(jid);
for (RosterEntry r : connection.getRoster().getEntries()) {
if (r.getUser().equals(withoutResource)) {
return r.getName();
}
}
return jid;
}
示例11: 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>();
}
}
示例12: 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();
}