powered by Jive Software

Automatically adding users to contact lists

I’ve just started with openfire, hoping to use it with a social-community-style site I’ve been working on. I’ve got it running now so that a logged in user who launches the chat client for the first time (I’m using Jeti as an applet) will have an account automatically created, and be automatically signed in.

Now, my next challenge is getting the user’s contact lists pre-populated. People in this site have chosen to create relationships with other users, and I want to pre-populate their contact lists from these relationships. So, if Bob is friends with Mark, Dan and Sally, I want to pre-populate Bob’s contact list with Mark, Dan and Sally.

As this is still in the highly-experimental stage on my site, I’ve gone as far as adding reciprocal entries into the jiveRoster table like:

5 | bob | dan@example.com | 3 | -1 | -1 | Dan

6 | dan | bob@example.com | 3 | -1 | -1 | Bob

This, however, has not resulted in what I hoped - as the contact lists for both users when loading up Jeti are still empty. I know that I’m propery connected to the server, and can manually add users, but I need an automatic way to do this. Can anyone lead me in the right direction? I’d assume that the ‘correct’ way would be building a java class to do this instead of direct db manipulation… but I was hoping to make it as simple as possible.

Thanks

Matt

Ok… I gave up on this late last night after adding the entries I mentioned above to jiveRoster didnt’ work. To get started on it again today, I went to load my applet, and voila - now the contact lists are populated. I then looked at what was necessary to create entries in jiveRosterGroups so I can have everyone put in the user’s ‘Site Friends’ contact list. I’ve gone and added that entry to the db - but it doesn’t reflect in my Jeti client - even with a full restart of the browser… so my question is… is openfire caching this info? And if so, for how long? Or is this a Jeti problem??

Thanks

Openfire does cache the database. So there are two ways:

  • manipulate the cache directly by writing a plugin, as you mentioned

  • try to decrease the cache life time, see this wiki entry. Never tried it, but maybe it will work.