// 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()
// ============================================================================
wxString stringized_message;
citsock = sock;
+ reply_to = sender;
ListToMultiline(stringized_message, msg);
if (whichbutton.GetId() == BUTTON_OK) {
delete this;
}
+ if (whichbutton.GetId() == BUTTON_REPLY) {
+ new SendExpress(citsock, BigMDI, reply_to);
+ delete this;
+ }
}
#include "utils.h"
+
+// Globals
+
+extern wxMDIParentFrame *BigMDI;
+
+
+
+
+
// TCPsocket represents a socket-level TCP connection to a server.
class TCPsocket {
public:
private:
void OnButtonPressed(wxCommandEvent& whichbutton);
CitClient *citsock;
+ wxString reply_to;
DECLARE_EVENT_TABLE()
};
public:
SendExpress( CitClient *sock,
wxMDIParentFrame *MyMDI,
- wxString *touser);
+ wxString touser);
private:
void OnButtonPressed(wxCommandEvent& whichbutton);
CitClient *citsock;
#include "includes.hpp"
+
+
+// Globals
+wxMDIParentFrame *BigMDI;
+
+
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// 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?
TheWholist->Activate();
}
else if (id == UMENU_SEND_EXPRESS)
- new SendExpress(citadel, this, NULL);
+ new SendExpress(citadel, this, "");
}
// Window menu handler
// frame constructor
SendExpress::SendExpress( CitClient *sock,
wxMDIParentFrame *MyMDI,
- wxString *touser)
+ wxString touser)
: wxMDIChildFrame(MyMDI, //parent
-1, //window id
" Page another user ",
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);
+ }
}
}
"Error",
wxOK | wxICON_EXCLAMATION,
NULL, -1, -1);
+ } else {
+ delete this;
}
}
}