mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-10-31 22:15:59 +01:00
Add convinient constructors for Message and Presence
This commit is contained in:
parent
9331a4c677
commit
5a2326a856
2 changed files with 25 additions and 0 deletions
|
@ -114,6 +114,18 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
||||||
this(JidCreate.from(to), body);
|
this(JidCreate.from(to), body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new message with the specified recipient and extension element.
|
||||||
|
*
|
||||||
|
* @param to
|
||||||
|
* @param extensionElement
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
public Message(Jid to, ExtensionElement extensionElement) {
|
||||||
|
this(to);
|
||||||
|
addExtension(extensionElement);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jivesoftware.smack.util.Objects;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents XMPP presence packets. Every presence stanza(/packet) has a type, which is one of
|
* Represents XMPP presence packets. Every presence stanza(/packet) has a type, which is one of
|
||||||
|
@ -78,6 +79,18 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
||||||
setType(type);
|
setType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new presence with the given type and using the given XMPP address as recipient.
|
||||||
|
*
|
||||||
|
* @param to the recipient.
|
||||||
|
* @param type the type.
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
public Presence(Jid to, Type type) {
|
||||||
|
this(type);
|
||||||
|
setTo(to);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new presence update with a specified status, priority, and mode.
|
* Creates a new presence update with a specified status, priority, and mode.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue