本文整理匯總了Java中org.jivesoftware.smack.util.StringUtils.parseResource方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.parseResource方法的具體用法?Java StringUtils.parseResource怎麽用?Java StringUtils.parseResource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jivesoftware.smack.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.parseResource方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: xmppAddressToJid
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public static String xmppAddressToJid(String participant) {
final String address = StringUtils.parseServer(participant);
final String[] parts = address.split("\\."); //$NON-NLS-1$
final String server = parts[parts.length-1];
final String nick = StringUtils.parseResource(participant);
return nick+"@"+server+JabberClient.JID_RESOURCE; //$NON-NLS-1$
}
示例2: findUsersInMultiUserChat
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
* 查詢聊天室所有成員的用戶名
* @param multiUserChat
* @return
*/
public static List<String> findUsersInMultiUserChat( MultiUserChat multiUserChat){
List<String> listUser = new ArrayList<String>();
Iterator<String> it = multiUserChat.getOccupants();
// 遍曆出聊天室人員名稱
while (it.hasNext()) {
// 聊天室成員名字
String name = StringUtils.parseResource(it.next());
listUser.add(name);
}
return listUser;
}
示例3: Occupant
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
Occupant(Presence presence) {
super();
MUCUser mucUser = (MUCUser) presence.getExtension("x",
"http://jabber.org/protocol/muc#user");
MUCUser.Item item = mucUser.getItem();
this.jid = item.getJid();
this.affiliation = item.getAffiliation();
this.role = item.getRole();
// Get the nickname from the FROM attribute of the presence
this.nick = StringUtils.parseResource(presence.getFrom());
}
示例4: getMUCMembers
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
* ��ȡ�����ҳ�Ա����
*
* @param muc
* @return
*/
public List<String> getMUCMembers(MultiUserChat muc) {
List<String> members = new ArrayList<String>();
Iterator<String> it = muc.getOccupants();
while (it.hasNext()) {
String name = StringUtils.parseResource(it.next());
SLog.i("��Ա����", name);
members.add(name);
}
return members;
}
示例5: processPacket
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
@Override
public void processPacket(Packet packet) {
// TODO Auto-generated method stub
SLog.i(tag, packet.toXML());
Message msg = (Message) packet;
String from = StringUtils.parseResource(msg.getFrom());
showToast(from+" ˵��"+msg.getBody());
}
示例6: processPacket
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
@Override
public void processPacket(Packet packet) {
// TODO Auto-generated method stub
SLog.i(tag, packet.toXML());
message = (Message) packet;
android.os.Message m = new android.os.Message();
handler.sendEmptyMessage(MESSAGE_TAG);
String from = StringUtils.parseResource(message.getFrom());
String time = DateUtil.date2Str(Calendar.getInstance(),
Constant.MS_FORMART);
RoomMsg rm = new RoomMsg();
// showToast(from+" ˵��"+message.getBody());
rm.setCnt(message.getBody());
rm.setTime(time);
//��ǰ�û�
String user = XmppConnectionManager.getInstance().getConnection().getUser();
if (!from.equals(user)) {
rm.setType(0);
rm.setFrom(from);
mDataArrays.add(rm);
int x=mDataArrays.size();
if (mDataArrays.size() > 30) {
mDataArrays.remove(0);
}
}
adapter.refresh(mDataArrays);
//adapter.notifyDataSetChanged();
android.os.Message ms = new android.os.Message();
ms.what = 1;
handler.handleMessage(ms);
// closeInput();
}
示例7: userHasLogged
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public void userHasLogged(String user) {
boolean isAnonymous = "".equals(StringUtils.parseName(user));
String title =
"User logged (" + connection.hashCode() + "): "
+ (isAnonymous ? "" : StringUtils.parseBareAddress(user))
+ "@"
+ connection.getServiceName()
+ ":"
+ connection.getPort();
title += "/" + StringUtils.parseResource(user);
Log.d("SMACK", title);
// Add the connection listener to the connection so that the debugger can be notified
// whenever the connection is closed.
connection.addConnectionListener(connListener);
}
示例8: userHasLogged
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
public void userHasLogged(String user) {
boolean isAnonymous = "".equals(StringUtils.parseName(user));
String title =
"User logged (" + connection.hashCode() + "): "
+ (isAnonymous ? "" : StringUtils.parseBareAddress(user))
+ "@"
+ connection.getServiceName()
+ ":"
+ connection.getPort();
title += "/" + StringUtils.parseResource(user);
System.out.println(title);
// Add the connection listener to the connection so that the debugger can be notified
// whenever the connection is closed.
connection.addConnectionListener(connListener);
}
示例9: getAbsolutePlayerJID
import org.jivesoftware.smack.util.StringUtils; //導入方法依賴的package包/類
/**
* Take the room-local JID for a player ([email protected]/nick) and change it into an absolute address for
* that player ([email protected]/VASSAL)
*
* @param jid
* @return
*/
public String getAbsolutePlayerJID(String jid) {
return StringUtils.parseResource(jid) + "@" + host + JID_RESOURCE; //$NON-NLS-1$
}