mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 02:39:42 +02:00
Deprecate Chat API, introduce new Chat API
Also add (From|To)TypeFilter and update/fix the documentation in a few places.
This commit is contained in:
parent
b0fef6ffcb
commit
d47463a533
22 changed files with 612 additions and 113 deletions
|
@ -69,6 +69,7 @@ Smack Extensions and currently supported XEPs of smack-extensions
|
|||
| XMPP Over BOSH | [XEP-0206](http://xmpp.org/extensions/xep-0206.html) | Use Bidirectional-streams Over Synchronous HTTP (BOSH) to transport XMPP stanzas. |
|
||||
| Attention | [XEP-0224](http://xmpp.org/extensions/xep-0224.html) | Getting attention of another user. |
|
||||
| Bits of Binary | [XEP-0231](http://xmpp.org/extensions/xep-0231.html) | Including or referring to small bits of binary data in an XML stanza. |
|
||||
| Best Practices for Resource Locking | [XEP-0296](https://xmpp.org/extensions/xep-0296.html) | Specifies best practices to be followed by Jabber/XMPP clients about when to lock into, and unlock away from, resources. |
|
||||
| Last Message Correction | [XEP-0308](http://xmpp.org/extensions/xep-0308.html) | Provides a method for indicating that a message is a correction of the last sent message. |
|
||||
| [Group Chat Invitations](invitation.md) | n/a | Send invitations to other users to join a group chat room. |
|
||||
| [Jive Properties](properties.md) | n/a | TODO |
|
||||
|
|
|
@ -97,8 +97,8 @@ done. The last step is to send the message as you do with any other message.
|
|||
|
||||
An XHTML message is like any regular message, therefore to send the message
|
||||
you can follow the usual steps you do in order to send a message. For example,
|
||||
to send a message as part of a chat just use the message **#send(Message)** of
|
||||
_**Chat**_ or you can use the message **#send(Stanza)** of
|
||||
to send a message as part of a chat just use the message **#sendMessage(Message)** of
|
||||
_**Chat**_ or you can use the message **#sendStanza(Stanza)** of
|
||||
_**XMPPConnection**_.
|
||||
|
||||
**Example**
|
||||
|
@ -142,19 +142,20 @@ XHTML bodies of any received message.
|
|||
|
||||
```
|
||||
// Create a listener for the chat and display any XHTML content
|
||||
PacketListener packetListener = new PacketListener() {
|
||||
public void processStanza(Stanza stanza) {
|
||||
Message message = (Message) stanza;
|
||||
IncomingChatMessageListener listener = new IncomingChatMessageListener() {
|
||||
public void newIncomingMessage(EntityBareJid from, Message message, Chat chat) {
|
||||
// Obtain the XHTML bodies of the message
|
||||
List<CharSequence> bodies = XHTMLManager.getBodies(message);
|
||||
if (bodies != null) {
|
||||
// Display the bodies on the console
|
||||
for (CharSequence body : bodies) {
|
||||
System.out.println(body);
|
||||
}
|
||||
if (bodies == null) {
|
||||
return;
|
||||
|
||||
// Display the bodies on the console
|
||||
for (CharSequence body : bodies) {
|
||||
System.out.println(body);
|
||||
}
|
||||
}
|
||||
};
|
||||
chat.addMessageListener(packetListener);
|
||||
chatManager.addListener(listener);
|
||||
```
|
||||
|
||||
Discover support for XHTML Messages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue