]> code.citadel.org Git - citadel.git/commitdiff
Removed all references to wxStringList and replaced them with wxString.
authorArt Cancro <ajc@citadel.org>
Sat, 10 Apr 1999 04:46:16 +0000 (04:46 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 10 Apr 1999 04:46:16 +0000 (04:46 +0000)
(We'll use newlines as a separator token.)

daphne/includes.hpp
daphne/roomtree.cpp
daphne/userlogin.cpp
daphne/utils.cpp

index b12ae5031a79d80062d8d5c3137b7c7ea1ffabb3..397a812babbb38ec922c0123982a175b80f034f6 100644 (file)
@@ -222,13 +222,13 @@ public:
 private:
        void OnButtonPressed(wxCommandEvent& whichbutton);
        CitClient *citsock;
-       DECLARE_EVENT_TABLE()
        void do_readloop(wxString readcmd);
        wxMDIParentFrame *citMyMDI;
        wxHtmlWindow *message_window;
         wxPanel *banner;
         wxButton *close_button;
        wxString ThisRoom;
+       DECLARE_EVENT_TABLE()
 };
 
 
@@ -275,6 +275,9 @@ private:
 void extract(wxString& outputbuf, wxString inputbuf, int parmnum);
 int extract_int(wxString inputbuf, int parmnum);
 void load_roomlist(RoomTree *tree, CitClient *citsock);
+void variformat_to_html(wxString& outputbuf,
+                        wxString inputbuf,
+                        bool add_header_and_footer);
 
 
 
index 51b51b57299a47f66f2c84ad7dd25c5f42eec633..22b4ba119bc9fd987823a47f24dfdadd2417fbee 100644 (file)
 
 class RoomItem : public wxTreeItemData {
 public:
-       RoomItem(wxString name);
+       RoomItem(wxString name, bool newmsgs);
        wxString RoomName;
+       bool HasNewMessages;
 };
 
-RoomItem::RoomItem(wxString name
+RoomItem::RoomItem(wxString name, bool newmsgs)
        : wxTreeItemData() {
 
-       RoomName = name;        
+       RoomName = name;
+       HasNewMessages = newmsgs;
 }
 
 
@@ -123,7 +125,7 @@ void RoomTree::LoadRoomList(void) {
                        roomname,
                        2,
                        -1,
-                       new RoomItem(roomname)
+                       new RoomItem(roomname, TRUE)
                        );
                SetItemBold(item, TRUE);
                SetItemBold(floorboards[floornum], TRUE);
@@ -142,10 +144,11 @@ void RoomTree::LoadRoomList(void) {
                        roomname,
                        3,
                        -1,
-                       new RoomItem(roomname)
+                       new RoomItem(roomname, FALSE)
                        );
        }
 
+
 }
 
 
index 61dcabd62afd61dd616c56a498805154abf8a43e..2c1bb5793f32174ea50f837ac2e2187e43e9dc24 100644 (file)
@@ -55,7 +55,7 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
                        "UserLogin"
                        ) {
 
-       wxString sendcmd, recvcmd, xferbuf;
+       wxString sendcmd, recvcmd, xferbuf, buf;
        wxPanel *banner;
 
        citsock = sock;
@@ -129,13 +129,7 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
                "exit_button"
                );
 
-       wxTextCtrl *hello = new wxTextCtrl(this, -1,
-               "", //value
-               wxDefaultPosition, wxDefaultSize,
-               wxTE_MULTILINE | wxTE_READONLY,
-               wxDefaultValidator, "");
-
-
+       wxHtmlWindow *hello = new wxHtmlWindow(this);
 
         // Set up a panel for the title...
         banner = new wxPanel(this, -1);
@@ -222,10 +216,11 @@ UserLogin::UserLogin(CitClient *sock, wxMDIParentFrame *MyMDI)
 
        sendcmd = "MESG hello";
        if (citsock->serv_trans(sendcmd, recvcmd, xferbuf)==1) {
-               hello->SetValue(xferbuf);
+               variformat_to_html(buf, xferbuf, FALSE);
+               buf = "<HTML><BODY><CENTER>"
+                       + buf + "</CENTER></BODY></HTML>\n";
+               hello->SetPage(buf);
        }
-
-
 }
 
 
index 392fa17c53b18368df668733f7a707d54fb0dc0c..bf7d068d3ea552d2ec35f420f8160d515dc3bad6 100644 (file)
@@ -31,3 +31,37 @@ int extract_int(wxString inputbuf, int parmnum) {
        return atoi((const char *)buf);
 }
 
+
+
+// Convert traditional Citadel variformat text to HTML
+void variformat_to_html(wxString& outputbuf,
+                       wxString inputbuf,
+                       bool add_header_and_footer) {
+
+       wxString buf;
+       int pos;
+
+       outputbuf.Empty();
+       buf = inputbuf;
+
+       if (add_header_and_footer) {
+               outputbuf.Append("<HTML><BODY>");
+       }
+
+       while (buf.Length() > 0) {
+               pos = buf.Find('\n', FALSE);
+               if (pos < 0) {
+                       buf = buf + "\n";
+                       pos = buf.Find('\n', FALSE);
+               }
+               if ( (buf.Left(1) == " ") && (outputbuf.Length() > 0) ) {
+                       outputbuf.Append("<BR>\n");
+               }
+               outputbuf.Append(buf.Left(pos));
+               buf = buf.Mid(pos+1);
+       }
+
+       if (add_header_and_footer) {
+               outputbuf.Append("</BODY></HTML>\n");
+       }
+}