Problem with Roster and users

Hello,

Currently Openfire server is using the users of our application. In our software, we need every user has to be friend of every other user. I’ve written a query for that, now I have every user as friend of every other user.

The problem now is, I have JID of a roster as david@127.0.0.1 and I have a user by name david. even though they both are same and David is online, I pull the roster list of another user, it shows David as Offline. But, when I send a message it goes to David. How do I approach this problem.

How do I create an association between the two ? Users and roster?

Any help?