powered by Jive Software

Automatically subscribe to a list of user


I have a problem

What i’m trying to do is weird but i coulnd nt figure a way to do this.

Imagine that on my website i have friendship relation management.

and i want to add a messaging service.

When 2 users become friends i want them to automatically be set as friends on chat.

But i can’t to this.

Is that mandatory that a user is loggued in to get its roster ?

I just want to get my users and set them as friends but without logging them into my jabber server, it has to be invisible for everyone…

For now i could nt find how to do that…

Hope it’s clear and you could help me



I have the excact same problem. I am able to create users using plugin.

I have managed to add relationships directly in the database but the problem here is that openfire adds all users and relationships to cache so you would have to restart the openfire server to make this work (and this is offcource not an option since relationships gets added all the time).

I guess we would need some kind of plugin that allowed us to do this.

If anyone has any idea plz let us now


I may have figured out a way to do this.

You can manipulate relationship between users in your plugin by connecting them with on another resource.

You connect as your user on the “server” resource and so you can get its roster and manage it.

The problem is when you have done what you have to do and disconnect this user on this resource, even if he is still online on his resource, he will appear as “unavailable” or “online” to his contacts.

and this is a problem.

How can i do to disconnect a user on a resource without modifying his presence on the other resource ??

What plugin are you using to do this?

In fact it’s the program that i’m coding which uses smack to do this.

Now i can use different resources to connect the same user so i can manipulate his roster. Which is what i want to do, like adding friends.

So that s fine.

But as i said, the problem now come from the fact that when i 've finished to work with the connection, i disconnect it and an unavailable presence is send to the server and consequently, the user appears as unavailable even if he is still connected to my server on his other resource.

I tried using presence priority but doesn’t seem to work. ( I m on EJABBERD, i don’ know if it’s linked)

I send a 0 presence on my connection and a 100 presence priority on the user client but still, when i disconnect my server connection, he become unavailable.

I tried to modify Smack Sources to avoid sending the packet in the shutdown method but no … Doesnt work.

If anybody did these, i ll be glad if he could give me at least a little hope


Ok I see your problem. Unfortunately Im not sure how this can be solved.

I use openfire and figured out that I could just manipulate the db, but I get problems because openfire cache all the rosters so i need to refresh cache to see the new relationships btw users.

So Im kind of stuck as well

Hopefully someone could help us


As i coulnd nt find a way to do what i wanted using smack, i finally use a script which send a server command to add friends automatically. ( add the mod_ctlextra )

But i’m using ejabberd, i don’t know if openfire allows this.

Good luck.


I am having a similar issue to add the relationship on both sides for the user. I’m using smack and openfire.

I tried the updating the database and as you pointed out Dubber, it requires restarting the server which is not really possible.

Has anyone managed to find a solution to this using openfire and smack? I have spent the last week trying to find a solution to this to no avail and any help would be much appreciated!

Thanks in advance,


I found a solution that works very well for me. I am building a community where friends in the community also should be friends on my chat server.

The solution I use is this.

I have a JS interface to my chat client. When someone becomes friends on the comunity this triggers a javascript to my client which adds the friends relationship.

If someone becomes friends when they are not logged into the chat a flag has to be set and this connection will be made as soon as they become online again.

This works but is dependent that u can add this stuff in the client u are using

Hi guys, what technologies are you both using, if you dont mind me asking?



I had the same situation, and solved it by using subscription plugin on openFire.

Good luck.

Yepp that would work as well

but im sending extra info with the subscription (e.g. nick name) so I couldnt use this.

But if you don need that this plugin would make things very easy