mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Add support for XEP-0382: Spoiler Messages
Fixes SMACK-795.
This commit is contained in:
parent
a729a7c43b
commit
ce19ea4114
11 changed files with 530 additions and 0 deletions
33
documentation/extensions/spoiler.md
Normal file
33
documentation/extensions/spoiler.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
Spoiler Messages
|
||||
================
|
||||
|
||||
[Back](index.md)
|
||||
|
||||
Spoiler Messages can be used to indicate that the body of a message is a spoiler and should be displayed as such.
|
||||
|
||||
## Usage
|
||||
|
||||
To get an instance of the SpoilerManager, call
|
||||
```
|
||||
SpoilerManager manager = SpoilerManager.getInstanceFor(connection);
|
||||
```
|
||||
This will automatically add Spoilers to the list of supported features of your client.
|
||||
|
||||
The manager can then be used to add SpoilerElements to messages like follows:
|
||||
```
|
||||
Message message = new Message();
|
||||
|
||||
// spoiler without hint
|
||||
SpoilerElement.addSpoiler(message);
|
||||
|
||||
// spoiler with hint about content
|
||||
SpoilerElement.addSpoiler(message, "End of Love Story");
|
||||
|
||||
// spoiler with localized hint
|
||||
SpoilerElement.addSpoiler(message, "de", "Der Kuchen ist eine Lüge");
|
||||
```
|
||||
|
||||
To get Spoilers from a message call
|
||||
```
|
||||
Map<String, String> spoilers = SpoilerElement.getSpoilers(message);
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue