mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Add Message(String, String) constructor
to make simply Smack examples work, e.g. Message message = new Message("user@example.org", "Hi, how are you?");
This commit is contained in:
parent
aeb385a022
commit
4d7e4b2ab1
1 changed files with 13 additions and 0 deletions
|
@ -27,6 +27,8 @@ import java.util.Set;
|
||||||
import org.jivesoftware.smack.util.TypedCloneable;
|
import org.jivesoftware.smack.util.TypedCloneable;
|
||||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
import org.jxmpp.stringprep.XmppStringprepException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents XMPP message packets. A message can be one of several types:
|
* Represents XMPP message packets. A message can be one of several types:
|
||||||
|
@ -101,6 +103,17 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
setBody(body);
|
setBody(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new message to the specified recipient and with the specified body.
|
||||||
|
*
|
||||||
|
* @param to the user to send the message to.
|
||||||
|
* @param body the body of the message.
|
||||||
|
* @throws XmppStringprepException if 'to' is not a valid XMPP address.
|
||||||
|
*/
|
||||||
|
public Message(String to, String body) throws XmppStringprepException {
|
||||||
|
this(JidCreate.from(to), body);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
Loading…
Reference in a new issue