當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.parseName方法代碼示例

本文整理匯總了Java中org.jivesoftware.smack.util.StringUtils.parseName方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.parseName方法的具體用法?Java StringUtils.parseName怎麽用?Java StringUtils.parseName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jivesoftware.smack.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.parseName方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: presenceChanged

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
@Override
public void presenceChanged(Presence presence)
{
	log.fine("Presence change from " + presence.getFrom());
	String name = StringUtils.parseName(presence.getFrom());
	if (!isMultiplicityDevice(name))
	{
		return;
	}

	if (presence.isAvailable())
	{
		notifyDeviceAvailable(name);
	}
	else
	{
		notifyDeviceUnavailable(name);
	}
}
 
開發者ID:synergynet,項目名稱:synergynet3.1,代碼行數:20,代碼來源:PresenceManager.java

示例2: getOfflnMessage

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * 獲取用戶的所有離線消息
 * @param xmppConnection
 * @return
 */
public static Map<String, List<HashMap<String, String>>> getOfflnMessage(XMPPConnection xmppConnection) {
    Map<String, List<HashMap<String, String>>> offlineMsgs = null;
    try {
        OfflineMessageManager offlineManager = new OfflineMessageManager(xmppConnection);
        Iterator<Message> it = offlineManager.getMessages();
        offlineMsgs = new HashMap<String, List<HashMap<String, String>>>();
        while (it.hasNext()) {
            Message message = it.next();
            String fromUser = StringUtils.parseName(message.getFrom());
            HashMap<String, String> histrory = new HashMap<String, String>();
            histrory.put("useraccount",StringUtils.parseName(xmppConnection.getUser()));
            histrory.put("friendaccount", fromUser);
            histrory.put("info", message.getBody());
            histrory.put("type", "left");
            if (offlineMsgs.containsKey(fromUser)) {
                offlineMsgs.get(fromUser).add(histrory);
            } else {
                List<HashMap<String, String>> temp = new ArrayList<HashMap<String, String>>();
                temp.add(histrory);
                offlineMsgs.put(fromUser, temp);
            }
        }
        offlineManager.deleteMessages();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return offlineMsgs;
}
 
開發者ID:FanHuaRan,項目名稱:SmackStudy,代碼行數:34,代碼來源:XMPPUtil.java

示例3: getOfflnMessage

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
 * 獲取用戶的所有離線消息
 * @param xmppConnection
 * @return
 */
public  static  Map<String, List<HashMap<String, String>>> getOfflnMessage(XMPPConnection xmppConnection) {
    Map<String, List<HashMap<String, String>>> offlineMsgs = null;
    try {
        OfflineMessageManager offlineManager = new OfflineMessageManager(xmppConnection);
        Iterator<Message> it = offlineManager.getMessages();
        offlineMsgs = new HashMap<String, List<HashMap<String, String>>>();
        while (it.hasNext()) {
            Message message = it.next();
            String fromUser = StringUtils.parseName(message.getFrom());
            HashMap<String, String> histrory = new HashMap<String, String>();
            histrory.put("useraccount",StringUtils.parseName(xmppConnection.getUser()));
            histrory.put("friendaccount", fromUser);
            histrory.put("info", message.getBody());
            histrory.put("type", "left");
            if (offlineMsgs.containsKey(fromUser)) {
                offlineMsgs.get(fromUser).add(histrory);
            } else {
                List<HashMap<String, String>> temp = new ArrayList<HashMap<String, String>>();
                temp.add(histrory);
                offlineMsgs.put(fromUser, temp);
            }
        }
        offlineManager.deleteMessages();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return offlineMsgs;
}
 
開發者ID:FanHuaRan,項目名稱:SmackStudy,代碼行數:34,代碼來源:XMPPUtil.java

示例4: processPacket

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public void processPacket(Packet packet) {
    if (packet instanceof AgentStatusRequest) {
        AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
        for (Iterator i = statusRequest.getAgents().iterator(); i.hasNext();) {
            AgentStatusRequest.Item item = (AgentStatusRequest.Item)i.next();
            String agentJID = item.getJID();
            if ("remove".equals(item.getType())) {

                // Removing the user from the roster, so remove any presence information
                // about them.
                String key = StringUtils.parseName(StringUtils.parseName(agentJID) + "@" +
                        StringUtils.parseServer(agentJID));
                presenceMap.remove(key);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_REMOVED, agentJID);
            }
            else {
                entries.add(agentJID);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_ADDED, agentJID);
            }
        }

        // Mark the roster as initialized.
        rosterInitialized = true;
    }
}
 
開發者ID:ice-coffee,項目名稱:EIM,代碼行數:28,代碼來源:AgentRoster.java

示例5: processPacket

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public void processPacket(Packet packet) {
    if (packet instanceof AgentStatusRequest) {
        AgentStatusRequest statusRequest = (AgentStatusRequest)packet;
        for (Iterator<AgentStatusRequest.Item> i = statusRequest.getAgents().iterator(); i.hasNext();) {
            AgentStatusRequest.Item item = i.next();
            String agentJID = item.getJID();
            if ("remove".equals(item.getType())) {

                // Removing the user from the roster, so remove any presence information
                // about them.
                String key = StringUtils.parseName(StringUtils.parseName(agentJID) + "@" +
                        StringUtils.parseServer(agentJID));
                presenceMap.remove(key);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_REMOVED, agentJID);
            }
            else {
                entries.add(agentJID);
                // Fire event for roster listeners.
                fireEvent(EVENT_AGENT_ADDED, agentJID);
            }
        }

        // Mark the roster as initialized.
        rosterInitialized = true;
    }
}
 
開發者ID:CJC-ivotten,項目名稱:androidPN-client.,代碼行數:28,代碼來源:AgentRoster.java

示例6: getName

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的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

示例7: toString

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public String toString() {
  return name + " (" + StringUtils.parseName(jid) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:4,代碼來源:JabberPlayer.java

示例8: getRawJid

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public String getRawJid() {
  if (jid.contains("/")) { //$NON-NLS-1$
    return StringUtils.parseName(jid) + "@" + StringUtils.parseServer(jid); //$NON-NLS-1$
  }
  return jid;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:7,代碼來源:JabberPlayer.java

示例9: getLoginName

import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public String getLoginName() {
  return StringUtils.parseName(jid);
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:4,代碼來源:JabberPlayer.java


注:本文中的org.jivesoftware.smack.util.StringUtils.parseName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。