]> code.citadel.org Git - citadel.git/commitdiff
Started a wholist
authorArt Cancro <ajc@citadel.org>
Sun, 21 Feb 1999 05:35:40 +0000 (05:35 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 21 Feb 1999 05:35:40 +0000 (05:35 +0000)
daphne/Makefile
daphne/citclient.cpp
daphne/daphne
daphne/userlogin.cpp
daphne/userlogin.hpp
daphne/who.cpp [new file with mode: 0644]
daphne/who.hpp [new file with mode: 0644]

index bbed94aa6880460e05bf78f2d4d2918419babf70..22e1fa7956721eaa7842aa60cb3b2e1046c98577 100644 (file)
@@ -1,8 +1,9 @@
 CFLAGS=`wx-config --cflags`
 LFLAGS=`wx-config --libs`
 
-daphne: main.o citclient.o userlogin.o testwindow.o
-       c++ main.o citclient.o userlogin.o testwindow.o $(LFLAGS) -o daphne
+daphne: main.o citclient.o userlogin.o testwindow.o who.o
+       c++ main.o citclient.o userlogin.o testwindow.o who.o \
+       $(LFLAGS) -o daphne
 
 main.o: main.cpp
        c++ -c $(CFLAGS) main.cpp
@@ -15,3 +16,6 @@ userlogin.o: userlogin.cpp
 
 testwindow.o: testwindow.cpp
        c++ -c $(CFLAGS) testwindow.cpp
+
+who.o: who.cpp
+       c++ -c $(CFLAGS) who.cpp
index dd034fb1c704e300dc7e7c0136593a652ea2506a..3ef6c9d1f1200da80c6e4c997b5ee4eae2256521 100644 (file)
@@ -91,10 +91,24 @@ int CitClient::serv_trans(
                        ) {
 
        int first_digit;
+       wxString buf;
 
        serv_puts(command);
        serv_gets(response);
        first_digit = (response.GetChar(0)) - '0';
+
+       if (first_digit == 1) {                 // LISTING_FOLLOWS
+               xferbuf.Clear();
+               while (serv_gets(buf), buf != "000") {
+                       xferbuf.Add(buf);
+               }
+       } else if (first_digit == 4) {          // SEND_LISTING
+               // FIX do this!!
+               serv_puts("000");
+       }
+
+
+
        return first_digit;
 }
 
index 89696623a6c960182b3ef77a91f37c4edee7add6..effaa714a9f1b2edd750cd5491988cbe2d6e369d 100755 (executable)
Binary files a/daphne/daphne and b/daphne/daphne differ
index a55f3943ee0bd9ef66135eccfdf7199f344d0833..553ac45fb88c7d8d7a6df2f9940e8c3912b9cd89 100644 (file)
@@ -4,8 +4,10 @@
 
 
 #include <wx/wx.h>
+#include <wx/listctrl.h>
 #include "citclient.hpp"
 #include "userlogin.hpp"
+#include "who.hpp"
 
 // ----------------------------------------------------------------------------
 // private classes
@@ -59,6 +61,7 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
                        ) {
 
        citsock = sock;
+       citMyMDI = MyMDI;
 
        // set the frame icon
        /* SetIcon(wxICON(mondrian)); */
@@ -211,6 +214,7 @@ void UserLogin::OnButtonPressed(wxCommandEvent& whichbutton) {
                                nopass.ShowModal();
                        } else {
                                // FIX do login procedure here
+                               (void)new who(citsock, citMyMDI);
                        }
                }
        }
index 203bde0e8183f42940f42ed6d40e64c2be08e5bc..d753f165169e6a55ecaaab82fd546f9a371a229a 100644 (file)
@@ -12,5 +12,6 @@ private:
        wxButton *exit_button;
        void OnButtonPressed(wxCommandEvent& whichbutton);
        CitClient *citsock;
+       wxMDIParentFrame *citMyMDI;
        DECLARE_EVENT_TABLE()
 };
diff --git a/daphne/who.cpp b/daphne/who.cpp
new file mode 100644 (file)
index 0000000..4ec63cc
--- /dev/null
@@ -0,0 +1,79 @@
+// ============================================================================
+// declarations
+// ============================================================================
+
+
+#include <wx/wx.h>
+#include <wx/listctrl.h>
+#include "citclient.hpp"
+#include "who.hpp"
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+       BUTTON_DISMISS
+};
+
+// ----------------------------------------------------------------------------
+// event tables and other macros for wxWindows
+// ----------------------------------------------------------------------------
+
+// the event tables connect the wxWindows events with the functions (event
+// handlers) which process them. It can be also done at run-time, but for the
+// simple menu events like this the static method is much simpler.
+BEGIN_EVENT_TABLE(     who, wxMDIChildFrame)
+END_EVENT_TABLE()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+
+// ----------------------------------------------------------------------------
+// the application class
+// ----------------------------------------------------------------------------
+
+// frame constructor
+who::who(CitClient *sock, wxMDIParentFrame *MyMDI)
+       : wxMDIChildFrame(MyMDI,        //parent
+                       -1,     //window id
+                       "Who is online?",
+                       wxDefaultPosition,
+                       wxDefaultSize,
+                       wxDEFAULT_FRAME_STYLE,
+                       "who"
+                       ) {
+
+       citsock = sock;
+
+       // set the frame icon
+       /* SetIcon(wxICON(mondrian)); */
+
+       wholist = new wxListCtrl(
+               this,
+               -1,     // replace this eventually with something active
+               wxDefaultPosition,
+               wxDefaultSize,
+               wxLC_REPORT,            // multicolumn
+               wxDefaultValidator,
+               "wholist");
+
+
+       wxLayoutConstraints *c1 = new wxLayoutConstraints;
+       c1->top.SameAs(this, wxTop, 10);                // 10 from the top
+       c1->bottom.SameAs(this, wxBottom, -10);
+       c1->left.SameAs(this, wxLeft, 10);
+       c1->right.SameAs(this, wxRight, -10);
+       wholist->SetConstraints(c1);
+
+       SetAutoLayout(TRUE);
+       Show(TRUE);
+}
diff --git a/daphne/who.hpp b/daphne/who.hpp
new file mode 100644 (file)
index 0000000..4862cb5
--- /dev/null
@@ -0,0 +1,11 @@
+// userlogin is the frame for logging in.
+class who : public wxMDIChildFrame {
+public:
+       who(CitClient *sock, wxMDIParentFrame *MyMDI);
+       int do_login();
+private:
+       void OnButtonPressed(wxCommandEvent& whichbutton);
+       CitClient *citsock;
+       wxListCtrl *wholist;
+       DECLARE_EVENT_TABLE()
+};