7 #ifndef SIMPLECHATSERVER_H_ 8 #define SIMPLECHATSERVER_H_ 10 #include <boost/noncopyable.hpp> 21 #include <boost/thread.hpp> 35 enum Type { Login, Logout, Rename, Message };
70 : type_(Message), user_(user), message_(message)
75 : type_(type), user_(user), data_(data)
114 bool disconnect(
Client *client);
159 void postChatEvent(
const ChatEvent& event);
164 #endif // SIMPLECHATSERVER_H_
Type type() const
Get the event type.
boost::recursive_mutex mutex_
std::map< Client *, ClientInfo > ClientMap
ChatEventCallback eventCallback
const Wt::WString & data() const
Get the extra data for this event.
Encapsulate a chat event.
std::set< Wt::WString > UserSet
Typedef for a collection of user names.
Type
Enumeration for the event type.
boost::function< void(const ChatEvent &)> ChatEventCallback
ChatEvent(const Wt::WString &user, const Wt::WString &message)
const Wt::WString & message() const
Get the message of the event.
static const WString Empty
ChatEvent(Type type, const Wt::WString &user, const Wt::WString &data=Wt::WString::Empty)
const Wt::WString & user() const
Get the user who caused the event.