]> code.citadel.org Git - citadel.git/commitdiff
Removed all 'cout' commands
authorSteve Williams <patriot@uncensored.citadel.org>
Sun, 7 Nov 1999 18:42:52 +0000 (18:42 +0000)
committerSteve Williams <patriot@uncensored.citadel.org>
Sun, 7 Nov 1999 18:42:52 +0000 (18:42 +0000)
changed 'exit' commands to 'close' on the userlogin menu
updated daphne so that disconnecting from the server doesn't
shut down the program.

daphne/ChangeLog
daphne/citclient.cpp
daphne/main.cpp
daphne/userlogin.cpp

index 3ee8e4ea5d5957a0ae16f82bef8d7b056115a1a6..6adfa90ef539c30fbe152c61fbb5271c692079c9 100644 (file)
@@ -1,5 +1,10 @@
 $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.
 
-
index 9595b7064d70d05a038d2685d86180d1c27696d6..9c04ca5ba5119f3f190c93d3a1e1e7acbc2ddd54 100644 (file)
@@ -21,14 +21,14 @@ int CitClient::attach(wxString host, wxString port) {
         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);
         }
 }
@@ -96,7 +96,7 @@ void CitClient::serv_gets(wxString& buf) {
                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;
@@ -116,7 +116,7 @@ void CitClient::serv_gets(wxString& buf) {
         GetLine(sock, buf);
 */
 
-       cout << "> " << buf << "(len=" << buf.Len() << ")\n";
+/*     cout << "> " << buf << "(len=" << buf.Len() << ")\n"; */
 }
 
 
@@ -127,7 +127,7 @@ void CitClient::serv_gets(wxString& buf) {
 // 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);
 }
@@ -169,14 +169,14 @@ int CitClient::serv_trans(
 
        // 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);
        }
@@ -219,16 +219,16 @@ int CitClient::serv_trans(
 
        // 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;
 }
 
@@ -343,19 +343,19 @@ void CitClient::reconnect_session(void) {
 
        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"; */
        }
 }
 
index 8281824112e47a2676309dda26644c4eff8cbcc1..8eeb52d903904c279caa5838e6fb8430ab9798ac 100644 (file)
@@ -14,6 +14,7 @@
 #include "bitmaps/mail.xpm"
 #include "bitmaps/who.xpm"
 #include "bitmaps/chat.xpm"
+#include "bitmaps/xglobe.xpm"
 #endif
 
 
@@ -52,6 +53,7 @@ public:
        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);
@@ -78,6 +80,7 @@ enum
 {
        DO_NOTHING,
        IG_Quit,
+       IG_Term,
        IG_About,
        IG_Text,
        MENU_CONNECT,
@@ -100,6 +103,7 @@ enum
 // 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)
@@ -193,8 +197,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
        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...");
 
@@ -238,7 +244,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 // 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
@@ -254,11 +260,13 @@ void MyFrame::InitToolBar(wxToolBar* toolBar) {
        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,
@@ -297,9 +305,17 @@ void MyFrame::InitToolBar(wxToolBar* toolBar) {
                        (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];
 }
 
@@ -323,6 +339,19 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 }
 
 
+// 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;
@@ -393,7 +422,7 @@ void MyFrame::OnConnect(wxCommandEvent& unused) {
        } 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");
index eeb4114f2170ac815988669391fea5ce4317c0a9..6770c71b3dc8ea315a9faf279c63a391772a37f0 100644 (file)
@@ -122,13 +122,13 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
        exit_button = new wxButton(
                this,
                BUTTON_EXIT,
-               "Exit",
+               "Close",
                wxPoint(300,300),
                wxSize(100,30),
                0L,
                wxDefaultValidator,
                "exit_button"
-               );
+               ); 
 
        wxHtmlWindow *hello = new wxHtmlWindow(this);
 
@@ -228,9 +228,15 @@ void UserLogin::OnButtonPressed(wxCommandEvent& whichbutton) {
        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) {