X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=d54ca16199accb15f7b3a7c0a70c4d5ae14046e8;hb=abeb8adc38f9d55fcb6cb3d076f57239b0a9a4d5;hp=f06119c7f9eb61da437456656bc4d878786e41bf;hpb=01cd4ccab2003b1e15ab03bb2411854bc9620038;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index f06119c7f..d54ca1619 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1,5 +1,8 @@ -/* $Id$ */ - +/* + * $Id$ + * + * Lots of different room-related operations. + */ #include #include @@ -32,11 +35,12 @@ struct folder { }; char *viewdefs[] = { - "Messages", - "Summary", + "Bulletin Board", + "Mail Folder", "Address Book", "Calendar", - "Tasks" + "Task List", + "Notes List" }; char floorlist[128][SIZ]; @@ -59,7 +63,7 @@ void load_floorlist(void) return; } while (serv_gets(buf), strcmp(buf, "000")) { - extract(floorlist[extract_int(buf, 0)], buf, 1); + extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]); } } @@ -176,7 +180,7 @@ void listrms(char *variety) while (serv_gets(buf), strcmp(buf, "000")) { ++num_rooms; rp = malloc(sizeof(struct roomlisting)); - extract(rp->rlname, buf, 0); + extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname); rp->rlflags = extract_int(buf, 1); rp->rlfloor = extract_int(buf, 2); rp->rlorder = extract_int(buf, 3); @@ -220,14 +224,14 @@ void listrms(char *variety) */ void zapped_list(void) { - output_headers(3); + output_headers(1, 1, 0, 0, 0, 0, 0); svprintf("BOXTITLE", WCS_STRING, "Zapped (forgotten) rooms"); do_template("beginbox"); listrms("LZRM -1"); - wprintf("

\n"); + wprintf("

\n"); wprintf("Click on any room to un-zap it and goto that room.\n"); do_template("endbox"); wDumpContent(1); @@ -281,7 +285,7 @@ void embed_newmail_button(void) { "" "" - "
" + "
" "%d new mail
", WC->new_mail); WC->remember_new_mail = WC->new_mail; } @@ -296,7 +300,10 @@ void embed_view_o_matic(void) { int i; wprintf("
\n" + "View as: " "\n"); + wprintf("
\n"); } -void embed_room_banner(char *got) { +void embed_room_banner(char *got, int navbar_style) { char fakegot[SIZ]; /* We need to have the information returned by a GOTO server command. @@ -358,7 +365,158 @@ void embed_room_banner(char *got) { svcallback("START", offer_start_page); do_template("roombanner"); - clear_local_substs(); + if (navbar_style != navbar_none) { + + wprintf("
\n" + "\n"); + + + if (navbar_style == navbar_default) wprintf( + "\n" + ); + + if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) { + wprintf( + "\n" + ); + } + + if (navbar_style == navbar_default) { + switch(WC->wc_view) { + case VIEW_ADDRESSBOOK: + wprintf( + "\n" + ); + break; + case VIEW_CALENDAR: + wprintf( + "\n" + ); + wprintf( + "\n" + ); + break; + case VIEW_TASKS: + wprintf( + "\n" + ); + break; + case VIEW_NOTES: + wprintf( + "\n" + ); + break; + case VIEW_MAILBOX: + wprintf( + "\n" + ); + break; + default: + wprintf( + "\n" + ); + break; + } + } + + if (navbar_style == navbar_default) { + wprintf( + "\n"); + } + + if (navbar_style == navbar_default) wprintf( + "\n" + ); + + if (navbar_style == navbar_default) wprintf( + "\n" + ); + + wprintf("
" + "" + "" + "Ungoto" + "" + "" + "" + "Read new messages" + "" + "" + "" + "" + "View contacts" + "" + "" + "" + "" + "Day view" + "" + "" + "" + "" + "Month view" + "" + "" + "" + "" + "View tasks" + "" + "" + "" + "" + "View notes" + "" + "" + "" + "" + "View message list" + "" + "" + "" + "" + "Read all messages" + "" + "" + "" + "" + ); + switch(WC->wc_view) { + case VIEW_ADDRESSBOOK: + wprintf("Add new contact"); + break; + case VIEW_CALENDAR: + wprintf("Add new event"); + break; + case VIEW_TASKS: + wprintf("Add new task"); + break; + case VIEW_NOTES: + wprintf("Add new note"); + break; + default: + wprintf("Enter a message"); + break; + } + wprintf("" + "" + "Skip this room" + "" + "" + "" + "Goto next room" + "" + "
\n"); + } + } @@ -366,36 +524,18 @@ void embed_room_banner(char *got) { /* - * generic routine to take the session to a new room + * back end routine to take the session to a new room * - * display_name values: 0 = goto only - * 1 = goto and display - * 2 = display only */ -void gotoroom(char *gname, int display_name) +void gotoroom(char *gname) { char buf[SIZ]; static long ls = (-1L); + /* store ungoto information */ + strcpy(WC->ugname, WC->wc_roomname); + WC->uglsn = ls; - if (display_name) { - output_headers(0); - wprintf("Pragma: no-cache\n"); - wprintf("Cache-Control: no-store\n"); - - wprintf("\n" - "\n" - "\n" - "\n" - "\n" - "\n"); - do_template("background"); - } - if (display_name != 2) { - /* store ungoto information */ - strcpy(WC->ugname, WC->wc_roomname); - WC->uglsn = ls; - } /* move to the new room */ serv_printf("GOTO %s", gname); serv_gets(buf); @@ -404,18 +544,17 @@ void gotoroom(char *gname, int display_name) serv_gets(buf); } if (buf[0] != '2') { - if (display_name) { - wprintf("%s
\n", &buf[4]); - wDumpContent(1); - } return; } - extract(WC->wc_roomname, &buf[4], 0); + extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname); WC->room_flags = extract_int(&buf[4], 4); /* highest_msg_read = extract_int(&buf[4],6); maxmsgnum = extract_int(&buf[4],5); is_mail = (char) extract_int(&buf[4],7); */ ls = extract_long(&buf[4], 6); + WC->wc_floor = extract_int(&buf[4], 10); + WC->wc_view = extract_int(&buf[4], 11); + WC->wc_default_view = extract_int(&buf[4], 12); if (WC->is_aide) WC->is_room_aide = WC->is_aide; @@ -425,15 +564,6 @@ void gotoroom(char *gname, int display_name) remove_march(WC->wc_roomname); if (!strcasecmp(gname, "_BASEROOM_")) remove_march(gname); - - /* Display the room banner */ - if (display_name) { - embed_room_banner(buf); - wDumpContent(1); - } - strcpy(WC->wc_roomname, WC->wc_roomname); - WC->wc_view = extract_int(&buf[4], 11); - WC->wc_default_view = extract_int(&buf[4], 12); } @@ -500,7 +630,7 @@ void gotonext(void) while (serv_gets(buf), strcmp(buf, "000")) { mptr = (struct march *) malloc(sizeof(struct march)); mptr->next = NULL; - extract(mptr->march_name, buf, 0); + extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name); mptr->march_floor = extract_int(buf, 2); mptr->march_order = extract_int(buf, 3); if (WC->march == NULL) { @@ -544,7 +674,7 @@ void gotonext(void) void smart_goto(char *next_room) { - gotoroom(next_room, 0); + gotoroom(next_room); readloop("readnew"); } @@ -561,7 +691,7 @@ void slrp_highest(void) serv_puts("SLRP HIGHEST"); serv_gets(buf); if (buf[0] != '2') { - wprintf("%s
\n", &buf[4]); + wprintf("%s
\n", &buf[4]); return; } } @@ -617,9 +747,9 @@ int self_service(int newval) { serv_gets(buf); if (buf[0] != '2') return(0); - extract(name, &buf[4], 0); - extract(password, &buf[4], 1); - extract(dirname, &buf[4], 2); + extract_token(name, &buf[4], 0, '|', sizeof name); + extract_token(password, &buf[4], 1, '|', sizeof password); + extract_token(dirname, &buf[4], 2, '|', sizeof dirname); flags = extract_int(&buf[4], 3); floor = extract_int(&buf[4], 4); order = extract_int(&buf[4], 5); @@ -667,6 +797,7 @@ void display_editroom(void) char buf[SIZ]; char cmd[SIZ]; char node[SIZ]; + char remote_room[SIZ]; char recp[SIZ]; char er_name[20]; char er_password[10]; @@ -678,10 +809,15 @@ void display_editroom(void) char *tab; char *shared_with; char *not_shared_with; + int roompolicy = 0; + int roomvalue = 0; + int floorpolicy = 0; + int floorvalue = 0; tab = bstr("tab"); if (strlen(tab) == 0) tab = "admin"; + load_floorlist(); serv_puts("GETR"); serv_gets(buf); @@ -690,16 +826,18 @@ void display_editroom(void) display_main_menu(); return; } - extract(er_name, &buf[4], 0); - extract(er_password, &buf[4], 1); - extract(er_dirname, &buf[4], 2); + extract_token(er_name, &buf[4], 0, '|', sizeof er_name); + extract_token(er_password, &buf[4], 1, '|', sizeof er_password); + extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname); er_flags = extract_int(&buf[4], 3); er_floor = extract_int(&buf[4], 4); - output_headers(1); + output_headers(1, 1, 1, 0, 0, 0, 0); /* print the tabbed dialog */ - wprintf("
" + wprintf("
" + "
" + "
" "" "\n"); @@ -709,7 +847,7 @@ void display_editroom(void) else { wprintf("\n"); } @@ -725,7 +863,7 @@ void display_editroom(void) else { wprintf("\n"); } @@ -735,6 +873,38 @@ void display_editroom(void) wprintf("\n"); + if (!strcmp(tab, "expire")) { + wprintf("\n"); + } + else { + wprintf("\n"); + } + + wprintf("\n"); + + if (!strcmp(tab, "access")) { + wprintf("\n"); + } + else { + wprintf("\n"); + } + + wprintf("\n"); + if (!strcmp(tab, "sharing")) { wprintf("\n"); - wprintf("
 "); } - wprintf("Room administration"); + wprintf("Administration"); if (!strcmp(tab, "admin")) { wprintf(""); } - wprintf("Room configuration"); + wprintf("Configuration"); if (!strcmp(tab, "config")) { wprintf(" "); + } + else { + wprintf(""); + } + wprintf("Message expire policy"); + if (!strcmp(tab, "expire")) { + wprintf(" "); + } + else { + wprintf(""); + } + wprintf("Access controls"); + if (!strcmp(tab, "access")) { + wprintf(" "); } @@ -767,16 +937,18 @@ void display_editroom(void) wprintf(" 
\n"); + wprintf("\n"); /* end tabbed dialog */ /* begin content of whatever tab is open now */ - wprintf("\n" + wprintf("
" + "
\n" "
\n"); if (!strcmp(tab, "admin")) { wprintf("
    " - "
  • \n" + "
  • \n" "Delete this room\n" "
  • \n" "Set or change the graphic for this room's banner\n" @@ -792,7 +964,6 @@ void display_editroom(void) wprintf("\n", er_name); wprintf("
  • Resides on floor: "); - load_floorlist(); wprintf("%s\n", &buf[4]); } else { - extract(er_roomaide, &buf[4], 0); + extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide); wprintf("\n", er_roomaide); } wprintf("
\n"); - wprintf(""); - wprintf(""); - wprintf("
\n"); + wprintf("\n" + "" + " " + "" + "\n" + ); } @@ -932,106 +1106,172 @@ void display_editroom(void) serv_puts("CONF getsys|application/x-citadel-ignet-config"); serv_gets(buf); if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) { - extract(node, buf, 0); + extract_token(node, buf, 0, '|', sizeof node); not_shared_with = realloc(not_shared_with, strlen(not_shared_with) + 32); strcat(not_shared_with, node); - strcat(not_shared_with, "|"); + strcat(not_shared_with, "\n"); } serv_puts("GNET"); serv_gets(buf); if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) { - extract(cmd, buf, 0); - extract(node, buf, 1); + extract_token(cmd, buf, 0, '|', sizeof cmd); + extract_token(node, buf, 1, '|', sizeof node); + extract_token(remote_room, buf, 2, '|', sizeof remote_room); if (!strcasecmp(cmd, "ignet_push_share")) { shared_with = realloc(shared_with, strlen(shared_with) + 32); strcat(shared_with, node); - strcat(shared_with, "|"); + if (strlen(remote_room) > 0) { + strcat(shared_with, "|"); + strcat(shared_with, remote_room); + } + strcat(shared_with, "\n"); } } - for (i=0; i
" + wprintf("

" "" "" "\n" - "
Shared withNot shared with
\n"); - - for (i=0; i\n"); + + wprintf("" + "" + "" + "" + "\n" + ); + + for (i=0; i 0) { - wprintf("%s ", node); - wprintf("" + "\n", node); + + wprintf(""); + + wprintf("\n"); } } - wprintf("" - "
Remote node nameRemote room nameActions
%s"); + if (strlen(remote_room) > 0) { + escputs(remote_room); + } + wprintf(""); + + wprintf("(unshare)
"); + if (strlen(remote_room) > 0) { + wprintf("|"); + urlescputs(remote_room); + } + wprintf("\">"); + wprintf("\n"); + wprintf("\n"); + wprintf(""); + wprintf("
\n"); - - for (i=0; i\n"); + wprintf("\n"); + wprintf("" + "" + "" + "" + "\n" + ); + + for (i=0; i 0) { - wprintf("%s ", node); - wprintf("" + "\n"); } } + wprintf("
Remote node nameRemote room nameActions
"); + escputs(node); + wprintf("" + "" + ""); + wprintf("(share)
"); + wprintf("|\">"); + wprintf("\n"); + wprintf("\n"); + wprintf(""); + wprintf("
\n"); wprintf("

\n" - "Reminder: When sharing a room, " + "

\n" + "Notes:
  • When sharing a room, " "it must be shared from both ends. Adding a node to " "the 'shared' list sends messages out, but in order to" " receive messages, the other nodes must be configured" - " to send messages out to your system as well.
    " - "\n"); + " to send messages out to your system as well.\n" + "
  • If the remote room name is blank, it is assumed " + "that the room name is identical on the remote node." + "
  • If the remote room name is different, the remote " + "node must also configure the name of the room here." + "

\n" + ); } /* Mailing list management */ if (!strcmp(tab, "listserv")) { - wprintf("
" + wprintf("
" "" "
"); wprintf("The contents of this room are being " "mailed as individual messages " "to the following list recipients:" - "

\n"); + "

\n"); serv_puts("GNET"); serv_gets(buf); if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) { - extract(cmd, buf, 0); + extract_token(cmd, buf, 0, '|', sizeof cmd); if (!strcasecmp(cmd, "listrecp")) { - extract(recp, buf, 1); + extract_token(recp, buf, 1, '|', sizeof recp); escputs(recp); wprintf(" (remove)
"); + wprintf("&tab=listserv\">(remove)
"); } } - wprintf("
\n" + wprintf("
\n" "\n" "\n"); wprintf("\n"); @@ -1043,40 +1283,40 @@ void display_editroom(void) wprintf("The contents of this room are being " "mailed in digest form " "to the following list recipients:" - "

\n"); + "

\n"); serv_puts("GNET"); serv_gets(buf); if (buf[0]=='1') while (serv_gets(buf), strcmp(buf, "000")) { - extract(cmd, buf, 0); + extract_token(cmd, buf, 0, '|', sizeof cmd); if (!strcasecmp(cmd, "digestrecp")) { - extract(recp, buf, 1); + extract_token(recp, buf, 1, '|', sizeof recp); escputs(recp); wprintf(" (remove)
"); + wprintf("&tab=listserv\">(remove)
"); } } - wprintf("
\n" + wprintf("
\n" "\n" "\n"); wprintf("\n"); wprintf(""); wprintf("
\n"); - wprintf("

\n"); + wprintf("

\n"); if (self_service(999) == 1) { wprintf("This room is configured to allow " "self-service subscribe/unsubscribe requests." " " - "Click to disable.
\n" + "Click to disable.
\n" "The URL for subscribe/unsubscribe is: " - "http://%s/listsub
\n", + "http://%s/listsub
\n", WC->http_host ); } @@ -1085,7 +1325,7 @@ void display_editroom(void) "self-service subscribe/unsubscribe requests." " " - "Click to enable.
\n" + "Click to enable.
\n" ); } @@ -1093,8 +1333,88 @@ void display_editroom(void) wprintf("\n"); } + + /* Mailing list management */ + if (!strcmp(tab, "expire")) { + + serv_puts("GPEX room"); + serv_gets(buf); + if (buf[0] == '2') { + roompolicy = extract_int(&buf[4], 0); + roomvalue = extract_int(&buf[4], 1); + } + + serv_puts("GPEX floor"); + serv_gets(buf); + if (buf[0] == '2') { + floorpolicy = extract_int(&buf[4], 0); + floorvalue = extract_int(&buf[4], 1); + } + + wprintf("
\n"); + wprintf("\n"); + wprintf("\n"); + + if (WC->axlevel >= 6) { + wprintf("\n"); + wprintf("\n"); + + wprintf("
Message expire policy for this room
("); + escputs(WC->wc_roomname); + wprintf(")
"); + wprintf("", + ((roompolicy == 0) ? "CHECKED" : "") ); + wprintf("Use the default policy for this floor
\n"); + wprintf("", + ((roompolicy == 1) ? "CHECKED" : "") ); + wprintf("Never automatically expire messages
\n"); + wprintf("", + ((roompolicy == 2) ? "CHECKED" : "") ); + wprintf("Expire by message count
\n"); + wprintf("", + ((roompolicy == 3) ? "CHECKED" : "") ); + wprintf("Expire by message age
"); + wprintf("Number of messages or days: "); + wprintf("", roomvalue); + wprintf("

Message expire policy for this floor
("); + escputs(floorlist[WC->wc_floor]); + wprintf(")
"); + wprintf("", + ((floorpolicy == 0) ? "CHECKED" : "") ); + wprintf("Use the system default
\n"); + wprintf("", + ((floorpolicy == 1) ? "CHECKED" : "") ); + wprintf("Never automatically expire messages
\n"); + wprintf("", + ((floorpolicy == 2) ? "CHECKED" : "") ); + wprintf("Expire by message count
\n"); + wprintf("", + ((floorpolicy == 3) ? "CHECKED" : "") ); + wprintf("Expire by message age
"); + wprintf("Number of messages or days: "); + wprintf("", + floorvalue); + } + + wprintf("
\n"); + wprintf("

\n"); + wprintf(""); + wprintf(" "); + wprintf(""); + wprintf("
\n" + "\n" + "
\n" + ); + + } + + /* Mailing list management */ + if (!strcmp(tab, "access")) { + display_whok(); + } + /* end content of whatever tab is open now */ - wprintf("\n"); + wprintf("\n"); wDumpContent(1); } @@ -1131,7 +1451,7 @@ void editroom(void) if (strcmp(bstr("sc"), "OK")) { strcpy(WC->ImportantMessage, "Cancelled. Changes were not saved."); - display_main_menu(); + display_editroom(); return; } serv_puts("GETR"); @@ -1139,12 +1459,12 @@ void editroom(void) if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); + display_editroom(); return; } - extract(er_name, &buf[4], 0); - extract(er_password, &buf[4], 1); - extract(er_dirname, &buf[4], 2); + extract_token(er_name, &buf[4], 0, '|', sizeof er_name); + extract_token(er_password, &buf[4], 1, '|', sizeof er_password); + extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname); er_flags = extract_int(&buf[4], 3); strcpy(er_roomaide, bstr("er_roomaide")); @@ -1154,7 +1474,7 @@ void editroom(void) if (buf[0] != '2') { strcpy(er_roomaide, ""); } else { - extract(er_roomaide, &buf[4], 0); + extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide); } } strcpy(buf, bstr("er_name")); @@ -1178,7 +1498,7 @@ void editroom(void) if (!strcmp(buf, "invonly")) { er_flags |= (QR_PRIVATE); } - if (!strcmp(buf, "guessname")) { + if (!strcmp(buf, "hidden")) { er_flags |= (QR_PRIVATE | QR_GUESSNAME); } if (!strcmp(buf, "passworded")) { @@ -1252,10 +1572,10 @@ void editroom(void) serv_gets(buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); + display_editroom(); return; } - gotoroom(er_name, 0); + gotoroom(er_name); if (strlen(er_roomaide) > 0) { sprintf(buf, "SETA %s", er_roomaide); @@ -1267,29 +1587,31 @@ void editroom(void) return; } } - smart_goto(er_name); + gotoroom(er_name); + strcpy(WC->ImportantMessage, "Your changes have been saved."); + display_editroom(); + return; } + /* - * Invite, Kick, and show Who Knows a room + * Display form for Invite, Kick, and show Who Knows a room */ -void display_whok(void) -{ +void do_invt_kick(void) { char buf[SIZ], room[SIZ], username[SIZ]; serv_puts("GETR"); serv_gets(buf); if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); + escputs(&buf[4]); return; } - extract(room, &buf[4], 0); + extract_token(room, &buf[4], 0, '|', sizeof room); strcpy(username, bstr("username")); - if(!strcmp(bstr("sc"), "Kick")) { + if (!strcmp(bstr("sc"), "Kick")) { sprintf(buf, "KICK %s", username); serv_puts(buf); serv_gets(buf); @@ -1301,7 +1623,9 @@ void display_whok(void) "User %s kicked out of room %s.\n", username, room); } - } else if(!strcmp(bstr("sc"), "Invite")) { + } + + if (!strcmp(bstr("sc"), "Invite")) { sprintf(buf, "INVT %s", username); serv_puts(buf); serv_gets(buf); @@ -1314,47 +1638,65 @@ void display_whok(void) username, room); } } - - output_headers(1); - stresc(buf, WC->wc_roomname, 1, 1); - svprintf("BOXTITLE", WCS_STRING, "Access control list for %s", buf); - do_template("beginbox"); + display_editroom(); +} + + + +/* + * Display form for Invite, Kick, and show Who Knows a room + */ +void display_whok(void) +{ + char buf[SIZ], room[SIZ], username[SIZ]; + + serv_puts("GETR"); + serv_gets(buf); + + if (buf[0] != '2') { + escputs(&buf[4]); + return; + } + extract_token(room, &buf[4], 0, '|', sizeof room); + + wprintf("" "
The users listed below have access to this room. " "To remove a user from the access list, select the user " - "name from the list and click 'Kick'.

"); + "name from the list and click 'Kick'.

"); - wprintf("
\n"); - wprintf("\n"); + wprintf("
\n"); + wprintf("
\n"); wprintf(""); wprintf("
\n"); wprintf("
" "To grant another user access to this room, enter the " - "user name in the box below and click 'Invite'.

"); + "user name in the box below and click 'Invite'.

"); - wprintf("
\n"); + wprintf("
\n"); + wprintf("\n"); wprintf("Invite: "); - wprintf("
\n" - "" - "" + wprintf("
\n" + "" + "" "
\n"); wprintf("
\n"); - do_template("endbox"); wDumpContent(1); } @@ -1376,11 +1718,19 @@ void display_entroom(void) display_main_menu(); return; } - output_headers(3); - svprintf("BOXTITLE", WCS_STRING, "Create a new room"); - do_template("beginbox"); - wprintf("
\n"); + output_headers(1, 1, 2, 0, 0, 0, 0); + wprintf("
\n" + "
" + "Create a new room" + "
\n" + "
\n
\n" + ); + + wprintf("
" + "
\n"); + + wprintf("\n"); wprintf("
  • Name of room: "); wprintf("\n"); @@ -1397,27 +1747,22 @@ void display_entroom(void) } wprintf("\n"); - wprintf("
  • Type of room:
      \n"); - - wprintf("
    • Public room\n"); - - wprintf("
    • Private - guess name\n"); - - wprintf("
    • Private - require password:\n"); - wprintf("\n"); - - wprintf("
    • Private - invitation only\n"); - - wprintf("
    • Personal (mailbox for you only)\n"); - wprintf("
    \n"); - - wprintf("
  • Default view for room: "); /* FOO */ - wprintf("\n"); for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) { wprintf("
  • Type of room:
      \n"); + + wprintf("
    • Public (automatically appears to everyone)\n"); + + wprintf("
    • Private - hidden (accessible to anyone who knows its name)\n"); + + wprintf("
    • Private - require password:\n"); + wprintf("\n"); + + wprintf("
    • Private - invitation only\n"); + + wprintf("
    • Personal (mailbox for you only)\n"); + + wprintf("
    \n"); + wprintf("
    \n"); wprintf(""); + wprintf(" "); wprintf(""); wprintf("
    \n"); - wprintf("\n
    "); + wprintf("\n
    "); serv_printf("MESG roomaccess"); serv_gets(buf); if (buf[0] == '1') { fmout(NULL, "CENTER"); } - do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } @@ -1462,9 +1845,9 @@ void er_set_default_view(int newview) { serv_gets(buf); if (buf[0] != '2') return; - extract(rm_name, &buf[4], 0); - extract(rm_pass, &buf[4], 1); - extract(rm_dir, &buf[4], 2); + extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name); + extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass); + extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir); rm_bits1 = extract_int(&buf[4], 3); rm_floor = extract_int(&buf[4], 4); rm_listorder = extract_int(&buf[4], 5); @@ -1490,6 +1873,7 @@ void entroom(void) char er_password[SIZ]; int er_floor; int er_num_type; + int er_view; if (strcmp(bstr("sc"), "OK")) { strcpy(WC->ImportantMessage, @@ -1501,9 +1885,10 @@ void entroom(void) strcpy(er_type, bstr("type")); strcpy(er_password, bstr("er_password")); er_floor = atoi(bstr("er_floor")); + er_view = atoi(bstr("er_view")); er_num_type = 0; - if (!strcmp(er_type, "guessname")) + if (!strcmp(er_type, "hidden")) er_num_type = 1; if (!strcmp(er_type, "passworded")) er_num_type = 2; @@ -1512,8 +1897,8 @@ void entroom(void) if (!strcmp(er_type, "personal")) er_num_type = 4; - sprintf(buf, "CRE8 1|%s|%d|%s|%d", - er_name, er_num_type, er_password, er_floor); + sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d", + er_name, er_num_type, er_password, er_floor, 0, er_view); serv_puts(buf); serv_gets(buf); if (buf[0] != '2') { @@ -1521,9 +1906,8 @@ void entroom(void) display_main_menu(); return; } - gotoroom(er_name, 0); - er_set_default_view(atoi(bstr("er_view"))); /* Set default view */ - do_change_view(atoi(bstr("er_view"))); /* Now go there */ + gotoroom(er_name); + do_change_view(er_view); /* Now go there */ } @@ -1532,19 +1916,24 @@ void entroom(void) */ void display_private(char *rname, int req_pass) { + output_headers(1, 1, 2, 0, 0, 0, 0); + wprintf("
\n" + "
" + "Go to a hidden room" + "
\n" + "
\n
\n" + ); - output_headers(3); - - svprintf("BOXTITLE", WCS_STRING, "Go to a hidden room"); - do_template("beginbox"); + wprintf("
" + "
\n"); wprintf("
\n"); - wprintf("
If you know the name of a hidden (guess-name) or\n"); + wprintf("
If you know the name of a hidden (guess-name) or\n"); wprintf("passworded room, you can enter that room by typing\n"); wprintf("its name below. Once you gain access to a private\n"); wprintf("room, it will appear in your regular room listings\n"); wprintf("so you don't have to keep returning here.\n"); - wprintf("

"); + wprintf("

"); wprintf("
\n"); @@ -1560,13 +1949,13 @@ void display_private(char *rname, int req_pass) wprintf("Enter room password:
"); wprintf("\n"); } - wprintf("

\n"); + wprintf("
\n"); wprintf("" " " ""); wprintf("\n"); - do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } @@ -1598,7 +1987,7 @@ void goto_private(void) display_private(bstr("gr_name"), 1); return; } - output_headers(1); + output_headers(1, 1, 1, 0, 0, 0, 0); wprintf("%s\n", &buf[4]); wDumpContent(1); return; @@ -1610,18 +1999,21 @@ void goto_private(void) */ void display_zap(void) { - output_headers(1); + output_headers(1, 1, 2, 0, 0, 0, 0); + wprintf("
\n"); wprintf("
"); - wprintf("Zap (forget) the current room\n"); + wprintf("Zap (forget/unsubscribe) the current room\n"); wprintf("
\n"); + wprintf("
\n
\n"); wprintf("If you select this option, %s will ", WC->wc_roomname); wprintf("disappear from your room list. Is this what you wish "); - wprintf("to do?
\n"); + wprintf("to do?
\n"); wprintf("
\n"); wprintf(""); + wprintf(" "); wprintf(""); wprintf("
\n"); wDumpContent(1); @@ -1644,14 +2036,10 @@ void zap(void) if (!strcasecmp(bstr("sc"), "OK")) { serv_printf("GOTO %s", WC->wc_roomname); serv_gets(buf); - if (buf[0] != '2') { - /* ExpressMessageCat(&buf[4]); */ - } else { + if (buf[0] == '2') { serv_puts("FORG"); serv_gets(buf); - if (buf[0] != '2') { - /* ExpressMessageCat(&buf[4]); */ - } else { + if (buf[0] == '2') { strcpy(final_destination, "_BASEROOM_"); } } @@ -1661,57 +2049,13 @@ void zap(void) - -/* - * Confirm deletion of the current room - */ -void confirm_delete_room(void) -{ - char buf[SIZ]; - - serv_puts("KILL 0"); - serv_gets(buf); - if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); - return; - } - output_headers(1); - wprintf("
"); - wprintf("Confirm deletion of room\n"); - wprintf("
\n"); - - wprintf("
"); - wprintf("
\n"); - - wprintf("Are you sure you want to delete "); - escputs(WC->wc_roomname); - wprintf("?
\n"); - - wprintf(""); - wprintf(""); - - wprintf("
\n"); - wDumpContent(1); -} - - /* * Delete the current room */ void delete_room(void) { char buf[SIZ]; - char sc[SIZ]; - - strcpy(sc, bstr("sc")); - if (strcasecmp(sc, "Delete")) { - strcpy(WC->ImportantMessage, - "Cancelled. This room was not deleted."); - display_main_menu(); - return; - } serv_puts("KILL 1"); serv_gets(buf); if (buf[0] != '2') { @@ -1732,6 +2076,10 @@ void netedit(void) { FILE *fp; char buf[SIZ]; char line[SIZ]; + char cmpa0[SIZ]; + char cmpa1[SIZ]; + char cmpb0[SIZ]; + char cmpb1[SIZ]; if (strlen(bstr("line"))==0) { display_editroom(); @@ -1758,7 +2106,12 @@ void netedit(void) { /* This loop works for add *or* remove. Spiffy, eh? */ while (serv_gets(buf), strcmp(buf, "000")) { - if (strcasecmp(buf, line)) { + extract_token(cmpa0, buf, 0, '|', sizeof cmpa0); + extract_token(cmpa1, buf, 1, '|', sizeof cmpa1); + extract_token(cmpb0, line, 0, '|', sizeof cmpb0); + extract_token(cmpb1, line, 1, '|', sizeof cmpb1); + if ( (strcasecmp(cmpa0, cmpb0)) + || (strcasecmp(cmpa1, cmpb1)) ) { fprintf(fp, "%s\n", buf); } } @@ -1828,6 +2181,7 @@ void do_change_view(int newview) { serv_printf("VIEW %d", newview); serv_gets(buf); + WC->wc_view = newview; smart_goto(WC->wc_roomname); } @@ -1851,24 +2205,53 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) { char buf[SIZ]; int levels, oldlevels; int i, t; + int actnum = 0; + int has_subfolders = 0; + + /* Include the menu expanding/collapsing code */ + wprintf("\n"); - do_template("beginbox_nt"); + /* BEGIN TREE MENU */ + wprintf("
\n"); + wprintf("
\n"); + wprintf("\n"); + wprintf(" \n"); + wprintf("
\n"); + /* END TREE MENU */ } /* @@ -1915,8 +2313,8 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (boxes_per_column < 1) boxes_per_column = 1; /* Outer table (for columnization) */ - wprintf("" - "
"); + wprintf("" + "
"); levels = 0; oldlevels = 0; @@ -1924,7 +2322,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { levels = num_tokens(fold[i].name, '|'); - if ((levels == 1) && (oldlevels == 2)) { + if ((levels == 1) && (oldlevels > 1)) { /* End inner box */ do_template("endbox"); @@ -1933,7 +2331,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if ((num_boxes % boxes_per_column) == 0) { ++current_column; if (current_column < columns) { - wprintf("\n"); + wprintf("\n"); } } } @@ -1941,7 +2339,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (levels == 1) { /* Begin inner box */ - extract(buf, fold[i].name, levels-1); + extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); stresc(boxtitle, buf, 1, 0); svprintf("BOXTITLE", WCS_STRING, boxtitle); do_template("beginbox"); @@ -1967,7 +2365,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { else { wprintf(""); } - extract(buf, fold[i].name, levels-1); + extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); escputs(buf); wprintf(""); if (fold[i].selectable) { @@ -1979,7 +2377,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (!strcasecmp(fold[i].name, "My Folders|Mail")) { wprintf(" (INBOX)"); } - wprintf("
\n"); + wprintf("
\n"); } } /* End the final inner box */ @@ -2024,7 +2422,7 @@ void list_all_rooms_by_floor(char *viewpref) { alloc_folders * sizeof(struct folder)); } memset(&fold[max_folders], 0, sizeof(struct folder)); - extract(fold[max_folders].name, buf, 1); + extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name); ++max_folders; ++num_floors; } @@ -2039,7 +2437,7 @@ void list_all_rooms_by_floor(char *viewpref) { alloc_folders * sizeof(struct folder)); } memset(&fold[max_folders], 0, sizeof(struct folder)); - extract(fold[max_folders].room, buf, 0); + extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room); ra_flags = extract_int(buf, 5); flags = extract_int(buf, 1); fold[max_folders].floor = extract_int(buf, 2); @@ -2081,6 +2479,14 @@ void list_all_rooms_by_floor(char *viewpref) { } } +/* test only hackish view + wprintf("
A Table
\n"); + for (i=0; i\n"); + } + */ + if (!strcasecmp(viewpref, "folders")) { do_folder_view(fold, max_folders, num_floors); } @@ -2099,7 +2505,7 @@ void list_all_rooms_by_floor(char *viewpref) { void knrooms() { char listviewpref[SIZ]; - output_headers(3); + output_headers(1, 1, 2, 0, 0, 0, 0); load_floorlist(); /* Determine whether the user is trying to change views */ @@ -2109,7 +2515,7 @@ void knrooms() { } } - get_preference("roomlistview", listviewpref); + get_preference("roomlistview", listviewpref, sizeof listviewpref); if ( (strcasecmp(listviewpref, "folders")) && (strcasecmp(listviewpref, "table")) ) { @@ -2117,7 +2523,8 @@ void knrooms() { } /* title bar */ - wprintf("
" + wprintf("
\n" + "\n"); - /* offer the ability to switch views */ wprintf("
" "" ); if (!strcasecmp(listviewpref, "rooms")) { @@ -2131,7 +2538,6 @@ void knrooms() { } wprintf("
\n" "
"); offer_start_page(); wprintf("
\n"); + wprintf("
\n" + "\n" + "
\n"); /* Display the room list in the user's preferred format */ list_all_rooms_by_floor(listviewpref); } + + + +/* + * Set the message expire policy for this room and/or floor + */ +void set_room_policy(void) { + char buf[SIZ]; + + if (strcmp(bstr("sc"), "OK")) { + strcpy(WC->ImportantMessage, + "Cancelled. Changes were not saved."); + display_editroom(); + return; + } + + serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue"))); + serv_gets(buf); + strcpy(WC->ImportantMessage, &buf[4]); + + if (WC->axlevel >= 6) { + strcat(WC->ImportantMessage, "
\n"); + serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue"))); + serv_gets(buf); + strcat(WC->ImportantMessage, &buf[4]); + } + + display_editroom(); +}