]> code.citadel.org Git - citadel.git/commitdiff
ini files!
authorArt Cancro <ajc@citadel.org>
Sat, 24 Apr 1999 00:43:21 +0000 (00:43 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 24 Apr 1999 00:43:21 +0000 (00:43 +0000)
daphne/includes.hpp
daphne/main.cpp

index 7d003e5af0c6919daf29d5c100e3b2216f463dcb..02124d8cf9e292bf71dd18b392181865761faf9d 100644 (file)
@@ -8,7 +8,6 @@
 #include <wx/tokenzr.h>
 #include <wxhtml/wxhtml.h>
 
-
 #define MAXFLOORS      128
 
 
@@ -293,3 +292,4 @@ void variformat_to_html(wxString& outputbuf,
 extern wxMDIParentFrame *BigMDI;
 extern RoomTree *RoomList;
 extern CitClient *citadel;
+extern wxConfig *ini;
index 11cd38f4195d05f65db4d51bfd526a656d448cf9..2233a2dc56a811574457d0c98db5f94156cc0f49 100644 (file)
@@ -20,6 +20,7 @@
 // Globals
 wxMDIParentFrame *BigMDI;
 RoomTree *RoomList;
+wxConfig *ini;
 
 
 // ----------------------------------------------------------------------------
@@ -130,22 +131,25 @@ CitClient *citadel;
 // `Main program' equivalent: the program execution "starts" here
 bool Daphne::OnInit()
 {
+       // Read the configuration file
+       ini = new wxConfig("daphne");
 
+       // Connect to the server
        citadel = new CitClient();
 
-    // Create the main application window
-    MyFrame *frame = new MyFrame("Daphne",
+       // Create the main application window
+       MyFrame *frame = new MyFrame("Daphne",
                                  wxPoint(10, 10), wxSize(600, 450));
-    BigMDI = frame;
+       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?
-    SetTopWindow(frame);
+       // Show it and tell the application that it's our main window
+       // @@@ what does it do exactly, in fact? is it necessary here?
+       SetTopWindow(frame);
 
-    // success: wxApp::OnRun() will be called which will enter the main message
-    // loop and the application will run. If we returned FALSE here, the
-    // application would exit immediately.
-    return TRUE;
+       // success: wxApp::OnRun() will be called which will enter the main
+       // message loop and the application will run. If we returned FALSE
+       // here, the application would exit immediately.
+       return TRUE;
 }
 
 // ----------------------------------------------------------------------------
@@ -297,6 +301,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
 
        // TRUE is to force the frame to close
        Close(TRUE);
+
+       // Write configuration back to disk
+       delete ini;
 }
 
 // User menu handler
@@ -346,8 +353,9 @@ void MyFrame::OnConnect(wxCommandEvent& unused) {
        int retval;
        wxString DefaultHost, DefaultPort;
 
-       DefaultHost = "uncnsrd.mt-kisco.ny.us";
-        DefaultPort = "504";
+       ini->Read("/Citadel Server/Host", &DefaultHost,
+               "uncnsrd.mt-kisco.ny.us");
+       ini->Read("/Citadel Server/Port", &DefaultPort, "504");
 
        if (citadel->IsConnected()) {
                wxMessageBox("You are currently connected to "