X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=ca0e50ed71ef85b14bdf9ab21ab92b592a3fe1bd;hb=bc17ed696720ce8a4726f6aaa70171f061319763;hp=af4b85c80e2fc3842f1df38a3c805486fd77cfc7;hpb=0b51c86b7b47f9c9b7357ffdd9619a2f6e4e9147;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index af4b85c80..ca0e50ed7 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1,25 +1,9 @@ -/* $Id$ */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* + * $Id$ + * + * Lots of different room-related operations. + */ + #include "webcit.h" struct folder { @@ -29,14 +13,16 @@ struct folder { int hasnewmsgs; int is_mailbox; int selectable; + int view; }; char *viewdefs[] = { - "Messages", - "Summary", + "Bulletin Board", + "Mail Folder", "Address Book", "Calendar", - "Tasks" + "Task List", + "Notes List" }; char floorlist[128][SIZ]; @@ -53,13 +39,13 @@ void load_floorlist(void) floorlist[a][0] = 0; serv_puts("LFLR"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { strcpy(floorlist[0], "Main Floor"); return; } - while (serv_gets(buf), strcmp(buf, "000")) { - extract(floorlist[extract_int(buf, 0)], buf, 1); + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]); } } @@ -110,7 +96,7 @@ void room_tree_list(struct roomlisting *rp) strcpy(rmname, rp->rlname); f = rp->rlflags; - wprintf(""); @@ -168,15 +154,15 @@ void listrms(char *variety) /* Ask the server for a room list */ serv_puts(variety); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { wprintf(" "); return; } - while (serv_gets(buf), strcmp(buf, "000")) { + while (serv_getln(buf, sizeof 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,15 +206,15 @@ void listrms(char *variety) */ void zapped_list(void) { - output_headers(3); + output_headers(1, 1, 0, 0, 0, 0); - svprintf("BOXTITLE", WCS_STRING, "Zapped (forgotten) rooms"); + svprintf("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms")); do_template("beginbox"); listrms("LZRM -1"); - wprintf("

\n"); - wprintf("Click on any room to un-zap it and goto that room.\n"); + wprintf("

\n"); + wprintf(_("Click on any room to un-zap it and goto that room.\n")); do_template("endbox"); wDumpContent(1); } @@ -242,49 +228,69 @@ void readinfo(void) char buf[SIZ]; serv_puts("RINF"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout(NULL, "CENTER"); + fmout("CENTER"); } } -/* Display room graphic. The server doesn't actually +/* Display room banner icon. The server doesn't actually * need the room name, but we supply it in order to - * keep the browser from using a cached graphic from + * keep the browser from using a cached icon from * another room. */ void embed_room_graphic(void) { char buf[SIZ]; serv_puts("OIMG _roompic_"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { - wprintf(""); - wprintf("wc_roomname); - wprintf("\">"); + wprintf("\">"); serv_puts("CLOS"); - serv_gets(buf); + serv_getln(buf, sizeof buf); } - -} - - -/* Let the user know if new mail has arrived - */ -void embed_newmail_button(void) { - if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) { - wprintf( - "
" - "" - "
" - "%d new mail
", WC->new_mail); - WC->remember_new_mail = WC->new_mail; + else if (WC->wc_view == VIEW_ADDRESSBOOK) { + wprintf("" + ); } + else if (WC->wc_view == VIEW_CALENDAR) { + wprintf("" + ); + } + else if (WC->wc_view == VIEW_TASKS) { + wprintf("" + ); + } + else if (WC->wc_view == VIEW_NOTES) { + wprintf("" + ); + } + else if (WC->wc_view == VIEW_MAILBOX) { + wprintf("" + ); + } + else { + wprintf("" + ); + } + } @@ -295,8 +301,11 @@ void embed_newmail_button(void) { void embed_view_o_matic(void) { int i; - wprintf("
\n" + 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. @@ -333,7 +342,7 @@ void embed_room_banner(char *got) { */ if (got == NULL) { serv_printf("GOTO %s", WC->wc_roomname); - serv_gets(fakegot); + serv_getln(fakegot, sizeof fakegot); got = fakegot; } @@ -353,12 +362,189 @@ void embed_room_banner(char *got) { svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2)); svcallback("ROOMPIC", embed_room_graphic); svcallback("ROOMINFO", readinfo); - svcallback("YOUHAVEMAIL", embed_newmail_button); svcallback("VIEWOMATIC", embed_view_o_matic); 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", _("Ungoto") + ); + + if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) { + wprintf( + "\n", _("Read new messages") + ); + } + + if (navbar_style == navbar_default) { + switch(WC->wc_view) { + case VIEW_ADDRESSBOOK: + wprintf( + "\n", _("View contacts") + ); + break; + case VIEW_CALENDAR: + wprintf( + "\n", _("Day view") + ); + wprintf( + "\n", _("Month view") + ); + break; + case VIEW_TASKS: + wprintf( + "\n", _("View tasks") + ); + break; + case VIEW_NOTES: + wprintf( + "\n", _("View notes") + ); + break; + case VIEW_MAILBOX: + wprintf( + "\n", _("View message list") + ); + break; + default: + wprintf( + "\n", _("Read all messages") + ); + break; + } + } + + if (navbar_style == navbar_default) { + switch(WC->wc_view) { + case VIEW_ADDRESSBOOK: + wprintf( + "\n", _("Add new contact") + ); + break; + case VIEW_CALENDAR: + wprintf( + "\n", _("Add new event") + ); + break; + case VIEW_TASKS: + wprintf( + "\n", _("Add new task") + ); + break; + case VIEW_NOTES: + wprintf( + "\n", _("Add new note") + ); + break; + default: + wprintf( + "\n", _("Enter a message") + ); + break; + } + } + + if (navbar_style == navbar_default) wprintf( + "\n", + _("Leave all messages marked as unread, go to next room with unread messages"), + _("Skip this room") + ); + + if (navbar_style == navbar_default) wprintf( + "\n", + _("Mark all messages as read, go to next room with unread messages"), + _("Goto next room") + ); + + wprintf("
" + "" + "" + "%s" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "" + "" + "%s" + "" + "" + "%s" + "" + "" + "%s" + "" + "" + "%s" + "" + "" + "%s" + "" + "" + "%s" + "" + "" + "" + "%s" + "" + "" + "" + "%s" + "
\n"); + } + } @@ -369,10 +555,11 @@ void embed_room_banner(char *got) { * back end routine to take the session to a new room * */ -void gotoroom(char *gname) +int gotoroom(char *gname) { char buf[SIZ]; static long ls = (-1L); + int err = 0; /* store ungoto information */ strcpy(WC->ugname, WC->wc_roomname); @@ -380,19 +567,24 @@ void gotoroom(char *gname) /* move to the new room */ serv_printf("GOTO %s", gname); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { + buf[3] = 0; + err = atoi(buf); serv_puts("GOTO _BASEROOM_"); - serv_gets(buf); + serv_getln(buf, sizeof buf); } if (buf[0] != '2') { - return; + buf[3] = 0; + err = atoi(buf); + return err; } - 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); */ + */ + WC->is_mailbox = 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); @@ -406,6 +598,8 @@ void gotoroom(char *gname) remove_march(WC->wc_roomname); if (!strcasecmp(gname, "_BASEROOM_")) remove_march(gname); + + return err; } @@ -467,12 +661,12 @@ void gotonext(void) if (WC->march == NULL) { serv_puts("LKRN"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') - while (serv_gets(buf), strcmp(buf, "000")) { + while (serv_getln(buf, sizeof 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) { @@ -531,9 +725,9 @@ void slrp_highest(void) /* set pointer */ serv_puts("SLRP HIGHEST"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { - wprintf("%s
\n", &buf[4]); + wprintf("%s
\n", &buf[4]); return; } } @@ -551,14 +745,14 @@ void ungoto(void) return; } serv_printf("GOTO %s", WC->ugname); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { smart_goto(WC->wc_roomname); return; } if (WC->uglsn >= 0L) { serv_printf("SLRP %ld", WC->uglsn); - serv_gets(buf); + serv_getln(buf, sizeof buf); } strcpy(buf, WC->ugname); strcpy(WC->ugname, ""); @@ -586,12 +780,12 @@ int self_service(int newval) { int flags, floor, order, view, flags2; serv_puts("GETR"); - serv_gets(buf); + serv_getln(buf, sizeof 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); @@ -619,7 +813,7 @@ int self_service(int newval) { serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d", name, password, dirname, flags, floor, order, view, flags2); - serv_gets(buf); + serv_getln(buf, sizeof buf); } return(newval); @@ -639,8 +833,9 @@ 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_name[128]; char er_password[10]; char er_dirname[15]; char er_roomaide[26]; @@ -660,23 +855,25 @@ void display_editroom(void) load_floorlist(); serv_puts("GETR"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); 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); /* print the tabbed dialog */ - wprintf("
" + wprintf("
" + "
" + "
" "" "\n"); @@ -684,9 +881,9 @@ void display_editroom(void) wprintf("\n"); } @@ -700,9 +897,9 @@ void display_editroom(void) wprintf("\n"); } @@ -716,9 +913,9 @@ void display_editroom(void) wprintf("\n"); } @@ -728,13 +925,29 @@ void display_editroom(void) wprintf("\n"); + if (!strcmp(tab, "access")) { + wprintf("\n"); + } + else { + wprintf("\n"); + } + + wprintf("\n"); + if (!strcmp(tab, "sharing")) { wprintf("\n"); } @@ -748,9 +961,9 @@ void display_editroom(void) wprintf("\n"); } @@ -760,31 +973,43 @@ void display_editroom(void) wprintf("\n"); - wprintf("
 "); } else { - wprintf(""); + wprintf(""); } - wprintf("Administration"); + wprintf(_("Administration")); if (!strcmp(tab, "admin")) { wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Configuration"); + wprintf(_("Configuration")); if (!strcmp(tab, "config")) { wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Message expire policy"); + wprintf(_("Message expire policy")); if (!strcmp(tab, "expire")) { wprintf(" "); + } + else { + wprintf(""); + } + wprintf(_("Access controls")); + if (!strcmp(tab, "access")) { + wprintf(" "); } else { - wprintf(""); + wprintf(""); } - wprintf("Sharing"); + wprintf(_("Sharing")); if (!strcmp(tab, "sharing")) { wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Mailing list service"); + wprintf(_("Mailing list service")); if (!strcmp(tab, "listserv")) { 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(""); } if (!strcmp(tab, "config")) { - wprintf("
\n"); + wprintf("\n"); - wprintf("
  • Name of room: "); - wprintf("\n", er_name); + wprintf("
    • "); + wprintf(_("Name of room: ")); + wprintf("\n", + er_name, + (sizeof(er_name)-1) + ); - wprintf("
    • Resides on floor: "); + wprintf("
    • "); + wprintf(_("Resides on floor: ")); wprintf("\n"); - wprintf("
    • Type of room:
        \n"); + wprintf("
      • "); + wprintf(_("Type of room:")); + wprintf("
          \n"); wprintf("
        • Public room\n"); + wprintf("> "); + wprintf(_("Public room")); + wprintf("\n"); - wprintf("
        • Private - guess name\n"); + wprintf("> "); + wprintf(_("Private - guess name")); - wprintf("
        • Private - require password:\n"); - wprintf("\n", er_password); + wprintf("> "); + wprintf(_("Private - require password:")); + wprintf("\n\n", + er_password); wprintf("
        • Private - invitation only\n"); + wprintf("> "); + wprintf(_("Private - invitation only")); - wprintf("
        • If private, cause current users to forget room\n"); + wprintf("\n
        • "); + wprintf(_("If private, cause current users to forget room")); - wprintf("
        \n"); + wprintf("\n
      \n"); wprintf("
    • Preferred users only\n"); + wprintf("> "); + wprintf(_("Preferred users only")); - wprintf("
    • Read-only room\n"); + wprintf("> "); + wprintf(_("Read-only room")); /* directory stuff */ - wprintf("
    • File directory room\n"); + wprintf("> "); + wprintf(_("File directory room")); - wprintf("
      • Directory name: "); - wprintf("\n", er_dirname); + wprintf("\n
        • "); + wprintf(_("Directory name: ")); + wprintf("\n", + er_dirname); wprintf("
        • Uploading allowed\n"); + wprintf("> "); + wprintf(_("Uploading allowed")); - wprintf("
        • Downloading allowed\n"); + wprintf("> "); + wprintf(_("Downloading allowed")); - wprintf("
        • Visible directory
        \n"); + wprintf("> "); + wprintf(_("Visible directory")); + wprintf("
      \n"); /* end of directory stuff */ wprintf("
    • Network shared room\n"); + wprintf("> "); + wprintf(_("Network shared room")); - wprintf("
    • Permanent (does not auto-purge)\n"); + wprintf("> "); + wprintf(_("Permanent (does not auto-purge)")); /* start of anon options */ - wprintf("
    • Anonymous messages
        \n"); + wprintf("\n
      • "); + wprintf(_("Anonymous messages")); + wprintf("
          \n"); wprintf("
        • No anonymous messages\n"); + wprintf("> "); + wprintf(_("No anonymous messages")); - wprintf("
        • All messages are anonymous\n"); + wprintf("> "); + wprintf(_("All messages are anonymous")); - wprintf("
        • Prompt user when entering messages
        \n"); + wprintf("> "); + wprintf(_("Prompt user when entering messages")); + wprintf("
      \n"); /* end of anon options */ - wprintf("
    • Room aide: \n"); + wprintf("
    • "); + wprintf(_("Room aide: ")); serv_puts("GETA"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { 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("\n" - "" + "" " " - "" - "
    \n" + "" + "\n", + _("Save changes"), + _("Cancel") ); } @@ -925,163 +1179,238 @@ void display_editroom(void) /* Learn the current configuration */ 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); + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + 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); + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + 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" - "" + "\n" + "" - "
    Shared withNot shared with
    \n"); + ""); + wprintf(_("Shared with")); + wprintf(""); + wprintf(_("Not shared with")); + wprintf("
    \n"); + + wprintf("\n"); - for (i=0; i 0) { - wprintf("%s ", node); - wprintf("" + "\n", node); + + wprintf(""); + + wprintf("\n"); } } - wprintf("
    "); + wprintf(_("Remote node name")); + wprintf(""); + wprintf(_("Remote room name")); + wprintf(""); + wprintf(_("Actions")); + wprintf("
    %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("", _("Unshare")); + wprintf("
    \n"); + wprintf("
    \n"); + wprintf("
    \n"); + wprintf("\n"); - for (i=0; i 0) { - wprintf("%s ", node); - wprintf("" + "\n"); } } + wprintf("
    "); + wprintf(_("Remote node name")); + wprintf(""); + wprintf(_("Remote room name")); + wprintf(""); + wprintf(_("Actions")); + wprintf("
    "); + escputs(node); + wprintf("" + "" + ""); + wprintf("(share)
    "); + wprintf("|\">"); + wprintf("\n"); + wprintf("\n"); + wprintf("", _("Share")); + wprintf("
    \n"); wprintf("

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

\n" + "%s
  • ", _("Notes:")); + wprintf(_("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. " + "
  • 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 " + 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); + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + 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\">"); + wprintf(_("(remove)")); + wprintf("
"); } } - wprintf("
\n" + wprintf("
\n" "\n" "\n"); wprintf("\n"); - wprintf(""); + wprintf("", _("Add")); wprintf("
\n"); wprintf("
\n"); - wprintf("The contents of this room are being " + 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); + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + 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\">"); + wprintf(_("(remove)")); + wprintf("
"); } } - wprintf("
\n" + wprintf("
\n" "\n" "\n"); wprintf("\n"); - wprintf(""); + wprintf("", _("Add")); 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" - "The URL for subscribe/unsubscribe is: " - "http://%s/listsub
\n", - WC->http_host - ); + wprintf(_("This room is configured to allow " + "self-service subscribe/unsubscribe requests.")); + wprintf(""); + wprintf(_("Click to disable.")); + wprintf("
\n"); + wprintf(_("The URL for subscribe/unsubscribe is: ")); + wprintf("%s://%s/listsub
\n", + (is_https ? "https" : "http"), + WC->http_host); } else { - wprintf("This room is not configured to allow " - "self-service subscribe/unsubscribe requests." - " " - "Click to enable.
\n" - ); + wprintf(_("This room is not configured to allow " + "self-service subscribe/unsubscribe requests.")); + wprintf(" "); + wprintf(_("Click to enable.")); + wprintf("
\n"); } @@ -1093,67 +1422,78 @@ void display_editroom(void) if (!strcmp(tab, "expire")) { serv_puts("GPEX room"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { roompolicy = extract_int(&buf[4], 0); roomvalue = extract_int(&buf[4], 1); } serv_puts("GPEX floor"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { floorpolicy = extract_int(&buf[4], 0); floorvalue = extract_int(&buf[4], 1); } - wprintf("
\n"); + wprintf("
\n"); wprintf("\n"); - wprintf("\n"); if (WC->axlevel >= 6) { - wprintf("\n"); - wprintf("\n"); + wprintf("\n"); wprintf("
Message expire policy for this room
("); + wprintf("
"); + wprintf(_("Message expire policy for this room")); + wprintf("
("); escputs(WC->wc_roomname); wprintf(")
"); wprintf("", ((roompolicy == 0) ? "CHECKED" : "") ); - wprintf("Use the default policy for this floor
\n"); + wprintf(_("Use the default policy for this floor")); + wprintf("
\n"); wprintf("", ((roompolicy == 1) ? "CHECKED" : "") ); - wprintf("Never automatically expire messages
\n"); + wprintf(_("Never automatically expire messages")); + wprintf("
\n"); wprintf("", ((roompolicy == 2) ? "CHECKED" : "") ); - wprintf("Expire by message count
\n"); + wprintf("Expire by message count
\n"); wprintf("", ((roompolicy == 3) ? "CHECKED" : "") ); - wprintf("Expire by message age
"); - wprintf("Number of messages or days: "); + wprintf(_("Expire by message age")); + wprintf("
"); + wprintf(_("Number of messages or days: ")); wprintf("", roomvalue); wprintf("

Message expire policy for this floor
("); + wprintf("

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

\n"); - wprintf(""); + wprintf("

\n"); + wprintf("", _("Save changes")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); wprintf("
\n" @@ -1163,9 +1503,13 @@ void display_editroom(void) } + /* Mailing list management */ + if (!strcmp(tab, "access")) { + display_whok(); + } /* end content of whatever tab is open now */ - wprintf("\n"); + wprintf("\n"); wDumpContent(1); } @@ -1190,7 +1534,7 @@ void toggle_self_service(void) { void editroom(void) { char buf[SIZ]; - char er_name[20]; + char er_name[128]; char er_password[10]; char er_dirname[15]; char er_roomaide[26]; @@ -1199,39 +1543,40 @@ void editroom(void) int bump; - if (strcmp(bstr("sc"), "OK")) { + if (strlen(bstr("ok_button")) == 0) { strcpy(WC->ImportantMessage, - "Cancelled. Changes were not saved."); + _("Cancelled. Changes were not saved.")); display_editroom(); return; } serv_puts("GETR"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); 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")); if (strlen(er_roomaide) == 0) { serv_puts("GETA"); - serv_gets(buf); + serv_getln(buf, sizeof buf); 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")); - buf[20] = 0; - if (strlen(buf) > 0) + buf[128] = 0; + if (strlen(buf) > 0) { strcpy(er_name, buf); + } strcpy(buf, bstr("er_password")); buf[10] = 0; @@ -1249,7 +1594,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")) { @@ -1320,7 +1665,7 @@ void editroom(void) sprintf(buf, "SETR %s|%s|%s|%u|%d|%d", er_name, er_password, er_dirname, er_flags, bump, er_floor); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_editroom(); @@ -1331,7 +1676,7 @@ void editroom(void) if (strlen(er_roomaide) > 0) { sprintf(buf, "SETA %s", er_roomaide); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_main_menu(); @@ -1339,96 +1684,117 @@ void editroom(void) } } gotoroom(er_name); - strcpy(WC->ImportantMessage, "Your changes have been saved."); + 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); + serv_getln(buf, sizeof 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 (strlen(bstr("kick_button")) > 0) { sprintf(buf, "KICK %s", username); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); } else { sprintf(WC->ImportantMessage, - "User %s kicked out of room %s.\n", + _("User %s kicked out of room %s.\n"), username, room); } - } else if(!strcmp(bstr("sc"), "Invite")) { + } + + if (strlen(bstr("invite_button")) > 0) { sprintf(buf, "INVT %s", username); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); } else { sprintf(WC->ImportantMessage, - "User %s invited to room %s.\n", + _("User %s invited to room %s.\n"), 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"); - wprintf("" - "
The users listed below have access to this room. " + 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_getln(buf, sizeof buf); + + if (buf[0] != '2') { + escputs(&buf[4]); + return; + } + extract_token(room, &buf[4], 0, '|', sizeof room); + + + wprintf("
"); + 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("

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

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

"); - wprintf("
\n"); + wprintf("
\n"); + wprintf("\n"); wprintf("Invite: "); - wprintf("
\n" - "" - "" - "
\n"); + wprintf("
\n" + "" + "" + "
\n", _("Invite")); wprintf("
\n"); - do_template("endbox"); wDumpContent(1); } @@ -1443,23 +1809,35 @@ void display_entroom(void) char buf[SIZ]; serv_puts("CRE8 0"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); 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); + wprintf("
\n" + "
" + ""); + wprintf(_("Create a new room")); + wprintf("" + "
\n" + "
\n
\n" + ); + + wprintf("
" + "
\n"); + + wprintf("\n"); - wprintf("
  • Name of room: "); + wprintf("
    • "); + wprintf(_("Name of room: ")); wprintf("\n"); - wprintf("
    • Resides on floor: "); + wprintf("
    • "); + wprintf(_("Resides on floor: ")); load_floorlist(); 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("
    • "); + wprintf(_("Type of room:")); + wprintf("
        \n"); + + wprintf("
      • "); + wprintf(_("Public (automatically appears to everyone)")); + + wprintf("\n
      • "); + wprintf(_("Private - hidden (accessible to anyone who knows its name)")); + + wprintf("\n
      • "); + wprintf(_("Private - require password: ")); + wprintf("\n"); + + wprintf("
      • "); + wprintf(_("Private - invitation only")); + + wprintf("\n
      • "); + wprintf(_("Personal (mailbox for you only)")); + + wprintf("\n
      \n"); + wprintf("
      \n"); - wprintf(""); + wprintf("", _("Create new room")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); wprintf("
      \n"); - wprintf("\n
      "); + wprintf("\n
      "); serv_printf("MESG roomaccess"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout(NULL, "CENTER"); + fmout("CENTER"); } - do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } @@ -1534,12 +1952,12 @@ void er_set_default_view(int newview) { int rm_bits2; serv_puts("GETR"); - serv_gets(buf); + serv_getln(buf, sizeof 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); @@ -1549,7 +1967,7 @@ void er_set_default_view(int newview) { rm_name, rm_pass, rm_dir, rm_bits1, rm_floor, rm_listorder, newview, rm_bits2 ); - serv_gets(buf); + serv_getln(buf, sizeof buf); } @@ -1567,9 +1985,9 @@ void entroom(void) int er_num_type; int er_view; - if (strcmp(bstr("sc"), "OK")) { + if (strlen(bstr("ok_button")) == 0) { strcpy(WC->ImportantMessage, - "Cancelled. No new room was created."); + _("Cancelled. No new room was created.")); display_main_menu(); return; } @@ -1580,7 +1998,7 @@ void entroom(void) 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; @@ -1592,7 +2010,7 @@ void entroom(void) 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); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_main_menu(); @@ -1608,41 +2026,54 @@ void entroom(void) */ void display_private(char *rname, int req_pass) { + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n" + "
" + ""); + wprintf(_("Go to a hidden room")); + wprintf("" + "
\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("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(_("If you know the name of a hidden (guess-name) or " + "passworded room, you can enter that room by typing " + "its name below. Once you gain access to a private " + "room, it will appear in your regular room listings " + "so you don't have to keep returning here.")); + wprintf("\n

"); - wprintf("
\n"); + wprintf("\n"); wprintf("\n" - "
" - "Enter room name:" + "
"); + wprintf(_("Enter room name:")); + wprintf("" "\n", rname); + "VALUE=\"%s\" MAXLENGTH=\"128\">\n", rname); if (req_pass) { wprintf("
"); - wprintf("Enter room password:"); + wprintf(_("Enter room password:")); + wprintf(""); wprintf("\n"); } - wprintf("

\n"); + wprintf("

\n"); - wprintf("" + wprintf("" " " - ""); + "", + _("Go there"), + _("Cancel") + ); wprintf("\n"); - do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } @@ -1654,7 +2085,7 @@ void goto_private(void) char hold_rm[SIZ]; char buf[SIZ]; - if (strcasecmp(bstr("sc"), "OK")) { + if (strlen(bstr("ok_button")) == 0) { display_main_menu(); return; } @@ -1664,7 +2095,7 @@ void goto_private(void) strcat(buf, "|"); strcat(buf, bstr("gr_pass")); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { smart_goto(bstr("gr_name")); @@ -1674,7 +2105,7 @@ void goto_private(void) display_private(bstr("gr_name"), 1); return; } - output_headers(1); + output_headers(1, 1, 1, 0, 0, 0); wprintf("%s\n", &buf[4]); wDumpContent(1); return; @@ -1686,20 +2117,24 @@ void goto_private(void) */ void display_zap(void) { - output_headers(1); + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n"); wprintf("
"); - wprintf("Zap (forget) the current room\n"); + wprintf(""); + wprintf(_("Zap (forget/unsubscribe) the current room")); + wprintf("\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(_("If you select this option, %s will " + "disappear from your room list. Is this what you wish " + "to do?
\n"), WC->wc_roomname); - wprintf("
\n"); - wprintf(""); + wprintf("\n"); + wprintf("", _("Zap this room")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); wprintf("
\n"); wDumpContent(1); } @@ -1718,17 +2153,13 @@ void zap(void) */ strcpy(final_destination, WC->wc_roomname); - if (!strcasecmp(bstr("sc"), "OK")) { + if (strlen(bstr("ok_button")) > 0) { serv_printf("GOTO %s", WC->wc_roomname); - serv_gets(buf); - if (buf[0] != '2') { - /* ExpressMessageCat(&buf[4]); */ - } else { + serv_getln(buf, sizeof buf); + if (buf[0] == '2') { serv_puts("FORG"); - serv_gets(buf); - if (buf[0] != '2') { - /* ExpressMessageCat(&buf[4]); */ - } else { + serv_getln(buf, sizeof buf); + if (buf[0] == '2') { strcpy(final_destination, "_BASEROOM_"); } } @@ -1738,59 +2169,15 @@ 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); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_main_menu(); @@ -1809,6 +2196,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(); @@ -1826,7 +2217,7 @@ void netedit(void) { } serv_puts("GNET"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { fclose(fp); display_editroom(); @@ -1834,15 +2225,20 @@ void netedit(void) { } /* This loop works for add *or* remove. Spiffy, eh? */ - while (serv_gets(buf), strcmp(buf, "000")) { - if (strcasecmp(buf, line)) { + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + 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); } } rewind(fp); serv_puts("SNET"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '4') { fclose(fp); display_editroom(); @@ -1854,7 +2250,7 @@ void netedit(void) { serv_puts(buf); } - if (!strcasecmp(bstr("cmd"), "add")) { + if (strlen(bstr("add_button")) > 0) { serv_puts(line); } @@ -1904,7 +2300,7 @@ void do_change_view(int newview) { char buf[SIZ]; serv_printf("VIEW %d", newview); - serv_gets(buf); + serv_getln(buf, sizeof buf); WC->wc_view = newview; smart_goto(WC->wc_roomname); } @@ -1927,20 +2323,35 @@ void change_view(void) { */ 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 levels; + int i; int has_subfolders = 0; + int *parents; + + parents = malloc(max_folders * sizeof(int)); + + /* BEGIN TREE MENU */ + wprintf("
Loading folder list...
\n"); + + /* include NanoTree */ + wprintf("\n"); + + /* initialize NanoTree */ + wprintf("\n"); - - do_template("beginbox_nt"); - wprintf("
\n"); - wprintf("\n"); - wprintf(" \n"); - wprintf("
\n"); - do_template("endbox"); + + wprintf("container = document.getElementById('roomlist_div'); \n" + "showTree(''); \n" + "\n" + ); + + free(parents); + /* END TREE MENU */ } /* * Boxes and rooms and lists ... oh my! */ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { - char buf[SIZ]; - char boxtitle[SIZ]; + char buf[256]; + char floor_name[256]; + char old_floor_name[256]; + char boxtitle[256]; int levels, oldlevels; int i, t; int num_boxes = 0; @@ -2030,23 +2445,28 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { int current_column = 0; int nf; + strcpy(floor_name, ""); + strcpy(old_floor_name, ""); + nf = num_floors; while (nf % columns != 0) ++nf; boxes_per_column = (nf / columns); if (boxes_per_column < 1) boxes_per_column = 1; /* Outer table (for columnization) */ - wprintf("" - "
"); + wprintf("" + "
"); levels = 0; oldlevels = 0; for (i=0; i 1)) { - + if ( (strcasecmp(floor_name, old_floor_name)) + && (strlen(old_floor_name) > 0) ) { /* End inner box */ do_template("endbox"); @@ -2054,19 +2474,17 @@ 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"); } } } + strcpy(old_floor_name, floor_name); if (levels == 1) { - /* Begin inner box */ - extract(buf, fold[i].name, levels-1); - stresc(boxtitle, buf, 1, 0); + stresc(boxtitle, floor_name, 1, 0); svprintf("BOXTITLE", WCS_STRING, boxtitle); do_template("beginbox"); - } oldlevels = levels; @@ -2075,7 +2493,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { wprintf(" "); if (levels>2) for (t=0; t<(levels-2); ++t) wprintf("   "); if (fold[i].selectable) { - wprintf(""); } @@ -2088,7 +2506,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) { @@ -2100,7 +2518,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 */ @@ -2137,30 +2555,30 @@ void list_all_rooms_by_floor(char *viewpref) { /* Then add floors */ serv_puts("LFLR"); - serv_gets(buf); - if (buf[0]=='1') while(serv_gets(buf), strcmp(buf, "000")) { + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) { if (max_folders >= alloc_folders) { alloc_folders = max_folders + 100; fold = realloc(fold, 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; } /* Now add rooms */ serv_puts("LKRA"); - serv_gets(buf); - if (buf[0]=='1') while(serv_gets(buf), strcmp(buf, "000")) { + serv_getln(buf, sizeof buf); + if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) { if (max_folders >= alloc_folders) { alloc_folders = max_folders + 100; fold = realloc(fold, 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); @@ -2169,6 +2587,7 @@ void list_all_rooms_by_floor(char *viewpref) { if (flags & QR_MAILBOX) { fold[max_folders].is_mailbox = 1; } + fold[max_folders].view = extract_int(buf, 6); room_to_folder(fold[max_folders].name, fold[max_folders].room, fold[max_folders].floor, @@ -2202,6 +2621,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); } @@ -2220,17 +2647,17 @@ void list_all_rooms_by_floor(char *viewpref) { void knrooms() { char listviewpref[SIZ]; - output_headers(3); + output_headers(1, 1, 2, 0, 0, 0); load_floorlist(); /* Determine whether the user is trying to change views */ if (bstr("view") != NULL) { if (strlen(bstr("view")) > 0) { - set_preference("roomlistview", bstr("view")); + set_preference("roomlistview", bstr("view"), 1); } } - get_preference("roomlistview", listviewpref); + get_preference("roomlistview", listviewpref, sizeof listviewpref); if ( (strcasecmp(listviewpref, "folders")) && (strcasecmp(listviewpref, "table")) ) { @@ -2238,7 +2665,8 @@ void knrooms() { } /* title bar */ - wprintf("
" + wprintf("
\n" + "\n"); - /* offer the ability to switch views */ wprintf("
" "" ); if (!strcasecmp(listviewpref, "rooms")) { @@ -2252,7 +2680,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); @@ -2287,21 +2717,21 @@ void knrooms() { void set_room_policy(void) { char buf[SIZ]; - if (strcmp(bstr("sc"), "OK")) { + if (strlen(bstr("ok_button")) == 0) { strcpy(WC->ImportantMessage, - "Cancelled. Changes were not saved."); + _("Cancelled. Changes were not saved.")); display_editroom(); return; } serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue"))); - serv_gets(buf); + serv_getln(buf, sizeof buf); strcpy(WC->ImportantMessage, &buf[4]); if (WC->axlevel >= 6) { - strcat(WC->ImportantMessage, "
\n"); + strcat(WC->ImportantMessage, "
\n"); serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue"))); - serv_gets(buf); + serv_getln(buf, sizeof buf); strcat(WC->ImportantMessage, &buf[4]); }