public final class Message extends Object
The content of the message is either plain or not. A plain content is the original markdown source of the message, whereas
a formatted content is the rendered HTML of the message. For example, a formatted cv-pls message will contain
an anchor (linking to the tag page for cv-pls) and the corresponding plain message will contain [tag:cv-pls]
instead.
A message is inherently linked to a chat room: an instance of Message
can only be obtained by calling Room.getMessage(long)
,
by giving it the id of the message to look for.
A message also contains a reference to the user that posted it. Refer to User
.
When a message is deleted, its content and user will always be null
, except if the current user is room-owner
or it is one of their own message.
Modifier and Type | Method and Description |
---|---|
String |
getContent()
Returns the content of this message.
|
int |
getEditCount()
Returns the number of times this message was edited.
|
long |
getId()
Returns the id of this message.
|
String |
getPlainContent()
Returns the plain content of this message.
|
int |
getStarCount()
Returns the number of stars this message has.
|
User |
getUser()
Returns the user that posted this message.
|
boolean |
isDeleted()
Tells whether this message was deleted.
|
boolean |
isPinned()
Tells whether this message is pinned.
|
public long getId()
public User getUser()
null
if the current user is not a room-owner
or this message is not one of their own message.public String getPlainContent()
getContent()
method, this corresponds
to the original Markdown source of the message, i.e. what the user exactly typed.
For example, a reply to a user will appear as :<id>
instead of the rendered username, and tags
will be returned as [tag:java]
.
This will be null
if the current user is not a room-owner and this message is not one of their own message.
public String getContent()
getPlainContent()
method, this is the fully rendered
HTML content of the message, as it is shown on screen.
For example, a message whose Markdown source is [tag:java]
will result in a rendered content of
<a href="//stackoverflow.com/questions/tagged/java"><span class="ob-post-tag" style="background-color: #E0EAF1; color: #3E6D8E; border-color: #3E6D8E; border-style: solid;">java</span></a>
.
This will be null
if the current user is not a room-owner and this message is not one of their own message.
public boolean isDeleted()
public int getStarCount()
public boolean isPinned()
public int getEditCount()