7 #ifndef SIMPLECHATSERVER_H_
8 #define SIMPLECHATSERVER_H_
10 #include <boost/noncopyable.hpp>
21 #include <boost/thread.hpp>
164 #endif // SIMPLECHATSERVER_H_
boost::recursive_mutex mutex_
SimpleChatServer(Wt::WServer &server)
Create a new chat server.
std::map< Client *, ClientInfo > ClientMap
void sendMessage(const Wt::WString &user, const Wt::WString &message)
Send a message on behalve of a user.
ChatEventCallback eventCallback
bool connect(Client *client, const ChatEventCallback &handleEvent)
Connects to the chat server.
Encapsulate a chat event.
const Wt::WString formattedHTML(const Wt::WString &user, Wt::TextFormat format) const
Get the message formatted as HTML, rendered for the given user.
UserSet users()
Get the users currently logged in.
std::set< Wt::WString > UserSet
Typedef for a collection of user names.
bool changeName(const Wt::WString &user, const Wt::WString &newUser)
Changes the name.
const Wt::WString & message() const
Get the message of the event.
Type
Enumeration for the event type.
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
void postChatEvent(const ChatEvent &event)
bool login(const Wt::WString &user)
Try to login with given user name.
bool disconnect(Client *client)
Disconnect from the chat server.
boost::function< void(const ChatEvent &)> ChatEventCallback
ChatEvent(const Wt::WString &user, const Wt::WString &message)
void logout(const Wt::WString &user)
Logout from the server.
const Wt::WString & user() const
Get the user who caused the event.
static const WString Empty
Type type() const
Get the event type.
ChatEvent(Type type, const Wt::WString &user, const Wt::WString &data=Wt::WString::Empty)
const Wt::WString & data() const
Get the extra data for this event.