powered by Jive Software

How to pull friends list based on member_id (custom db setup)

Hi all,

I have managed to connect my existing members database and I’m able to login to my OpenFire server with any members login information. This works great so far.

No I would like to be able to see which friends of each member are online.

In my database I keep a friends table that stores all of my friend connections.

Table: Friendships

Columns: member_id, friend_id

How would I load all of a members friends so that when logged in to Openfire he/she will know who of his/her friends is online?

PS. I have registration and anonymous login disabled.

Thank you

Hi,

http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/db-integ ration-guide.html descibes the group integration. Seems you need to create a datbase view which allows you to use the SQL statements Openfire does support.

LG

I believe so too, its just hard to plan out in my head because there is no notion of groups in my friendships scheme on the website.

I would greatly appreciate some further thinking on how to get this going.

Thank you,

Alexander

Hi Alexander,

you may need some JOINs and two VIEWs, maybe a materialized view… For myGroups this could be a VIEW like

CREATE VIEW view_myGroups AS SELECT DISTINCT member_id AS groupName, member_id AS groupDescription FROM Friendships;

For myGroupUsers you’ll need a JOIN, a SQL guru may write one for you which works fine.

LG