$Log$
+Revision 1.2 1999/11/07 18:42:52 smw
+Removed all 'cout' commands
+changed 'exit' commands to 'close' on the userlogin menu
+updated daphne so that disconnecting from the server doesn't
+shut down the program.
+
Revision 1.1 1999/11/07 17:56:38 ajc
* Began the ChangeLog for this project.
-
sock->SetNotify(0);
sock->Connect(addr, TRUE);
if (sock->IsConnected()) {
- cout << "Connect succeeded\n" ;
+/* cout << "Connect succeeded\n" ; */
serv_gets(ServerReady);
initialize_session();
curr_host = host; // Remember host and port, in case
curr_port = port; // we need to auto-reconnect later
return(0);
} else {
- cout << "Connect failed\n" ;
+ /* cout << "Connect failed\n" ;*/
return(1);
}
}
if (nl_pos < 0) {
sock->Read(&charbuf[nbytes], (sizeof(charbuf)-nbytes) );
nbytes += sock->LastCount();
- cout << "Read " << sock->LastCount() << " bytes \n";
+ /* cout << "Read " << sock->LastCount() << " bytes \n";*/
}
for (i=nbytes; i>=0; --i)
if (charbuf[i] == 10) nl_pos = i;
GetLine(sock, buf);
*/
- cout << "> " << buf << "(len=" << buf.Len() << ")\n";
+/* cout << "> " << buf << "(len=" << buf.Len() << ")\n"; */
}
// Write a line of text to the server
void CitClient::serv_puts(wxString buf) {
- cout << "< " << buf << "\n" ;
+ /* cout << "< " << buf << "\n" ; */
sock->Write((const char *)buf, buf.Len());
sock->Write("\n", 1);
}
// If a mutex is to be wrapped around this function in the future,
// it must begin HERE.
- cout << "Beginning transaction\n";
+/* cout << "Beginning transaction\n"; */
Critter.Enter();
// wxBeginBusyCursor();
serv_puts(command);
if (IsConnected() == FALSE) {
- wxSleep(5); // Give a crashed server some time to restart
+ wxSleep(20); // Give a crashed server some time to restart
reconnect_session();
serv_puts(command);
}
// If a mutex is to be wrapped around this function in the future,
// it must end HERE.
- cout << "Ending transaction...\n";
+/* cout << "Ending transaction...\n"; */
// wxEndBusyCursor();
Critter.Leave();
- cout << "...done.\n";
+/* cout << "...done.\n"; */
if (express_messages_waiting) {
download_express_messages();
}
- cout << "serv_trans() returning " << first_digit << "\n";
+/* cout << "serv_trans() returning " << first_digit << "\n"; */
return first_digit;
}
if (attach(curr_host, curr_port) != 0) {
// FIX do this more elegantly
- cout << "Could not re-establish session (1)\n";
+ /* cout << "Could not re-establish session (1)\n"; */
}
sendcmd = "USER " + curr_user;
if (serv_trans(sendcmd) != 3) {
// FIX do this more elegantly
- cout << "Could not re-establish session (2)\n";
+ /* cout << "Could not re-establish session (2)\n"; */
}
sendcmd = "PASS " + curr_pass;
if (serv_trans(sendcmd) != 2) {
// FIX do this more elegantly
- cout << "Could not re-establish session (3)\n";
+ /* cout << "Could not re-establish session (3)\n"; */
}
}
#include "bitmaps/mail.xpm"
#include "bitmaps/who.xpm"
#include "bitmaps/chat.xpm"
+#include "bitmaps/xglobe.xpm"
#endif
void OnAbout(wxCommandEvent& event);
void OnDoCmd(wxCommandEvent& event);
void GotoNewRoom(wxTreeEvent& event);
+ void DoTerm(wxCommandEvent& event);
private:
void OnConnect(wxCommandEvent& event);
void OnGotoMail(wxCommandEvent& event);
{
DO_NOTHING,
IG_Quit,
+ IG_Term,
IG_About,
IG_Text,
MENU_CONNECT,
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE( MyFrame, wxMDIParentFrame)
EVT_MENU( IG_Quit, MyFrame::OnQuit)
+ EVT_MENU( IG_Term, MyFrame::DoTerm)
EVT_MENU( IG_About, MyFrame::OnAbout)
EVT_MENU( MENU_CONNECT, MyFrame::OnConnect)
EVT_MENU( EMENU_PREFS, MyFrame::OnEditMenu)
menuFile->Append(MENU_CONNECT, "&Connect");
menuFile->Append(MENU_TESTWIN, "Add &Test window");
menuFile->AppendSeparator();
+ menuFile->Append(IG_Term, "&Disconnect");
menuFile->Append(IG_Quit, "E&xit");
+
wxMenu *menuEdit = new wxMenu;
menuEdit->Append(EMENU_PREFS, "&Preferences...");
// The toolbar for this application.
void MyFrame::InitToolBar(wxToolBar* toolBar) {
int i;
- wxBitmap* bitmaps[4];
+ wxBitmap* bitmaps[5];
// wxGTK seems to do the right thing by itself, while wxMSW wants to be
// told how big the toolbar icons are going to be, otherwise it defaults to
bitmaps[1] = new wxBitmap("bitmaps/mail.bmp", wxBITMAP_TYPE_BMP);
bitmaps[2] = new wxBitmap("bitmaps/who.bmp", wxBITMAP_TYPE_BMP);
bitmaps[3] = new wxBitmap("bitmaps/chat.bmp", wxBITMAP_TYPE_BMP);
+ bitmaps[4] = new wxBitmap("bitmaps/xglobe.bmp", wxBITMAP_TYPE_BMP);
#else
bitmaps[0] = new wxBitmap(globe_xpm);
bitmaps[1] = new wxBitmap(mail_xpm);
bitmaps[2] = new wxBitmap(who_xpm);
bitmaps[3] = new wxBitmap(chat_xpm);
+ bitmaps[4] = new wxBitmap(xglobe_xpm);
#endif
toolBar->AddTool(MENU_CONNECT,
(wxObject *)NULL,
"Real-time chat");
+ toolBar->AddTool(IG_Term,
+ *bitmaps[4],
+ wxNullBitmap,
+ FALSE,
+ -1, -1,
+ (wxObject *)NULL,
+ "Disconnect");
+
toolBar->Realize();
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 5; i++)
delete bitmaps[i];
}
}
+// Testing for doterm
+
+void MyFrame::DoTerm(wxCommandEvent& WXUNUSED(event))
+{
+
+ // Kill the client connection
+ citadel->detach();
+ BigMDI->SetStatusText("Not connected");
+
+}
+
+
+
// Edit menu handler
void MyFrame::OnEditMenu(wxCommandEvent& cmd) {
int id;
} else {
retval = citadel->attach(DefaultHost, DefaultPort);
if (retval == 0) {
- SetStatusText("Connected to " + citadel->HumanNode, 0);
+ SetStatusText("Connected to " + citadel->HumanNode, 0);
new UserLogin(citadel, this);
} else {
wxMessageBox("Could not connect to server.", "Error");
exit_button = new wxButton(
this,
BUTTON_EXIT,
- "Exit",
+ "Close",
wxPoint(300,300),
wxSize(100,30),
0L,
wxDefaultValidator,
"exit_button"
- );
+ );
wxHtmlWindow *hello = new wxHtmlWindow(this);
int r;
if (whichbutton.GetId() == BUTTON_EXIT) {
+ if (citadel->IsConnected()) {
sendbuf = "QUIT";
citsock->serv_trans(sendbuf);
- cleanup(0);
+ BigMDI->SetStatusText("Not connected");
+ delete this;
+ } else {
+ BigMDI->SetStatusText("Not connected");
+ delete this; }
+
}
if (whichbutton.GetId() == BUTTON_LOGIN) {