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


Java RosterEntry.getName方法代码示例

本文整理汇总了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);
  }
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:21,代码来源:RosterExchange.java

示例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;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:24,代码来源:ContacterManager.java

示例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;

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

示例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();
	}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:23,代码来源:MUCRoom.java

示例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);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:22,代码来源:RosterExchange.java

示例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();
        }
    }
 
开发者ID:rokoroku,项目名称:LoLMessenger,代码行数:17,代码来源:ParcelableRoster.java

示例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;
}
 
开发者ID:snuk182,项目名称:aceim,代码行数:24,代码来源:XMPPRosterListener.java

示例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();
}
 
开发者ID:victoryckl,项目名称:XmppTest,代码行数:18,代码来源:SmackImpl.java

示例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;
}
 
开发者ID:jingshauizh,项目名称:androidsummary,代码行数:16,代码来源:IMUtil.java

示例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;
}
 
开发者ID:kcbanner,项目名称:chief,代码行数:19,代码来源:Bot.java

示例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>();
	}
}
 
开发者ID:jonathangerbaud,项目名称:KlyphMessenger,代码行数:30,代码来源:MessengerService.java

示例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();
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:12,代码来源:SmackableImp.java


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