#include <SimpleChatServer.h>
Public Types | |
typedef std::set< Wt::WString > | UserSet |
Typedef for a collection of user names. | |
Public Member Functions | |
SimpleChatServer () | |
Create a new chat server. | |
bool | login (const Wt::WString &user) |
Try to login with given user name. | |
void | logout (const Wt::WString &user) |
Logout from the server. | |
Wt::WString | suggestGuest () |
Get a suggestion for a guest user name. | |
void | sendMessage (const Wt::WString &user, const Wt::WString &message) |
Send a message on behalve of a user. | |
UserSet | users () |
Get the users currently logged in. | |
Public Attributes | |
Wt::Signal< const ChatEvent & > | chatEvent |
Signal that will convey chat events. | |
Private Attributes | |
boost::mutex | mutex_ |
UserSet | users_ |
Definition at line 68 of file SimpleChatServer.h.
typedef std::set<Wt::WString> SimpleChatServer::UserSet |
SimpleChatServer::SimpleChatServer | ( | ) |
bool SimpleChatServer::login | ( | const Wt::WString & | user | ) |
Try to login with given user name.
Returns false if the login was not successfull.
Definition at line 45 of file SimpleChatServer.C.
void SimpleChatServer::logout | ( | const Wt::WString & | user | ) |
WString SimpleChatServer::suggestGuest | ( | ) |
void SimpleChatServer::sendMessage | ( | const Wt::WString & | user, | |
const Wt::WString & | message | |||
) |
SimpleChatServer::UserSet SimpleChatServer::users | ( | ) |
Signal that will convey chat events.
Every client should connect to this signal, and process events.
Definition at line 97 of file SimpleChatServer.h.
boost::mutex SimpleChatServer::mutex_ [private] |
Definition at line 108 of file SimpleChatServer.h.
UserSet SimpleChatServer::users_ [private] |
Definition at line 110 of file SimpleChatServer.h.