本文整理匯總了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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例7: toString
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public String toString() {
return name + " (" + StringUtils.parseName(jid) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
示例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;
}
示例9: getLoginName
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public String getLoginName() {
return StringUtils.parseName(jid);
}