本文整理汇总了Java中org.xmpp.packet.Message.addExtension方法的典型用法代码示例。如果您正苦于以下问题:Java Message.addExtension方法的具体用法?Java Message.addExtension怎么用?Java Message.addExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xmpp.packet.Message
的用法示例。
在下文中一共展示了Message.addExtension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.xmpp.packet.Message; //导入方法依赖的package包/类
/**
* Build an XMPP error message with MMX extension.
* @return
*/
public Message build() {
Message errorMsg = new Message();
String appId = JIDUtil.getAppId(mOrigMsg.getFrom());
errorMsg.setType(Type.error);
errorMsg.setTo(mOrigMsg.getFrom());
errorMsg.setFrom(appId + "%" + appId + "@" + XMPPServer.getInstance().getServerInfo().getXMPPDomain());
errorMsg.setID(mOrigMsg.getID());
errorMsg.addExtension(new MMXPacketExtension(mHeaders, mPayload));
return errorMsg;
}
示例2: sendAuthorizationRequest
import org.xmpp.packet.Message; //导入方法依赖的package包/类
/**
* Sends an request to authorize the pending subscription to the specified owner.
*
* @param owner the JID of the user that will get the authorization request.
*/
public void sendAuthorizationRequest(JID owner) {
Message authRequest = new Message();
authRequest.addExtension(node.getAuthRequestForm(this));
authRequest.setTo(owner);
authRequest.setFrom(node.getService().getAddress());
// Send authentication request to node owners
node.getService().send(authRequest);
}
示例3: testForwarded
import org.xmpp.packet.Message; //导入方法依赖的package包/类
@Test
public void testForwarded() {
Message message = new Message();
message.setType(Message.Type.chat);
message.setBody("Tests");
message.addExtension(new DataForm(DataForm.Type.submit));
Forwarded forwarded = new Forwarded(message);
Forwarded forwarded2 = new Forwarded(message);
String xml1 = forwarded.getElement().asXML();
String xml2 = forwarded2.getElement().asXML();
assertEquals("<forwarded xmlns=\"urn:xmpp:forward:0\"><message xmlns=\"jabber:client\" type=\"chat\"><body>Tests</body><x xmlns=\"jabber:x:data\" type=\"submit\"/></message></forwarded>", xml1);
assertEquals("<forwarded xmlns=\"urn:xmpp:forward:0\"><message xmlns=\"jabber:client\" type=\"chat\"><body>Tests</body><x xmlns=\"jabber:x:data\" type=\"submit\"/></message></forwarded>", xml2);
}
示例4: shouldNotStoreEmptyChatMessagesWithOnlyChatStates
import org.xmpp.packet.Message; //导入方法依赖的package包/类
@Test
public void shouldNotStoreEmptyChatMessagesWithOnlyChatStates() {
Message message = new Message();
message.setType(Message.Type.chat);
PacketExtension chatState = new PacketExtension("composing", "http://jabber.org/protocol/chatstates");
message.addExtension(chatState);
assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
示例5: shouldNotStoreEmptyChatMessagesWithOnlyChatStatesAndThread
import org.xmpp.packet.Message; //导入方法依赖的package包/类
@Test
public void shouldNotStoreEmptyChatMessagesWithOnlyChatStatesAndThread() {
Message message = new Message();
message.setType(Message.Type.chat);
message.setThread("1234");
PacketExtension chatState = new PacketExtension("composing", "http://jabber.org/protocol/chatstates");
message.addExtension(chatState);
assertFalse(OfflineMessageStore.shouldStoreMessage(message));
}
示例6: shouldStoreEmptyChatMessagesWithOtherExtensions
import org.xmpp.packet.Message; //导入方法依赖的package包/类
@Test
public void shouldStoreEmptyChatMessagesWithOtherExtensions() {
Message message = new Message();
message.setType(Message.Type.chat);
PacketExtension chatState = new PacketExtension("composing", "http://jabber.org/protocol/chatstates");
message.addExtension(chatState);
PacketExtension packetExtension2 = new PacketExtension("received", "urn:xmpp:receipts");
message.addExtension(packetExtension2);
assertTrue(OfflineMessageStore.shouldStoreMessage(message));
}
示例7: sendAuthorizationRequest
import org.xmpp.packet.Message; //导入方法依赖的package包/类
/**
* Sends an request to authorize the pending subscription to the specified owner.
*
* @param owner the JID of the user that will get the authorization request.
*/
public void sendAuthorizationRequest(JID owner) {
Message authRequest = new Message();
authRequest.addExtension(node.getAuthRequestForm(this));
authRequest.setTo(owner);
authRequest.setFrom(service.getAddress());
// Send authentication request to node owners
service.send(authRequest);
}
示例8: sendAuthorizationRequest
import org.xmpp.packet.Message; //导入方法依赖的package包/类
/**
* Sends an request to authorize the pending subscription to the specified owner.
*
* @param owner the JID of the user that will get the authorization request.
*/
public void sendAuthorizationRequest(JID owner) {
Message authRequest = new Message();
authRequest.addExtension(node.getAuthRequestForm(this));
authRequest.setTo(owner);
authRequest.setFrom(node.getService().getAddress());
// Send authentication request to node owners
node.getService().send(authRequest);
}