X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=a68f896f29291792e4cdaae1a783de9f7fd83c1e;hb=d2e4ed1ae2bf6deb60280974ec1b29544c5de49f;hp=79323c9f8a110fd892d64a3c9d6b6f7c879aa254;hpb=25c1a365ac0838076ba05bccf81eef3e6a19898d;p=citadel.git diff --git a/webcit/roomops.c b/webcit/roomops.c index 79323c9f8..a68f896f2 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 */ @@ -63,35 +52,84 @@ void initialize_viewdefs(void) { viewdefs[VIEW_BLOG] = _("Blog"); } +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("")} +}; - -/* - * load the list of floors - * / -void load_floorlist(StrBuf *Buf) +void DBG_QR(long QR) { - int a; - int Done = 0; - - for (a = 0; a < MAX_FLOORS; ++a) - floorlist[a][0] = 0; + int i = 1; + int j=0; + StrBuf *QRVec; - serv_puts("LFLR"); - StrBuf_ServGetln(Buf); - if (GetServerStatus(Buf, NULL) != 1) { - strcpy(floorlist[0], "Main Floor"); - return; + 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); + } + i = i << 1; + j++; } - while (!Done && (StrBuf_ServGetln(Buf)>=0)) { - if ( (StrLength(Buf)==3) && - !strcmp(ChrPtr(Buf), "000")) { - Done = 1; - break; + lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec)); + FreeStrBuf(&QRVec); +} + + + +void DBG_QR2(long QR2) +{ + int i = 1; + int j=0; + StrBuf *QR2Vec; + + 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); } - extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]); + i = i << 1; + j++; } + lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec)); + FreeStrBuf(&QR2Vec); } -*/ /* @@ -438,84 +476,6 @@ long gotoroom(const StrBuf *gname) return err; } -void DBG_QR(long QR) -{ - const char *QRFlagList[15] = { - strof(QR_PERMANENT), - strof(QR_INUSE), - strof(QR_PRIVATE), - strof(QR_PASSWORDED), - strof(QR_GUESSNAME), - strof(QR_DIRECTORY), - strof(QR_UPLOAD), - strof(QR_DOWNLOAD), - strof(QR_VISDIR), - strof(QR_ANONONLY), - strof(QR_ANONOPT), - strof(QR_NETWORK), - strof(QR_PREFONLY), - strof(QR_READONLY), - strof(QR_MAILBOX) - }; - 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, QRFlagList[j], -1, 0); - } - i = i << 1; - j++; - } - lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec)); - FreeStrBuf(&QRVec); -} - - - -void DBG_QR2(long QR2) -{ - const char *QR2FlagList[15] = { - strof(QR2_SYSTEM), - strof(QR2_SELFLIST), - strof(QR2_COLLABDEL), - strof(QR2_SUBJECTREQ), - strof(QR2_SMTP_PUBLIC), - strof(QR2_MODERATED), - "", - "", - "", - "", - "", - "", - "", - "", - "" - }; - int i = 1; - int j=0; - StrBuf *QR2Vec; - - QR2Vec = NewStrBufPlain(NULL, 256); - while (i != 0) - { - if ((QR2 & i) != 0) { - if (StrLength(QR2Vec) > 0) - StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0); - StrBufAppendBufPlain(QR2Vec, QR2FlagList[j], -1, 0); - } - i = i << 1; - j++; - } - lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec)); - FreeStrBuf(&QR2Vec); -} - void ParseGoto(folder *room, StrBuf *Line) @@ -655,12 +615,33 @@ void LoadRoomAide(void) } FreeStrBuf (&Buf); } + +int SaveRoomAide(folder *Room) +{ + StrBuf *Buf; + Buf = NewStrBuf (); + serv_printf("SETA %s", ChrPtr(Room->RoomAide)); + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) != 2) { + StrBufCutLeft(Buf, 4); + AppendImportantMessage (SKEY(Buf)); + FreeStrBuf(&Buf); + return 0; + } + FreeStrBuf(&Buf); + return 1; +} + void tmplput_CurrentRoomFloorName(StrBuf *Target, WCTemplputParams *TP) { wcsession *WCC = WC; folder *Folder = &WCC->CurRoom; - const Floor *pFloor = Folder->Floor; + const Floor *pFloor; + + if (Folder == NULL) + return; + pFloor = Folder->Floor; if (pFloor == NULL) return; @@ -676,46 +657,86 @@ void tmplput_CurrentRoomAide(StrBuf *Target, WCTemplputParams *TP) StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0); } - -void LoadRoomXA (void) +int GetCurrentRoomFlags(folder *Room) { - wcsession *WCC = WC; StrBuf *Buf; - - if (WCC->CurRoom.XALoaded) - return; - WCC->CurRoom.XALoaded = 1; Buf = NewStrBuf(); serv_puts("GETR"); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) != 2) { - FlushStrBuf(WCC->CurRoom.XAPass); - FlushStrBuf(WCC->CurRoom.Directory); - - AppendImportantMessage (ChrPtr(Buf) + 4, - StrLength(Buf) - 4); + FlushStrBuf(Room->XAPass); + FlushStrBuf(Room->Directory); + StrBufCutLeft(Buf, 4); + AppendImportantMessage (SKEY(Buf)); + FreeStrBuf(&Buf); + return 0; } else { const char *Pos; Pos = ChrPtr(Buf) + 4; - FreeStrBuf(&WCC->CurRoom.XAPass); - FreeStrBuf(&WCC->CurRoom.Directory); + FreeStrBuf(&Room->XAPass); + FreeStrBuf(&Room->Directory); - WCC->CurRoom.XAPass = NewStrBufPlain (NULL, StrLength (Buf)); - WCC->CurRoom.Directory = NewStrBufPlain (NULL, StrLength (Buf)); + Room->XAPass = NewStrBufPlain (NULL, StrLength (Buf)); + Room->Directory = NewStrBufPlain (NULL, StrLength (Buf)); - StrBufSkip_NTokenS(Buf, &Pos, '|', 1); /* The Name, we already know... */ - StrBufExtract_NextToken(WCC->CurRoom.XAPass, Buf, &Pos, '|'); - StrBufExtract_NextToken(WCC->CurRoom.Directory, Buf, &Pos, '|'); - StrBufSkip_NTokenS(Buf, &Pos, '|', 2); /* QRFlags, FloorNum we already know... */ - WCC->CurRoom.Order = StrBufExtractNext_long(Buf, &Pos, '|'); - /* defview, we already know you. */ - /* QR2Flags, we already know them... */ + FreeStrBuf(&Room->name); + Room->name = NewStrBufPlain(NULL, StrLength(Buf)); + StrBufExtract_NextToken(Room->name, Buf, &Pos, '|'); + + StrBufExtract_NextToken(Room->XAPass, Buf, &Pos, '|'); + StrBufExtract_NextToken(Room->Directory, Buf, &Pos, '|'); + + Room->QRFlags = StrBufExtractNext_long(Buf, &Pos, '|'); + Room->floorid = StrBufExtractNext_long(Buf, &Pos, '|'); + Room->Order = StrBufExtractNext_long(Buf, &Pos, '|'); + Room->defview = StrBufExtractNext_long(Buf, &Pos, '|'); + Room->QRFlags2 = StrBufExtractNext_long(Buf, &Pos, '|'); + FreeStrBuf (&Buf); + Room->XALoaded = 1; + return 1; + } +} + +int SetCurrentRoomFlags(folder *Room) +{ + StrBuf *Buf; + + Buf = NewStrBuf(); + serv_printf("SETR %s|%s|%s|%ld|%d|%d|%ld|%ld|%ld", + ChrPtr(Room->name), + ChrPtr(Room->XAPass), + ChrPtr(Room->Directory), + Room->QRFlags, + Room->BumpUsers, + Room->floorid, + Room->Order, + Room->defview, + Room->QRFlags2); + + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) != 2) { + StrBufCutLeft(Buf, 4); + AppendImportantMessage (SKEY(Buf)); + FreeStrBuf(&Buf); + return 0; + } else { + FreeStrBuf(&Buf); + return 1; } - FreeStrBuf (&Buf); +} + +void LoadRoomXA (void) +{ + wcsession *WCC = WC; + + if (WCC->CurRoom.XALoaded) + return; + + GetCurrentRoomFlags(&WCC->CurRoom); } @@ -965,1195 +986,156 @@ void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP) StrBuf *Buf; if ((WCC == NULL) || - (WCC->CurRoom.defview >= VIEW_MAX) || - (WCC->CurRoom.defview < VIEW_BBS)) - { - LogTemplateError(Target, "Token", ERR_PARM2, TP, - "Roomview [%ld] not valid\n", - (WCC != NULL)? - WCC->CurRoom.defview : -1); - return; - } - - Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1); - StrBufAppendTemplate(Target, TP, Buf, 0); - FreeStrBuf(&Buf); -} - -void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP) -{ - long CheckThis; - StrBuf *Buf; - - CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0); - if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS)) - { - LogTemplateError(Target, "Token", ERR_PARM2, TP, - "Roomview [%ld] not valid\n", - CheckThis); - return; - } - - Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1); - StrBufAppendTemplate(Target, TP, Buf, 0); - FreeStrBuf(&Buf); -} - - -int ConditionalIsAllowedDefaultView(StrBuf *Target, WCTemplputParams *TP) -{ - wcsession *WCC = WC; - long CheckThis; - - if (WCC == NULL) - return 0; - - CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0); - if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS)) - { - LogTemplateError(Target, "Conditional", ERR_PARM2, TP, - "Roomview [%ld] not valid\n", - CheckThis); - return 0; - } - - return allowed_default_views[CheckThis] != 0; -} - -/* - * goto next room - */ -void smart_goto(const StrBuf *next_room) { - gotoroom(next_room); - readloop(readnew, eUseDefault); -} - - - -/* - * mark all messages in current room as having been read - */ -void slrp_highest(void) -{ - char buf[256]; - - serv_puts("SLRP HIGHEST"); - serv_getln(buf, sizeof 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; - - - - -/* - * 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 self_service(int newval) { - int current_value = 0; - char buf[SIZ]; - - char name[SIZ]; - char password[SIZ]; - char dirname[SIZ]; - int flags, floor, order, view, flags2; - - serv_puts("GETR"); - serv_getln(buf, sizeof buf); - if (buf[0] != '2') return(0); - - extract_token(name, &buf[4], 0, '|', sizeof name); - extract_token(password, &buf[4], 1, '|', sizeof password); - extract_token(dirname, &buf[4], 2, '|', sizeof dirname); - flags = extract_int(&buf[4], 3); - floor = extract_int(&buf[4], 4); - order = extract_int(&buf[4], 5); - view = extract_int(&buf[4], 6); - flags2 = extract_int(&buf[4], 7); - - if (flags2 & QR2_SELFLIST) { - current_value = 1; - } - else { - current_value = 0; - } - - if (newval == 1) { - flags2 = flags2 | QR2_SELFLIST; - } - else if (newval == 0) { - flags2 = flags2 & ~QR2_SELFLIST; - } - else { - return(current_value); - } - - if (newval != current_value) { - serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d", - name, password, dirname, flags, - floor, order, view, flags2); - serv_getln(buf, sizeof buf); - } - - FlushRoomlist (); - return(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); - FlushRoomlist (); - - return (1); -} - - - - - - -/* - * display the form for editing a room - */ -void display_editroom(void) -{ - char buf[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; - char *shared_with; - char *not_shared_with = NULL; - int roompolicy = 0; - int roomvalue = 0; - int floorpolicy = 0; - int floorvalue = 0; - char pop3_host[128]; - char pop3_user[32]; - int bg = 0; - - tab = bstr("tab"); - if (IsEmptyStr(tab)) tab = "admin"; - -// Buf = NewStrBuf(); -// load_floorlist(Buf); -// FreeStrBuf(&Buf); - output_headers(1, 1, 1, 0, 0, 0); - - 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); http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } @@ -2165,19 +1147,15 @@ 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, @@ -2185,67 +1163,17 @@ void editroom(void) 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)); - http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); - FreeStrBuf(&Buf); + if (GetCurrentRoomFlags (&WCC->CurRoom) == 0) return; - } - FlushRoomlist (); - - 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); } @@ -2260,6 +1188,8 @@ void editroom(void) } else { er_flags &= ~QR_MAILBOX; } + + if (yesbstr("prefonly")) { er_flags |= QR_PREFONLY; @@ -2322,6 +1252,7 @@ void editroom(void) er_flags &= ~QR_VISDIR; } + Ptr = sbstr("anon"); er_flags &= ~(QR_ANONONLY | QR_ANONOPT); @@ -2330,56 +1261,34 @@ void editroom(void) if (!strcmp(ChrPtr(Ptr), "anon2")) er_flags |= QR_ANONOPT; - bump = yesbstr("bump"); + er_name = sbstr("er_name"); + er_dirname = sbstr("er_dirname"); + er_roomaide = sbstr("er_roomaide"); + er_password = sbstr("er_password"); - er_floor = ibstr("er_floor"); + FlushStrBuf(WCC->CurRoom.name); + StrBufAppendBuf(WCC->CurRoom.name, er_name, 0); - 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]); - http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); - FreeStrBuf(&Buf); - FreeStrBuf(&er_name); - FreeStrBuf(&er_password); - FreeStrBuf(&er_dirname); - FreeStrBuf(&er_roomaide); - return; - } - gotoroom(er_name); + FlushStrBuf(WCC->CurRoom.Directory); + StrBufAppendBuf(WCC->CurRoom.Directory, er_dirname, 0); - 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.")); + 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"); + + WCC->CurRoom.floorid = ibstr("er_floor"); + + succ1 = SetCurrentRoomFlags(&WCC->CurRoom); + + succ2 = SaveRoomAide (&WCC->CurRoom); + + if (succ1 + succ2 == 0) + AppendImportantMessage (_("Your changes have been saved."), -1); http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); - FreeStrBuf(&Buf); - FreeStrBuf(&er_name); - FreeStrBuf(&er_password); - FreeStrBuf(&er_dirname); - FreeStrBuf(&er_roomaide); return; } @@ -2432,80 +1341,6 @@ void do_invt_kick(void) { http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0); } - - -/* - * Display form for Invite, Kick, and show Who Knows a room - */ -void display_whok(void) -{ - char buf[SIZ], room[SIZ], username[SIZ]; - - serv_puts("GETR"); - serv_getln(buf, sizeof buf); - - if (buf[0] != '2') { - escputs(&buf[4]); - return; - } - extract_token(room, &buf[4], 0, '|', sizeof room); - - - 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(" "); - - 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(" |