From f633313c4ad74b8842960ecd8a5e706404f378e1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 2 Jan 2017 00:47:25 +0100 Subject: [PATCH] Add Message.setBody(CharSequence) --- .../org/jivesoftware/smack/packet/Message.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java index 6751e89a3..e0ec0ce82 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java @@ -332,6 +332,23 @@ public final class Message extends Stanza implements TypedCloneable { return Collections.unmodifiableSet(bodies); } + /** + * Sets the body of the message. + * + * @param body the body of the message. + * @see #setBody(String) + * @since 4.2 + */ + public void setBody(CharSequence body) { + String bodyString; + if (body != null) { + bodyString = body.toString(); + } else { + bodyString = null; + } + setBody(bodyString); + } + /** * Sets the body of the message. The body is the main message contents. *