00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _TMWSERV_CHATHANDLER_H_
00025 #define _TMWSERV_CHATHANDLER_H_
00026
00027 #include <iosfwd>
00028
00029 #include "net/connectionhandler.hpp"
00030
00031 class ChatClient;
00032
00036 class ChatHandler : public ConnectionHandler
00037 {
00038 public:
00045 void process(enet_uint32 timeout = 0);
00046
00050 bool
00051 startListen(enet_uint16 port);
00052
00053 protected:
00057 void processMessage(NetComputer *computer, MessageIn &message);
00058 NetComputer *computerConnected(ENetPeer *);
00059 void computerDisconnected(NetComputer *);
00060
00061 private:
00065 void handleCommand(ChatClient &computer, std::string const &command);
00066
00070 void warnPlayerAboutBadWords(ChatClient &computer);
00071
00075 void announce(ChatClient &computer, std::string const &text);
00076
00080 void sayToPlayer(ChatClient &computer, std::string const &playerName,
00081 std::string const &text);
00082
00086 void sayInChannel(ChatClient &computer, short channel,
00087 std::string const &);
00088
00092 void sendInChannel(short channelId, MessageOut &);
00093
00097 void warnUsersAboutPlayerEventInChat(short channelId,
00098 std::string const &userName,
00099 char eventId);
00100
00105 void removeOutdatedPending();
00106 };
00107
00111 void registerChatClient(std::string const &, std::string const &, int);
00112
00113 #endif