X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=a6005641de2a466d38c30fee7adca94a2b242843;hb=0596c6d9b3e9dda73beaa239e6349478667d267d;hp=8840d127f3d7d40ed9932734173eeeab23b4654e;hpb=c71900c353f2787af7963887d8f3c69bbc64dfd3;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index 8840d127f..a6005641d 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1,52 +1,54 @@ /* * $Id$ - * - * Lots of different room-related operations. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/** + * \defgroup RoomOps Lots of different room-related operations. + * \ingroup CitadelCommunitacion + */ +/*@{*/ #include "webcit.h" -struct folder { - int floor; - char room[SIZ]; - char name[SIZ]; - int hasnewmsgs; - int is_mailbox; - int selectable; -}; - -char *viewdefs[] = { - "Bulletin Board", - "Mail Folder", - "Address Book", - "Calendar", - "Task List", - "Notes List" -}; - -char floorlist[128][SIZ]; +char floorlist[128][SIZ]; /**< list of our floor names */ -/* - * load the list of floors +char *viewdefs[8]; /**< the different kinds of available views */ + +/** + * \brief initialize the viewdefs with localized strings + */ +void initialize_viewdefs(void) { + viewdefs[0] = _("Bulletin Board"); + viewdefs[1] = _("Mail Folder"); + viewdefs[2] = _("Address Book"); + viewdefs[3] = _("Calendar"); + viewdefs[4] = _("Task List"); + viewdefs[5] = _("Notes List"); + viewdefs[6] = _("Wiki"); + viewdefs[7] = _("Calendar List"); +} + +/** + * \brief Determine which views are allowed as the default for creating a new room. + * + * \param which_view The view ID being queried. + */ +int is_view_allowed_as_default(int which_view) +{ + switch(which_view) { + case VIEW_BBS: return(1); + case VIEW_MAILBOX: return(1); + case VIEW_ADDRESSBOOK: return(1); + case VIEW_CALENDAR: return(1); + case VIEW_TASKS: return(1); + case VIEW_NOTES: return(1); + case VIEW_WIKI: return(0); /**< because it isn't finished yet */ + case VIEW_CALBRIEF: return(0); + default: return(0); /**< should never get here */ + } +} + + +/** + * \brief load the list of floors */ void load_floorlist(void) { @@ -57,19 +59,38 @@ 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]); } } -/* - * remove a room from the march list +/** + * \brief Free a session's march list + * + * \param wcf Pointer to session being cleared + */ +void free_march_list(struct wcsession *wcf) +{ + struct march *mptr; + + while (wcf->march != NULL) { + mptr = wcf->march->next; + free(wcf->march); + wcf->march = mptr; + } + +} + + + +/** + * \brief remove a room from the march list */ void remove_march(char *aaa) { @@ -99,7 +120,10 @@ void remove_march(char *aaa) - +/** + * \brief display rooms in tree structure??? + * \param rp the roomlist to build a tree from + */ void room_tree_list(struct roomlisting *rp) { char rmname[64]; @@ -114,7 +138,7 @@ void room_tree_list(struct roomlisting *rp) strcpy(rmname, rp->rlname); f = rp->rlflags; - wprintf(""); @@ -134,8 +158,11 @@ void room_tree_list(struct roomlisting *rp) } -/* - * Room ordering stuff (compare first by floor, then by order) +/** + * \brief Room ordering stuff (compare first by floor, then by order) + * \param r1 first roomlist to compare + * \param r2 second roomlist co compare + * \return are they the same??? */ int rordercmp(struct roomlisting *r1, struct roomlisting *r2) { @@ -157,8 +184,9 @@ int rordercmp(struct roomlisting *r1, struct roomlisting *r2) } -/* - * Common code for all room listings +/** + * \brief Common code for all room listings + * \param variety what??? */ void listrms(char *variety) { @@ -169,18 +197,18 @@ void listrms(char *variety) struct roomlisting *rp; struct roomlisting *rs; - - /* Ask the server for a room list */ + /** 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); @@ -212,180 +240,268 @@ void listrms(char *variety) room_tree_list(rl); - /* If no rooms were listed, print an nbsp to make the cell + /** + * If no rooms were listed, print an nbsp to make the cell * borders show up anyway. */ if (num_rooms == 0) wprintf(" "); } -/* - * list all forgotten rooms +/** + * \brief list all forgotten rooms */ void zapped_list(void) { - output_headers(1, 1, 0, 0, 0, 0, 0); + 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(_("Click on any room to un-zap it and goto that room.\n")); do_template("endbox"); wDumpContent(1); } -/* - * read this room's info file (set v to 1 for verbose mode) +/** + * \brief read this room's info file (set v to 1 for verbose mode) */ void readinfo(void) { - char buf[SIZ]; + char buf[256]; + char briefinfo[128]; + char fullinfo[8192]; + int fullinfo_len = 0; serv_puts("RINF"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout(NULL, "CENTER"); + + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + if (fullinfo_len < (sizeof fullinfo - sizeof buf)) { + strcpy(&fullinfo[fullinfo_len], buf); + fullinfo_len += strlen(buf); + } + } + + safestrncpy(briefinfo, fullinfo, sizeof briefinfo); + strcpy(&briefinfo[50], "..."); + + wprintf("
"); + escputs(briefinfo); + wprintf("
"); + wprintf("\"%s\"", + _("Close window") + ); + escputs(fullinfo); + wprintf("
"); + } + else { + wprintf(" "); } } -/* Display room graphic. The server doesn't actually +/** + * \brief 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) || (WC->wc_view == VIEW_CALBRIEF) ) { + 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("" + ); + } + } -/* - * Display the current view and offer an option to change it +/** + * \brief Display the current view and offer an option to change it */ void embed_view_o_matic(void) { int i; - wprintf("
\n" - "View as: " - "\n", WC->nonce); + wprintf(" " + "
\n"); + wprintf("\n"); } +/** + * \brief Display a search box + */ +void embed_search_o_matic(void) { + wprintf("
\n"); + wprintf("\n", WC->nonce); + wprintf(" \n" + ); + wprintf("
\n"); +} + + +/** + * \brief Embed the room banner + * + * \param got The information returned from a GOTO server command + * \param navbar_style Determines which navigation buttons to display + * + */ void embed_room_banner(char *got, int navbar_style) { - char fakegot[SIZ]; + char buf[256]; - /* We need to have the information returned by a GOTO server command. + /** + * We need to have the information returned by a GOTO server command. * If it isn't supplied, we fake it by issuing our own GOTO. */ if (got == NULL) { serv_printf("GOTO %s", WC->wc_roomname); - serv_gets(fakegot); - got = fakegot; + serv_getln(buf, sizeof buf); + got = buf; } - /* If the user happens to select the "make this my start page" link, + /** The browser needs some information for its own use */ + wprintf("\n", + WC->wc_is_trash + ); + + /** + * If the user happens to select the "make this my start page" link, * we want it to remember the URL as a "/dotskip" one instead of * a "skip" or "gotonext" or something like that. */ - snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s", + snprintf(WC->this_page, sizeof(WC->this_page), "dotskip&room=%s", WC->wc_roomname); - /* Check for new mail. */ + /** Check for new mail. */ WC->new_mail = extract_int(&got[4], 9); WC->wc_view = extract_int(&got[4], 11); - svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname); - svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1)); - svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2)); + stresc(buf, WC->wc_roomname, 1, 1); + svprintf("ROOMNAME", WCS_STRING, "%s", buf); + svprintf("NUMMSGS", WCS_STRING, + _("%d new of %d messages"), + extract_int(&got[4], 1), + 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("SEARCHOMATIC", embed_search_o_matic); svcallback("START", offer_start_page); do_template("roombanner"); if (navbar_style != navbar_none) { - wprintf("
\n" - "\n"); - + wprintf("
    "); if (navbar_style == navbar_default) wprintf( - "
\n" + "
  • " + "" + "" + "%s" + "
  • \n", _("Ungoto") ); if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) { wprintf( - "\n" + "
  • " + "" + "" + "%s" + "
  • \n", _("Read new messages") ); } @@ -393,168 +509,253 @@ void embed_room_banner(char *got, int navbar_style) { switch(WC->wc_view) { case VIEW_ADDRESSBOOK: wprintf( - "\n" + "%s" + "\n", _("View contacts") ); break; case VIEW_CALENDAR: wprintf( - "\n" + "%s" + "\n", _("Month view") ); + break; + case VIEW_CALBRIEF: wprintf( - "\n" + "%s" + "\n", _("Calendar list") ); break; case VIEW_TASKS: wprintf( - "\n" + "%s" + "\n", _("View tasks") ); break; case VIEW_NOTES: wprintf( - "\n" + "%s" + "\n", _("View notes") ); break; case VIEW_MAILBOX: wprintf( - "\n" + "%s" + "\n", _("View message list") + ); + break; + case VIEW_WIKI: + wprintf( + "
  • " + "" + "" + "" + "%s" + "
  • \n", _("Wiki home") ); break; default: wprintf( - "\n" + "%s" + "\n", _("Read all messages") ); break; } } if (navbar_style == navbar_default) { - wprintf( - "\n"); } if (navbar_style == navbar_default) wprintf( - "\n" + "
  • " + "" + "" + "%s" + "
  • \n", + _("Leave all messages marked as unread, go to next room with unread messages"), + _("Skip this room") ); if (navbar_style == navbar_default) wprintf( - "\n" + "
  • " + "" + "" + "%s" + "
  • \n", + _("Mark all messages as read, go to next room with unread messages"), + _("Goto next room") ); - wprintf("
    " - "" - "" - "Ungoto" - "" - "" - "" - "Read new messages" - "" - "" - "" + "" + "" "" - "View contacts" - "" - "" - "" + "" + "" + "" + "%s" + "\n", _("Day view") + ); + wprintf( + "
  • " + "" + "" "" - "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"); + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Add new contact") + ); break; case VIEW_CALENDAR: - wprintf("Add new event"); + case VIEW_CALBRIEF: + wprintf("
  • 0) wprintf("?year=%s", bstr("year")); + if (strlen(bstr("month")) > 0) wprintf("?month=%s", bstr("month")); + if (strlen(bstr("day")) > 0) wprintf("?day=%s", bstr("day")); + wprintf("\">" + "" + "%s" + "
  • \n", _("Add new event") + ); break; case VIEW_TASKS: - wprintf("Add new task"); + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Add new task") + ); break; case VIEW_NOTES: - wprintf("Add new note"); + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Add new note") + ); + break; + case VIEW_WIKI: + safestrncpy(buf, bstr("page"), sizeof buf); + str_wiki_index(buf); + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", buf, _("Edit this page") + ); + break; + case VIEW_MAILBOX: + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Write mail") + ); break; default: - wprintf("Enter a message"); + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Enter a message") + ); break; } - wprintf("
    " - "" - "Skip this room" - "" - "" - "" - "Goto next room" - "" - "
    \n"); + wprintf("\n"); } } - - - -/* - * back end routine to take the session to a new room +/** + * \brief back end routine to take the session to a new room + * \param gname room to go to * */ -void gotoroom(char *gname) +int gotoroom(char *gname) { char buf[SIZ]; static long ls = (-1L); + int err = 0; - /* store ungoto information */ + /** store ungoto information */ strcpy(WC->ugname, WC->wc_roomname); WC->uglsn = ls; - /* move to the new room */ + /** 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); WC->wc_default_view = extract_int(&buf[4], 12); + WC->wc_is_trash = extract_int(&buf[4], 13); + WC->room_flags2 = extract_int(&buf[4], 14); if (WC->is_aide) WC->is_room_aide = WC->is_aide; @@ -564,12 +765,17 @@ void gotoroom(char *gname) remove_march(WC->wc_roomname); if (!strcasecmp(gname, "_BASEROOM_")) remove_march(gname); + + return err; } -/* - * Locate the room on the march list which we most want to go to. Each room +/** + * \brief Locate the room on the march list which we most want to go to. + * Each room * is measured given a "weight" of preference based on various factors. + * \param desired_floor the room number on the citadel server + * \return the roomname */ char *pop_march(int desired_floor) { @@ -606,7 +812,8 @@ char *pop_march(int desired_floor) -/* Goto next room having unread messages. +/** + *\brief Goto next room having unread messages. * We want to skip over rooms that the user has already been to, and take the * user back to the lobby when done. The room we end up in is placed in * newroom - which is set to 0 (the lobby) initially. @@ -615,36 +822,42 @@ char *pop_march(int desired_floor) */ void gotonext(void) { - char buf[SIZ]; + char buf[256]; struct march *mptr, *mptr2; + char room_name[128]; char next_room[128]; - /* First check to see if the march-mode list is already allocated. + /** + * First check to see if the march-mode list is already allocated. * If it is, pop the first room off the list and go there. */ 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")) { - mptr = (struct march *) malloc(sizeof(struct march)); - mptr->next = NULL; - extract(mptr->march_name, buf, 0); - mptr->march_floor = extract_int(buf, 2); - mptr->march_order = extract_int(buf, 3); - if (WC->march == NULL) { - WC->march = mptr; - } else { - mptr2 = WC->march; - while (mptr2->next != NULL) - mptr2 = mptr2->next; - mptr2->next = mptr; + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(room_name, buf, 0, '|', sizeof room_name); + if (strcasecmp(room_name, WC->wc_roomname)) { + mptr = (struct march *) malloc(sizeof(struct march)); + mptr->next = NULL; + safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name); + mptr->march_floor = extract_int(buf, 2); + mptr->march_order = extract_int(buf, 3); + if (WC->march == NULL) { + WC->march = mptr; + } else { + mptr2 = WC->march; + while (mptr2->next != NULL) + mptr2 = mptr2->next; + mptr2->next = mptr; + } } } -/* add _BASEROOM_ to the end of the march list, so the user will end up - * in the system base room (usually the Lobby>) at the end of the loop - */ + /** + * add _BASEROOM_ to the end of the march list, so the user will end up + * in the system base room (usually the Lobby>) at the end of the loop + */ mptr = (struct march *) malloc(sizeof(struct march)); mptr->next = NULL; strcpy(mptr->march_name, "_BASEROOM_"); @@ -656,10 +869,10 @@ void gotonext(void) mptr2 = mptr2->next; mptr2->next = mptr; } -/* - * ...and remove the room we're currently in, so a oto doesn't make us - * walk around in circles - */ + /** + * ...and remove the room we're currently in, so a oto doesn't make us + * walk around in circles + */ remove_march(WC->wc_roomname); } if (WC->march != NULL) { @@ -673,6 +886,10 @@ void gotonext(void) } +/** + * \brief goto next room + * \param next_room next room to go to + */ void smart_goto(char *next_room) { gotoroom(next_room); readloop("readnew"); @@ -680,25 +897,20 @@ void smart_goto(char *next_room) { -/* - * mark all messages in current room as having been read +/** + * \brief mark all messages in current room as having been read */ void slrp_highest(void) { - char buf[SIZ]; + char buf[256]; - /* set pointer */ serv_puts("SLRP HIGHEST"); - serv_gets(buf); - if (buf[0] != '2') { - wprintf("%s
    \n", &buf[4]); - return; - } + serv_getln(buf, sizeof buf); } -/* - * un-goto the previous room +/** + * \brief un-goto the previous room */ void ungoto(void) { @@ -709,14 +921,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, ""); @@ -727,11 +939,11 @@ void ungoto(void) -/* - * Set/clear/read the "self-service list subscribe" flag for a room +/** + * \brief Set/clear/read the "self-service list subscribe" flag for a room * - * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged. - * Always returns the new value. + * \param newval set to 0 to clear, 1 to set, any other value to leave unchanged. + * \return return the new value. */ int self_service(int newval) { @@ -744,12 +956,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); @@ -777,7 +989,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); @@ -789,21 +1001,22 @@ int self_service(int newval) { -/* - * display the form for editing a room +/** + * \brief display the form for editing a room */ 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 cmd[1024]; + char node[256]; + char remote_room[128]; + char recp[1024]; + char er_name[128]; char er_password[10]; char er_dirname[15]; char er_roomaide[26]; unsigned er_flags; + unsigned er_flags2; int er_floor; int i, j; char *tab; @@ -819,35 +1032,36 @@ 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); + er_flags2 = extract_int(&buf[4], 7); - output_headers(1, 1, 1, 0, 0, 0, 0); + output_headers(1, 1, 1, 0, 0, 0); - /* print the tabbed dialog */ + /** print the tabbed dialog */ wprintf("
    " - "
    " + "
    " "" "" "\n"); if (!strcmp(tab, "admin")) { - wprintf("\n"); } @@ -858,12 +1072,12 @@ void display_editroom(void) wprintf("\n"); if (!strcmp(tab, "config")) { - wprintf("\n"); } @@ -874,12 +1088,12 @@ void display_editroom(void) wprintf("\n"); if (!strcmp(tab, "expire")) { - wprintf("\n"); } @@ -890,12 +1104,12 @@ void display_editroom(void) wprintf("\n"); if (!strcmp(tab, "access")) { - wprintf("\n"); } @@ -906,12 +1120,12 @@ void display_editroom(void) wprintf("\n"); if (!strcmp(tab, "sharing")) { - wprintf("\n"); } @@ -922,12 +1136,12 @@ void display_editroom(void) wprintf("\n"); if (!strcmp(tab, "listserv")) { - wprintf("\n"); } @@ -938,31 +1152,43 @@ void display_editroom(void) wprintf("\n"); wprintf("
     "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Administration"); + wprintf(_("Administration")); if (!strcmp(tab, "admin")) { wprintf(" "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Configuration"); + wprintf(_("Configuration")); if (!strcmp(tab, "config")) { wprintf(" "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Message expire policy"); + wprintf(_("Message expire policy")); if (!strcmp(tab, "expire")) { wprintf(" "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Access controls"); + wprintf(_("Access controls")); if (!strcmp(tab, "access")) { wprintf(" "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Sharing"); + wprintf(_("Sharing")); if (!strcmp(tab, "sharing")) { wprintf(" "); + wprintf(""); } else { - wprintf(""); + wprintf(""); } - wprintf("Mailing list service"); + wprintf(_("Mailing list service")); if (!strcmp(tab, "listserv")) { wprintf(" 
    \n"); - /* end tabbed dialog */ + /** end tabbed dialog */ - /* begin content of whatever tab is open now */ - wprintf("
    " - "\n" + /** begin content of whatever tab is open now */ + wprintf("
    " + "
    \n" "
    \n"); if (!strcmp(tab, "admin")) { wprintf(""); } if (!strcmp(tab, "config")) { - wprintf("
    \n"); + wprintf("\n"); + wprintf("\n", WC->nonce); - 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 (automatically appears to everyone)")); + wprintf("\n"); wprintf("
          • Private - guess name\n"); + wprintf("> "); + wprintf(_("Private - hidden (accessible to anyone who knows its 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")); + + wprintf("\n
      • "); + wprintf(_("All users allowed to post may also delete messages")); - /* 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 */ + /** 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)")); + + wprintf("\n
      • "); + wprintf(_("Subject Required (Force users to specify a message subject)")); - /* start of anon options */ + /** 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]); + 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") ); } - /* Sharing the room with other Citadel nodes... */ + /** Sharing the room with other Citadel nodes... */ if (!strcmp(tab, "sharing")) { shared_with = strdup(""); not_shared_with = strdup(""); - /* Learn the current configuration */ + /** 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); @@ -1113,11 +1380,11 @@ void display_editroom(void) } 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(remote_room, buf, 2); + 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); @@ -1131,38 +1398,43 @@ void display_editroom(void) } for (i=0; i
      " "" - "" - "\n" + "" + "\n" "" "
      Shared withNot shared with
      "); + wprintf(_("Shared with")); + wprintf(""); + wprintf(_("Not shared with")); + wprintf("
      \n"); - wprintf("" - "" - "" - "" - "\n" - ); + wprintf("
      Remote node nameRemote room nameActions
      \n"); for (i=0; i 0) { - wprintf("" - "\n", node); + wprintf(""); + wprintf("\n", WC->nonce); + wprintf("\n", node); wprintf("\n"); } } wprintf("
      "); + wprintf(_("Remote node name")); + wprintf(""); + wprintf(_("Remote room name")); + wprintf(""); + wprintf(_("Actions")); + wprintf("
      %s
      %s"); if (strlen(remote_room) > 0) { @@ -1185,26 +1457,27 @@ void display_editroom(void) wprintf("\n"); wprintf(""); + "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare")); wprintf("
      \n"); wprintf("
      \n"); - wprintf("" - "" - "" - "" - "\n" - ); + wprintf("
      Remote node nameRemote room nameActions
      \n"); for (i=0; i 0) { - wprintf("
      " - "
      \n"); } } @@ -1229,103 +1502,122 @@ void display_editroom(void) wprintf("
      "); + wprintf(_("Remote node name")); + wprintf(""); + wprintf(_("Remote room name")); + wprintf(""); + wprintf(_("Actions")); + wprintf("
      "); + wprintf(""); + wprintf("\n", WC->nonce); + wprintf("
      "); escputs(node); wprintf("" "\n"); wprintf(""); + "NAME=\"add_button\" VALUE=\"%s\">", _("Share")); wprintf("
      \n"); wprintf("

      \n" - "Notes:
      • When sharing a room, " + "%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 */ + /** Mailing list management */ if (!strcmp(tab, "listserv")) { 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("\">"); + wprintf(_("(remove)")); + wprintf("
        "); } } - wprintf("
        \n" + wprintf("
        \n" "\n" "\n"); - wprintf("\n"); - wprintf(""); + wprintf("\n", WC->nonce); + wprintf("\n"); + 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("\">"); + wprintf(_("(remove)")); + wprintf("
        "); } } - wprintf("
        \n" + wprintf("
        \n" "\n" "\n"); - wprintf("\n"); - wprintf(""); + wprintf("\n", WC->nonce); + wprintf("\n"); + wprintf("", _("Add")); wprintf("
        \n"); - wprintf("

        \n"); + wprintf("
    \n"); + + /** Pop open an address book -- begin **/ + wprintf("
    " + "" + "" + " %s" + "
    ", + _("List"), + _("Digest"), + _("Add recipients from Contacts or other address books"), + _("Add recipients from Contacts or other address books") + ); + /** Pop open an address book -- end **/ + wprintf("
    "); 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"); } @@ -1333,71 +1625,84 @@ void display_editroom(void) } - /* Mailing list management */ + /** Mailing list management */ 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", WC->nonce); wprintf("\n"); - wprintf("\n"); if (WC->axlevel >= 6) { 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")); + wprintf("
    \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("", _("Save changes")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); wprintf("
    \n" @@ -1407,20 +1712,21 @@ void display_editroom(void) } - /* Mailing list management */ + /** Mailing list management */ if (!strcmp(tab, "access")) { display_whok(); } - /* end content of whatever tab is open now */ + /** end content of whatever tab is open now */ wprintf("
    \n"); + address_book_popup(); wDumpContent(1); } -/* - * Toggle self-service list subscription +/** + * \brief Toggle self-service list subscription */ void toggle_self_service(void) { int newval = 0; @@ -1432,54 +1738,61 @@ void toggle_self_service(void) { -/* - * save new parameters for a room +/** + * \brief save new parameters for a room */ 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]; int er_floor; unsigned er_flags; + int er_listingorder; + int er_defaultview; + unsigned er_flags2; 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); + er_listingorder = extract_int(&buf[4], 5); + er_defaultview = extract_int(&buf[4], 6); + er_flags2 = extract_int(&buf[4], 7); 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; @@ -1515,12 +1828,24 @@ void editroom(void) er_flags &= ~QR_READONLY; } + if (!strcmp(bstr("collabdel"), "yes")) { + er_flags2 |= QR2_COLLABDEL; + } else { + er_flags2 &= ~QR2_COLLABDEL; + } + if (!strcmp(bstr("permanent"), "yes")) { er_flags |= QR_PERMANENT; } else { er_flags &= ~QR_PERMANENT; } + if (!strcmp(bstr("subjectreq"), "yes")) { + er_flags2 |= QR2_SUBJECTREQ; + } else { + er_flags2 &= ~QR2_SUBJECTREQ; + } + if (!strcmp(bstr("network"), "yes")) { er_flags |= QR_NETWORK; } else { @@ -1565,10 +1890,11 @@ void editroom(void) er_floor = atoi(bstr("er_floor")); - sprintf(buf, "SETR %s|%s|%s|%u|%d|%d", - er_name, er_password, er_dirname, er_flags, bump, er_floor); + sprintf(buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u", + er_name, er_password, er_dirname, er_flags, bump, er_floor, + er_listingorder, er_defaultview, er_flags2); serv_puts(buf); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_editroom(); @@ -1579,7 +1905,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(); @@ -1587,53 +1913,53 @@ 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; } -/* - * Display form for Invite, Kick, and show Who Knows a room +/** + * \brief Display form for Invite, Kick, and show Who Knows a room */ 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') { 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); } } - 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); } } @@ -1643,36 +1969,38 @@ void do_invt_kick(void) { -/* - * Display form for Invite, Kick, and show Who Knows a room +/** + * \brief 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); + serv_getln(buf, sizeof buf); if (buf[0] != '2') { escputs(&buf[4]); return; } - extract(room, &buf[4], 0); + extract_token(room, &buf[4], 0, '|', sizeof room); - wprintf("" - "
    The users listed below have access to this 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", WC->nonce); 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", WC->nonce); + wprintf(_("Invite:")); + wprintf(" "); wprintf("
    \n" - "" - "" - "
    \n"); + "" + "" + "
    \n", _("Invite")); wprintf("
    \n"); wDumpContent(1); @@ -1701,8 +2032,8 @@ void display_whok(void) -/* - * display the form for entering a new room +/** + * \brief display the form for entering a new room */ void display_entroom(void) { @@ -1710,7 +2041,7 @@ 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]); @@ -1718,23 +2049,28 @@ void display_entroom(void) return; } - output_headers(1, 1, 2, 0, 0, 0, 0); + output_headers(1, 1, 2, 0, 0, 0); wprintf("
    \n" - "
    " - "Create a new room" + "
    " + ""); + wprintf(_("Create a new room")); + wprintf("" "
    \n" "\n
    \n" ); - wprintf("
    " - "
    \n"); + wprintf("
    " + "
    \n"); - wprintf("
    \n"); + wprintf("\n"); + wprintf("\n", WC->nonce); - wprintf("
    • Name of room: "); + wprintf("
      • "); + wprintf(_("Name of room: ")); wprintf("\n"); - wprintf("
      • Resides on floor: "); + wprintf("
      • "); + wprintf(_("Resides on floor: ")); load_floorlist(); wprintf("\n"); - /* Our clever little snippet of JavaScript automatically selects - * a public room if the view is set to Bulletin Board, and it - * selects a mailbox room otherwise. The user can override this, - * of course. - */ - wprintf("
      • Default view for room: "); + /** + * Our clever little snippet of JavaScript automatically selects + * a public room if the view is set to Bulletin Board or wiki, and + * it selects a mailbox room otherwise. The user can override this, + * of course. We also disable the floor selector for mailboxes. + */ + wprintf("
      • "); + wprintf(_("Default view for room: ")); wprintf("\n"); - wprintf("
      • Type of room:
          \n"); + wprintf("
        • "); + wprintf(_("Type of room:")); + wprintf("
            \n"); wprintf("
          • Public (automatically appears to everyone)\n"); + "\"> "); + wprintf(_("Public (automatically appears to everyone)")); - wprintf("
          • Private - hidden (accessible to anyone who knows its name)\n"); + "\"> "); + wprintf(_("Private - hidden (accessible to anyone who knows its name)")); - wprintf("
          • Private - require password:\n"); + "\"> "); + wprintf(_("Private - require password: ")); wprintf("\n"); wprintf("
          • Private - invitation only\n"); + "\"> "); + wprintf(_("Private - invitation only")); - wprintf("
          • Personal (mailbox for you only)\n"); + "\"> "); + wprintf(_("Personal (mailbox for you only)")); - wprintf("
          \n"); + wprintf("\n
        \n"); wprintf("
        \n"); - wprintf(""); + wprintf("", _("Create new room")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); 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"); } wprintf("
    \n"); wDumpContent(1); @@ -1825,8 +2173,8 @@ void display_entroom(void) -/* - * support function for entroom() -- sets the default view +/** + * \brief support function for entroom() -- sets the default view */ void er_set_default_view(int newview) { @@ -1841,12 +2189,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); @@ -1856,13 +2204,13 @@ 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); } -/* - * enter a new room +/** + * \brief enter a new room */ void entroom(void) { @@ -1874,9 +2222,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; } @@ -1899,7 +2247,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(); @@ -1910,63 +2258,72 @@ void entroom(void) } -/* - * display the screen to enter a private room +/** + * \brief display the screen to enter a private room */ void display_private(char *rname, int req_pass) { - output_headers(1, 1, 2, 0, 0, 0, 0); + output_headers(1, 1, 2, 0, 0, 0); wprintf("
    \n" - "
    " - "Go to a hidden room" + "
    " + ""); + wprintf(_("Go to a hidden room")); + wprintf("" "
    \n" "\n
    \n" ); - wprintf("
    " - "
    \n"); + 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", WC->nonce); wprintf("\n" - "
    " - "Enter room name:" + "cellpadding=\"5\" class=\"roomops_background_alt\">\n" + "
    "); + 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("" + wprintf("" " " - ""); + "", + _("Go there"), + _("Cancel") + ); wprintf("
    \n"); wprintf("
    \n"); wDumpContent(1); } -/* - * goto a private room +/** + * \brief goto a private room */ 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; } @@ -1976,7 +2333,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")); @@ -1986,58 +2343,62 @@ void goto_private(void) display_private(bstr("gr_name"), 1); return; } - output_headers(1, 1, 1, 0, 0, 0, 0); + output_headers(1, 1, 1, 0, 0, 0); wprintf("%s\n", &buf[4]); wDumpContent(1); return; } -/* - * display the screen to zap a room +/** + * \brief display the screen to zap a room */ void display_zap(void) { - output_headers(1, 1, 2, 0, 0, 0, 0); + output_headers(1, 1, 2, 0, 0, 0); wprintf("
    \n"); - wprintf("
    "); - wprintf("Zap (forget/unsubscribe) the current room\n"); + wprintf("
    "); + 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("\n", WC->nonce); + wprintf("", _("Zap this room")); wprintf(" "); - wprintf(""); + wprintf("", _("Cancel")); wprintf("
    \n"); wDumpContent(1); } -/* - * zap a room +/** + * \brief zap a room */ void zap(void) { char buf[SIZ]; char final_destination[SIZ]; - /* If the forget-room routine fails for any reason, we fall back + /** + * If the forget-room routine fails for any reason, we fall back * to the current room; otherwise, we go to the Lobby */ 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); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { serv_puts("FORG"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { strcpy(final_destination, "_BASEROOM_"); } @@ -2048,61 +2409,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, 1, 2, 0, 0, 0, 0); - wprintf("
    \n"); - wprintf("
    "); - wprintf("Confirm deletion of room\n"); - wprintf("
    \n"); - wprintf("
    \n
    \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 +/** + * \brief 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(); @@ -2114,8 +2429,8 @@ void delete_room(void) -/* - * Perform changes to a room's network configuration +/** + * \brief Perform changes to a room's network configuration */ void netedit(void) { FILE *fp; @@ -2125,6 +2440,7 @@ void netedit(void) { char cmpa1[SIZ]; char cmpb0[SIZ]; char cmpb1[SIZ]; + int i, num_addrs; if (strlen(bstr("line"))==0) { display_editroom(); @@ -2142,19 +2458,19 @@ void netedit(void) { } serv_puts("GNET"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { fclose(fp); display_editroom(); return; } - /* This loop works for add *or* remove. Spiffy, eh? */ - while (serv_gets(buf), strcmp(buf, "000")) { - extract(cmpa0, buf, 0); - extract(cmpa1, buf, 1); - extract(cmpb0, line, 0); - extract(cmpb1, line, 1); + /** This loop works for add *or* remove. Spiffy, eh? */ + 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); @@ -2163,7 +2479,7 @@ void netedit(void) { rewind(fp); serv_puts("SNET"); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] != '4') { fclose(fp); display_editroom(); @@ -2175,8 +2491,23 @@ void netedit(void) { serv_puts(buf); } - if (!strcasecmp(bstr("cmd"), "add")) { - serv_puts(line); + if (strlen(bstr("add_button")) > 0) { + num_addrs = num_tokens(bstr("line"), ','); + if (num_addrs < 2) { + /* just adding one node or address */ + serv_puts(line); + } + else { + /* adding multiple addresses separated by commas */ + for (i=0; iwc_view = newview; smart_goto(WC->wc_roomname); } -/* - * Change the view for this room +/** + * \brief Change the view for this room */ void change_view(void) { int view; @@ -2243,26 +2579,43 @@ void change_view(void) { } -/* - * One big expanded tree list view --- like a folder list +/** + * \brief One big expanded tree list view --- like a folder list + * \param fold the folder to view + * \param max_folders how many folders??? + * \param num_floors hom many floors??? */ 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"); - - /* BEGIN TREE MENU */ - wprintf("
    \n"); - wprintf("
    \n"); - wprintf("\n"); - wprintf(" \n"); - wprintf("
    \n"); - /* END TREE MENU */ + + wprintf("container = document.getElementById('roomlist_div'); \n" + "showTree(''); \n" + "\n" + ); + + free(parents); + /** END TREE MENU */ } -/* - * Boxes and rooms and lists ... oh my! +/** + * \brief Boxes and rooms and lists ... oh my! + * \param fold the folder to view + * \param max_folders how many folders??? + * \param num_floors hom many floors??? */ 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; @@ -2352,12 +2715,15 @@ 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) */ + /** Outer table (for columnization) */ wprintf("" "
    "); @@ -2366,9 +2732,11 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { for (i=0; i 1)) { - + if ( (strcasecmp(floor_name, old_floor_name)) + && (strlen(old_floor_name) > 0) ) { /* End inner box */ do_template("endbox"); @@ -2380,15 +2748,13 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { } } } + strcpy(old_floor_name, floor_name); if (levels == 1) { - - /* Begin inner box */ - extract(buf, fold[i].name, levels-1); - stresc(boxtitle, buf, 1, 0); + /** Begin inner box */ + stresc(boxtitle, floor_name, 1, 0); svprintf("BOXTITLE", WCS_STRING, boxtitle); do_template("beginbox"); - } oldlevels = levels; @@ -2397,7 +2763,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(""); } @@ -2410,7 +2776,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) { @@ -2425,16 +2791,167 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { wprintf("
    \n"); } } - /* End the final inner box */ + /** End the final inner box */ do_template("endbox"); wprintf("
    \n"); } +/** + * \brief print a floor div??? + * \param which_floordiv name of the floordiv??? + */ +void set_floordiv_expanded(char *which_floordiv) { + begin_ajax_response(); + safestrncpy(WC->floordiv_expanded, which_floordiv, sizeof WC->floordiv_expanded); + end_ajax_response(); +} -/* - * Show the room list. (only should get called by +/** + * \brief view the iconbar + * \param fold the folder to view + * \param max_folders how many folders??? + * \param num_floors hom many floors??? + */ +void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { + char buf[256]; + char floor_name[256]; + char old_floor_name[256]; + char floordivtitle[256]; + char floordiv_id[32]; + int levels, oldlevels; + int i, t; + int num_drop_targets = 0; + char *icon = NULL; + + strcpy(floor_name, ""); + strcpy(old_floor_name, ""); + + levels = 0; + oldlevels = 0; + for (i=0; i 0) ) { + /** End inner box */ + wprintf("
    \n"); + wprintf("
    \n"); /** floordiv */ + } + strcpy(old_floor_name, floor_name); + + if (levels == 1) { + /** Begin floor */ + stresc(floordivtitle, floor_name, 0, 0); + sprintf(floordiv_id, "floordiv%d", i); + wprintf("" + "%s
    \n", floordiv_id, floordivtitle); + wprintf("
    ", + floordiv_id, + (!strcasecmp(floordiv_id, WC->floordiv_expanded) ? "block" : "none") + ); + } + + oldlevels = levels; + + if (levels > 1) { + wprintf("
    ", i); + wprintf(" "); + if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" "); + + /** choose the icon */ + if (fold[i].view == VIEW_ADDRESSBOOK) { + icon = "viewcontacts_16x.gif" ; + } + else if (fold[i].view == VIEW_CALENDAR) { + icon = "calarea_16x.gif" ; + } + else if (fold[i].view == VIEW_CALBRIEF) { + icon = "calarea_16x.gif" ; + } + else if (fold[i].view == VIEW_TASKS) { + icon = "taskmanag_16x.gif" ; + } + else if (fold[i].view == VIEW_NOTES) { + icon = "storenotes_16x.gif" ; + } + else if (fold[i].view == VIEW_MAILBOX) { + icon = "privatemess_16x.gif" ; + } + else { + icon = "chatrooms_16x.gif" ; + } + + if (fold[i].selectable) { + wprintf(""); + wprintf("\"\" ", icon); + } + else { + wprintf(""); + } + if (fold[i].hasnewmsgs) { + wprintf(""); + } + else { + wprintf(""); + } + extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); + escputs(buf); + if (!strcasecmp(fold[i].name, "My Folders|Mail")) { + wprintf(" (INBOX)"); + } + wprintf(""); + if (fold[i].selectable) { + wprintf(""); + } + else { + wprintf(""); + } + wprintf("
    "); + wprintf("
    \n"); /** roomdiv */ + } + } + wprintf("
    \n"); /** floordiv */ + + + /** BEGIN: The old invisible pixel trick, to get our JavaScript to initialize */ + wprintf(" 1) { + wprintf("drop_targets_elements[%d]=$('roomdiv%d');\n", num_drop_targets, i); + wprintf("drop_targets_roomnames[%d]='", num_drop_targets); + jsescputs(fold[i].room); + wprintf("';\n"); + ++num_drop_targets; + } + } + + wprintf("num_drop_targets = %d;\n", num_drop_targets); + if (strlen(WC->floordiv_expanded) > 1) { + wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded); + } + + wprintf("\">\n"); + /** END: The old invisible pixel trick, to get our JavaScript to initialize */ +} + + + +/** + * \brief Show the room list. + * (only should get called by * knrooms() because that's where output_headers() is called from) + * \param viewpref the view preferences??? */ void list_all_rooms_by_floor(char *viewpref) { @@ -2447,9 +2964,26 @@ void list_all_rooms_by_floor(char *viewpref) { int i, j; int ra_flags = 0; int flags = 0; - int num_floors = 1; /* add an extra one for private folders */ + int num_floors = 1; /** add an extra one for private folders */ - /* Start with the mailboxes */ + /** If our cached folder list is very old, burn it. */ + if (WC->cache_fold != NULL) { + if ((time(NULL) - WC->cache_timestamp) > 300) { + free(WC->cache_fold); + WC->cache_fold = NULL; + } + } + + /** Can we do the iconbar roomlist from cache? */ + if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) { + do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors); + return; + } + + /** Grab the floor table so we know how to build the list... */ + load_floorlist(); + + /** Start with the mailboxes */ max_folders = 1; alloc_folders = 1; fold = malloc(sizeof(struct folder)); @@ -2457,32 +2991,35 @@ void list_all_rooms_by_floor(char *viewpref) { strcpy(fold[0].name, "My folders"); fold[0].is_mailbox = 1; - /* Then add floors */ + /** 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 */ + /** refresh the messages index for this room */ +// serv_puts("GOTO "); +// while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); + /** 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); @@ -2491,6 +3028,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, @@ -2499,7 +3037,7 @@ void list_all_rooms_by_floor(char *viewpref) { ++max_folders; } - /* Bubble-sort the folder list */ + /** Bubble-sort the folder list */ for (i=0; i
    A Table
    \n"); - for (i=0; i\n"); - } - */ if (!strcasecmp(viewpref, "folders")) { do_folder_view(fold, max_folders, num_floors); } + else if (!strcasecmp(viewpref, "hackish_view")) { + for (i=0; i\n"); + } + } + else if (!strcasecmp(viewpref, "iconbar")) { + do_iconbar_view(fold, max_folders, num_floors); + } else { do_rooms_view(fold, max_folders, num_floors); } - free(fold); - wDumpContent(1); + /* Don't free the folder list ... cache it for future use! */ + if (WC->cache_fold != NULL) { + free(WC->cache_fold); + } + WC->cache_fold = fold; + WC->cache_max_folders = max_folders; + WC->cache_num_floors = num_floors; + WC->cache_timestamp = time(NULL); } -/* Do either a known rooms list or a folders list, depending on the +/** + * \brief Do either a known rooms list or a folders list, depending on the * user's preference */ -void knrooms() { +void knrooms(void) +{ char listviewpref[SIZ]; - output_headers(1, 1, 2, 0, 0, 0, 0); - load_floorlist(); + output_headers(1, 1, 2, 0, 0, 0); - /* Determine whether the user is trying to change views */ + /** 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")) ) { strcpy(listviewpref, "rooms"); } - /* title bar */ + /** title bar */ wprintf("
    \n" - "
    " + "\n"); - /* offer the ability to switch views */ + /** offer the ability to switch views */ wprintf("
    " "" ); if (!strcasecmp(listviewpref, "rooms")) { - wprintf("Room list"); + wprintf(_("Room list")); } if (!strcasecmp(listviewpref, "folders")) { - wprintf("Folder list"); + wprintf(_("Folder list")); } if (!strcasecmp(listviewpref, "table")) { - wprintf("Room list"); + wprintf(_("Room list")); } wprintf("
    \n" "