本文整理汇总了Java中org.jivesoftware.smackx.address.packet.MultipleAddresses类的典型用法代码示例。如果您正苦于以下问题:Java MultipleAddresses类的具体用法?Java MultipleAddresses怎么用?Java MultipleAddresses使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultipleAddresses类属于org.jivesoftware.smackx.address.packet包,在下文中一共展示了MultipleAddresses类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
@Override
public MultipleAddresses parse(XmlPullParser parser,
int initialDepth) throws XmlPullParserException,
IOException {
MultipleAddresses multipleAddresses = new MultipleAddresses();
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
switch (name) {
case MultipleAddresses.Address.ELEMENT:
String typeString = parser.getAttributeValue("", "type");
Type type = Type.valueOf(typeString);
String jid = parser.getAttributeValue("", "jid");
String node = parser.getAttributeValue("", "node");
String desc = parser.getAttributeValue("", "desc");
boolean delivered = "true".equals(parser.getAttributeValue("", "delivered"));
String uri = parser.getAttributeValue("", "uri");
// Add the parsed address
multipleAddresses.addAddress(type, jid, node, desc, delivered, uri);
break;
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return multipleAddresses;
}
示例2: MultipleRecipientInfo
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
MultipleRecipientInfo(MultipleAddresses extension) {
this.extension = extension;
}
示例3: getMultipleRecipienServiceAddress
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the address of the multiple recipients service. To obtain such address service
* discovery is going to be used on the connected server and if none was found then another
* attempt will be tried on the server items. The discovered information is going to be
* cached for 24 hours.
*
* @param connection the connection to use for disco. The connected server is going to be
* queried.
* @return the address of the multiple recipients service or <tt>null</tt> if none was found.
* @throws NoResponseException if there was no response from the server.
* @throws XMPPErrorException
* @throws NotConnectedException
*/
private static String getMultipleRecipienServiceAddress(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
List<String> services = sdm.findServices(MultipleAddresses.NAMESPACE, true, true);
if (services.size() > 0) {
return services.get(0);
}
return null;
}
示例4: getMultipleRecipientInfo
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the {@link MultipleRecipientInfo} contained in the specified stanza(/packet) or
* <tt>null</tt> if none was found. Only packets sent to multiple recipients will
* contain such information.
*
* @param packet the stanza(/packet) to check.
* @return the MultipleRecipientInfo contained in the specified stanza(/packet) or <tt>null</tt>
* if none was found.
*/
public static MultipleRecipientInfo getMultipleRecipientInfo(Stanza packet) {
MultipleAddresses extension = (MultipleAddresses) packet
.getExtension(MultipleAddresses.ELEMENT, MultipleAddresses.NAMESPACE);
return extension == null ? null : new MultipleRecipientInfo(extension);
}
示例5: getTOAddresses
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the list of {@link org.jivesoftware.smackx.address.packet.MultipleAddresses.Address}
* that were the primary recipients of the packet.
*
* @return list of primary recipients of the packet.
*/
public List<MultipleAddresses.Address> getTOAddresses() {
return extension.getAddressesOfType(MultipleAddresses.Type.to);
}
示例6: getCCAddresses
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the list of {@link org.jivesoftware.smackx.address.packet.MultipleAddresses.Address}
* that were the secondary recipients of the packet.
*
* @return list of secondary recipients of the packet.
*/
public List<MultipleAddresses.Address> getCCAddresses() {
return extension.getAddressesOfType(MultipleAddresses.Type.cc);
}
示例7: getReplyRoom
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the JID of a MUC room to which responses should be sent or <tt>null</tt> if
* no specific address was provided. When no specific address was provided then the reply
* can be sent to any or all recipients. Otherwise, the user should join the specified room
* and send the reply to the room.
*
* @return the JID of a MUC room to which responses should be sent or <tt>null</tt> if
* no specific address was provided.
*/
public String getReplyRoom() {
List<MultipleAddresses.Address> replyRoom = extension.getAddressesOfType(MultipleAddresses.Type.replyroom);
return replyRoom.isEmpty() ? null : ((MultipleAddresses.Address) replyRoom.get(0)).getJid();
}
示例8: shouldNotReply
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns true if the received stanza(/packet) should not be replied. Use
* {@link MultipleRecipientManager#reply(org.jivesoftware.smack.XMPPConnection, org.jivesoftware.smack.packet.Message, org.jivesoftware.smack.packet.Message)}
* to send replies.
*
* @return true if the received stanza(/packet) should not be replied.
*/
public boolean shouldNotReply() {
return !extension.getAddressesOfType(MultipleAddresses.Type.noreply).isEmpty();
}
示例9: getReplyAddress
import org.jivesoftware.smackx.address.packet.MultipleAddresses; //导入依赖的package包/类
/**
* Returns the address to which all replies are requested to be sent or <tt>null</tt> if
* no specific address was provided. When no specific address was provided then the reply
* can be sent to any or all recipients.
*
* @return the address to which all replies are requested to be sent or <tt>null</tt> if
* no specific address was provided.
*/
public MultipleAddresses.Address getReplyAddress() {
List<MultipleAddresses.Address> replyTo = extension.getAddressesOfType(MultipleAddresses.Type.replyto);
return replyTo.isEmpty() ? null : (MultipleAddresses.Address) replyTo.get(0);
}