]> code.citadel.org Git - citadel.git/commitdiff
Got the fake mail floor in place.
authorArt Cancro <ajc@citadel.org>
Sat, 8 May 1999 05:00:55 +0000 (05:00 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 8 May 1999 05:00:55 +0000 (05:00 +0000)
daphne/roomtree.cpp
daphne/utils.cpp

index 9a2c4dd306a2433e02e363beba3c523e0c4d1310..8abc486884e1c668a9c32c7aa12cd8f37ed232dd 100644 (file)
@@ -14,6 +14,7 @@ wxTreeItemId null_item;
 enum {
        RI_NOTHING,
        RI_ROOM,
+       RI_CURRUSER,
        RI_SERVPROPS
 };
 
@@ -93,7 +94,9 @@ void RoomTree::LoadRoomList(void) {
        wxString sendcmd, recvcmd, buf, floorname, roomname, transbuf;
        wxTreeItemId item;
        wxTreeItemId prev;
-       int i, pos, floornum;
+       int i, pos, floornum, where;
+       int mailfloor;
+       unsigned int roomflags;
 
        prev = null_item;
 
@@ -110,6 +113,15 @@ void RoomTree::LoadRoomList(void) {
                -1,
                NULL);
 
+       // Create a fake floor for all of this user's mail rooms
+       mailfloor = AppendItem(
+               GetRootItem(),
+               citsock->curr_user,
+               1,                      // FIX use an envelope icon here
+               -1,
+               new RoomItem(citsock->curr_user, FALSE, RI_CURRUSER)
+               );
+               
        sendcmd = "LFLR";
        // Bail out silently if we can't retrieve the floor list
        if (citsock->serv_trans(sendcmd, recvcmd, transbuf) != 1) return;
@@ -135,9 +147,14 @@ void RoomTree::LoadRoomList(void) {
                buf = transbuf.Left(pos);
                transbuf = transbuf.Mid(pos+1);
                extract(roomname, buf, 0);
+               roomflags = extract_int(buf, 1);
                floornum = extract_int(buf, 2);
+               if (roomflags & QR_MAILBOX)
+                       where = mailfloor;
+               else
+                       where = floorboards[floornum];
                item = AppendItem(
-                       floorboards[floornum],
+                       where,
                        roomname,
                        2,
                        -1,
@@ -159,9 +176,14 @@ void RoomTree::LoadRoomList(void) {
                buf = transbuf.Left(pos);
                transbuf = transbuf.Mid(pos+1);
                extract(roomname, buf, 0);
+               roomflags = extract_int(buf, 1);
                floornum = extract_int(buf, 2);
+               if (roomflags & QR_MAILBOX)
+                       where = mailfloor;
+               else
+                       where = floorboards[floornum];
                AppendItem(
-                       floorboards[floornum],
+                       where,
                        roomname,
                        3,
                        -1,
@@ -195,6 +217,8 @@ void RoomTree::LoadRoomList(void) {
                new RoomItem("Security", FALSE, RI_SERVPROPS)
                );
 
+       Expand(GetRootItem());
+
        // Demo of traversal -- do not use
        // while (march_next != null_item) {
        //      wxTreeItemId foo = GetNextRoomId();
index de3ba29446b44efc7576e6176de25ccf1ac3400c..a1cb1b3c9131028c30cbfe44a1c339c8de7ba6f8 100644 (file)
@@ -33,24 +33,42 @@ void variformat_to_html(wxString& outputbuf,
                        wxString inputbuf,
                        bool add_header_and_footer) {
 
-       wxString buf;
+       wxString buf, ch;
        int pos;
 
        outputbuf.Empty();
-       buf = inputbuf;
+
+       // Escape out any reserved characters
+       buf = "";
+       for (pos=0; pos<inputbuf.Length(); ++pos) {
+               ch = inputbuf.Mid(pos, 1);
+               if (ch == "<")
+                       buf.Append("&lt;");
+               else if (ch == ">")
+                       buf.Append("&gt;");
+               else if (ch == "\"")
+                       buf.Append("&quot;");
+               else
+                       buf.Append(ch);
+       }
 
        if (add_header_and_footer) {
                outputbuf.Append("<HTML><BODY>");
        }
 
+       // Parse the body of the text
        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");
+               if (outputbuf.Length() > 0) {
+                       if (buf.Left(1) == " ") {
+                               outputbuf.Append("<BR>\n");
+                       } else {
+                               outputbuf.Append(" ");
+                       }
                }
                outputbuf.Append(buf.Left(pos));
                buf = buf.Mid(pos+1);