Author: egon
Date: 2004-10-11 10:11:42 -0400 (Mon, 11 Oct 2004)
New Revision: 378

Modified:
   trunk/clients/wxhaver/wxHaverFrame.cpp
   trunk/clients/wxhaver/wxHaverFrame.h
   trunk/clients/wxhaver/wxHaverParser.cpp
   trunk/clients/wxhaver/wxHaverParser.h
Log:
Updated to support 0.07

Modified: trunk/clients/wxhaver/wxHaverFrame.cpp
===================================================================
--- trunk/clients/wxhaver/wxHaverFrame.cpp      2004-10-11 13:38:35 UTC (rev 
377)
+++ trunk/clients/wxhaver/wxHaverFrame.cpp      2004-10-11 14:11:42 UTC (rev 
378)
@@ -62,7 +62,7 @@
                (this, &wxHaverFrame::OnWant);
        mParser.AddCommand("WANT", want);
        
-       mSock = new wxSocketClient();
+       mSock = new wxHaverSockClient();
        mSock->SetEventHandler(*this, WH_Socket);
        mSock->SetNotify(wxSOCKET_CONNECTION_FLAG | wxSOCKET_INPUT_FLAG |
                        wxSOCKET_LOST_FLAG);
@@ -122,7 +122,7 @@
 {
        wxIPV4address addr;
        addr.Hostname("localhost");
-       addr.Service(7071);
+       addr.Service(7070);
 
        mTextLines->AppendText(_T("\nConnecting to ") + addr.Hostname() + 
_("..."));
        mSock->Connect(addr, false);
@@ -138,6 +138,8 @@
                        " on port " << addr.Service();
                wxMessageBox(errortext, "Alert!");
        }
+
+       *mSock << "HAVER" << "wxHaver/" WH_VERSION_STRING << CRLF;
 }
 
 void wxHaverFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
@@ -152,9 +154,7 @@
 void wxHaverFrame::OnWant(vector<wxString> args)
 {
        *mTextLines << "\nReceived WANT...";
-       if (args[0] == "VERSION") {
-               char cmd[] = "VERSION\twxHaver/" WH_VERSION_STRING CRLF;
-               mSock->Write(cmd, sizeof(cmd));
-               *mTextLines << "\nSending version info...";
+       if (args[0] == "IDENT") {
+               *mSock << "IDENT" << "nornagon" << CRLF;
        }
 }

Modified: trunk/clients/wxhaver/wxHaverFrame.h
===================================================================
--- trunk/clients/wxhaver/wxHaverFrame.h        2004-10-11 13:38:35 UTC (rev 
377)
+++ trunk/clients/wxhaver/wxHaverFrame.h        2004-10-11 14:11:42 UTC (rev 
378)
@@ -31,7 +31,7 @@
 
                void OnWant(std::vector<wxString>);
        private:
-               wxSocketClient *mSock;
+               wxHaverSockClient *mSock;
                wxSplitterWindow *mServerSplit;
                wxTextCtrl      *mTextLines;
                wxTextCtrl      *mTextEntry;

Modified: trunk/clients/wxhaver/wxHaverParser.cpp
===================================================================
--- trunk/clients/wxhaver/wxHaverParser.cpp     2004-10-11 13:38:35 UTC (rev 
377)
+++ trunk/clients/wxhaver/wxHaverParser.cpp     2004-10-11 14:11:42 UTC (rev 
378)
@@ -5,6 +5,7 @@
 
 #include "wxHaver.h"
 #include "wxHaverParser.h"
+#include "wx/socket.h"
 #include <vector>
 #include <map>
 #include <string>
@@ -44,6 +45,16 @@
 }
 
 //------------------------------------------------------------------------
+//  wxHaverSockClient
+//------------------------------------------------------------------------
+
+wxHaverSockClient &wxHaverSockClient::operator<<(wxString str)
+{
+       if (str != CRLF) str += "\t";
+       Write(str.c_str(), str.length());
+}
+
+//------------------------------------------------------------------------
 //  wxHaverParser
 //------------------------------------------------------------------------
 

Modified: trunk/clients/wxhaver/wxHaverParser.h
===================================================================
--- trunk/clients/wxhaver/wxHaverParser.h       2004-10-11 13:38:35 UTC (rev 
377)
+++ trunk/clients/wxhaver/wxHaverParser.h       2004-10-11 14:11:42 UTC (rev 
378)
@@ -7,6 +7,7 @@
 #define WH_wxHaverParser_H
 
 #include "wxHaver.h"
+#include "wx/socket.h"
 #include <vector> // I think wxArray is dumb. :P So unless I (or someone else)
 #include <map>   // can be bothered to learn and implement wxArray instead,
                                  // I'm sticking with std::vector and std::map.
@@ -47,6 +48,12 @@
                void Call(std::vector<wxString> args) { (*pt2Obj.*fpt)(args); }
 };
 
+class wxHaverSockClient : public wxSocketClient
+{
+       public:
+               wxHaverSockClient &operator<<(wxString);
+};
+
 class wxHaverParser
 {
        public:


Reply via email to