Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Friend-adding mechanism #2
Adding friends should be possible by just knowing the IP of the person you want to be friends with. You should send a request to their server, which will be part of the standard protocol, providing your name and IP. The request can be dealt with in any way seen fit by the server. Perhaps it chooses to add them immediately or perhaps it puts them in a queue, waiting to be accepted, whilst notifying the owner of this.
The URL for this could be
And all information could be sent as POST variables in a POST request. That covers adding a friend in one direction and maybe once the friend has accepted the friendship, the server can send back a similar request but with the owner's details, for which the original requestor is already waiting. A random password should also be sent in the original request and the responding request. If you request someone to be your friend, the server doesn't necessarily have to give access to them immediately. Even though they have a password for access, the server could reject them until they give the original requestor access.
Notifications are now implemented in a basic form. They are currently being used to send friend requests but these cannot be responded to yet. The next step would be to use the information in the notification to return a friend request.
OK, something has been created but it needs cleaning up desperately. I'm not sure if using the password field is clever. However, it does go unused until two people are friends so perhaps it just needs standardising across the code base (like having constant strings in one place and then referring to them).
Far too much is done by the "client" part of the site. The client should not access Users or Friends but it's getting closer to that. "Me" is now the person who has logged in instead of a constant global.
In short, the server needs to support friend adding, but this is just a case of moving code and rearranging url patterns.