use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.
the class Chat method sendMessage.
/**
* Sends the specified text as a message to the other chat participant.
* This is a convenience method for:
*
* <pre>
* Message message = chat.createMessage();
* message.setBody(messageText);
* chat.sendMessage(message);
* </pre>
*
* @param text the text to send.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendMessage(String text) throws NotConnectedException, InterruptedException {
Message message = new Message();
message.setBody(text);
sendMessage(message);
}
use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.
the class ChatConnectionTest method validateMessageTypeWithDefaults4.
@Test
public void validateMessageTypeWithDefaults4() {
Message incomingChat = createChatPacket("134", true);
incomingChat.setType(Type.headline);
assertNull(listener.getNewChat());
}
use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.
the class ChatConnectionTest method validateMessageTypeWithDefaults1.
@Test
public void validateMessageTypeWithDefaults1() {
Message incomingChat = createChatPacket("134", true);
incomingChat.setType(Type.chat);
processServerMessage(incomingChat);
assertNotNull(listener.getNewChat());
}
use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.
the class JivePropertiesExtensionTest method checkProvider.
@Test
public void checkProvider() throws Exception {
// @formatter:off
String properties = "<message from='romeo@example.net/orchard' to='juliet@example.com/balcony'>" + "<body>Neither, fair saint, if either thee dislike.</body>" + "<properties xmlns='http://www.jivesoftware.com/xmlns/xmpp/properties'>" + "<property>" + "<name>FooBar</name>" + "<value type='integer'>42</value>" + "</property>" + "</properties>" + "</message>";
// @formatter:on
Message message = (Message) PacketParserUtils.parseStanza(properties);
JivePropertiesExtension jpe = JivePropertiesExtension.from(message);
assertNotNull(jpe);
Integer integer = (Integer) jpe.getProperty("FooBar");
assertNotNull(integer);
int fourtytwo = integer;
assertEquals(42, fourtytwo);
}
use of org.jivesoftware.smack.packet.Message in project Smack by igniterealtime.
the class MessageCorrectExtensionTest method checkStanzas.
@Test
public void checkStanzas() throws Exception {
Message initialMessage = (Message) PacketParserUtils.parseStanza(initialMessageXml);
MessageCorrectExtension messageCorrectExtension = new MessageCorrectExtension(idInitialMessage);
Assert.assertEquals(messageCorrectExtension.toXML().toString(), messageCorrectionXml);
initialMessage.addExtension(messageCorrectExtension);
Assert.assertEquals(initialMessage.toXML(), expectedXml);
}
Aggregations