本文整理了Java中org.jivesoftware.smack.packet.Message.getExtension()
方法的一些代码示例,展示了Message.getExtension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getExtension()
方法的具体详情如下:
包路径:org.jivesoftware.smack.packet.Message
类名称:Message
方法名:getExtension
暂无
代码示例来源:origin: igniterealtime/Smack
/**
* Return a Jive properties extensions of the given message.
*
* @param message the message to return the extension from.
* @return a Jive properties extension or null.
* @since 4.2
*/
public static JivePropertiesExtension from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
/**
* Return the stanza-id element of a message.
*
* @param message message
* @return stanza-id element of a jid, or null if absent.
*/
public static StanzaIdElement getStanzaId(Message message) {
return message.getExtension(StanzaIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Return the origin-id element of a message or null, if absent.
*
* @param message message
* @return origin-id element
*/
public static OriginIdElement getOriginId(Message message) {
return message.getExtension(OriginIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Extract a {@link MoodElement} from a message.
*
* @param message message
*
* @return {@link MoodElement} or null.
*/
public static MoodElement fromMessage(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Get the {@link DeliveryReceipt} extension of the message, if any.
*
* @param message the message.
* @return the {@link DeliveryReceipt} extension or {@code null}
*/
public static DeliveryReceipt from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
/**
* Returns true if the message contains an XHTML extension.
*
* @param message the message to check if contains an XHTML extension or not
* @return a boolean indicating whether the message is an XHTML message
*/
public static boolean isXHTMLMessage(Message message) {
return message.getExtension(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null;
}
代码示例来源:origin: igniterealtime/Smack
public static Unfriend from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static AcknowledgedExtension from(Message message) {
return (AcknowledgedExtension) message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static Friend from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static IoTFieldsExtension from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static XHTMLExtension from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static MarkableExtension from(Message message) {
return (MarkableExtension) message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static ReceivedExtension from(Message message) {
return (ReceivedExtension) message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static DisplayedExtension from(Message message) {
return (DisplayedExtension) message.getExtension(ELEMENT, NAMESPACE);
}
}
代码示例来源:origin: igniterealtime/Smack
public static MamResultExtension from(Message message) {
return (MamResultExtension) message.getExtension(ELEMENT, NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
public static NoCopyHint from(Message message) {
return message.getExtension(ELEMENT, NAMESPACE);
}
代码示例来源:origin: igniterealtime/Smack
@Override
public void processStanza(Stanza packet) {
Message message = (Message) packet;
RosterExchange rosterExchange = message.getExtension(ELEMENT, NAMESPACE);
// Fire event for roster exchange listeners
fireRosterExchangeListeners(message.getFrom(), rosterExchange.getRosterEntries());
}
};
代码示例来源:origin: igniterealtime/Smack
@Override
public void verify(Message request, IQ response) {
DataPacketExtension dpe = request.getExtension(
DataPacketExtension.ELEMENT, DataPacketExtension.NAMESPACE);
assertEquals(lastSeq++, dpe.getSeq());
}
代码示例来源:origin: igniterealtime/Smack
@Test
public void hintSpoilerTest() throws Exception {
final String xml = "<spoiler xmlns='urn:xmpp:spoiler:0'>Love story end</spoiler>";
Message message = new Message();
SpoilerElement.addSpoiler(message, "Love story end");
SpoilerElement withHint = message.getExtension(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
assertEquals("Love story end", withHint.getHint());
assertNull(withHint.getLanguage());
assertXMLEqual(xml, withHint.toXML(null).toString());
XmlPullParser parser = TestUtils.getParser(xml);
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
assertXMLEqual(xml, parsed.toXML(null).toString());
}
代码示例来源:origin: igniterealtime/Smack
@Test
public void emptySpoilerTest() throws Exception {
final String xml = "<spoiler xmlns='urn:xmpp:spoiler:0'/>";
Message message = new Message();
SpoilerElement.addSpoiler(message);
SpoilerElement empty = message.getExtension(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
assertNull(empty.getHint());
assertNull(empty.getLanguage());
assertXMLEqual(xml, empty.toXML(null).toString());
XmlPullParser parser = TestUtils.getParser(xml);
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
assertXMLEqual(xml, parsed.toXML(null).toString());
}
内容来源于网络,如有侵权,请联系作者删除!