enum {
RI_NOTHING,
RI_ROOM,
+ RI_CURRUSER,
RI_SERVPROPS
};
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;
-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;
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,
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,
new RoomItem("Security", FALSE, RI_SERVPROPS)
);
+ Expand(GetRootItem());
+
// Demo of traversal -- do not use
// while (march_next != null_item) {
// wxTreeItemId foo = GetNextRoomId();
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("<");
+ else if (ch == ">")
+ buf.Append(">");
+ else if (ch == "\"")
+ buf.Append(""");
+ 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);