Want to create a "buddy list" script...

They have: 173 posts

Joined: Feb 2005

Okay, so I am wanting to create a script, and the best way I can think is to call it a buddy list. I just can't think of THE WAY to do it.. it's not coming to me! hehe

I have no problems with any aspect, except for saying who is who's buddy. What would be the best way to accomplish this? One person cannot be a friend of another, without the other being a friend of that person...

I can't quite think of how I would link them together. I first thought of like another table called friends which had USER_ID and FRIEND_ID... then just get all FRIEND_IDs for the current USER_ID... however, if user's 1 and 2 were friends.. in that table I would have
USER_ID = 1
FRIEND_ID = 2

USER_ID = 2
FRIEND_ID = 1

that seems rather redundant and surely there must be a better way. I think basically all IM programs accomplish this because I think each person has to be on each other's lists... so how can I cross reference the two user ids that they are FRIENDS OF EACH OTHER??

I hope I explained that well enough... what im thinking is hard to write down hehe..

Thanks in advance!

SonicMailer Pro - Professional mailing list manager & award-winning email marketing software
Download a FREE 30-day trial today!
Use coupon savemoreon4 and save 10%!

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

Well, you could have a table of

general_id / friend_1 / friend_2

Then check the list to see if the person is in Friend_1 or Friend_2

But, this poses a problem, because in IM programs, everyone has their own list, and if you want to remove someone from the list, doesn't mean you're removed from their's. Also, different people have different properties, such as an alias name, and whether or not they are blocked, etc.

It may seem redundant, but it makes the most sense.

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

As for the IM's I use, (AIM, Yahoo, MSN and ICQ), it isn't required that the other person have me on their buddy list for me to have them on mine.

-Greg

They have: 173 posts

Joined: Feb 2005

Okay..w ell bad example I guess, but I want it that if one has one, the other has the one... so they HAVE to have each other. If one chooses to delete it, then they cannot see each other...

SonicMailer Pro - Professional mailing list manager & award-winning email marketing software
Download a FREE 30-day trial today!
Use coupon savemoreon4 and save 10%!

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

Well, just have a block system, so that people can block, or delete people off their buddy list, and with deleting, you could just make it a block/remove from visible list.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.