According to the javadoc to be able to modify a presence before sending one can use addPresenceInterceptor:
But I see it uses addStanzaSendingListener:
new AndFilter(fromRoomFilter,
MessageWithSubjectFilter.INSTANCE,
new NotFilter(MessageTypeFilter.ERROR),
// According to XEP-0045 § 8.1 "A message with a <subject/> and a <body/> or a <subject/> and a <thread/> is a
// legitimate message, but it SHALL NOT be interpreted as a subject change."
new NotFilter(MessageWithBodiesFilter.INSTANCE),
new NotFilter(MessageWithThreadFilter.INSTANCE))
);
// @formatter:on
connection.addStanzaListener(declinesListener, new AndFilter(fromRoomFilter, DECLINE_FILTER));
connection.addStanzaSendingListener(presenceInterceptor, new AndFilter(ToMatchesFilter.create(room),
StanzaTypeFilter.PRESENCE));
messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
// Wait for a presence packet back from the server.
// @formatter:off
StanzaFilter responseFilter = new AndFilter(StanzaTypeFilter.PRESENCE,
new OrFilter(
// We use a bare JID filter for positive responses, since the MUC service/room may rewrite the nickname.
new AndFilter(FromMatchesFilter.createBare(getRoom()), MUCUserStatusCodeFilter.STATUS_110_PRESENCE_TO_SELF),
// In case there is an error reply, we match on an error presence with the same stanza id and from the full
Which is fired after the packet is sent:
I’m I reading it wrong or it is a bug?
Flow
May 20, 2022, 11:05am
2
It is a bug. MultiUserChat should use XMPPConnection.addPresenceInterceptor()
. However this would require API changes, which is a reason to not do it for Smack 4.4, and only fix it in the main branch.
Flow
May 21, 2022, 11:42am
3
Created SMACK-925 . Since the functionaliy is broken is Smack 4.4 anyways, I think breaking the API in this regard shoud not be an issue. If anything, it makes the user aware that something, that’s been used, is broken.
1 Like
system
Closed
August 29, 2022, 11:47am
5
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.