chathandler.hpp

Go to the documentation of this file.
00001 /*
00002  *  The Mana World Server
00003  *  Copyright 2004 The Mana World Development Team
00004  *
00005  *  This file is part of The Mana World.
00006  *
00007  *  The Mana World is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  any later version.
00011  *
00012  *  The Mana World is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with The Mana World; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  *  $Id: chathandler.hpp 3011 2007-01-06 18:46:17Z b_lindeijer $
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

Generated on Fri Mar 30 15:39:16 2007 for TMW Server by  doxygen 1.3.9.1