00001 00012 #ifndef _CONNESSIONE 00013 #define _CONNESSIONE 00014 00015 #include "Definitions.h" 00016 00017 #include <wx/wxprec.h> 00018 #ifndef WX_PRECOMP 00019 #include <wx/wx.h> 00020 #endif 00021 #include <wx/socket.h> 00022 #include <wx/string.h> 00023 #include "ParserIn.h" 00024 #include "ParserOut.h" 00025 00026 class Connessione: public wxEvtHandler 00027 { 00028 private: 00032 wxString serverAddr; 00036 int serverPort; 00040 int serverTimeout; 00051 bool rfc_compliant; 00055 wxSocketClient* serverSocket; 00059 StatusGui* status; 00063 ParserIn* parserIn; 00067 ParserOut* parserOut; 00071 wxString cmdBuffer; 00075 WX_DECLARE_STRING_HASH_MAP(TerminalGui* , wxTerminalsMap); 00079 wxTerminalsMap terminalsMap; 00080 00081 public: 00091 Connessione(wxString addr, int port = 6667, int timeout = 3, 00092 bool rfcCompliant = FALSE); 00096 ~Connessione(); 00101 bool Connect(); 00106 bool Disconnect(); 00112 bool sendCommand(wxString command); 00118 void readSocket(); 00123 ParserOut* getParserOut(); 00128 void CreateChannel(wxString nome); 00134 void CreateQuery(wxString nome); 00139 void CreateStatus(wxString nome); 00147 bool TerminalExists(wxString nome); 00152 void DeleteTerminal(wxString nome); 00157 TerminalGui* GetTerminal(wxString nome); 00162 StatusGui* GetStatus(); 00167 wxString GetMyNick(); 00171 void UserQuit(wxString name, wxString msg); 00175 void UserChNick(wxString oldname, wxString newname); 00176 00177 // Dichiarazione della tabella degli eventi. 00178 DECLARE_EVENT_TABLE() 00179 00180 00183 void OnSocketEvent(wxSocketEvent&); 00184 }; 00185 00186 enum 00187 { 00188 SOCKET_ID 00189 }; 00190 00191 #endif 00192