Project: An application that requires a 1-1 private chat.
Current system: The current login system in the application uses a cookie system for the users to remain logged in.
I understand how to implement the chat system (I just read about Comet, and might implement it later, but for now, I plan to use basic AJAX using a timer); the chat will be stored in a text/xml file during the chat, and it will be archived into the database once it's finished. The filename will be stored in a database when the chat starts, and once retrieved, will be stored as a cookie (the database will be untouched, except for when the chat starts and ends).
Problem: A user cannot start conversations with another user unless they are both online. How do I design the system such that the chat can only start if both users are online?
I don't really need specific code, just the logic of making it work.