X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=0f1e8637b8c6007c402ac20a4b76524db63770a8;hb=cc00bcfda5fb94058057eb3d3cc39867fe86cda7;hp=1db499d619e8a20eb19b8bbdd4ccba1f1055e9b2;hpb=2b42b9962d1772e89f45a9ff2f08c0587dcc10fd;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index 1db499d61..0f1e8637b 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -5,17 +5,6 @@ #include "webcit.h" #include "webserver.h" -#define MAX_FLOORS 128 - -char floorlist[MAX_FLOORS][SIZ]; /* list of our floor names */ - -/* See GetFloorListHash and GetRoomListHash for info on these. - * Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys. - */ - -void display_whok(void); -int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP); - char *viewdefs[VIEW_MAX]; /* the different kinds of available views */ @@ -33,6 +22,20 @@ ROOM_VIEWS exchangeable_views[VIEW_MAX][VIEW_MAX] = { /* the different kinds of }; /* the brief calendar view is disabled: VIEW_CALBRIEF */ +ROOM_VIEWS allowed_default_views[VIEW_MAX] = { + 1, /* VIEW_BBS Bulletin board view */ + 1, /* VIEW_MAILBOX Mailbox summary */ + 1, /* VIEW_ADDRESSBOOK Address book view */ + 1, /* VIEW_CALENDAR Calendar view */ + 1, /* VIEW_TASKS Tasks view */ + 1, /* VIEW_NOTES Notes view */ + 1, /* VIEW_WIKI Wiki view */ + 0, /* VIEW_CALBRIEF Brief Calendar view */ + 0, /* VIEW_JOURNAL Journal view */ + 0 /* VIEW_BLOG Blog view (not yet implemented) */ +}; + + /* * Initialize the viewdefs with localized strings */ @@ -49,207 +52,86 @@ void initialize_viewdefs(void) { viewdefs[VIEW_BLOG] = _("Blog"); } -/* - * 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); - case VIEW_WIKI: return(1); - case VIEW_CALBRIEF: return(0); - case VIEW_JOURNAL: return(0); - default: return(0); /* should never get here */ - } -} - - -/* - * load the list of floors - */ -void load_floorlist(StrBuf *Buf) -{ - int a; - int Done = 0; - - for (a = 0; a < MAX_FLOORS; ++a) - floorlist[a][0] = 0; - - serv_puts("LFLR"); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 1) { - strcpy(floorlist[0], "Main Floor"); - return; - } - while (!Done && (StrBuf_ServGetln(Buf)>=0)) { - if ( (StrLength(Buf)==3) && - !strcmp(ChrPtr(Buf), "000")) { - Done = 1; - break; +ConstStr QRFlagList[] = { + {HKEY(strof(QR_PERMANENT))}, + {HKEY(strof(QR_INUSE))}, + {HKEY(strof(QR_PRIVATE))}, + {HKEY(strof(QR_PASSWORDED))}, + {HKEY(strof(QR_GUESSNAME))}, + {HKEY(strof(QR_DIRECTORY))}, + {HKEY(strof(QR_UPLOAD))}, + {HKEY(strof(QR_DOWNLOAD))}, + {HKEY(strof(QR_VISDIR))}, + {HKEY(strof(QR_ANONONLY))}, + {HKEY(strof(QR_ANONOPT))}, + {HKEY(strof(QR_NETWORK))}, + {HKEY(strof(QR_PREFONLY))}, + {HKEY(strof(QR_READONLY))}, + {HKEY(strof(QR_MAILBOX))} +}; +ConstStr QR2FlagList[] = { + {HKEY(strof(QR2_SYSTEM))}, + {HKEY(strof(QR2_SELFLIST))}, + {HKEY(strof(QR2_COLLABDEL))}, + {HKEY(strof(QR2_SUBJECTREQ))}, + {HKEY(strof(QR2_SMTP_PUBLIC))}, + {HKEY(strof(QR2_MODERATED))}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")}, + {HKEY("")} +}; + +void DBG_QR(long QR) +{ + int i = 1; + int j=0; + StrBuf *QRVec; + + QRVec = NewStrBufPlain(NULL, 256); + while (i != 0) + { + if ((QR & i) != 0) { + if (StrLength(QRVec) > 0) + StrBufAppendBufPlain(QRVec, HKEY(" | "), 0); + StrBufAppendBufPlain(QRVec, CKEY(QRFlagList[j]), 0); } - extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]); - } -} - - - - -/* - * display rooms in tree structure - */ -void room_tree_list(struct roomlisting *rp) -{ - char rmname[64]; - int f; - - if (rp == NULL) { - return; + i = i << 1; + j++; } - - room_tree_list(rp->lnext); - - strcpy(rmname, rp->rlname); - f = rp->rlflags; - - wc_printf(""); - escputs1(rmname, 1, 1); - if ((f & QR_DIRECTORY) && (f & QR_NETWORK)) - wc_printf("}"); - else if (f & QR_DIRECTORY) - wc_printf("]"); - else if (f & QR_NETWORK) - wc_printf(")"); - else - wc_printf(">"); - wc_printf(" \n"); - - room_tree_list(rp->rnext); - free(rp); + lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec)); + FreeStrBuf(&QRVec); } -/* - * Room ordering stuff (compare first by floor, then by order) - */ -int rordercmp(struct roomlisting *r1, struct roomlisting *r2) -{ - if ((r1 == NULL) && (r2 == NULL)) - return (0); - if (r1 == NULL) - return (-1); - if (r2 == NULL) - return (1); - if (r1->rlfloor < r2->rlfloor) - return (-1); - if (r1->rlfloor > r2->rlfloor) - return (1); - if (r1->rlorder < r2->rlorder) - return (-1); - if (r1->rlorder > r2->rlorder) - return (1); - return (0); -} - -/* - * Common code for all room listings - */ -void listrms(char *variety) +void DBG_QR2(long QR2) { - char buf[SIZ]; - int num_rooms = 0; + int i = 1; + int j=0; + StrBuf *QR2Vec; - struct roomlisting *rl = NULL; - struct roomlisting *rp; - struct roomlisting *rs; - - /* Ask the server for a room list */ - serv_puts(variety); - serv_getln(buf, sizeof buf); - if (buf[0] != '1') { - wc_printf(" "); - return; - } - - while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { - ++num_rooms; - rp = malloc(sizeof(struct roomlisting)); - 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); - rp->lnext = NULL; - rp->rnext = NULL; - - rs = rl; - if (rl == NULL) { - rl = rp; - } else - while (rp != NULL) { - if (rordercmp(rp, rs) < 0) { - if (rs->lnext == NULL) { - rs->lnext = rp; - rp = NULL; - } else { - rs = rs->lnext; - } - } else { - if (rs->rnext == NULL) { - rs->rnext = rp; - rp = NULL; - } else { - rs = rs->rnext; - } - } - } + QR2Vec = NewStrBufPlain(NULL, 256); + while (i != 0) + { + if ((QR2 & i) != 0) { + if (StrLength(QR2Vec) > 0) + StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0); + StrBufAppendBufPlain(QR2Vec, CKEY(QR2FlagList[j]), 0); + } + i = i << 1; + j++; } - - room_tree_list(rl); - - /* - * If no rooms were listed, print an nbsp to make the cell - * borders show up anyway. - */ - if (num_rooms == 0) wc_printf(" "); + lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec)); + FreeStrBuf(&QR2Vec); } -/* - * list all forgotten rooms - */ -void zapped_list(void) -{ - WCTemplputParams SubTP; - StrBuf *Buf; - - output_headers(1, 1, 1, 0, 0, 0); - memset(&SubTP, 0, sizeof(WCTemplputParams)); - Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1); - SubTP.Filter.ContextType = CTX_STRBUF; - SubTP.Context = Buf; - DoTemplate(HKEY("beginbox"), NULL, &SubTP); - - FreeStrBuf(&Buf); - - listrms("LZRM -1"); - - wc_printf("

\n"); - wc_printf(_("Click on any room to un-zap it and goto that room.\n")); - do_template("endbox", NULL); - wDumpContent(1); -} - - - - /* * Embed the room banner * @@ -264,7 +146,7 @@ void embed_room_banner(void) char buf[256]; /* refresh current room states... */ - gotoroom(NULL); + /* dosen't work??? gotoroom(NULL); */ /* The browser needs some information for its own use */ wc_printf("" - ); - - /* begin content of whatever tab is open now */ - - if (!strcmp(tab, "admin")) { - wc_printf("
"); - wc_printf(""); - wc_printf("
"); - } - - if (!strcmp(tab, "config")) { - wc_printf("
"); - serv_puts("GETR"); - serv_getln(buf, sizeof buf); - - if (!strncmp(buf, "550", 3)) { - wc_printf("

%s


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

%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); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - - wc_printf("
\n"); - wc_printf("\n" - "" - " " - "" - "
\n", - _("Save changes"), - _("Cancel") - ); - } - wc_printf("
"); - } - - - /* Sharing the room with other Citadel nodes... */ - if (!strcmp(tab, "sharing")) { - wc_printf("
"); - - shared_with = strdup(""); - not_shared_with = strdup(""); - - /** Learn the current configuration */ - serv_puts("CONF getsys|application/x-citadel-ignet-config"); - serv_getln(buf, sizeof buf); - if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { - extract_token(node, buf, 0, '|', sizeof node); - not_shared_with = realloc(not_shared_with, - strlen(not_shared_with) + 32); - strcat(not_shared_with, node); - strcat(not_shared_with, "\n"); - } - - serv_puts("GNET"); - serv_getln(buf, sizeof buf); - if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { - extract_token(cmd, buf, 0, '|', sizeof cmd); - extract_token(node, buf, 1, '|', sizeof node); - extract_token(remote_room, buf, 2, '|', sizeof remote_room); - if (!strcasecmp(cmd, "ignet_push_share")) { - shared_with = realloc(shared_with, - strlen(shared_with) + 32); - strcat(shared_with, node); - if (!IsEmptyStr(remote_room)) { - strcat(shared_with, "|"); - strcat(shared_with, remote_room); - } - strcat(shared_with, "\n"); - } - } - - for (i=0; i
" - "" - "" - "\n" - "" - "
"); - wc_printf(_("Shared with")); - wc_printf(""); - wc_printf(_("Not shared with")); - wc_printf("
\n"); - - wc_printf("\n"); - - for (i=0; i"); - wc_printf("\n", WC->nonce); - wc_printf("\n", node); - - wc_printf(""); - - wc_printf("\n"); - } - } - - wc_printf("
"); - wc_printf(_("Remote node name")); - wc_printf(""); - wc_printf(_("Remote room name")); - wc_printf(""); - wc_printf(_("Actions")); - wc_printf("
%s"); - if (!IsEmptyStr(remote_room)) { - escputs(remote_room); - } - wc_printf(""); - - wc_printf(""); - wc_printf("\n"); - wc_printf("\n"); - wc_printf("", _("Unshare")); - wc_printf("
\n"); - wc_printf("
\n"); - wc_printf("\n"); - - for (i=0; i"); - wc_printf("\n", WC->nonce); - wc_printf("\n"); - } - } - - wc_printf("
"); - wc_printf(_("Remote node name")); - wc_printf(""); - wc_printf(_("Remote room name")); - wc_printf(""); - wc_printf(_("Actions")); - wc_printf("
"); - escputs(node); - wc_printf("" - "" - ""); - wc_printf(""); - wc_printf("\n"); - wc_printf("\n"); - wc_printf("", _("Share")); - wc_printf("
\n"); - wc_printf("

\n" - "%s
  • ", _("Notes:")); - wc_printf(_("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 " - "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" - )); - - wc_printf("
"); - } - - if (not_shared_with != NULL) - free (not_shared_with); - - /* Mailing list management */ - if (!strcmp(tab, "listserv")) { - room_states RoomFlags; - wc_printf("
"); - - wc_printf("
" - "" - "
"); - - wc_printf(_("The contents of this room are being " - "mailed as individual messages " - "to the following list recipients:" - "

\n")); - - serv_puts("GNET"); - 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_token(recp, buf, 1, '|', sizeof recp); - - escputs(recp); - wc_printf(" "); - wc_printf(_("(remove)")); - wc_printf("
"); - } - } - wc_printf("
\n" - "\n" - "\n"); - wc_printf("\n", WC->nonce); - wc_printf("\n"); - wc_printf("", _("Add")); - wc_printf("
\n"); - - wc_printf("
\n"); - - wc_printf(_("The contents of this room are being " - "mailed in digest form " - "to the following list recipients:" - "

\n")); - - serv_puts("GNET"); - 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_token(recp, buf, 1, '|', sizeof recp); - - escputs(recp); - wc_printf(" "); - wc_printf(_("(remove)")); - wc_printf("
"); - } - } - wc_printf("
\n" - "\n" - "\n"); - wc_printf("\n", WC->nonce); - wc_printf("\n"); - wc_printf("", _("Add")); - wc_printf("
\n"); - - wc_printf("
\n"); - - /** Pop open an address book -- begin **/ - wc_printf("
" - "" - "" - " %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 **/ - - wc_printf("
\n
\n"); - - get_roomflags (&RoomFlags); - - /* Self Service subscription? */ - wc_printf("\n" - " \n", - (is_https ? "https" : "http"), - ChrPtr(WC->Hdr->HR.http_host)); - /* Public posting? */ - wc_printf("\n", - (is_publiclist(&RoomFlags))?"checked":""); - - /* Moderated List? */ - wc_printf("\n", - (is_moderatedlist(&RoomFlags))?"checked":""); - - - wc_printf("", _("Save changes")); - wc_printf("
\n"); - wc_printf(_("Allow self-service subscribe/unsubscribe requests.")); - wc_printf("
\n", - (is_selflist(&RoomFlags))?"checked":""); - wc_printf(_("The URL for subscribe/unsubscribe is: ")); - wc_printf("%s://%s/listsub
"); - wc_printf(_("Allow non-subscribers to mail to this room.")); - wc_printf("
"); - wc_printf(_("Room post publication needs Aide permission.")); - wc_printf("
" - "
"); - - - wc_printf("
\n"); - wc_printf("
"); - } - - - /* Configuration of The Dreaded Auto-Purger */ - if (!strcmp(tab, "expire")) { - wc_printf("
"); - - serv_puts("GPEX room"); - serv_getln(buf, sizeof buf); - if (!strncmp(buf, "550", 3)) { - wc_printf("

%s


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

%s


\n", &buf[4]); - } - else { - roompolicy = extract_int(&buf[4], 0); - roomvalue = extract_int(&buf[4], 1); - - 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); - } - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - wc_printf("\n"); - wc_printf("\n"); - - if (WC->axlevel >= 6) { - wc_printf("\n"); - wc_printf("\n"); - - wc_printf("
"); - wc_printf(_("Message expire policy for this room")); - wc_printf("
("); - escputs(ChrPtr(WC->CurRoom.name)); - wc_printf(")
"); - wc_printf("", - ((roompolicy == 0) ? "CHECKED" : "") ); - wc_printf(_("Use the default policy for this floor")); - wc_printf("
\n"); - wc_printf("", - ((roompolicy == 1) ? "CHECKED" : "") ); - wc_printf(_("Never automatically expire messages")); - wc_printf("
\n"); - wc_printf("", - ((roompolicy == 2) ? "CHECKED" : "") ); - wc_printf(_("Expire by message count")); - wc_printf("
\n"); - wc_printf("", - ((roompolicy == 3) ? "CHECKED" : "") ); - wc_printf(_("Expire by message age")); - wc_printf("
"); - wc_printf(_("Number of messages or days: ")); - wc_printf("", roomvalue); - wc_printf("

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

\n"); - wc_printf("", _("Save changes")); - wc_printf(" "); - wc_printf("", _("Cancel")); - wc_printf("
\n" - "\n" - "
\n" - ); - } - - wc_printf("
"); - } - - /* Access controls */ - if (!strcmp(tab, "access")) { - wc_printf("
"); - display_whok(); - wc_printf("
"); - } - - /* Fetch messages from remote locations */ - if (!strcmp(tab, "feeds")) { - wc_printf("
"); - - wc_printf(""); - wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:")); - wc_printf("
\n"); - - wc_printf("" - ""); - - 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; - wc_printf("", - (bg ? "even" : "odd") - ); - - wc_printf(""); - - wc_printf(""); - - wc_printf(""); /* Don't show the password */ - - wc_printf("", extract_int(buf, 4) ? _("Yes") : _("No")); - - wc_printf("", extract_long(buf, 5)); /* Fetching interval */ - - wc_printf(""); - - wc_printf(""); - } - } - - wc_printf("\n" - "" - "" - "\n"); - wc_printf("\n", WC->nonce); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf("
"); - wc_printf(_("Remote host")); - wc_printf(""); - wc_printf(_("User name")); - wc_printf(""); - wc_printf(_("Password")); - wc_printf(""); - wc_printf(_("Keep messages on server?")); - wc_printf(""); - wc_printf(_("Interval")); - wc_printf("
"); - extract_token(pop3_host, buf, 1, '|', sizeof pop3_host); - escputs(pop3_host); - wc_printf(""); - extract_token(pop3_user, buf, 2, '|', sizeof pop3_user); - escputs(pop3_user); - wc_printf("*****%s%ld"); - wc_printf(" "); - wc_printf(_("(remove)")); - wc_printf("
"); - wc_printf("\n"); - wc_printf(""); - wc_printf("\n"); - wc_printf(""); - wc_printf("\n"); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf(""); - wc_printf("", _("Add")); - wc_printf("
\n"); - - wc_printf("
\n"); - - wc_printf(""); - wc_printf(_("Fetch the following RSS feeds and store them in this room:")); - wc_printf("
\n"); - - wc_printf("" - ""); - - 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; - wc_printf("", - (bg ? "even" : "odd") - ); + wcsession *WCC = WC; - wc_printf(""); - - wc_printf(""); - - wc_printf(""); - } - } + if (GetCurrentRoomFlags (&WCC->CurRoom) == 0) + { + return 0; + } - wc_printf("\n" - "" - "" - "\n"); - wc_printf("\n", WC->nonce); - wc_printf(""); - wc_printf(""); - wc_printf("
"); - wc_printf("\" "); - wc_printf(_("Feed URL")); - wc_printf(""); - wc_printf("
"); - extract_token(pop3_host, buf, 1, '|', sizeof pop3_host); - escputs(pop3_host); - wc_printf(""); - wc_printf(" "); - wc_printf(_("(remove)")); - wc_printf("
"); - wc_printf("\n"); - wc_printf(""); - wc_printf("", _("Add")); - wc_printf("
\n"); + if ((WCC->CurRoom.QRFlags2 & QR2_SELFLIST) != 0) { + current_value = 1; + } + else { + current_value = 0; + } - wc_printf("
"); + if (newval == 1) { + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST; + } + else if (newval == 0) { + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST; + } + else { + return(current_value); } + if (newval != current_value) { + SetCurrentRoomFlags(&WCC->CurRoom); + } - /* end content of whatever tab is open now */ - wc_printf("\n"); + return(newval); - address_book_popup(); - wDumpContent(1); } + /* * Toggle self-service list subscription */ void toggle_self_service(void) { - room_states RoomFlags; + wcsession *WCC = WC; - get_roomflags (&RoomFlags); + if (GetCurrentRoomFlags (&WCC->CurRoom) == 0) + return; if (yesbstr("QR2_SelfList")) - RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST; else - RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST; if (yesbstr("QR2_SMTP_PUBLIC")) - RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC; else - RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC; if (yesbstr("QR2_Moderated")) - RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_MODERATED; else - RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_MODERATED; if (yesbstr("QR2_SubsOnly")) - RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC; else - RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC; + WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC; - set_roomflags (&RoomFlags); + SetCurrentRoomFlags (&WCC->CurRoom); - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } @@ -2232,85 +1150,33 @@ void toggle_self_service(void) { */ void editroom(void) { + wcsession *WCC = WC; const StrBuf *Ptr; - StrBuf *Buf; - StrBuf *er_name; - StrBuf *er_password; - StrBuf *er_dirname; - StrBuf *er_roomaide; - int er_floor; + const StrBuf *er_name; + const StrBuf *er_password; + const StrBuf *er_dirname; + const StrBuf *er_roomaide; unsigned er_flags; - int er_listingorder; - int er_defaultview; unsigned er_flags2; - int bump; - + int succ1, succ2; if (!havebstr("ok_button")) { strcpy(WC->ImportantMessage, _("Cancelled. Changes were not saved.")); - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } - serv_puts("GETR"); - Buf = NewStrBuf(); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 2) { - StrBufCutLeft(Buf, 4); - strcpy(WC->ImportantMessage, ChrPtr(Buf)); - display_editroom(); - FreeStrBuf(&Buf); + if (GetCurrentRoomFlags (&WCC->CurRoom) == 0) return; - } - - er_name = NewStrBuf(); - er_password = NewStrBuf(); - er_dirname = NewStrBuf(); - er_roomaide = NewStrBuf(); - - StrBufCutLeft(Buf, 4); - StrBufExtract_token(er_name, Buf, 0, '|'); - StrBufExtract_token(er_password, Buf, 1, '|'); - StrBufExtract_token(er_dirname, Buf, 2, '|'); - er_flags = StrBufExtract_int(Buf, 3, '|'); - er_listingorder = StrBufExtract_int(Buf, 5, '|'); - er_defaultview = StrBufExtract_int(Buf, 6, '|'); - er_flags2 = StrBufExtract_int(Buf, 7, '|'); - - er_roomaide = NewStrBufDup(sbstr("er_roomaide")); - if (StrLength(er_roomaide) == 0) { - serv_puts("GETA"); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 2) { - FlushStrBuf(er_roomaide); - } else { - StrBufCutLeft(Buf, 4); - StrBufExtract_token(er_roomaide, Buf, 0, '|'); - } - } - Ptr = sbstr("er_name"); - if (StrLength(Ptr) > 0) { - FlushStrBuf(er_name); - StrBufAppendBuf(er_name, Ptr, 0); - } - Ptr = sbstr("er_password"); - if (StrLength(Ptr) > 0) { - FlushStrBuf(er_password); - StrBufAppendBuf(er_password, Ptr, 0); - } - + LoadRoomAide(); - Ptr = sbstr("er_dirname"); - if (StrLength(Ptr) > 0) { /* todo: cut 15 */ - FlushStrBuf(er_dirname); - StrBufAppendBuf(er_dirname, Ptr, 0); - } + er_flags = WCC->CurRoom.QRFlags; + er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME); + er_flags2 = WCC->CurRoom.QRFlags2; Ptr = sbstr("type"); - er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME); - if (!strcmp(ChrPtr(Ptr), "invonly")) { er_flags |= (QR_PRIVATE); } @@ -2325,6 +1191,8 @@ void editroom(void) } else { er_flags &= ~QR_MAILBOX; } + + if (yesbstr("prefonly")) { er_flags |= QR_PREFONLY; @@ -2387,6 +1255,7 @@ void editroom(void) er_flags &= ~QR_VISDIR; } + Ptr = sbstr("anon"); er_flags &= ~(QR_ANONONLY | QR_ANONOPT); @@ -2395,338 +1264,102 @@ void editroom(void) if (!strcmp(ChrPtr(Ptr), "anon2")) er_flags |= QR_ANONOPT; - bump = yesbstr("bump"); - - er_floor = ibstr("er_floor"); - - StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u", - ChrPtr(er_name), - ChrPtr(er_password), - ChrPtr(er_dirname), - er_flags, - bump, - er_floor, - er_listingorder, - er_defaultview, - er_flags2); - serv_putbuf(Buf); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 2) { - strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]); - display_editroom(); - FreeStrBuf(&Buf); - FreeStrBuf(&er_name); - FreeStrBuf(&er_password); - FreeStrBuf(&er_dirname); - FreeStrBuf(&er_roomaide); - return; - } - gotoroom(er_name); - - if (StrLength(er_roomaide) > 0) { - serv_printf("SETA %s", ChrPtr(er_roomaide)); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 2) { - strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]); - display_main_menu(); - FreeStrBuf(&Buf); - FreeStrBuf(&er_name); - FreeStrBuf(&er_password); - FreeStrBuf(&er_dirname); - FreeStrBuf(&er_roomaide); - return; - } - } - gotoroom(er_name); - strcpy(WC->ImportantMessage, _("Your changes have been saved.")); - display_editroom(); - FreeStrBuf(&Buf); - FreeStrBuf(&er_name); - FreeStrBuf(&er_password); - FreeStrBuf(&er_dirname); - FreeStrBuf(&er_roomaide); - return; -} - - -/* - * 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_getln(buf, sizeof buf); - - if (buf[0] != '2') { - escputs(&buf[4]); - return; - } - extract_token(room, &buf[4], 0, '|', sizeof room); - - strcpy(username, bstr("username")); - - if (havebstr("kick_button")) { - sprintf(buf, "KICK %s", username); - serv_puts(buf); - serv_getln(buf, sizeof buf); + er_name = sbstr("er_name"); + er_dirname = sbstr("er_dirname"); + er_roomaide = sbstr("er_roomaide"); + er_password = sbstr("er_password"); - if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); - } else { - sprintf(WC->ImportantMessage, - _("User %s kicked out of room %s.\n"), - username, room); - } - } + FlushStrBuf(WCC->CurRoom.name); + StrBufAppendBuf(WCC->CurRoom.name, er_name, 0); - if (havebstr("invite_button")) { - sprintf(buf, "INVT %s", username); - serv_puts(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"), - username, room); - } - } + FlushStrBuf(WCC->CurRoom.Directory); + StrBufAppendBuf(WCC->CurRoom.Directory, er_dirname, 0); - display_editroom(); -} + FlushStrBuf(WCC->CurRoom.RoomAide); + StrBufAppendBuf(WCC->CurRoom.RoomAide, er_roomaide, 0); + FlushStrBuf(WCC->CurRoom.XAPass); + StrBufAppendBuf(WCC->CurRoom.XAPass, er_password, 0); + WCC->CurRoom.BumpUsers = yesbstr("bump"); -/* - * Display form for Invite, Kick, and show Who Knows a room - */ -void display_whok(void) -{ - char buf[SIZ], room[SIZ], username[SIZ]; + WCC->CurRoom.floorid = ibstr("er_floor"); - serv_puts("GETR"); - serv_getln(buf, sizeof buf); + succ1 = SetCurrentRoomFlags(&WCC->CurRoom); - if (buf[0] != '2') { - escputs(&buf[4]); - return; - } - extract_token(room, &buf[4], 0, '|', sizeof room); - - - wc_printf("
"); - wc_printf(_("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'.")); - wc_printf("

"); + succ2 = SaveRoomAide (&WCC->CurRoom); - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - wc_printf("\n"); - wc_printf("
\n"); - - wc_printf("", _("Kick")); - wc_printf("
\n"); - - wc_printf("
"); - wc_printf(_("To grant another user access to this room, enter the " - "user name in the box below and click 'Invite'.")); - wc_printf("

"); - - wc_printf("
\n"); - wc_printf("\n"); - wc_printf("\n", WC->nonce); - wc_printf(_("Invite:")); - wc_printf(" "); - wc_printf("
\n" - "" - "" - "
\n", _("Invite")); - /* Pop open an address book -- begin **/ - wc_printf( - "" - "" - " %s", - _("User"), - _("Users"), _("Users") - ); - /* Pop open an address book -- end **/ - - wc_printf("
\n"); - address_book_popup(); - wDumpContent(1); + if (succ1 + succ2 == 0) + AppendImportantMessage (_("Your changes have been saved."), -1); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); + return; } - /* - * display the form for entering a new room + * Display form for Invite, Kick, and show Who Knows a room */ -void display_entroom(void) +void do_invt_kick(void) { - StrBuf *Buf; - int i; - char buf[SIZ]; - - Buf = NewStrBuf(); - serv_puts("CRE8 0"); - serv_getln(buf, sizeof buf); - - if (buf[0] != '2') { - strcpy(WC->ImportantMessage, &buf[4]); - display_main_menu(); - FreeStrBuf(&Buf); - return; - } - - output_headers(1, 1, 1, 0, 0, 0); - - svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room")); - do_template("beginbox", NULL); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); + StrBuf *Buf, *User; + const StrBuf *UserNames; + int Kick, Invite; + wcsession *WCC = WC; - wc_printf(" "); - wc_printf(""); + if (GetCurrentRoomFlags(&WCC->CurRoom) == 1) + { + const char *Pos; + UserNames = sbstr("username"); + Kick = havebstr("kick_button"); + Invite = havebstr("invite_button"); - wc_printf(""); - - /* - * 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. - */ - wc_printf(""); - - wc_printf("
"); - wc_printf(_("Name of room: ")); - wc_printf(""); - wc_printf("\n"); - wc_printf("
"); - wc_printf(_("Resides on floor: ")); - wc_printf(""); - load_floorlist(Buf); - wc_printf("\n"); - wc_printf("
"); - wc_printf(_("Default view for room: ")); - wc_printf(""); - wc_printf("\n"); - wc_printf("
"); - wc_printf(_("Type of room:")); - wc_printf(""); - wc_printf("
    \n"); - - wc_printf("
  • "); - wc_printf(_("Public (automatically appears to everyone)")); - wc_printf("
  • "); - - wc_printf("\n
  • "); - wc_printf(_("Private - hidden (accessible to anyone who knows its name)")); - wc_printf("
  • "); - - wc_printf("\n
  • "); - wc_printf(_("Private - require password: ")); - wc_printf("\n"); - wc_printf("
  • "); - - wc_printf("
  • "); - wc_printf(_("Private - invitation only")); - wc_printf("
  • "); - - wc_printf("\n
  • "); - wc_printf(_("Personal (mailbox for you only)")); - wc_printf("
  • "); - - wc_printf("\n
\n"); - wc_printf("
\n"); - - wc_printf("
\n"); - wc_printf("", _("Create new room")); - wc_printf(" "); - wc_printf("", _("Cancel")); - wc_printf("
\n"); - wc_printf("
\n
"); - serv_printf("MESG roomaccess"); - serv_getln(buf, sizeof buf); - if (buf[0] == '1') { - fmout("LEFT"); - } - - do_template("endbox", NULL); + } - wDumpContent(1); - FreeStrBuf(&Buf); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } - - - /* * support function for entroom() -- sets the default view */ @@ -2814,8 +1447,6 @@ void entroom(void) return; } /** TODO: Room created, now update the left hand icon bar for this user */ - burn_folder_cache(0); /* burn the old folder cache */ - gotoroom(er_name); serv_printf("VIEW %d", er_view); @@ -2823,7 +1454,7 @@ void entroom(void) WCC->CurRoom.view = er_view; if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) { - display_editroom (); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } else { do_change_view(er_view); /* Now go there */ } @@ -2831,124 +1462,47 @@ void entroom(void) } -/** - * \brief display the screen to enter a private room - */ -void display_private(char *rname, int req_pass) -{ - WCTemplputParams SubTP; - StrBuf *Buf; - output_headers(1, 1, 1, 0, 0, 0); - - Buf = NewStrBufPlain(_("Go to a hidden room"), -1); - memset(&SubTP, 0, sizeof(WCTemplputParams)); - SubTP.Filter.ContextType = CTX_STRBUF; - SubTP.Context = Buf; - DoTemplate(HKEY("beginbox"), NULL, &SubTP); - - FreeStrBuf(&Buf); - - wc_printf("

"); - wc_printf(_("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.")); - wc_printf("

"); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - - wc_printf(" " - "
"); - wc_printf(_("Enter room name:")); - wc_printf("" - "\n", rname); - - if (req_pass) { - wc_printf("
"); - wc_printf(_("Enter room password:")); - wc_printf(""); - wc_printf("\n"); - } - wc_printf("
\n"); - - wc_printf("
\n"); - wc_printf("" - " " - "", - _("Go there"), - _("Cancel") - ); - wc_printf("
\n"); - - do_template("endbox", NULL); - - wDumpContent(1); -} - /** * \brief goto a private room */ void goto_private(void) { char hold_rm[SIZ]; - char buf[SIZ]; + StrBuf *Buf; + const StrBuf *gr_name; + long err; if (!havebstr("ok_button")) { display_main_menu(); return; } + gr_name = sbstr("gr_name"); + Buf = NewStrBuf(); strcpy(hold_rm, ChrPtr(WC->CurRoom.name)); serv_printf("GOTO %s|%s", - bstr("gr_name"), + ChrPtr(gr_name), bstr("gr_pass")); - serv_getln(buf, sizeof buf); - - if (buf[0] == '2') { - smart_goto(sbstr("gr_name")); + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, &err) == 2) { + FlushRoomlist(); + smart_goto(gr_name); + FreeStrBuf(&Buf); return; } - if (!strncmp(buf, "540", 3)) { - display_private(bstr("gr_name"), 1); + if (err == 540) { + DoTemplate(HKEY("room_display_private"), NULL, &NoCtx); + FreeStrBuf(&Buf); return; } - output_headers(1, 1, 1, 0, 0, 0); - wc_printf("%s\n", &buf[4]); - wDumpContent(1); + StrBufCutLeft(Buf, 4); + AppendImportantMessage (SKEY(Buf)); + Buf = NewStrBufPlain(HKEY("_BASEROOM_")); + smart_goto(Buf); + FreeStrBuf(&Buf); return; } -/** - * \brief display the screen to zap a room - */ -void display_zap(void) -{ - output_headers(1, 1, 2, 0, 0, 0); - - wc_printf("
\n"); - wc_printf("

"); - wc_printf(_("Zap (forget/unsubscribe) the current room")); - wc_printf("

\n"); - wc_printf("
\n"); - - wc_printf("
\n"); - - wc_printf(_("If you select this option, %s will " - "disappear from your room list. Is this what you wish " - "to do?
\n"), ChrPtr(WC->CurRoom.name)); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - wc_printf("", _("Zap this room")); - wc_printf(" "); - wc_printf("", _("Cancel")); - wc_printf("
\n"); - wDumpContent(1); -} - /** * \brief zap a room @@ -2975,6 +1529,7 @@ void zap(void) StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0); } } + FlushRoomlist (); } smart_goto(final_destination); FreeStrBuf(&final_destination); @@ -2992,7 +1547,7 @@ void delete_room(void) 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(); @@ -3000,6 +1555,7 @@ void delete_room(void) } else { StrBuf *Buf; + FlushRoomlist (); Buf = NewStrBufPlain(HKEY("_BASEROOM_")); smart_goto(Buf); FreeStrBuf(&Buf); @@ -3040,14 +1596,14 @@ void netedit(void) { strcat(line, bstr("suffix")); } else { - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } fp = tmpfile(); if (fp == NULL) { - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } @@ -3055,7 +1611,7 @@ void netedit(void) { serv_getln(buf, sizeof buf); if (buf[0] != '1') { fclose(fp); - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } @@ -3076,7 +1632,7 @@ void netedit(void) { serv_getln(buf, sizeof buf); if (buf[0] != '4') { fclose(fp); - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } @@ -3106,54 +1662,10 @@ void netedit(void) { serv_puts("000"); fclose(fp); - display_editroom(); -} - - - -/** - * \brief Convert a room name to a folder-ish-looking name. - * \param folder the folderish name - * \param room the room name - * \param floor the floor name - * \param is_mailbox is it a mailbox? - */ -void room_to_folder(char *folder, char *room, int floor, int is_mailbox) -{ - int i, len; - - /** - * For mailboxes, just do it straight... - */ - if (is_mailbox) { - sprintf(folder, "My folders|%s", room); - } - - /** - * Otherwise, prefix the floor name as a "public folders" moniker - */ - else { - if (floor > MAX_FLOORS) { - wc_backtrace (); - sprintf(folder, "%%%%%%|%s", room); - } - else { - sprintf(folder, "%s|%s", floorlist[floor], room); - } - } - - /** - * Replace "\" characters with "|" for pseudo-folder-delimiting - */ - len = strlen (folder); - for (i=0; icache_fold != NULL) { - if ((time(NULL) - WC->cache_timestamp) > age) { - free(WC->cache_fold); - WC->cache_fold = NULL; - } - } -} - - - /** * \brief Do either a known rooms list or a folders list, depending on the * user's preference @@ -3241,22 +1735,22 @@ void set_room_policy(void) { if (!havebstr("ok_button")) { strcpy(WC->ImportantMessage, _("Cancelled. Changes were not saved.")); - display_editroom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); return; } - serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue")); + serv_printf("SPEX roompolicy|%d|%d", ibstr("roompolicy"), ibstr("roomvalue")); serv_getln(buf, sizeof buf); strcpy(WC->ImportantMessage, &buf[4]); if (WC->axlevel >= 6) { strcat(WC->ImportantMessage, "
\n"); - serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue")); + serv_printf("SPEX floorpolicy|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue")); serv_getln(buf, sizeof buf); strcat(WC->ImportantMessage, &buf[4]); } - - display_editroom(); + ReloadCurrentRoom(); + http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP) @@ -3264,11 +1758,6 @@ void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP) StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0); } - -void _display_private(void) { - display_private("", 0); -} - void dotgoto(void) { if (!havebstr("room")) { readloop(readnew, eUseDefault); @@ -3359,9 +1848,15 @@ int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP) if (QR_CheckFlag == 0) LogTemplateError(Target, "Conditional", ERR_PARM1, TP, "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!"); + + if (WCC == NULL) + return 0; - return ((WCC!=NULL) && - ((WCC->CurRoom.QRFlags & QR_CheckFlag) != 0)); + if ((TP->Tokens->Params[2]->MaskBy == eOR) || + (TP->Tokens->Params[2]->MaskBy == eNO)) + return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0; + else + return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag; } int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP) @@ -3373,7 +1868,12 @@ int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP) if (QR_CheckFlag == 0) LogTemplateError(Target, "Conditional", ERR_PARM1, TP, "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!"); - return ((Folder->QRFlags & QR_CheckFlag) != 0); + + if ((TP->Tokens->Params[2]->MaskBy == eOR) || + (TP->Tokens->Params[2]->MaskBy == eNO)) + return (Folder->QRFlags & QR_CheckFlag) != 0; + else + return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag; } @@ -3387,8 +1887,15 @@ int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP) LogTemplateError(Target, "Conditional", ERR_PARM1, TP, "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!"); - return ((WCC!=NULL) && - ((WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0)); + + if (WCC == NULL) + return 0; + + if ((TP->Tokens->Params[2]->MaskBy == eOR) || + (TP->Tokens->Params[2]->MaskBy == eNO)) + return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0; + else + return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag; } int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP) @@ -3462,6 +1969,7 @@ HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP) IKEY(n), Token, HFreeStrBuf); + n++; } } else if (State == 550) @@ -3473,6 +1981,36 @@ HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP) return Whok; } + + +void _FlushRoomList(wcsession *WCC) +{ + free_march_list(WCC); + DeleteHash(&WCC->Floors); + DeleteHash(&WCC->Rooms); + DeleteHash(&WCC->FloorsByName); + FlushFolder(&WCC->CurRoom); +} + +void ReloadCurrentRoom(void) +{ + wcsession *WCC = WC; + StrBuf *CurRoom; + + CurRoom = WCC->CurRoom.name; + WCC->CurRoom.name = NULL; + _FlushRoomList(WCC); + gotoroom(CurRoom); + FreeStrBuf(&CurRoom); +} + +void FlushRoomlist(void) +{ + wcsession *WCC = WC; + _FlushRoomList(WCC); +} + + void InitModule_ROOMOPS (void) @@ -3490,16 +2028,12 @@ InitModule_ROOMOPS WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0); WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL); WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL); - WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0); + WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL); - WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0); - WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0); WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0); - WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0); WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0); - WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0); WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0); - WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0); + WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0); WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0); WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0); @@ -3527,6 +2061,8 @@ InitModule_ROOMOPS RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE); RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE); RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE); + RegisterConditional(HKEY("COND:ALLOWED_DEFAULT_VIEW"), 0, ConditionalIsAllowedDefaultView, CTX_NONE); + RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE); RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE); @@ -3632,15 +2168,7 @@ void SessionDestroyModule_ROOMOPS (wcsession *sess) { - FlushFolder(&sess->CurRoom); - if (sess->cache_fold != NULL) { - free(sess->cache_fold); - } - - free_march_list(sess); - DeleteHash(&sess->Floors); - DeleteHash(&sess->Rooms); - DeleteHash(&sess->FloorsByName); + _FlushRoomList (sess); }