0

I am using ejabbered with converse.js and I am playing around with user administration on ejabberd admin panel, more precisely with adding/removing a user from and to a shared group.

While the user is online(converse client is connected to the server) any changes I do in admin panel are reflected in the client immediately. When I add or remove user to and from a group, contacts are updated appropriately. I can also see the roster add/remove messages in the websocket connection as I submit changes in the admin panel.

While user is offline(converse client is not connected) and I add the user to the new shared group, next time user connects, he will see the updated contact list(new contacts are added on the client), BUT if I remove the user from a shared group while he is offline, next time he comes online, the roster will not be changed. Even if I click the contacts refresh button, no contact will be removed.

In order words, only roster additions are respected while user is offline.

Now I kinda understand what's going on, since "remove" message is essentially missed by the client, but I am still wondering, is there any way to synchronize roster items between conversejs and ejabberd in such a way that they are 1 to 1 even while user is offline?

Smiki
  • 19
  • 5
  • 1
    "Even if I click the contacts refresh button, no contact will be removed" This is a bug, and after reading this, I made a fix. See here: https://github.com/conversejs/converse.js/commit/2d5b0753e2c90ae47485d173dc36b4cf883c3cf2 Ideally, it should not be necessary to refresh the roster after contacts have been removed via Ejabberd. I would expect that the next time the user logs in, that the returned roster diff (if roster versioning is used) should include a "subscription" attribute with value "remove", so that the contact gets removed. Either that's not the case, or there is a bug. – JC Brand Apr 14 '22 at 09:45
  • @JCBrand I am hoping that your fix will resolve the "login case" as well since I experienced the same scenario there: cached contacts were not cleared on login roster fetch, they were only added when user initially logged in. I don't think roster versioning is used. Thanks for the quick fix and response. If you wish you can write a response to the question and I will accept it. – Smiki Apr 15 '22 at 07:36

1 Answers1

1

I can reproduce that problem using ejabberd from git and Converse 9.1.0. It seems Converse stores the roster in the webbrowser, and restores it at login, probably to save network consumption.

I disabled this option in Converse, and now the roster is requested at every login: https://conversejs.org/docs/html/configuration.html#clear-cache-on-logout

Offtopic: during the last weeks, I've added some improvements to administer mod_conversejs, see https://github.com/processone/ejabberd/commits/master/src/mod_conversejs.erl

Badlop
  • 3,840
  • 1
  • 8
  • 9