Apocalypse mirror
Sourceforge mirror |
News | Info | Characters | Arenas | Screenshots | Forums | Download | ||||
Developer: | Making of | Character-HOWTO | AI Design | Submit a Character | |||
Documentation: | Main Page | Modules | Class Hierarchy | Class List | File List |
00001 /*************************************************************************** 00002 OnlineChat.h - description 00003 ------------------- 00004 begin : Thu Jan 29 2004 00005 copyright : (C) 2004 by upi 00006 email : upi@feel 00007 ***************************************************************************/ 00008 00009 #ifndef ONLINECHAT_H 00010 #define ONLINECHAT_H 00011 00043 #include "SDL_net.h" 00044 #include <string> 00045 #include <map> 00046 00047 00048 class CReadline; 00049 class CTextArea; 00050 struct SDL_Surface; 00051 00052 typedef std::map<std::string,std::string> TNickMap; 00053 00054 00055 class COnlineChat 00056 { 00057 public: 00058 COnlineChat(); 00059 ~COnlineChat(); 00060 00061 bool Start(); 00062 void Stop(); 00063 void DoOnlineChat(); 00064 00065 protected: 00066 void Redraw(); 00067 void Update(); // Read network traffic. Might get disconnected... 00068 void SendRawData( char a_cID, const std::string& a_rsData ); 00069 00070 void ReceiveMsg( char a_cID, char* a_pcData ); 00071 void ReceiveUser( char a_cID, char* a_pcData ); 00072 00073 void DrawNickList(); 00074 void Menu(); 00075 00076 00077 protected: 00078 TCPsocket m_poSocket; 00079 SDLNet_SocketSet m_poSocketSet; 00080 00081 char m_acIncomingBuffer[4096]; 00082 int m_iIncomingBufferSize; 00083 00084 std::string m_sLastError; 00085 00086 SDL_Surface* m_poScreen; 00087 SDL_Surface* m_poBackground; 00088 CReadline* m_poReadline; 00089 CTextArea* m_poTextArea; 00090 00091 bool m_bMyNickIsOk; 00092 TNickMap m_asNicks; 00093 }; 00094 00095 #endif // ONLINECHAT_H