]> code.citadel.org Git - citadel.git/commitdiff
Got the "reply" button working when receiving a page.
authorArt Cancro <ajc@citadel.org>
Sat, 13 Mar 1999 02:42:53 +0000 (02:42 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 13 Mar 1999 02:42:53 +0000 (02:42 +0000)
daphne/express_message.cpp
daphne/includes.hpp
daphne/main.cpp
daphne/send_express.cpp

index 7e0d0723f23c270c6aa215aba0752dd5a6ce032c..6cec3baa0fef62b3a1a9d13e336633e6d3fb07d0 100644 (file)
@@ -28,6 +28,7 @@ enum
 // simple menu events like this the static method is much simpler.
 BEGIN_EVENT_TABLE(     express_message, wxFrame)
        EVT_BUTTON(     BUTTON_OK,      express_message::OnButtonPressed)
+       EVT_BUTTON(     BUTTON_REPLY,   express_message::OnButtonPressed)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -59,6 +60,7 @@ express_message::express_message(
        wxString stringized_message;
 
        citsock = sock;
+       reply_to = sender;
 
        ListToMultiline(stringized_message, msg);
 
@@ -132,4 +134,8 @@ void express_message::OnButtonPressed(wxCommandEvent& whichbutton) {
         if (whichbutton.GetId() == BUTTON_OK) {
                 delete this;
         }
+        if (whichbutton.GetId() == BUTTON_REPLY) {
+               new SendExpress(citsock, BigMDI, reply_to);
+               delete this;
+       }
 }
index 270fe58922a8c681a91659beca9d645ce72cdb4c..8452a7069204b23015ce48604cb1604b2d26d5a1 100644 (file)
@@ -8,6 +8,15 @@
 #include "utils.h"
 
 
+
+// Globals
+
+extern wxMDIParentFrame *BigMDI;
+
+
+
+
+
 // TCPsocket represents a socket-level TCP connection to a server.
 class TCPsocket {
 public:
@@ -88,6 +97,7 @@ public:
 private:
        void OnButtonPressed(wxCommandEvent& whichbutton);
        CitClient *citsock;
+       wxString reply_to;
        DECLARE_EVENT_TABLE()
 };
 
@@ -100,7 +110,7 @@ class SendExpress : public wxMDIChildFrame {
 public:
        SendExpress(    CitClient *sock,
                        wxMDIParentFrame *MyMDI, 
-                       wxString *touser);
+                       wxString touser);
 private:
        void OnButtonPressed(wxCommandEvent& whichbutton);
        CitClient *citsock;
index 75e7d9a22ec0c7513261cc2cbde606a3760c238d..60391ea428712957949558ea2855f3fb47078ff5 100644 (file)
@@ -9,6 +9,12 @@
 
 #include "includes.hpp"
 
+
+
+// Globals
+wxMDIParentFrame *BigMDI;
+
+
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
@@ -119,6 +125,7 @@ bool Daphne::OnInit()
     // Create the main application window
     MyFrame *frame = new MyFrame("Daphne",
                                  wxPoint(10, 10), wxSize(600, 450));
+    BigMDI = frame;
 
     // Show it and tell the application that it's our main window
     // @@@ what does it do exactly, in fact? is it necessary here?
@@ -209,7 +216,7 @@ void MyFrame::OnUsersMenu(wxCommandEvent& cmd) {
                        TheWholist->Activate();
        }
        else if (id == UMENU_SEND_EXPRESS)
-               new SendExpress(citadel, this, NULL);
+               new SendExpress(citadel, this, "");
 }
 
 // Window menu handler
index ebf4e86588f770ddd353dc895ca2c71e71d50886..85b503c0aaa9e444861a04fd132b7acdf0acb801 100644 (file)
@@ -39,7 +39,7 @@ END_EVENT_TABLE()
 // frame constructor
 SendExpress::SendExpress(      CitClient *sock,
                                wxMDIParentFrame *MyMDI,
-                               wxString *touser)
+                               wxString touser)
        : wxMDIChildFrame(MyMDI,        //parent
                        -1,     //window id
                        " Page another user ",
@@ -164,10 +164,15 @@ SendExpress::SendExpress( CitClient *sock,
         sendcmd = "RWHO";
         if (citsock->serv_trans(sendcmd, recvcmd, xferbuf) != 1) return;
 
-        for (i=0; i<xferbuf.Number(); ++i) {
-                buf.Printf("%s", (wxString *)xferbuf.Nth(i)->GetData());
-                extract(user, buf, 1);
-               ToWhom->Append(user);
+       if (touser.Length() > 0) {
+               ToWhom->Append(touser);
+               ToWhom->SetSelection(0, TRUE);
+       } else {
+               for (i=0; i<xferbuf.Number(); ++i) {
+                       buf.Printf("%s", (wxString *)xferbuf.Nth(i)->GetData());
+                       extract(user, buf, 1);
+                       ToWhom->Append(user);
+               }
        }
 
 }
@@ -189,6 +194,8 @@ void SendExpress::OnButtonPressed(wxCommandEvent& whichbutton) {
                                        "Error",
                                        wxOK | wxICON_EXCLAMATION,
                                        NULL, -1, -1);
+               } else {
+                       delete this;
                }
        }
 }