1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Merge pull request #335 from bjalon/patch-3

Update processing.md
This commit is contained in:
Florian Schmaus 2019-08-22 15:16:37 +02:00 committed by GitHub
commit 9dc24c2b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,8 @@ and a stanza listener:
``` ```
// Create a stanza filter to listen for new messages from a particular // Create a stanza filter to listen for new messages from a particular
// user. We use an AndFilter to combine two other filters._ // user. We use an AndFilter to combine two other filters._
StanzaFilter filter = new AndFilter(StanzaTypeFilter.MESSAGE, FromMatchesFilter.create("mary@jivesoftware.com")); StanzaFilter filter = new AndFilter(StanzaTypeFilter.MESSAGE,
FromMatchesFilter.create(JidCreate.entityBareFrom("mary@jivesoftware.com")));
// Assume we've created an XMPPConnection named "connection". // Assume we've created an XMPPConnection named "connection".
// First, register a stanza collector using the filter we created. // First, register a stanza collector using the filter we created.
@ -29,7 +30,7 @@ StanzaCollector myCollector = connection.createStanzaCollector(filter);
// Next, create a stanza listener. We use an anonymous inner class for brevity. // Next, create a stanza listener. We use an anonymous inner class for brevity.
StanzaListener myListener = new StanzaListener() { StanzaListener myListener = new StanzaListener() {
**public** **void** processStanza(Stanza stanza) { public void processStanza(Stanza stanza) {
// Do something with the incoming stanza here._ // Do something with the incoming stanza here._
} }
}; };