Project

General

Profile

Custom Presence Plugin

Nicolas C
Added over 5 years ago

Hi team,

I have a custom plugin to handle the subscription process in a simpler way, it's a copy of Presence.java class with some customizations. To go a bit deep, what I did is to intercept all presence stanzas and depending on what type it is, I add, update or delete the subscription and also of course is applied to the database.

The issue is on the delete process, when this plugin intercepts a presence stanza of type "unsubscribed", it deletes both user subscription automatically.

Up to here, all is right, but if the user do not get offline and then online again and User A requests subscription to the User B, no roster item is added to User A. I think maybe it has to be with the roster item list is loaded on memory and Tigase detects that the User A already is subscribed to User B.

The way to reproduce would be:

1) User A subscribes User B

2) User B accepts the subscription, and both users become to status BOTH each other.

3) User A removes the subscription. The roster item of both users is deleted from the plugin automatically.

4) User A still online after removing the subscription, request subscription to User B again.

There, is where the problem appears. Tigase does not add a new item to database on User A roster with the pending subscription. I think it could be becouse of the roster loaded on memory of Tigase is not up to date on that moment.

I attached the plugin class file. The methods that were modified are "processInUnsubscribed", "processOutSubscribed" and "processInSubscribed".

Sorry for writing so much but the problem is difficult to explain.

Hope I have been clear enough.

Thanks in advance..

Nico


Replies (1)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 5 years ago

First question, what kind of XMPP clients do you use? If these are standard XMPP clients then you have to be aware that they expect very specific behaviour from the server side. Most of them require that subscription workflow adheres to the specification.

Secondly, if you intercept a subscription request, you can change the roster but you also have to notify the client and the other client/user of the roster change. I think you should look at the method: roster_util.updateBuddyChange(...) call in the original Presence plugin.

    (1-1/1)