X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=a128ba8bf4311ecf2ad7f4ae9d464b46f5be871c;hb=4ece18dbfa7b31a9dc319ec0480ed651a30b3213;hp=2a2017f1bd2aef6b83cb1868a50d67006bb833af;hpb=1e32899153e9e52aaec1e651e0c33a563b8aaed8;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index 2a2017f1b..a128ba8bf 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1,19 +1,17 @@ /* * $Id$ + * Lots of different room-related operations. */ -/** - * \defgroup RoomOps Lots of different room-related operations. - * \ingroup CitadelCommunitacion - */ -/*@{*/ -#include "webcit.h" -char floorlist[128][SIZ]; /**< list of our floor names */ +#include "webcit.h" +#include "webserver.h" +#define MAX_FLOORS 128 +char floorlist[MAX_FLOORS][SIZ]; /**< list of our floor names */ -char *viewdefs[7]; /**< the different kinds of available views */ +char *viewdefs[9]; /**< the different kinds of available views */ -/** - * \brief initialize the viewdefs with localized strings +/* + * Initialize the viewdefs with localized strings */ void initialize_viewdefs(void) { viewdefs[0] = _("Bulletin Board"); @@ -23,18 +21,45 @@ void initialize_viewdefs(void) { viewdefs[4] = _("Task List"); viewdefs[5] = _("Notes List"); viewdefs[6] = _("Wiki"); + viewdefs[7] = _("Calendar List"); + viewdefs[8] = _("Journal"); } +/* + * Determine which views are allowed as the default for creating a new room. + */ +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); + +#ifdef TECH_PREVIEW + case VIEW_WIKI: return(1); +#else /* TECH_PREVIEW */ + case VIEW_WIKI: return(0); /* because it isn't finished yet */ +#endif /* TECH_PREVIEW */ + + case VIEW_CALBRIEF: return(0); + case VIEW_JOURNAL: return(0); + default: return(0); /* should never get here */ + } +} -/** - * \brief load the list of floors + +/* + * load the list of floors */ void load_floorlist(void) { int a; char buf[SIZ]; - for (a = 0; a < 128; ++a) + for (a = 0; a < MAX_FLOORS; ++a) floorlist[a][0] = 0; serv_puts("LFLR"); @@ -49,8 +74,25 @@ void load_floorlist(void) } -/** - * \brief remove a room from the march list +/* + * Free a session's march list + */ +void free_march_list(struct wcsession *wcf) +{ + struct march *mptr; + + while (wcf->march != NULL) { + mptr = wcf->march->next; + free(wcf->march); + wcf->march = mptr; + } + +} + + + +/* + * remove a room from the march list */ void remove_march(char *aaa) { @@ -80,9 +122,8 @@ void remove_march(char *aaa) -/** - * \brief display rooms in tree structure??? - * \param rp the roomlist to build a tree from +/* + * display rooms in tree structure */ void room_tree_list(struct roomlisting *rp) { @@ -111,7 +152,7 @@ void room_tree_list(struct roomlisting *rp) wprintf(")"); else wprintf(">"); - wprintf(" \n"); + wprintf(" \n"); room_tree_list(rp->rnext); free(rp); @@ -157,7 +198,6 @@ void listrms(char *variety) struct roomlisting *rp; struct roomlisting *rs; - /** Ask the server for a room list */ serv_puts(variety); serv_getln(buf, sizeof buf); @@ -165,6 +205,7 @@ void listrms(char *variety) wprintf(" "); return; } + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { ++num_rooms; rp = malloc(sizeof(struct roomlisting)); @@ -213,7 +254,7 @@ void listrms(char *variety) */ void zapped_list(void) { - output_headers(1, 1, 0, 0, 0, 0); + output_headers(1, 1, 1, 0, 0, 0); svprintf("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms")); do_template("beginbox"); @@ -232,12 +273,37 @@ void zapped_list(void) */ void readinfo(void) { - char buf[SIZ]; + char buf[256]; + char briefinfo[128]; + char fullinfo[8192]; + int fullinfo_len = 0; serv_puts("RINF"); serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout("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(" "); @@ -260,7 +326,7 @@ void embed_room_graphic(void) { serv_puts("OIMG _roompic_"); serv_getln(buf, sizeof buf); if (buf[0] == '2') { - wprintf("wc_roomname); wprintf("\">"); serv_puts("CLOS"); @@ -272,7 +338,7 @@ void embed_room_graphic(void) { "\">" ); } - else if (WC->wc_view == VIEW_CALENDAR) { + else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) { wprintf("" @@ -313,13 +379,13 @@ void embed_room_graphic(void) { void embed_view_o_matic(void) { int i; - wprintf("
\n" - ""); + wprintf("\n"); + wprintf("\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 view room banner - * \param got what??? - * \param navbar_style + * \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 buf[256]; - + char buf2[1024]; + char sanitized_roomname[256]; + char with_files[256]; + int file_count=0; + /** * 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. @@ -384,39 +474,55 @@ void embed_room_banner(char *got, int navbar_style) { WC->new_mail = extract_int(&got[4], 9); WC->wc_view = extract_int(&got[4], 11); - svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname); + /* Is this a directory room and does it contain files and how many? */ + if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR)) + { + serv_puts("RDIR"); + serv_getln(buf2, sizeof buf2); + if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000")) + file_count++; + snprintf (with_files, sizeof with_files, + "; %d %s ", + file_count, + ((file_count>1) || (file_count == 0) ? _("files") : _("file"))); + } + else + strcpy (with_files, ""); + + stresc(sanitized_roomname, 256, WC->wc_roomname, 1, 1); + svprintf("ROOMNAME", WCS_STRING, "%s", sanitized_roomname); svprintf("NUMMSGS", WCS_STRING, - _("%d new of %d messages"), + _("%d new of %d messages%s"), extract_int(&got[4], 1), - extract_int(&got[4], 2) + extract_int(&got[4], 2), + with_files ); svcallback("ROOMPIC", embed_room_graphic); svcallback("ROOMINFO", readinfo); 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("
\n", _("Ungoto") + "\n", _("Ungoto") ); if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) { wprintf( - "\n", _("Read new messages") + "\n", _("Read new messages") ); } @@ -424,88 +530,99 @@ void embed_room_banner(char *got, int navbar_style) { switch(WC->wc_view) { case VIEW_ADDRESSBOOK: wprintf( - "\n", _("View contacts") + "\n", _("View contacts") ); break; case VIEW_CALENDAR: wprintf( - "\n", _("Day view") + "\n", _("Day view") + ); + wprintf( + "
  • " + "" + "" + "" + "%s" + "
  • \n", _("Month view") ); + break; + case VIEW_CALBRIEF: wprintf( - "\n", _("Month view") + "\n", _("Calendar list") ); break; case VIEW_TASKS: wprintf( - "\n", _("View tasks") + "\n", _("View tasks") ); break; case VIEW_NOTES: wprintf( - "\n", _("View notes") + "\n", _("View notes") ); break; case VIEW_MAILBOX: wprintf( - "\n", _("View message list") + "\n", _("View message list") ); break; case VIEW_WIKI: wprintf( - "\n", _("Wiki home") + "\n", _("Wiki home") ); break; default: wprintf( - "\n", _("Read all messages") + "\n", _("Read all messages") ); break; } @@ -515,94 +632,110 @@ void embed_room_banner(char *got, int navbar_style) { switch(WC->wc_view) { case VIEW_ADDRESSBOOK: wprintf( - "\n", _("Add new contact") + "\n", _("Add new contact") ); break; case VIEW_CALENDAR: - wprintf( - "\n", _("Add new event") + "\n", _("Add new event") ); break; case VIEW_TASKS: wprintf( - "\n", _("Add new task") + "\n", _("Add new task") ); break; case VIEW_NOTES: wprintf( - "\n", _("Add new note") + "\n", _("Add new note") ); break; case VIEW_WIKI: safestrncpy(buf, bstr("page"), sizeof buf); str_wiki_index(buf); wprintf( - "\n", buf, _("Edit this page") + "\n", buf, _("Edit this page") + ); + break; + case VIEW_MAILBOX: + wprintf( + "
  • " + "" + "" + "%s" + "
  • \n", _("Write mail") ); break; default: wprintf( - "\n", _("Enter a message") + "\n", _("Enter a message") ); break; } } if (navbar_style == navbar_default) wprintf( - "\n", + "\n", _("Leave all messages marked as unread, go to next room with unread messages"), _("Skip this room") ); if (navbar_style == navbar_default) wprintf( - "\n", + "\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" - "
  • " + case VIEW_CALBRIEF: + wprintf("
  • " "" "%s" - "
  • " + "
  • " + "" "" "%s" - "
  • " + "
  • " + "" "" "%s" - "
  • " + "
  • " + "" "" "%s" - "
  • " + "
  • " + "" "" "%s" - "
  • " + "
  • " "" + "title=\"%s\">" "" "%s" - "
  • " + "
  • " "" + "title=\"%s\">" "" "%s" - "
  • \n"); + wprintf("\n"); } } - - - /** * \brief back end routine to take the session to a new room * \param gname room to go to @@ -643,6 +776,7 @@ int gotoroom(char *gname) 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; @@ -699,8 +833,9 @@ char *pop_march(int desired_floor) -/** - *\brief Goto next room having unread messages. +/* + * 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. @@ -709,11 +844,14 @@ char *pop_march(int desired_floor) */ void gotonext(void) { - char buf[SIZ]; - struct march *mptr, *mptr2; + char buf[256]; + struct march *mptr = NULL; + struct march *mptr2 = NULL; + char room_name[128]; char next_room[128]; + int ELoop = 0; - /** + /* * 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. */ @@ -723,26 +861,37 @@ void gotonext(void) serv_getln(buf, sizeof buf); if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { - mptr = (struct march *) malloc(sizeof(struct march)); - mptr->next = NULL; - 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) { - WC->march = mptr; - } else { - mptr2 = WC->march; - while (mptr2->next != NULL) - mptr2 = mptr2->next; - mptr2->next = mptr; + if (IsEmptyStr(buf)) { + if (ELoop > 10000) + return; + if (ELoop % 100 == 0) + sleeeeeeeeeep(1); + ELoop ++; + continue; } + 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->next = mptr; + mptr2 = mptr; + } + buf[0] = '\0'; } - /** + /* * 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; + mptr->march_order = 0; + mptr->march_floor = 0; strcpy(mptr->march_name, "_BASEROOM_"); if (WC->march == NULL) { WC->march = mptr; @@ -752,7 +901,7 @@ 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 */ @@ -769,9 +918,8 @@ void gotonext(void) } -/** - * \brief goto next room - * \param next_room next room to go to +/* + * goto next room */ void smart_goto(char *next_room) { gotoroom(next_room); @@ -780,25 +928,20 @@ void smart_goto(char *next_room) { -/** - * \brief mark all messages in current room as having been read +/* + * 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_getln(buf, sizeof buf); - if (buf[0] != '2') { - wprintf("%s
    \n", &buf[4]); - return; - } } -/** - * \brief un-goto the previous room +/* + * un-goto the previous room */ void ungoto(void) { @@ -823,15 +966,25 @@ void ungoto(void) smart_goto(buf); } +typedef struct __room_states { + char password[SIZ]; + char dirname[SIZ]; + char name[SIZ]; + int flags; + int floor; + int order; + int view; + int flags2; +} room_states; -/** - * \brief Set/clear/read the "self-service list subscribe" flag for a room +/* + * Set/clear/read the "self-service list subscribe" flag for a room * - * \param newval set to 0 to clear, 1 to set, any other value to leave unchanged. - * \return return the new value. + * set newval to 0 to clear, 1 to set, any other value to leave unchanged. + * returns the new value. */ int self_service(int newval) { @@ -841,7 +994,7 @@ int self_service(int newval) { char name[SIZ]; char password[SIZ]; char dirname[SIZ]; - int flags, floor, order, view, flags2; + int flags, floor, order, view, flags2; serv_puts("GETR"); serv_getln(buf, sizeof buf); @@ -884,26 +1037,85 @@ int self_service(int newval) { } +int is_selflist(room_states *RoomFlags) +{ + return ((RoomFlags->flags2 & QR2_SELFLIST) != 0); +} + +int is_publiclist(room_states *RoomFlags) +{ + return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0); +} + +int is_moderatedlist(room_states *RoomFlags) +{ + return ((RoomFlags->flags2 & QR2_MODERATED) != 0); +} + +/* + * 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. + * returns the new value. + */ + +int get_roomflags(room_states *RoomOps) +{ + char buf[SIZ]; + + serv_puts("GETR"); + serv_getln(buf, sizeof buf); + if (buf[0] != '2') return(0); + + extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name); + extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password); + extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname); + RoomOps->flags = extract_int(&buf[4], 3); + RoomOps->floor = extract_int(&buf[4], 4); + RoomOps->order = extract_int(&buf[4], 5); + RoomOps->view = extract_int(&buf[4], 6); + RoomOps->flags2 = extract_int(&buf[4], 7); + return (1); +} + +int set_roomflags(room_states *RoomOps) +{ + char buf[SIZ]; + serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d", + RoomOps->name, + RoomOps->password, + RoomOps->dirname, + RoomOps->flags, + RoomOps->floor, + RoomOps->order, + RoomOps->view, + RoomOps->flags2); + serv_getln(buf, sizeof buf); + return (1); +} -/** - * \brief display the form for editing a room + + +/* + * 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 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; @@ -913,330 +1125,372 @@ void display_editroom(void) int roomvalue = 0; int floorpolicy = 0; int floorvalue = 0; + char pop3_host[128]; + char pop3_user[32]; + int bg = 0; tab = bstr("tab"); - if (strlen(tab) == 0) tab = "admin"; + if (IsEmptyStr(tab)) tab = "admin"; load_floorlist(); - serv_puts("GETR"); - serv_getln(buf, sizeof buf); - - if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); - return; - } - 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, 1, 1, 0, 0, 0); + wprintf("
    "); + /** print the tabbed dialog */ - wprintf("
    " - "
    " - "" - "" - "\n"); + wprintf("
      \n"); + wprintf("
    • "); - } - else { - wprintf("
    \n"); - } - else { - wprintf("\n"); - } - - wprintf("\n"); - - if (!strcmp(tab, "config")) { - wprintf("\n"); + wprintf(" tab_cell_label\">"); + wprintf(_("Administration")); } else { - wprintf("\n"); + wprintf("< tab_cell_edit\">"); + wprintf(_("Administration")); + wprintf(""); } + wprintf("\n"); - wprintf("\n"); + if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) { - if (!strcmp(tab, "expire")) { - wprintf("\n"); - } - else { - wprintf("\n"); - } + wprintf("
  • "); + wprintf(_("Configuration")); + } + else { + wprintf(" tab_cell_edit\">"); + wprintf(_("Configuration")); + wprintf(""); + } + wprintf("
  • \n"); - wprintf("\n"); + wprintf("
  • "); + wprintf(_("Message expire policy")); + } + else { + wprintf(" tab_cell_edit\">"); + wprintf(_("Message expire policy")); + wprintf(""); + } + wprintf("
  • \n"); + + wprintf("
  • "); + wprintf(_("Access controls")); + } + else { + wprintf(" tab_cell_edit\">"); + wprintf(_("Access controls")); + wprintf(""); + } + wprintf("
  • \n"); - if (!strcmp(tab, "access")) { - wprintf("\n"); - } - else { - wprintf("\n"); - } + wprintf("
  • "); + wprintf(_("Sharing")); + } + else { + wprintf(" tab_cell_edit\">"); + wprintf(_("Sharing")); + wprintf(""); + } + wprintf("
  • \n"); - wprintf("\n"); + wprintf("
  • "); + wprintf(_("Mailing list service")); + } + else { + wprintf("< tab_cell_edit\">"); + wprintf(_("Mailing list service")); + wprintf(""); + } + wprintf("
  • \n"); - if (!strcmp(tab, "sharing")) { - wprintf("\n"); - } - else { - wprintf("\n"); - } - - wprintf("\n"); - if (!strcmp(tab, "listserv")) { - wprintf("\n"); + wprintf("< tab_cell_edit\">"); + wprintf(_("Remote retrieval")); + wprintf(""); } - else { - wprintf("\n"); - } - - wprintf("\n"); + wprintf("\n"); - wprintf("
     "); - } - wprintf(_("Administration")); - if (!strcmp(tab, "admin")) { - wprintf(" "); - } - else { - wprintf(""); - } - wprintf(_("Configuration")); - if (!strcmp(tab, "config")) { - wprintf(" "); - } - else { - wprintf(""); - } - wprintf(_("Message expire policy")); - if (!strcmp(tab, "expire")) { - wprintf(" "); - } - else { - wprintf(""); - } - wprintf(_("Access controls")); - if (!strcmp(tab, "access")) { - wprintf(" "); } - else { - wprintf(""); - } - wprintf(_("Sharing")); - if (!strcmp(tab, "sharing")) { - wprintf(" "); + wprintf("
  • "); + wprintf(_("Remote retrieval")); } else { - wprintf("
  • "); - } - wprintf(_("Mailing list service")); - if (!strcmp(tab, "listserv")) { - wprintf(" 
    \n"); - /** end tabbed dialog */ + wprintf("\n"); + /* end tabbed dialog */ - /** begin content of whatever tab is open now */ - wprintf("
    " - "\n" - "
    \n"); + /* begin content of whatever tab is open now */ if (!strcmp(tab, "admin")) { - wprintf(""); + wprintf(""); } if (!strcmp(tab, "config")) { - wprintf("
    \n"); - - wprintf("
    • "); - wprintf(_("Name of room: ")); - wprintf("\n", - er_name, - (sizeof(er_name)-1) - ); - - wprintf("
    • "); - wprintf(_("Resides on floor: ")); - wprintf("\n"); - - wprintf("
    • "); - wprintf(_("Type of room:")); - wprintf("
        \n"); - - wprintf("
      • "); - wprintf(_("Public room")); - wprintf("\n"); - - wprintf("
      • "); - wprintf(_("Private - guess name")); - - wprintf("\n
      • "); - wprintf(_("Private - require password:")); - wprintf("\n\n", - er_password); - - wprintf("
      • "); - wprintf(_("Private - invitation only")); - - wprintf("\n
      • "); - wprintf(_("If private, cause current users to forget room")); - - wprintf("\n
      \n"); - - wprintf("
    • "); - wprintf(_("Preferred users only")); - - wprintf("\n
    • "); - wprintf(_("Read-only room")); - - /** directory stuff */ - wprintf("\n
    • "); - wprintf(_("File directory room")); + wprintf("
      "); + serv_puts("GETR"); + serv_getln(buf, sizeof buf); - wprintf("\n
      • "); - wprintf(_("Directory name: ")); - wprintf("\n", - er_dirname); + if (!strncmp(buf, "550", 3)) { + wprintf("

        %s


        \n", + _("Higher access is required to access this function.") + ); + } + else if (buf[0] != '2') { + wprintf("

        %s


        \n", &buf[4]); + } + else { + 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); + + wprintf("\n"); + wprintf("\n", WC->nonce); + + wprintf("
        • "); + wprintf(_("Name of room: ")); + wprintf("\n", + er_name, + (sizeof(er_name)-1) + ); + + wprintf("
        • "); + wprintf(_("Resides on floor: ")); + wprintf("\n"); - wprintf("
        • "); - wprintf(_("Uploading allowed")); + wprintf("
        • "); + wprintf(_("Type of room:")); + wprintf("
            \n"); - wprintf("\n
          • "); - wprintf(_("Downloading allowed")); + wprintf("
          • "); + wprintf(_("Public (automatically appears to everyone)")); + wprintf("\n"); - wprintf("\n
          • "); - wprintf(_("Visible directory")); - wprintf("
          \n"); + wprintf("
        • "); + wprintf(_("Private - hidden (accessible to anyone who knows its name)")); + + wprintf("\n
        • "); + wprintf(_("Private - require password: ")); + wprintf("\n\n", + er_password); + + wprintf("
        • "); + wprintf(_("Private - invitation only")); + + wprintf("\n
        • "); + wprintf(_("Personal (mailbox for you only)")); + + wprintf("\n
        • "); + wprintf(_("If private, cause current users to forget room")); + + wprintf("\n
        \n"); + + wprintf("
      • "); + wprintf(_("Preferred users only")); + + wprintf("\n
      • "); + wprintf(_("Read-only room")); + + wprintf("\n
      • "); + wprintf(_("All users allowed to post may also delete messages")); + + /** directory stuff */ + wprintf("\n
      • "); + wprintf(_("File directory room")); - /** end of directory stuff */ + wprintf("\n
        • "); + wprintf(_("Directory name: ")); + wprintf("\n", + er_dirname); - wprintf("
        • "); - wprintf(_("Network shared room")); - - wprintf("\n
        • "); - wprintf(_("Permanent (does not auto-purge)")); - - /** start of anon options */ - - wprintf("\n
        • "); - wprintf(_("Anonymous messages")); - wprintf("
            \n"); + wprintf("> "); + wprintf(_("Uploading allowed")); + + wprintf("\n
          • "); + wprintf(_("Downloading allowed")); + + wprintf("\n
          • "); + wprintf(_("Visible directory")); + wprintf("
          \n"); + + /** end of directory stuff */ - wprintf("
        • "); - wprintf(_("No anonymous messages")); + wprintf("
        • "); + wprintf(_("Network shared room")); - wprintf("\n
        • "); - wprintf(_("All messages are anonymous")); + wprintf("\n
        • "); + wprintf(_("Permanent (does not auto-purge)")); - wprintf("\n
        • "); - wprintf(_("Prompt user when entering messages")); - wprintf("
        \n"); + wprintf("\n
      • "); + wprintf(_("Subject Required (Force users to specify a message subject)")); - /* end of anon options */ + /** start of anon options */ + + wprintf("\n
      • "); + wprintf(_("Anonymous messages")); + wprintf("
          \n"); + + wprintf("
        • "); + wprintf(_("No anonymous messages")); - wprintf("
        • "); - wprintf(_("Room aide: ")); - serv_puts("GETA"); - serv_getln(buf, sizeof buf); - if (buf[0] != '2') { - wprintf("%s\n", &buf[4]); - } else { - extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide); - wprintf("\n", er_roomaide); + wprintf("\n
        • "); + wprintf(_("All messages are anonymous")); + + wprintf("\n
        • "); + wprintf(_("Prompt user when entering messages")); + wprintf("
        \n"); + + /* end of anon options */ + + wprintf("
      • "); + wprintf(_("Room aide: ")); + serv_puts("GETA"); + serv_getln(buf, sizeof buf); + if (buf[0] != '2') { + wprintf("%s\n", &buf[4]); + } else { + extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide); + wprintf("\n", er_roomaide); + } + + wprintf("
      \n"); + wprintf("\n" + "" + " " + "" + "
      \n", + _("Save changes"), + _("Cancel") + ); } - - wprintf("
    \n"); - wprintf("\n" - "" - " " - "" - "
    \n", - _("Save changes"), - _("Cancel") - ); + wprintf(""); } - /** Sharing the room with other Citadel nodes... */ + /* Sharing the room with other Citadel nodes... */ if (!strcmp(tab, "sharing")) { + wprintf("
    "); shared_with = strdup(""); not_shared_with = strdup(""); @@ -1262,7 +1516,7 @@ void display_editroom(void) shared_with = realloc(shared_with, strlen(shared_with) + 32); strcat(shared_with, node); - if (strlen(remote_room) > 0) { + if (!IsEmptyStr(remote_room)) { strcat(shared_with, "|"); strcat(shared_with, remote_room); } @@ -1281,121 +1535,122 @@ void display_editroom(void) } } - /** Display the stuff */ + /* Display the stuff */ wprintf("

    " - "" - "" + "
    "); + "" + "" - "" + "\n" - "\n" + "
    "); wprintf(_("Shared with")); - wprintf(""); + wprintf(""); wprintf(_("Not shared with")); - wprintf("
    \n"); + wprintf("
    \n"); - wprintf("" - "
    "); + wprintf("\n"); + wprintf("\n"); for (i=0; i 0) { - wprintf("" - "\n", node); + if (!IsEmptyStr(node)) { + wprintf(""); + wprintf("\n", WC->nonce); + wprintf("\n", node); - wprintf(""); + wprintf(""); - wprintf("\n"); + wprintf("\n"); } } - wprintf("
    "); wprintf(_("Remote node name")); - wprintf(""); + wprintf(""); wprintf(_("Remote room name")); - wprintf(""); + wprintf(""); wprintf(_("Actions")); - wprintf("
    %s
    %s"); - if (strlen(remote_room) > 0) { + wprintf(""); + if (!IsEmptyStr(remote_room)) { escputs(remote_room); } - wprintf(""); + wprintf(""); - wprintf(" 0) { + if (!IsEmptyStr(remote_room)) { wprintf("|"); urlescputs(remote_room); } wprintf("\">"); - wprintf("\n"); - wprintf("\n"); - wprintf("\n"); + wprintf("\n"); + wprintf("", _("Unshare")); - wprintf("
    \n"); - wprintf("
    \n"); - wprintf("
    "); + wprintf("
    \n"); + wprintf("
    \n"); + wprintf("\n"); + wprintf("\n"); for (i=0; i 0) { - wprintf("
    " - "
    \n"); + wprintf("\n"); } } - wprintf("
    "); wprintf(_("Remote node name")); - wprintf(""); + wprintf(""); wprintf(_("Remote room name")); - wprintf(""); + wprintf(""); wprintf(_("Actions")); - wprintf("
    "); + if (!IsEmptyStr(node)) { + wprintf(""); + wprintf("\n", WC->nonce); + wprintf("
    "); escputs(node); - wprintf("" - "" + "" - ""); - wprintf(""); + wprintf(""); - wprintf("\n"); - wprintf("\n"); - wprintf("", _("Share")); - wprintf("
    \n"); - wprintf("

    \n" - "%s
    • ", _("Notes:")); + wprintf("
    \n"); + wprintf("

    \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. " - "
    • If the remote room name is blank, it is assumed " + "
    • 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 " + "
    • If the remote room name is different, the remote " "node must also configure the name of the room here." - "

    \n" + "
    \n" )); + wprintf("
    "); } - /** Mailing list management */ + /* Mailing list management */ if (!strcmp(tab, "listserv")) { + room_states RoomFlags; + wprintf("
    "); wprintf("
    " - "" - "
    "); + "" + "
    "); wprintf(_("The contents of this room are being " "mailed as individual messages " @@ -1410,22 +1665,22 @@ void display_editroom(void) extract_token(recp, buf, 1, '|', sizeof recp); escputs(recp); - wprintf(" "); + wprintf("\">"); wprintf(_("(remove)")); wprintf("
    "); } } - wprintf("
    \n" - "\n" - "\n"); - wprintf("\n"); - wprintf("", _("Add")); - wprintf("
    \n"); - - wprintf("
    \n"); + wprintf("
    \n" + "\n" + "\n"); + wprintf("\n", WC->nonce); + wprintf("\n"); + wprintf("", _("Add")); + wprintf("
    \n"); + + wprintf("
    \n"); wprintf(_("The contents of this room are being " "mailed in digest form " @@ -1440,161 +1695,354 @@ void display_editroom(void) extract_token(recp, buf, 1, '|', sizeof recp); escputs(recp); - wprintf(" "); + wprintf("\">"); wprintf(_("(remove)")); wprintf("
    "); } } - wprintf("
    \n" - "\n" - "\n"); - wprintf("\n"); - wprintf("", _("Add")); - wprintf("
    \n"); + wprintf("
    \n" + "\n" + "\n"); + wprintf("\n", WC->nonce); + wprintf("\n"); + wprintf("", _("Add")); + wprintf("
    \n"); - wprintf("

    \n"); - - if (self_service(999) == 1) { - 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.")); - wprintf(" "); - wprintf(_("Click to enable.")); - 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("
    \n
    \n"); + + get_roomflags (&RoomFlags); + + /* Self Service subscription? */ + wprintf("\n" + " \n", + (is_https ? "https" : "http"), + WC->http_host); + /* Public posting? */ + wprintf("\n", + (is_publiclist(&RoomFlags))?"checked":""); + + /* Moderated List? */ + wprintf("\n", + (is_moderatedlist(&RoomFlags))?"checked":""); + + wprintf("", _("Save changes")); + wprintf("
    \n"); + wprintf(_("Allow self-service subscribe/unsubscribe requests.")); + wprintf("
    \n", + (is_selflist(&RoomFlags))?"checked":""); + wprintf(_("The URL for subscribe/unsubscribe is: ")); + wprintf("%s://%s/listsub
    "); + wprintf(_("Allow non-subscribers to mail to this room.")); + wprintf("
    "); + wprintf(_("Room post publication needs Aide permission.")); + wprintf("
    " + "
    "); + wprintf("
    \n"); + wprintf("
    "); } - /** Mailing list management */ + /* Configuration of The Dreaded Auto-Purger */ if (!strcmp(tab, "expire")) { + wprintf("
    "); serv_puts("GPEX room"); serv_getln(buf, sizeof buf); - if (buf[0] == '2') { - roompolicy = extract_int(&buf[4], 0); - roomvalue = extract_int(&buf[4], 1); + if (!strncmp(buf, "550", 3)) { + wprintf("

    %s


    \n", + _("Higher access is required to access this function.") + ); } - - serv_puts("GPEX floor"); - serv_getln(buf, sizeof buf); - if (buf[0] == '2') { - floorpolicy = extract_int(&buf[4], 0); - floorvalue = extract_int(&buf[4], 1); + else if (buf[0] != '2') { + wprintf("

    %s


    \n", &buf[4]); } + else { + roompolicy = extract_int(&buf[4], 0); + roomvalue = extract_int(&buf[4], 1); - wprintf("
    \n"); - wprintf("\n"); - wprintf("\n"); - - if (WC->axlevel >= 6) { - wprintf("\n"); - wprintf("\n"); - - 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")); - wprintf("
    \n"); - wprintf("", - ((roompolicy == 1) ? "CHECKED" : "") ); - wprintf(_("Never automatically expire messages")); - wprintf("
    \n"); - wprintf("", - ((roompolicy == 2) ? "CHECKED" : "") ); - wprintf(_("Expire by message count")); - wprintf("
    \n"); - wprintf("", - ((roompolicy == 3) ? "CHECKED" : "") ); - wprintf(_("Expire by message age")); - wprintf("
    "); - wprintf(_("Number of messages or days: ")); - wprintf("", roomvalue); - wprintf("

    "); - wprintf(_("Message expire policy for this floor")); + serv_puts("GPEX floor"); + 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", WC->nonce); + wprintf("\n"); + wprintf("\n"); + + if (WC->axlevel >= 6) { + wprintf("\n"); + wprintf("\n"); + + wprintf("
    "); + wprintf(_("Message expire policy for this room")); wprintf("
    ("); - escputs(floorlist[WC->wc_floor]); - wprintf(")
    "); - wprintf("", - ((floorpolicy == 0) ? "CHECKED" : "") ); - wprintf(_("Use the system default")); + escputs(WC->wc_roomname); + wprintf(")"); + wprintf("", + ((roompolicy == 0) ? "CHECKED" : "") ); + wprintf(_("Use the default policy for this floor")); wprintf("
    \n"); - wprintf("", - ((floorpolicy == 1) ? "CHECKED" : "") ); + wprintf("", + ((roompolicy == 1) ? "CHECKED" : "") ); wprintf(_("Never automatically expire messages")); wprintf("
    \n"); - wprintf("", - ((floorpolicy == 2) ? "CHECKED" : "") ); + wprintf("", + ((roompolicy == 2) ? "CHECKED" : "") ); wprintf(_("Expire by message count")); wprintf("
    \n"); - wprintf("", - ((floorpolicy == 3) ? "CHECKED" : "") ); + wprintf("", + ((roompolicy == 3) ? "CHECKED" : "") ); wprintf(_("Expire by message age")); wprintf("
    "); wprintf(_("Number of messages or days: ")); - wprintf("", - floorvalue); + wprintf("", roomvalue); + wprintf("

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

    \n"); + wprintf("", _("Save changes")); + wprintf(" "); + wprintf("", _("Cancel")); + wprintf("
    \n" + "\n" + "\n" + ); } - wprintf("
    \n"); - wprintf("

    \n"); - wprintf("", _("Save changes")); - wprintf(" "); - wprintf("", _("Cancel")); - wprintf("
    \n" - "\n" - "\n" - ); - + wprintf("
    "); } - /** Mailing list management */ + /* Access controls */ if (!strcmp(tab, "access")) { + wprintf("
    "); display_whok(); + wprintf("
    "); } - /** end content of whatever tab is open now */ - wprintf("
    \n"); + /* Fetch messages from remote locations */ + if (!strcmp(tab, "feeds")) { + wprintf("
    "); + + wprintf(""); + wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:")); + wprintf("
    \n"); + wprintf("" + ""); + + serv_puts("GNET"); + serv_getln(buf, sizeof buf); + bg = 1; + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(cmd, buf, 0, '|', sizeof cmd); + if (!strcasecmp(cmd, "pop3client")) { + safestrncpy(recp, &buf[11], sizeof recp); + + bg = 1 - bg; + wprintf("", + (bg ? "even" : "odd") + ); + + wprintf(""); + + wprintf(""); + + wprintf(""); /* Don't show the password */ + + wprintf("", extract_int(buf, 4) ? _("Yes") : _("No")); + + wprintf(""); + + wprintf(""); + } + } + + wprintf("\n" + "" + "" + "\n"); + wprintf("\n", WC->nonce); + wprintf(""); + wprintf(""); + wprintf(""); + wprintf(""); + wprintf(""); + wprintf("
    "); + wprintf(_("Remote host")); + wprintf(""); + wprintf(_("User name")); + wprintf(""); + wprintf(_("Password")); + wprintf(""); + wprintf(_("Keep messages on server?")); + wprintf("
    "); + extract_token(pop3_host, buf, 1, '|', sizeof pop3_host); + escputs(pop3_host); + wprintf(""); + extract_token(pop3_user, buf, 2, '|', sizeof pop3_user); + escputs(pop3_user); + wprintf("*****%s"); + wprintf(" "); + wprintf(_("(remove)")); + wprintf("
    "); + wprintf("\n"); + wprintf(""); + wprintf("\n"); + wprintf(""); + wprintf("\n"); + wprintf(""); + wprintf(""); + wprintf(""); + wprintf("", _("Add")); + wprintf("
    \n"); + + wprintf("
    \n"); + + wprintf(""); + wprintf(_("Fetch the following RSS feeds and store them in this room:")); + wprintf("
    \n"); + + wprintf("" + ""); + + serv_puts("GNET"); + serv_getln(buf, sizeof buf); + bg = 1; + if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(cmd, buf, 0, '|', sizeof cmd); + if (!strcasecmp(cmd, "rssclient")) { + safestrncpy(recp, &buf[10], sizeof recp); + + bg = 1 - bg; + wprintf("", + (bg ? "even" : "odd") + ); + + wprintf(""); + + wprintf(""); + + wprintf(""); + } + } + + wprintf("\n" + "" + "" + "\n"); + wprintf("\n", WC->nonce); + wprintf(""); + wprintf(""); + wprintf("
    "); + wprintf("\" "); + wprintf(_("Feed URL")); + wprintf(""); + wprintf("
    "); + extract_token(pop3_host, buf, 1, '|', sizeof pop3_host); + escputs(pop3_host); + wprintf(""); + wprintf(" "); + wprintf(_("(remove)")); + wprintf("
    "); + wprintf("\n"); + wprintf(""); + wprintf("", _("Add")); + wprintf("
    \n"); + + wprintf("
    "); + } + + + /* end content of whatever tab is open now */ + wprintf("
    \n"); + + address_book_popup(); wDumpContent(1); } -/** - * \brief Toggle self-service list subscription +/* + * Toggle self-service list subscription */ void toggle_self_service(void) { - int newval = 0; + room_states RoomFlags; - newval = atoi(bstr("newval")); - self_service(newval); + get_roomflags (&RoomFlags); + + /* Yank out the bits we want to change */ + RoomFlags.flags2 = RoomFlags.flags2 & + !(QR2_SELFLIST|QR2_SMTP_PUBLIC|QR2_MODERATED); + + if (!strcasecmp(bstr("QR2_SelfList"), "yes")) + RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST; + if (!strcasecmp(bstr("QR2_SMTP_PUBLIC"), "yes")) + RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC; + if (!strcasecmp(bstr("QR2_Moderated"), "yes")) + RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED; + + set_roomflags (&RoomFlags); + display_editroom(); } -/** - * \brief save new parameters for a room +/* + * save new parameters for a room */ void editroom(void) { @@ -1605,10 +2053,13 @@ void editroom(void) char er_roomaide[26]; int er_floor; unsigned er_flags; + int er_listingorder; + int er_defaultview; + unsigned er_flags2; int bump; - if (strlen(bstr("ok_button")) == 0) { + if (IsEmptyStr(bstr("ok_button"))) { strcpy(WC->ImportantMessage, _("Cancelled. Changes were not saved.")); display_editroom(); @@ -1626,9 +2077,12 @@ void editroom(void) 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) { + if (IsEmptyStr(er_roomaide)) { serv_puts("GETA"); serv_getln(buf, sizeof buf); if (buf[0] != '2') { @@ -1639,18 +2093,18 @@ void editroom(void) } strcpy(buf, bstr("er_name")); buf[128] = 0; - if (strlen(buf) > 0) { + if (!IsEmptyStr(buf)) { strcpy(er_name, buf); } strcpy(buf, bstr("er_password")); buf[10] = 0; - if (strlen(buf) > 0) + if (!IsEmptyStr(buf)) strcpy(er_password, buf); strcpy(buf, bstr("er_dirname")); buf[15] = 0; - if (strlen(buf) > 0) + if (!IsEmptyStr(buf)) strcpy(er_dirname, buf); strcpy(buf, bstr("type")); @@ -1665,6 +2119,12 @@ void editroom(void) if (!strcmp(buf, "passworded")) { er_flags |= (QR_PRIVATE | QR_PASSWORDED); } + if (!strcmp(buf, "personal")) { + er_flags |= QR_MAILBOX; + } else { + er_flags &= ~QR_MAILBOX; + } + if (!strcmp(bstr("prefonly"), "yes")) { er_flags |= QR_PREFONLY; } else { @@ -1677,12 +2137,25 @@ 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 { @@ -1727,8 +2200,9 @@ 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_getln(buf, sizeof buf); if (buf[0] != '2') { @@ -1738,7 +2212,7 @@ void editroom(void) } gotoroom(er_name); - if (strlen(er_roomaide) > 0) { + if (!IsEmptyStr(er_roomaide)) { sprintf(buf, "SETA %s", er_roomaide); serv_puts(buf); serv_getln(buf, sizeof buf); @@ -1755,8 +2229,8 @@ void editroom(void) } -/** - * \brief Display form for Invite, Kick, and show Who Knows a room +/* + * Display form for Invite, Kick, and show Who Knows a room */ void do_invt_kick(void) { char buf[SIZ], room[SIZ], username[SIZ]; @@ -1772,7 +2246,7 @@ void do_invt_kick(void) { strcpy(username, bstr("username")); - if (strlen(bstr("kick_button")) > 0) { + if (!IsEmptyStr(bstr("kick_button"))) { sprintf(buf, "KICK %s", username); serv_puts(buf); serv_getln(buf, sizeof buf); @@ -1786,7 +2260,7 @@ void do_invt_kick(void) { } } - if (strlen(bstr("invite_button")) > 0) { + if (!IsEmptyStr(bstr("invite_button"))) { sprintf(buf, "INVT %s", username); serv_puts(buf); serv_getln(buf, sizeof buf); @@ -1805,8 +2279,8 @@ void do_invt_kick(void) { -/** - * \brief Display form for Invite, Kick, and show Who Knows a room +/* + * Display form for Invite, Kick, and show Who Knows a room */ void display_whok(void) { @@ -1822,15 +2296,16 @@ void display_whok(void) extract_token(room, &buf[4], 0, '|', sizeof room); - wprintf("
    "); + 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'.")); wprintf("

    "); - wprintf("
    \n"); - wprintf("\n"); - wprintf("\n", WC->nonce); + wprintf("\n"); + wprintf("
    \n"); + wprintf("
    \n"); wprintf("", _("Kick")); - wprintf("
    \n"); + wprintf("\n"); - wprintf("
    "); + 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("\n"); + wprintf("\n", WC->nonce); wprintf(_("Invite:")); wprintf(" "); - wprintf("
    \n" + wprintf("
    \n" "" "" - "
    \n", _("Invite")); + "
    \n", _("Invite")); + /* Pop open an address book -- begin **/ + wprintf( + "" + "" + " %s", + _("User"), + _("Users"), _("Users") + ); + /* Pop open an address book -- end **/ - wprintf("
    \n"); + wprintf("
    \n"); + address_book_popup(); wDumpContent(1); } -/** - * \brief display the form for entering a new room +/* + * display the form for entering a new room */ void display_entroom(void) { @@ -1883,47 +2370,47 @@ void display_entroom(void) return; } - output_headers(1, 1, 2, 0, 0, 0); - wprintf("
    \n" - "
    " - ""); - wprintf(_("Create a new room")); - wprintf("" - "
    \n" - "
    \n
    \n" - ); + output_headers(1, 1, 1, 0, 0, 0); - wprintf("
    " - "
    \n"); + svprintf("BOXTITLE", WCS_STRING, _("Create a new room")); + do_template("beginbox"); wprintf("
    \n"); + wprintf("\n", WC->nonce); + + wprintf(" "); - wprintf("
    • "); + wprintf("
    "); - wprintf("
  • "); + wprintf("
  • "); - /** + /* * 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("
  • "); - wprintf("
  • "); + wprintf("
  • "); wprintf(_("Name of room: ")); - wprintf("\n"); + wprintf(""); + wprintf("\n"); + wprintf("
    "); wprintf(_("Resides on floor: ")); + wprintf(""); load_floorlist(); - wprintf("\n"); for (i = 0; i < 128; ++i) - if (strlen(floorlist[i]) > 0) { - wprintf("\n"); + wprintf("\n"); } - wprintf("\n"); + wprintf("\n"); + wprintf("
    "); + wprintf(_("Default view for room: ")); + wprintf(""); + wprintf("\n"); + wprintf("\n"); + wprintf("
    "); wprintf(_("Type of room:")); - wprintf("
      \n"); + wprintf("
    "); + wprintf("
      \n"); - wprintf("
    • "); wprintf(_("Public (automatically appears to everyone)")); + wprintf("
    • "); - wprintf("\n
    • "); wprintf(_("Private - hidden (accessible to anyone who knows its name)")); + wprintf("
    • "); - wprintf("\n
    • "); wprintf(_("Private - require password: ")); - wprintf("\n"); + wprintf("\n"); + wprintf("
    • "); - wprintf("
    • "); wprintf(_("Private - invitation only")); + wprintf("
    • "); - wprintf("\n
    • "); wprintf(_("Personal (mailbox for you only)")); + wprintf("
    • "); - wprintf("\n
    \n"); + wprintf("\n\n"); + wprintf("
    \n"); - wprintf("
    \n"); - wprintf("", _("Create new room")); + wprintf("
    \n"); + wprintf("", _("Create new room")); wprintf(" "); - wprintf("", _("Cancel")); - wprintf("
    \n"); - wprintf("
    \n
    "); + wprintf("", _("Cancel")); + wprintf("\n"); + wprintf("\n
    "); serv_printf("MESG roomaccess"); serv_getln(buf, sizeof buf); if (buf[0] == '1') { - fmout("CENTER"); + fmout("LEFT"); } - wprintf("
    \n"); + + do_template("endbox"); + wDumpContent(1); } -/** - * \brief support function for entroom() -- sets the default view +/* + * support function for entroom() -- sets the default view */ void er_set_default_view(int newview) { @@ -2040,8 +2539,8 @@ void er_set_default_view(int newview) { -/** - * \brief enter a new room +/* + * Create a new room */ void entroom(void) { @@ -2053,7 +2552,7 @@ void entroom(void) int er_num_type; int er_view; - if (strlen(bstr("ok_button")) == 0) { + if (IsEmptyStr(bstr("ok_button"))) { strcpy(WC->ImportantMessage, _("Cancelled. No new room was created.")); display_main_menu(); @@ -2084,6 +2583,10 @@ void entroom(void) display_main_menu(); return; } + /** TODO: Room created, now udate the left hand icon bar for this user */ + burn_folder_cache(0); /* burn the old folder cache */ + + gotoroom(er_name); do_change_view(er_view); /* Now go there */ } @@ -2094,54 +2597,48 @@ 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(1, 1, 1, 0, 0, 0); - wprintf("
    " - "
    \n"); + svprintf("BOXTITLE", WCS_STRING, _("Go to a hidden room")); + do_template("beginbox"); - wprintf("
    \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("

    "); - wprintf("
    \n"); + wprintf("\n"); + wprintf("\n", WC->nonce); - wprintf("\n" - "
    "); + wprintf(" " + "
    "); wprintf(_("Enter room name:")); - wprintf("" - "\n", rname); + wprintf("" + "\n", rname); if (req_pass) { - wprintf("
    "); + wprintf("
    "); wprintf(_("Enter room password:")); - wprintf(""); - wprintf("\n"); + wprintf(""); + wprintf("\n"); } - wprintf("

    \n"); + wprintf("
    \n"); - wprintf("" + wprintf("
    \n"); + wprintf("" " " - "", + "", _("Go there"), _("Cancel") ); - wprintf("\n"); - wprintf("
    \n"); + wprintf("
    \n"); + + do_template("endbox"); + wDumpContent(1); } @@ -2153,7 +2650,7 @@ void goto_private(void) char hold_rm[SIZ]; char buf[SIZ]; - if (strlen(bstr("ok_button")) == 0) { + if (IsEmptyStr(bstr("ok_button"))) { display_main_menu(); return; } @@ -2188,22 +2685,23 @@ void display_zap(void) output_headers(1, 1, 2, 0, 0, 0); wprintf("
    \n"); - wprintf("
    "); - wprintf(""); + wprintf("

    "); wprintf(_("Zap (forget/unsubscribe) the current room")); - wprintf("\n"); - wprintf("

    \n"); - wprintf("
    \n
    \n"); + wprintf("\n"); + wprintf("
    \n"); + + wprintf("
    \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("", _("Zap this room")); + wprintf("\n"); + wprintf("\n", WC->nonce); + wprintf("", _("Zap this room")); wprintf(" "); - wprintf("", _("Cancel")); - wprintf("
    \n"); + wprintf("", _("Cancel")); + wprintf("\n"); wDumpContent(1); } @@ -2222,7 +2720,7 @@ void zap(void) */ strcpy(final_destination, WC->wc_roomname); - if (strlen(bstr("ok_button")) > 0) { + if (!IsEmptyStr(bstr("ok_button"))) { serv_printf("GOTO %s", WC->wc_roomname); serv_getln(buf, sizeof buf); if (buf[0] == '2') { @@ -2245,8 +2743,10 @@ void delete_room(void) { char buf[SIZ]; + serv_puts("KILL 1"); serv_getln(buf, sizeof buf); + burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */ if (buf[0] != '2') { strcpy(WC->ImportantMessage, &buf[4]); display_main_menu(); @@ -2269,15 +2769,29 @@ void netedit(void) { char cmpa1[SIZ]; char cmpb0[SIZ]; char cmpb1[SIZ]; - - if (strlen(bstr("line"))==0) { + int i, num_addrs; + + if (!IsEmptyStr(bstr("line_pop3host"))) { + strcpy(line, bstr("prefix")); + strcat(line, bstr("line_pop3host")); + strcat(line, "|"); + strcat(line, bstr("line_pop3user")); + strcat(line, "|"); + strcat(line, bstr("line_pop3pass")); + strcat(line, "|"); + strcat(line, atoi(bstr("line_pop3keep")) ? "1" : "0" ); + strcat(line, bstr("suffix")); + } + else if (!IsEmptyStr(bstr("line"))) { + strcpy(line, bstr("prefix")); + strcat(line, bstr("line")); + strcat(line, bstr("suffix")); + } + else { display_editroom(); return; } - strcpy(line, bstr("prefix")); - strcat(line, bstr("line")); - strcat(line, bstr("suffix")); fp = tmpfile(); if (fp == NULL) { @@ -2319,8 +2833,23 @@ void netedit(void) { serv_puts(buf); } - if (strlen(bstr("add_button")) > 0) { - serv_puts(line); + if (!IsEmptyStr(bstr("add_button"))) { + 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; i MAX_FLOORS) { + wc_backtrace (); + sprintf(folder, "%%%%%%|%s", room); + } + else { + sprintf(folder, "%s|%s", floorlist[floor], room); + } } /** * Replace "\" characters with "|" for pseudo-folder-delimiting */ - for (i=0; i"); + wprintf(""); } else if (fold[i].hasnewmsgs) { - wprintf(""); + wprintf(""); } else { - wprintf(""); + wprintf(""); } extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); escputs(buf); - wprintf(""); + wprintf(""); wprintf("', "); if (has_subfolders) { @@ -2473,6 +3011,9 @@ void do_folder_view(struct folder *fold, int max_folders, int num_floors) { else if (fold[i].view == VIEW_CALENDAR) { wprintf("'static/calarea_16x.gif'"); } + else if (fold[i].view == VIEW_CALBRIEF) { + wprintf("'static/calarea_16x.gif'"); + } else if (fold[i].view == VIEW_TASKS) { wprintf("'static/taskmanag_16x.gif'"); } @@ -2534,7 +3075,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (boxes_per_column < 1) boxes_per_column = 1; /** Outer table (for columnization) */ - wprintf("" + wprintf("
    " "
    "); levels = 0; @@ -2546,9 +3087,10 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { '|', sizeof floor_name); if ( (strcasecmp(floor_name, old_floor_name)) - && (strlen(old_floor_name) > 0) ) { + && (!IsEmptyStr(old_floor_name)) ) { /* End inner box */ do_template("endbox"); + wprintf("
    "); ++num_boxes; if ((num_boxes % boxes_per_column) == 0) { @@ -2562,7 +3104,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { if (levels == 1) { /** Begin inner box */ - stresc(boxtitle, floor_name, 1, 0); + stresc(boxtitle, 256, floor_name, 1, 0); svprintf("BOXTITLE", WCS_STRING, boxtitle); do_template("beginbox"); } @@ -2581,14 +3123,14 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { wprintf(""); } if (fold[i].hasnewmsgs) { - wprintf(""); + wprintf(""); } else { - wprintf(""); + wprintf(""); } extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); escputs(buf); - wprintf(""); + wprintf(""); if (fold[i].selectable) { wprintf(""); } @@ -2604,7 +3146,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) { /** End the final inner box */ do_template("endbox"); - wprintf("
    \n"); + wprintf("\n"); } /** @@ -2646,7 +3188,7 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { '|', sizeof floor_name); if ( (strcasecmp(floor_name, old_floor_name)) - && (strlen(old_floor_name) > 0) ) { + && (!IsEmptyStr(old_floor_name)) ) { /** End inner box */ wprintf("
    \n"); wprintf("
    \n"); /** floordiv */ @@ -2655,7 +3197,7 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { if (levels == 1) { /** Begin floor */ - stresc(floordivtitle, floor_name, 0, 0); + stresc(floordivtitle, 256, floor_name, 0, 0); sprintf(floordiv_id, "floordiv%d", i); wprintf("" @@ -2680,6 +3222,9 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { 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" ; } @@ -2703,17 +3248,17 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { wprintf(""); } if (fold[i].hasnewmsgs) { - wprintf(""); + wprintf(""); } else { - wprintf(""); + wprintf(""); } extract_token(buf, fold[i].name, levels-1, '|', sizeof buf); escputs(buf); if (!strcasecmp(fold[i].name, "My Folders|Mail")) { wprintf(" (INBOX)"); } - wprintf(""); + wprintf(""); if (fold[i].selectable) { wprintf(""); } @@ -2744,7 +3289,8 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { } wprintf("num_drop_targets = %d;\n", num_drop_targets); - if (strlen(WC->floordiv_expanded) > 1) { + if ((WC->floordiv_expanded[0] != '\0')&& + (WC->floordiv_expanded[1] != '\0')){ wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded); } @@ -2754,6 +3300,25 @@ void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) { +/** + * \brief Burn the cached folder list. + * \param age How old the cahce needs to be before we burn it. + */ + +void burn_folder_cache(time_t age) +{ + /** If our cached folder list is very old, burn it. */ + if (WC->cache_fold != NULL) { + if ((time(NULL) - WC->cache_timestamp) > age) { + free(WC->cache_fold); + WC->cache_fold = NULL; + } + } +} + + + + /** * \brief Show the room list. * (only should get called by @@ -2768,19 +3333,18 @@ void list_all_rooms_by_floor(char *viewpref) { struct folder ftmp; int max_folders = 0; int alloc_folders = 0; + int *floor_mapping; + int IDMax; int i, j; int ra_flags = 0; int flags = 0; int num_floors = 1; /** add an extra one for private folders */ - + char buf2[SIZ]; + char buf3[SIZ]; + /** 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; - } - } - + burn_folder_cache(300); + /** 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); @@ -2809,10 +3373,23 @@ void list_all_rooms_by_floor(char *viewpref) { } memset(&fold[max_folders], 0, sizeof(struct folder)); extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name); + extract_token(buf3, buf, 0, '|', SIZ); + fold[max_folders].floor = atol (buf3); ++max_folders; ++num_floors; } - + IDMax = 0; + for (i=0; icache_max_folders = max_folders; WC->cache_num_floors = num_floors; WC->cache_timestamp = time(NULL); + free(floor_mapping); } @@ -2906,7 +3511,7 @@ void knrooms(void) /** Determine whether the user is trying to change views */ if (bstr("view") != NULL) { - if (strlen(bstr("view")) > 0) { + if (!IsEmptyStr(bstr("view"))) { set_preference("roomlistview", bstr("view"), 1); } } @@ -2919,10 +3524,9 @@ void knrooms(void) } /** title bar */ - wprintf("
    \n" - "\n"); + wprintf("\n"); /** offer the ability to switch views */ - wprintf("
    " - "" - ); + wprintf("
    \n"); + wprintf("
    "); + wprintf("

    "); if (!strcasecmp(listviewpref, "rooms")) { wprintf(_("Room list")); } @@ -2932,32 +3536,35 @@ void knrooms(void) if (!strcasecmp(listviewpref, "table")) { wprintf(_("Room list")); } - wprintf("

    \n" - "\n"); - wprintf("\n", + "\n", ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" ) ); - wprintf("\n", + "\n", ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" ) ); - wprintf("
    "); - offer_start_page(); - wprintf("
    \n"); - wprintf("
    \n" - "
    \n" - "
    \n"); + wprintf(""); + wprintf(""); + wprintf("
    \n"); + + wprintf("
    \n"); /** Display the room list in the user's preferred format */ list_all_rooms_by_floor(listviewpref); @@ -2972,7 +3579,7 @@ void knrooms(void) void set_room_policy(void) { char buf[SIZ]; - if (strlen(bstr("ok_button")) == 0) { + if (IsEmptyStr(bstr("ok_button"))) { strcpy(WC->ImportantMessage, _("Cancelled. Changes were not saved.")); display_editroom(); @@ -2993,5 +3600,4 @@ void set_room_policy(void) { display_editroom(); } - /*@}*/