From a3ba94ad306d781296c53012f732f3a910015263 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 14 Jan 2010 21:46:39 +0000 Subject: [PATCH] * create function to parse the output of goto into our folder structure * migrate wcsessions goto fragments to a static folder instance 'CurRoom' * make all places follow that change * use the room structure in goto_config_room --- webcit/addressbook_popup.c | 2 +- webcit/auth.c | 26 +--- webcit/calendar_view.c | 17 +-- webcit/context_loop.c | 6 - webcit/cookie_conversion.c | 2 +- webcit/groupdav_delete.c | 4 +- webcit/groupdav_get.c | 8 +- webcit/groupdav_options.c | 4 +- webcit/groupdav_propfind.c | 16 +-- webcit/groupdav_put.c | 4 +- webcit/listsub.c | 2 +- webcit/marchlist.c | 8 +- webcit/messages.c | 38 +++--- webcit/msg_renderers.c | 12 +- webcit/paging.c | 4 +- webcit/preferences.c | 32 +++-- webcit/preferences.h | 2 + webcit/pushemail.c | 14 +- webcit/roomlist.c | 16 ++- webcit/roomops.c | 267 ++++++++++++++++++++++++++----------- webcit/roomops.h | 18 ++- webcit/smtpqueue.c | 2 +- webcit/summary.c | 5 +- webcit/sysmsgs.c | 2 +- webcit/tasks.c | 2 +- webcit/vcard_edit.c | 6 +- webcit/webcit.c | 4 +- webcit/webcit.h | 24 ++-- webcit/wiki.c | 16 +-- 29 files changed, 350 insertions(+), 213 deletions(-) diff --git a/webcit/addressbook_popup.c b/webcit/addressbook_popup.c index 13a2066e7..a9bf01a4b 100644 --- a/webcit/addressbook_popup.c +++ b/webcit/addressbook_popup.c @@ -148,7 +148,7 @@ void display_address_book_inner_div() { else { set_room_pref("defaddrbook",NewStrBufDup(sbstr("which_addr_book")), 0); - saved_roomname = NewStrBufDup(WC->wc_roomname); + saved_roomname = NewStrBufDup(WC->CurRoom.name); gotoroom(sbstr("which_addr_book")); serv_puts("DVCA"); serv_getln(buf, sizeof buf); diff --git a/webcit/auth.c b/webcit/auth.c index fc0da9507..185eba443 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -540,7 +540,7 @@ void do_logout(void) FlushStrBuf(WCC->wc_username); FlushStrBuf(WCC->wc_password); - FlushStrBuf(WCC->wc_roomname); + FlushStrBuf(WCC->CurRoom.name); FlushStrBuf(WCC->wc_fullname); /* FIXME: this is to suppress the iconbar displaying, because we aren't @@ -740,13 +740,14 @@ void validate(void) */ void display_reg(int during_login) { + folder Room; StrBuf *Buf; message_summary *VCMsg = NULL; wc_mime_attachment *VCAtt = NULL; long vcard_msgnum; Buf = NewStrBuf(); - if (goto_config_room(Buf) != 0) { + if (goto_config_room(Buf, &Room) != 0) { lprintf(9, "display_reg() exiting because goto_config_room() failed\n"); if (during_login) { do_welcome(); @@ -755,8 +756,10 @@ void display_reg(int during_login) display_main_menu(); } FreeStrBuf(&Buf); + FlushFolder(&Room); return; } + FlushFolder(&Room); FreeStrBuf(&Buf); vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt); @@ -777,7 +780,7 @@ void display_reg(int during_login) else { StrBuf *ReturnTo; ReturnTo = NewStrBufPlain(HKEY("display_main_menu?gotofirst=")); - StrBufAppendBuf(ReturnTo, WC->wc_roomname, 0); + StrBufAppendBuf(ReturnTo, WC->CurRoom.name, 0); do_edit_vcard(vcard_msgnum, "1", VCMsg, VCAtt, ChrPtr(ReturnTo), USERCONFIGROOM); FreeStrBuf(&ReturnTo); } @@ -901,13 +904,6 @@ int ConditionalAide(StrBuf *Target, WCTemplputParams *TP) return (WCC != NULL)? (WC->is_aide == 0) : 0; } -int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP) -{ - wcsession *WCC = WC; - return (WCC != NULL)? (WCC->is_room_aide == 0) : 0; -} - - int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP) { wcsession *WCC = WC; @@ -915,13 +911,6 @@ int ConditionalIsLoggedIn(StrBuf *Target, WCTemplputParams *TP) } -int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP) -{ - wcsession *WCC = WC; - return (WCC != NULL)? ( (WCC->is_room_aide) || (WCC->is_mailbox) || (WCC->room_flags2 & QR2_COLLABDEL) ) : 0; -} - - void _display_openid_login(void) { display_openid_login(NULL); } @@ -1051,8 +1040,6 @@ InitModule_AUTH WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0); RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE); - RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE); - RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE); RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE); return ; @@ -1066,7 +1053,6 @@ SessionDestroyModule_AUTH FreeStrBuf(&sess->wc_username); FreeStrBuf(&sess->wc_fullname); FreeStrBuf(&sess->wc_password); - FreeStrBuf(&sess->wc_roomname); FreeStrBuf(&sess->httpauth_pass); FreeStrBuf(&sess->cs_inet_email); } diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index 191ea78d1..0d81611a6 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -1392,17 +1392,16 @@ int calendar_summary_view(void) { p = icalproperty_new_summary(_("Untitled Task")); icalcomponent_add_property(Cal->cal, p); } - if (p != NULL) { - - - if (WCC->wc_view == VIEW_TASKS) { + if (p != NULL) + { + if (WCC->CurRoom.view == VIEW_TASKS) { wc_printf(""); } else { @@ -1418,7 +1417,7 @@ int calendar_summary_view(void) { today_tm.tm_mon + 1, today_tm.tm_mday ); - escputs(ChrPtr(WCC->wc_roomname)); + escputs(ChrPtr(WCC->CurRoom.name)); wc_printf("\">"); } escputs((char *) icalproperty_get_comment(p)); @@ -1445,6 +1444,7 @@ int calendar_GetParamsGetServerCall(SharedMessageStatus *Stat, char *cmd, long len) { + wcsession *WCC = WC; calview *c; time_t now; struct tm tm; @@ -1491,7 +1491,7 @@ int calendar_GetParamsGetServerCall(SharedMessageStatus *Stat, c->view = calview_day; } else { - if (WC->wc_view == VIEW_CALBRIEF) { + if (WCC->CurRoom.view == VIEW_CALBRIEF) { c->view = calview_brief; } else { @@ -1528,6 +1528,7 @@ int calendar_RenderView_or_Tail(SharedMessageStatus *Stat, void **ViewSpecific, long oper) { + wcsession *WCC = WC; calview *c = (calview*) *ViewSpecific; if (c->view == calview_day) { @@ -1537,7 +1538,7 @@ int calendar_RenderView_or_Tail(SharedMessageStatus *Stat, calendar_week_view(c->year, c->month, c->day); } else { - if (WC->wc_view == VIEW_CALBRIEF) { + if (WCC->CurRoom.view == VIEW_CALBRIEF) { calendar_brief_month_view(c->year, c->month, c->day); } else { diff --git a/webcit/context_loop.c b/webcit/context_loop.c index aca0cd47a..66261da1d 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -615,11 +615,6 @@ void tmplput_current_user(StrBuf *Target, WCTemplputParams *TP) StrBufAppendTemplate(Target, TP, WC->wc_fullname, 0); } -void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP) -{ - StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0); -} - void Header_HandleContentLength(StrBuf *Line, ParsedHttpHdrs *hdr) { hdr->HR.ContentLength = StrToi(Line); @@ -775,7 +770,6 @@ InitModule_CONTEXT RegisterHeaderHandler(HKEY("IF-MODIFIED-SINCE"), Header_HandleIfModSince); RegisterNamespace("CURRENT_USER", 0, 1, tmplput_current_user, NULL, CTX_NONE); - RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE); RegisterNamespace("NONCE", 0, 0, tmplput_nonce, NULL, 0); WebcitAddUrlHandler(HKEY("404"), "", 0, do_404, ANONYMOUS|COOKIEUNNEEDED); diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 25f85c73d..ff9460b52 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -33,7 +33,7 @@ void stuff_to_cookie(int unset_cookies) StrBufHexescAppend(WCC->HBuf, NULL, "|"); StrBufHexescAppend(WCC->HBuf, WCC->wc_password, NULL); StrBufHexescAppend(WCC->HBuf, NULL, "|"); - StrBufHexescAppend(WCC->HBuf, WCC->wc_roomname, NULL); + StrBufHexescAppend(WCC->HBuf, WCC->CurRoom.name, NULL); StrBufHexescAppend(WCC->HBuf, NULL, "|"); StrBufHexescAppend(WCC->HBuf, NULL, get_selected_language()); StrBufHexescAppend(WCC->HBuf, NULL, "|"); diff --git a/webcit/groupdav_delete.c b/webcit/groupdav_delete.c index 2d1ab5fa7..e4cb41695 100644 --- a/webcit/groupdav_delete.c +++ b/webcit/groupdav_delete.c @@ -35,10 +35,10 @@ void groupdav_delete(void) //StrBufCutLeft(WCC->Hdr->HR.ReqLine, 1); /* Go to the correct room. */ - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { gotoroom(dav_roomname); } - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { hprintf("HTTP/1.1 404 not found\r\n"); groupdav_common_headers(); hprintf("Content-Length: 0\r\n\r\n"); diff --git a/webcit/groupdav_get.c b/webcit/groupdav_get.c index c56eb99f7..f3f994405 100644 --- a/webcit/groupdav_get.c +++ b/webcit/groupdav_get.c @@ -127,10 +127,10 @@ void groupdav_get(void) } /* Go to the correct room. */ - if (strcasecmp(ChrPtr(WCC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WCC->CurRoom.name), ChrPtr(dav_roomname))) { gotoroom(dav_roomname); } - if (strcasecmp(ChrPtr(WCC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WCC->CurRoom.name), ChrPtr(dav_roomname))) { hprintf("HTTP/1.1 404 not found\r\n"); groupdav_common_headers(); hprintf("Content-Type: text/plain\r\n"); @@ -230,11 +230,11 @@ void groupdav_get(void) */ if (!strncasecmp(content_type, "multipart/", 10)) { - if ( (WCC->wc_default_view == VIEW_CALENDAR) || (WCC->wc_default_view == VIEW_TASKS) ) { + if ( (WCC->CurRoom.defview == VIEW_CALENDAR) || (WCC->CurRoom.defview == VIEW_TASKS) ) { strcpy(epdata.desired_content_type_1, "text/calendar"); } - else if (WCC->wc_default_view == VIEW_ADDRESSBOOK) { + else if (WCC->CurRoom.defview == VIEW_ADDRESSBOOK) { strcpy(epdata.desired_content_type_1, "text/vcard"); strcpy(epdata.desired_content_type_2, "text/x-vcard"); } diff --git a/webcit/groupdav_options.c b/webcit/groupdav_options.c index 9453b503c..1b1f3b904 100644 --- a/webcit/groupdav_options.c +++ b/webcit/groupdav_options.c @@ -47,11 +47,11 @@ void groupdav_options(void) } /* Go to the correct room. */ - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { gotoroom(dav_roomname); } - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { hprintf("HTTP/1.1 404 not found\r\n"); groupdav_common_headers(); hprintf("Date: %s\r\n", datestring); diff --git a/webcit/groupdav_propfind.c b/webcit/groupdav_propfind.c index e12051265..fbfae2309 100644 --- a/webcit/groupdav_propfind.c +++ b/webcit/groupdav_propfind.c @@ -262,10 +262,10 @@ void groupdav_propfind(void) } /* Go to the correct room. */ - if (strcasecmp(ChrPtr(WCC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WCC->CurRoom.name), ChrPtr(dav_roomname))) { gotoroom(dav_roomname); } - if (strcasecmp(ChrPtr(WCC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WCC->CurRoom.name), ChrPtr(dav_roomname))) { hprintf("HTTP/1.1 404 not found\r\n"); groupdav_common_headers(); hprintf("Date: %s\r\n", datestring); @@ -321,7 +321,7 @@ void groupdav_propfind(void) wc_printf(""); groupdav_identify_host(); wc_printf("/groupdav/"); - urlescputs(ChrPtr(WCC->wc_roomname)); + urlescputs(ChrPtr(WCC->CurRoom.name)); euid_escapize(encoded_uid, ChrPtr(dav_uid)); wc_printf("/%s", encoded_uid); wc_printf(""); @@ -373,18 +373,18 @@ void groupdav_propfind(void) wc_printf(""); groupdav_identify_host(); wc_printf("/groupdav/"); - urlescputs(ChrPtr(WCC->wc_roomname)); + urlescputs(ChrPtr(WCC->CurRoom.name)); wc_printf(""); wc_printf(""); wc_printf("HTTP/1.1 200 OK"); wc_printf(""); wc_printf(""); - escputs(ChrPtr(WCC->wc_roomname)); + escputs(ChrPtr(WCC->CurRoom.name)); wc_printf(""); wc_printf(""); - switch(WCC->wc_default_view) { + switch(WCC->CurRoom.defview) { case VIEW_CALENDAR: wc_printf(""); break; @@ -440,11 +440,11 @@ void groupdav_propfind(void) wc_printf(""); groupdav_identify_host(); wc_printf("/groupdav/"); - urlescputs(ChrPtr(WCC->wc_roomname)); + urlescputs(ChrPtr(WCC->CurRoom.name)); euid_escapize(encoded_uid, uid); wc_printf("/%s", encoded_uid); wc_printf(""); - switch(WCC->wc_default_view) { + switch(WCC->CurRoom.defview) { case VIEW_CALENDAR: wc_printf("text/x-ical"); break; diff --git a/webcit/groupdav_put.c b/webcit/groupdav_put.c index d79d17fa8..4e924f2aa 100644 --- a/webcit/groupdav_put.c +++ b/webcit/groupdav_put.c @@ -87,10 +87,10 @@ void groupdav_put(void) } /* Go to the correct room. */ - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { gotoroom(dav_roomname); } - if (strcasecmp(ChrPtr(WC->wc_roomname), ChrPtr(dav_roomname))) { + if (strcasecmp(ChrPtr(WC->CurRoom.name), ChrPtr(dav_roomname))) { hprintf("HTTP/1.1 404 not found\r\n"); groupdav_common_headers(); hprintf("Content-Type: text/plain\r\n"); diff --git a/webcit/listsub.c b/webcit/listsub.c index 4dba177d0..bd5e26182 100644 --- a/webcit/listsub.c +++ b/webcit/listsub.c @@ -26,7 +26,7 @@ void do_listsub(void) FlushStrBuf(WC->wc_fullname); FlushStrBuf(WC->wc_username); FlushStrBuf(WC->wc_password); - FlushStrBuf(WC->wc_roomname); + FlushStrBuf(WC->CurRoom.name); output_headers(1, 0, 0, 1, 1, 0); begin_burst(); diff --git a/webcit/marchlist.c b/webcit/marchlist.c index d442f97c0..8f17d9a52 100644 --- a/webcit/marchlist.c +++ b/webcit/marchlist.c @@ -131,7 +131,7 @@ void gotonext(void) continue; } extract_token(room_name, buf, 0, '|', sizeof room_name); - if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) { + if (strcasecmp(room_name, ChrPtr(WC->CurRoom.name))) { mptr = (struct march *) malloc(sizeof(struct march)); mptr->next = NULL; safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name); @@ -166,7 +166,7 @@ void gotonext(void) * ...and remove the room we're currently in, so a oto doesn't make us * walk around in circles */ - remove_march(WC->wc_roomname); + remove_march(WC->CurRoom.name); } if (WC->march != NULL) { next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */ @@ -192,14 +192,14 @@ void ungoto(void) } if (!strcmp(WC->ugname, "")) { - smart_goto(WC->wc_roomname); + smart_goto(WC->CurRoom.name); return; } serv_printf("GOTO %s", WC->ugname); Buf = NewStrBuf(); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) != 2) { - smart_goto(WC->wc_roomname); + smart_goto(WC->CurRoom.name); FreeStrBuf(&Buf); return; } diff --git a/webcit/messages.c b/webcit/messages.c index 23f81d3c8..39a1ecf95 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -382,7 +382,7 @@ void handle_one_message(void) break; case eDELETE: CmdBuf = NewStrBuf (); - if (WCC->wc_is_trash) { /* Delete from Trash is a real delete */ + if ((WCC->CurRoom.RAFlags & UA_ISTRASH) != 0) { /* Delete from Trash is a real delete */ serv_printf("DELE %ld", msgnum); } else { /* Otherwise move it to Trash */ @@ -442,7 +442,7 @@ void embed_message(void) { break; case eDELETE: CmdBuf = NewStrBuf (); - if (WCC->wc_is_trash) { /* Delete from Trash is a real delete */ + if ((WCC->CurRoom.RAFlags & UA_ISTRASH) != 0) { /* Delete from Trash is a real delete */ serv_printf("DELE %ld", msgnum); } else { /* Otherwise move it to Trash */ @@ -644,7 +644,7 @@ int load_msg_ptrs(const char *servcmd, SharedMessageStatus *Stat) /* node name */ StrBufExtract_NextToken(Buf2, Buf, &Ptr, '|'); if ((StrLength(Buf2) !=0 ) && - ( ((WCC->room_flags & QR_NETWORK) + ( ((WCC->CurRoom.QRFlags & QR_NETWORK) || ((strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_nodename)) && (strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_fqdn)))))))) { @@ -770,14 +770,14 @@ void readloop(long oper) void *ViewSpecific; if (havebstr("is_summary") && (1 == (ibstr("is_summary")))) { - WCC->wc_view = VIEW_MAILBOX; + WCC->CurRoom.view = VIEW_MAILBOX; } if (havebstr("is_ajax") && (1 == (ibstr("is_ajax")))) { WCC->is_ajax = 1; } - if ((oper == do_search) && (WCC->wc_view == VIEW_WIKI)) { + if ((oper == do_search) && (WCC->CurRoom.view == VIEW_WIKI)) { display_wiki_pagelist(); return; } @@ -786,10 +786,10 @@ void readloop(long oper) Stat.maxload = 10000; Stat.lowest_found = (-1); Stat.highest_found = (-1); - GetHash(ReadLoopHandler, IKEY(WCC->wc_view), &vViewMsg); + GetHash(ReadLoopHandler, IKEY(WCC->CurRoom.view), &vViewMsg); if (vViewMsg == NULL) { - WCC->wc_view = VIEW_BBS; - GetHash(ReadLoopHandler, IKEY(WCC->wc_view), &vViewMsg); + WCC->CurRoom.view = VIEW_BBS; + GetHash(ReadLoopHandler, IKEY(WCC->CurRoom.view), &vViewMsg); } if (vViewMsg == NULL) { return; // TODO: print message @@ -798,7 +798,7 @@ void readloop(long oper) ViewMsg = (RoomRenderer*) vViewMsg; if (!WCC->is_ajax) { output_headers(1, 1, 1, 0, 0, 0); - } else if (WCC->wc_view == VIEW_MAILBOX) { + } else if (WCC->CurRoom.view == VIEW_MAILBOX) { jsonMessageListHdr(); } @@ -856,7 +856,7 @@ void readloop(long oper) /* Put some helpful data in vars for mailsummary_json */ svputlong("READLOOP:TOTALMSGS", Stat.nummsgs); svputlong("READLOOP:STARTMSG", Stat.startmsg); - svputlong("WCVIEW", WCC->wc_view); + svputlong("WCVIEW", WCC->CurRoom.view); /* * iterate over each message. if we need to load an attachment, do it here. @@ -932,7 +932,7 @@ void post_mime_to_server(void) { } /* Only do multipart/alternative for mailboxes. BBS and Wiki rooms don't need it. */ - if (WC->wc_view == VIEW_MAILBOX) { + if (WC->CurRoom.view == VIEW_MAILBOX) { include_text_alt = 1; } @@ -1190,13 +1190,13 @@ void post_message(void) serv_printf("Cc: %s", ChrPtr(Cc)); serv_printf("Bcc: %s", ChrPtr(Bcc)); } else { - serv_printf("X-Citadel-Room: %s", ChrPtr(WC->wc_roomname)); + serv_printf("X-Citadel-Room: %s", ChrPtr(WC->CurRoom.name)); } } post_mime_to_server(); if (save_to_drafts) { StrBufAppendBufPlain(WCC->ImportantMsg, _("Message has been saved to Drafts.\n"), -1, 0); - gotoroom(WCC->wc_roomname); + gotoroom(WCC->CurRoom.name); display_enter(); FreeStrBuf(&Buf); return; @@ -1215,7 +1215,7 @@ void post_message(void) lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf)); StrBufAppendBuf(WCC->ImportantMsg, Buf, 0); - if (save_to_drafts) gotoroom(WCC->wc_roomname); + if (save_to_drafts) gotoroom(WCC->CurRoom.name); display_enter(); FreeStrBuf(&Buf); return; @@ -1298,8 +1298,8 @@ void display_enter(void) * Are we perhaps in an address book view? If so, then an "enter * message" command really means "add new entry." */ - if (WCC->wc_default_view == VIEW_ADDRESSBOOK) { - do_edit_vcard(-1, "", NULL, NULL, "", ChrPtr(WCC->wc_roomname)); + if (WCC->CurRoom.defview == VIEW_ADDRESSBOOK) { + do_edit_vcard(-1, "", NULL, NULL, "", ChrPtr(WCC->CurRoom.name)); return; } @@ -1307,7 +1307,7 @@ void display_enter(void) * Are we perhaps in a calendar room? If so, then an "enter * message" command really means "add new calendar item." */ - if (WCC->wc_default_view == VIEW_CALENDAR) { + if (WCC->CurRoom.defview == VIEW_CALENDAR) { display_edit_event(); return; } @@ -1316,7 +1316,7 @@ void display_enter(void) * Are we perhaps in a tasks view? If so, then an "enter * message" command really means "add new task." */ - if (WCC->wc_default_view == VIEW_TASKS) { + if (WCC->CurRoom.defview == VIEW_TASKS) { display_edit_task(); return; } @@ -1392,7 +1392,7 @@ void delete_msg(void) msgid = lbstr("msgid"); - if (WC->wc_is_trash) { /* Delete from Trash is a real delete */ + if ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0) { /* Delete from Trash is a real delete */ serv_printf("DELE %ld", msgid); } else { /* Otherwise move it to Trash */ diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 1766f9ed2..459f8e955 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -335,7 +335,7 @@ void tmplput_MAIL_SUMM_CCCC(StrBuf *Target, WCTemplputParams *TP) void examine_room(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) { if ((StrLength(HdrLine) > 0) && - (strcasecmp(ChrPtr(HdrLine), ChrPtr(WC->wc_roomname)))) { + (strcasecmp(ChrPtr(HdrLine), ChrPtr(WC->CurRoom.name)))) { FreeStrBuf(&Msg->Room); Msg->Room = NewStrBufDup(HdrLine); } @@ -373,7 +373,7 @@ void examine_node(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) wcsession *WCC = WC; if ( (StrLength(HdrLine) > 0) && - ((WC->room_flags & QR_NETWORK) + ((WC->CurRoom.QRFlags & QR_NETWORK) || ((strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_nodename)) && (strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_fqdn))))))) { FreeStrBuf(&Msg->OtherNode); @@ -494,9 +494,9 @@ void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC StrBuf *Buf; Buf = NewStrBuf(); /** If it's my vCard I can edit it */ - if ( (!strcasecmp(ChrPtr(WCC->wc_roomname), USERCONFIGROOM)) - || (!strcasecmp(&(ChrPtr(WCC->wc_roomname)[11]), USERCONFIGROOM)) - || (WC->wc_view == VIEW_ADDRESSBOOK) + if ( (!strcasecmp(ChrPtr(WCC->CurRoom.name), USERCONFIGROOM)) + || (!strcasecmp(&(ChrPtr(WCC->CurRoom.name)[11]), USERCONFIGROOM)) + || (WC->CurRoom.view == VIEW_ADDRESSBOOK) ) { StrBufAppendPrintf(Buf, "", Mime->msgnum, ChrPtr(Mime->PartNum)); @@ -975,7 +975,7 @@ void render_MAIL_html(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCh /* HTML is fun, but we've got to strip it first */ output_html(ChrPtr(Mime->Charset), - (WC->wc_view == VIEW_WIKI ? 1 : 0), + (WC->CurRoom.view == VIEW_WIKI ? 1 : 0), Mime->msgnum, Mime->Data, Buf); FreeStrBuf(&Mime->Data); diff --git a/webcit/paging.c b/webcit/paging.c index 1ee2782b7..bb6ad8e2f 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -103,7 +103,7 @@ void do_chat(void) char buf[SIZ]; /** First, check to make sure we're still allowed in this room. */ - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); serv_getln(buf, sizeof buf); if (buf[0] != '2') { StrBuf *Buf; @@ -198,7 +198,7 @@ int setup_chat_socket(void) { serv_printf("PASS %s", ChrPtr(WC->wc_password)); serv_getln(buf, sizeof buf); if (buf[0] == '2') { - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); serv_getln(buf, sizeof buf); if (buf[0] == '2') { serv_puts("CHAT"); diff --git a/webcit/preferences.c b/webcit/preferences.c index 4934388f1..aeca0028a 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -197,14 +197,18 @@ void ParsePref(HashList **List, StrBuf *ReadBuf) */ void load_preferences(void) { + folder Room; wcsession *WCC = WC; int Done = 0; StrBuf *ReadBuf; long msgnum = 0L; + memset(&Room, 0, sizeof(folder)); ReadBuf = NewStrBufPlain(NULL, SIZ * 4); - if (goto_config_room(ReadBuf) != 0) { + if (goto_config_room(ReadBuf, &Room) != 0) { FreeStrBuf(&ReadBuf); + FlushFolder(&Room); + return; /* oh well. */ } @@ -239,19 +243,20 @@ void load_preferences(void) } /* Go back to the room we're supposed to be in */ - if (StrLength(WCC->wc_roomname) > 0) { - serv_printf("GOTO %s", ChrPtr(WCC->wc_roomname)); + if (StrLength(WCC->CurRoom.name) > 0) { + serv_printf("GOTO %s", ChrPtr(WCC->CurRoom.name)); StrBuf_ServGetln(ReadBuf); GetServerStatus(ReadBuf, NULL); } FreeStrBuf(&ReadBuf); + FlushFolder(&Room); } /* * Goto the user's configuration room, creating it if necessary. * returns 0 on success or nonzero upon failure. */ -int goto_config_room(StrBuf *Buf) +int goto_config_room(StrBuf *Buf, folder *Room) { serv_printf("GOTO %s", USERCONFIGROOM); StrBuf_ServGetln(Buf); @@ -266,6 +271,7 @@ int goto_config_room(StrBuf *Buf) return(1); } } + ParseGoto(Room, Buf); return(0); } @@ -330,16 +336,23 @@ void WritePrefsToServer(HashList *Hash) */ void save_preferences(void) { + folder Room; wcsession *WCC = WC; int Done = 0; StrBuf *ReadBuf; long msgnum = 0L; ReadBuf = NewStrBuf(); - if (goto_config_room(ReadBuf) != 0) { + memset(&Room, 0, sizeof(folder)); + if (goto_config_room(ReadBuf, &Room) != 0) { FreeStrBuf(&ReadBuf); + FlushFolder(&Room); + return; /* oh well. */ } +//void do_change_view(int newview) { + + serv_puts("MSGS ALL|0|1"); StrBuf_ServGetln(ReadBuf); if (GetServerStatus(ReadBuf, NULL) == 8) { @@ -372,12 +385,13 @@ void save_preferences(void) } /** Go back to the room we're supposed to be in */ - if (StrLength(WCC->wc_roomname) > 0) { - serv_printf("GOTO %s", ChrPtr(WCC->wc_roomname)); + if (StrLength(WCC->CurRoom.name) > 0) { + serv_printf("GOTO %s", ChrPtr(WCC->CurRoom.name)); StrBuf_ServGetln(ReadBuf); GetServerStatus(ReadBuf, NULL); } FreeStrBuf(&ReadBuf); + FlushFolder(&Room); } /** @@ -581,7 +595,7 @@ int get_room_prefs_backend(const char *key, size_t keylen, int Ret; pref_name = NewStrBufPlain (HKEY("ROOM:")); - StrBufAppendBuf(pref_name, WC->wc_roomname, 0); + StrBufAppendBuf(pref_name, WC->CurRoom.name, 0); StrBufAppendBufPlain(pref_name, HKEY(":"), 0); StrBufAppendBufPlain(pref_name, key, keylen, 0); Ret = get_pref_backend(SKEY(pref_name), Pref); @@ -665,7 +679,7 @@ void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_s StrBuf *pref_name; pref_name = NewStrBufPlain (HKEY("ROOM:")); - StrBufAppendBuf(pref_name, WC->wc_roomname, 0); + StrBufAppendBuf(pref_name, WC->CurRoom.name, 0); StrBufAppendBufPlain(pref_name, HKEY(":"), 0); StrBufAppendBufPlain(pref_name, key, keylen, 0); set_preference_backend(SKEY(pref_name), 0, value, PRF_STRING, save_to_server, NULL); diff --git a/webcit/preferences.h b/webcit/preferences.h index 2d8fb1227..3fd617d44 100644 --- a/webcit/preferences.h +++ b/webcit/preferences.h @@ -51,3 +51,5 @@ const StrBuf *get_X_PREFS(const char *key, size_t keylen, #define set_x_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, sizeof(b) - 1, c, d) void set_X_PREFS(const char *key, size_t keylen, const char *xkey, size_t xkeylen, StrBuf *value, int save_to_server); + +int goto_config_room(StrBuf *Buf, folder *room); diff --git a/webcit/pushemail.c b/webcit/pushemail.c index 586fca67e..81b13fd67 100644 --- a/webcit/pushemail.c +++ b/webcit/pushemail.c @@ -6,6 +6,7 @@ void display_pushemail(void) { + folder Room; int Done = 0; StrBuf *Buf; long vector[8] = {8, 0, 0, 1, 2, 3, 4, 5}; @@ -19,7 +20,7 @@ void display_pushemail(void) /* Find any existing settings*/ Buf = NewStrBuf(); - if (goto_config_room(Buf) == 0) { + if (goto_config_room(Buf, &Room) == 0) { int msgnum = 0; serv_puts("MSGS ALL|0|1"); StrBuf_ServGetln(Buf); @@ -80,10 +81,11 @@ void display_pushemail(void) } } svput("SMSNUM", WCS_STRING, " "); - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); StrBuf_ServGetln(Buf); GetServerStatus(Buf, NULL); } + FlushFolder(&Room); output_headers(1, 1, 2, 0, 0, 0); DoTemplate(HKEY("prefs_pushemail"), NULL, &SubTP); wDumpContent(1); @@ -92,6 +94,7 @@ void display_pushemail(void) void save_pushemail(void) { + folder Room; int Done = 0; StrBuf *Buf; char buf[SIZ]; @@ -103,10 +106,13 @@ void save_pushemail(void) sms = bstr("user_sms_number"); } Buf = NewStrBuf(); - if (goto_config_room(Buf) != 0) { + if (goto_config_room(Buf, &Room) != 0) { FreeStrBuf(&Buf); + FlushFolder(&Room); return; /* oh well. */ } + FlushFolder(&Room); + serv_puts("MSGS ALL|0|1"); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 8) { @@ -146,7 +152,7 @@ void save_pushemail(void) } /** Go back to the room we're supposed to be in */ - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); StrBuf_ServGetln(Buf); GetServerStatus(Buf, NULL); http_redirect("display_pushemail"); diff --git a/webcit/roomlist.c b/webcit/roomlist.c index fe7183db1..c440085f0 100644 --- a/webcit/roomlist.c +++ b/webcit/roomlist.c @@ -125,20 +125,26 @@ HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP) return GetRoomListHash(Target, TP); } -void DeleteFolder(void *vFolder) +void FlushFolder(folder *room) { int i; - folder *room; - room = (folder*) vFolder; FreeStrBuf(&room->name); - if (room->RoomNameParts != NULL) { for (i=0; i < room->nRoomNameParts; i++) FreeStrBuf(&room->RoomNameParts[i]); free(room->RoomNameParts); } +} + +void vDeleteFolder(void *vFolder) +{ + folder *room; + + room = (folder*) vFolder; + FlushFolder(room); + free(room); } @@ -232,7 +238,7 @@ HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP) /* now we know everything, remember it... */ - Put(rooms, SKEY(room->name), room, DeleteFolder); + Put(rooms, SKEY(room->name), room, vDeleteFolder); } } diff --git a/webcit/roomops.c b/webcit/roomops.c index d3dab0389..470b8cca8 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -290,36 +290,36 @@ void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP) serv_getln(buf, sizeof buf); if (buf[0] == '2') { wc_printf("wc_roomname)); + urlescputs(ChrPtr(WC->CurRoom.name)); wc_printf("\">"); serv_puts("CLOS"); serv_getln(buf, sizeof buf); } - else if (WC->wc_view == VIEW_ADDRESSBOOK) { + else if (WC->CurRoom.view == VIEW_ADDRESSBOOK) { wc_printf("\"\"" ); } - else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) { + else if ( (WC->CurRoom.view == VIEW_CALENDAR) || (WC->CurRoom.view == VIEW_CALBRIEF) ) { wc_printf("\"\"" ); } - else if (WC->wc_view == VIEW_TASKS) { + else if (WC->CurRoom.view == VIEW_TASKS) { wc_printf("\"\"" ); } - else if (WC->wc_view == VIEW_NOTES) { + else if (WC->CurRoom.view == VIEW_NOTES) { wc_printf("\"\"" ); } - else if (WC->wc_view == VIEW_MAILBOX) { + else if (WC->CurRoom.view == VIEW_MAILBOX) { wc_printf("\"\"" @@ -360,15 +360,15 @@ void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP) * view in a non-Calendar room. */ if ( - (i == WC->wc_view) - || (i == WC->wc_default_view) /* default */ - || ( (i == 0) && (WC->wc_default_view == 1) ) /* mail or bulletin */ - || ( (i == 1) && (WC->wc_default_view == 0) ) /* mail or bulletin */ - /* || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */ + (i == WC->CurRoom.view) + || (i == WC->CurRoom.defview) /* default */ + || ( (i == 0) && (WC->CurRoom.defview == 1) ) /* mail or bulletin */ + || ( (i == 1) && (WC->CurRoom.defview == 0) ) /* mail or bulletin */ + /* || ( (i == 7) && (WC->CurRoom.defview == 3) ) (calendar list temporarily disabled) */ ) { wc_printf("\n"); @@ -417,16 +417,16 @@ void embed_room_banner(char *got, int navbar_style) { if (got == NULL) { memset(buf, '0', 20); buf[20] = '\0'; - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); serv_getln(buf, sizeof buf); got = buf; } /* The browser needs some information for its own use */ wc_printf("\n", - WC->wc_is_trash + " room_is_trash = %d; \n" + "\n", + ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0) ); /* @@ -439,15 +439,15 @@ void embed_room_banner(char *got, int navbar_style) { } StrBufPrintf(WCC->Hdr->this_page, "dotskip?room=%s", - ChrPtr(WC->wc_roomname) + ChrPtr(WC->CurRoom.name) ); /* Check for new mail. */ WC->new_mail = extract_int(&got[4], 9); - WC->wc_view = extract_int(&got[4], 11); + WC->CurRoom.view = extract_int(&got[4], 11); /* Is this a directory room and does it contain files and how many? */ - if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR)) + if ((WC->CurRoom.QRFlags & QR_DIRECTORY) && (WC->CurRoom.QRFlags & QR_VISDIR)) { serv_puts("RDIR"); serv_getln(buf2, sizeof buf2); @@ -487,7 +487,7 @@ void embed_room_banner(char *got, int navbar_style) { "\n", _("Ungoto") ); - if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) { + if ( (navbar_style == navbar_default) && (WC->CurRoom.view == VIEW_BBS) ) { wc_printf( "
  • " "" @@ -498,7 +498,7 @@ void embed_room_banner(char *got, int navbar_style) { } if (navbar_style == navbar_default) { - switch(WC->wc_view) { + switch(WC->CurRoom.view) { case VIEW_ADDRESSBOOK: wc_printf( "
  • " @@ -600,7 +600,7 @@ void embed_room_banner(char *got, int navbar_style) { } if (navbar_style == navbar_default) { - switch(WC->wc_view) { + switch(WC->CurRoom.view) { case VIEW_ADDRESSBOOK: wc_printf( "
  • " @@ -757,13 +757,14 @@ void embed_room_banner(char *got, int navbar_style) { */ long gotoroom(const StrBuf *gname) { + wcsession *WCC = WC; StrBuf *Buf; static long ls = (-1L); long err = 0; /* store ungoto information */ - strcpy(WC->ugname, ChrPtr(WC->wc_roomname)); - WC->uglsn = ls; + strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name)); + WCC->uglsn = ls; Buf = NewStrBuf(); /* move to the new room */ @@ -782,32 +783,9 @@ long gotoroom(const StrBuf *gname) return err; } } + ParseGoto(&WCC->CurRoom, Buf); - if (WC->wc_roomname == NULL) - WC->wc_roomname = NewStrBuf(); - else - FlushStrBuf(WC->wc_roomname); - - StrBufExtract_token(WC->wc_roomname, Buf, 0, '|'); - StrBufCutLeft(WC->wc_roomname, 4); - WC->room_flags = StrBufExtract_int(Buf, 4, '|'); - /* highest_msg_read = extract_int(&buf[4],6); - maxmsgnum = extract_int(&buf[4],5); - */ - WC->is_mailbox = StrBufExtract_int(Buf, 7, '|'); - ls = StrBufExtract_long(Buf, 6, '|'); - WC->wc_floor = StrBufExtract_int(Buf, 10, '|'); - WC->wc_view = StrBufExtract_int(Buf, 11, '|'); - WC->wc_default_view = StrBufExtract_int(Buf, 12, '|'); - WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|'); - WC->room_flags2 = StrBufExtract_int(Buf, 14, '|'); - - if (WC->is_aide) - WC->is_room_aide = WC->is_aide; - else - WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|'); - - remove_march(WC->wc_roomname); + remove_march(WCC->CurRoom.name); if (!strcasecmp(ChrPtr(gname), "_BASEROOM_")) remove_march(gname); FreeStrBuf(&Buf); @@ -816,6 +794,109 @@ long gotoroom(const StrBuf *gname) } +void ParseGoto(folder *room, StrBuf *Line) +{ + wcsession *WCC = WC; + const char *Pos; + int flag; + void *vFloor = NULL; + StrBuf *pBuf; + + if (StrLength(Line) < 4) { + return; + } + + /* ignore the commandstate... */ + Pos = ChrPtr(Line) + 4; + + if (room->RoomNameParts != NULL) + { + int i; + for (i=0; i < room->nRoomNameParts; i++) + FreeStrBuf(&room->RoomNameParts[i]); + free(room->RoomNameParts); + room->RoomNameParts = NULL; + } + + pBuf = room->name; + if (pBuf == NULL) + pBuf = NewStrBufPlain(NULL, StrLength(Line)); + else + FlushStrBuf(pBuf); + memset(room, 0, sizeof(folder)); + room->name = pBuf; + + StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name + + room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|'); + if (room->nNewMessages > 0) + room->RAFlags |= UA_HASNEWMSGS; + + room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|'); + + room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|'); + + room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags + + room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|'); + room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|'); + + room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox + + flag = StrBufExtractNext_long(Line, &Pos, '|'); + if (WCC->is_aide || flag) + room->RAFlags |= UA_ADMINALLOWED; + + room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|'); + + room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor + + room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view + + room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview + + flag = StrBufExtractNext_long(Line, &Pos, '|'); + if (flag) + room->RAFlags |= UA_ISTRASH; // wc_is_trash + + room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2 + + /* find out, whether we are in a sub-room */ + room->nRoomNameParts = StrBufNum_tokens(room->name, '\\'); + if (room->nRoomNameParts > 1) + { + int i; + + Pos = NULL; + room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1)); + memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1)); + for (i=0; i < room->nRoomNameParts; i++) + { + room->RoomNameParts[i] = NewStrBuf(); + StrBufExtract_NextToken(room->RoomNameParts[i], + room->name, &Pos, '\\'); + } + } + + /* Private mailboxes on the main floor get remapped to the personal folder */ + if ((room->QRFlags & QR_MAILBOX) && + (room->floorid == 0)) + { + room->floorid = VIRTUAL_MY_FLOOR; + if ((room->nRoomNameParts == 1) && + (StrLength(room->name) == 4) && + (strcmp(ChrPtr(room->name), "Mail") == 0)) + { + room->is_inbox = 1; + } + + } + /* get a pointer to the floor we're on: */ + GetHash(WCC->Floors, IKEY(room->floorid), &vFloor); + room->Floor = (const floor*) vFloor; +} + + /* * goto next room */ @@ -1136,7 +1217,7 @@ void display_editroom(void) wc_printf(_("Delete this room")); wc_printf("\n" "
  • wc_roomname)); + urlescputs(ChrPtr(WC->CurRoom.name)); wc_printf("\">\n"); wc_printf(_("Set or change the icon for this room's banner")); wc_printf("\n" @@ -1690,7 +1771,7 @@ void display_editroom(void) wc_printf(""); wc_printf(_("Message expire policy for this room")); wc_printf("
    ("); - escputs(ChrPtr(WC->wc_roomname)); + escputs(ChrPtr(WC->CurRoom.name)); wc_printf(")"); wc_printf("", ((roompolicy == 0) ? "CHECKED" : "") ); @@ -1717,7 +1798,7 @@ void display_editroom(void) wc_printf(""); wc_printf(_("Message expire policy for this floor")); wc_printf("
    ("); - escputs(floorlist[WC->wc_floor]); + escputs(floorlist[WC->CurRoom.floorid]); wc_printf(")"); wc_printf("", ((floorpolicy == 0) ? "CHECKED" : "") ); @@ -2614,7 +2695,7 @@ void goto_private(void) display_main_menu(); return; } - strcpy(hold_rm, ChrPtr(WC->wc_roomname)); + strcpy(hold_rm, ChrPtr(WC->CurRoom.name)); serv_printf("GOTO %s|%s", bstr("gr_name"), bstr("gr_pass")); @@ -2652,7 +2733,7 @@ void display_zap(void) wc_printf(_("If you select this option, %s will " "disappear from your room list. Is this what you wish " - "to do?
    \n"), ChrPtr(WC->wc_roomname)); + "to do?
    \n"), ChrPtr(WC->CurRoom.name)); wc_printf("
    \n"); wc_printf("\n", WC->nonce); @@ -2676,10 +2757,10 @@ void zap(void) * If the forget-room routine fails for any reason, we fall back * to the current room; otherwise, we go to the Lobby */ - final_destination = NewStrBufDup(WC->wc_roomname); + final_destination = NewStrBufDup(WC->CurRoom.name); if (havebstr("ok_button")) { - serv_printf("GOTO %s", ChrPtr(WC->wc_roomname)); + serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name)); serv_getln(buf, sizeof buf); if (buf[0] == '2') { serv_puts("FORG"); @@ -2877,8 +2958,8 @@ void do_change_view(int newview) { serv_printf("VIEW %d", newview); serv_getln(buf, sizeof buf); - WC->wc_view = newview; - smart_goto(WC->wc_roomname); + WC->CurRoom.view = newview; + smart_goto(WC->CurRoom.name); } @@ -2972,7 +3053,7 @@ void set_room_policy(void) { void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP) { - StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0); + StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0); } @@ -2985,12 +3066,24 @@ void dotgoto(void) { readloop(readnew); return; } - if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */ + if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */ slrp_highest(); } smart_goto(sbstr("room")); } + + +void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + + if (WCC != NULL) + StrBufAppendTemplate(Target, TP, + WCC->CurRoom.name, + 0); +} + void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP) { wc_printf("
    \n"); @@ -3008,6 +3101,20 @@ void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP) StrBufAppendBufPlain(Target, WCC->ugname, -1, 0); } +int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + return (WCC != NULL)? (WCC->is_room_aide == 0) : 0; +} + +int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + return (WCC == NULL)? 0 : + ( (WCC->is_room_aide) || /////TODO! + (WCC->CurRoom.is_inbox) || + (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) ); +} int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP) { @@ -3015,7 +3122,7 @@ int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP) return ((WCC!=NULL) && (!IsEmptyStr(WCC->ugname)) && - (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0)); + (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0)); } int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP) @@ -3023,7 +3130,7 @@ int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_PERMANENT) != 0)); + ((WCC->CurRoom.QRFlags & QR_PERMANENT) != 0)); } int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP) @@ -3031,7 +3138,7 @@ int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_INUSE) != 0)); + ((WCC->CurRoom.QRFlags & QR_INUSE) != 0)); } int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP) @@ -3039,7 +3146,7 @@ int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_PRIVATE) != 0)); + ((WCC->CurRoom.QRFlags & QR_PRIVATE) != 0)); } int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP) @@ -3047,7 +3154,7 @@ int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_PASSWORDED) != 0)); + ((WCC->CurRoom.QRFlags & QR_PASSWORDED) != 0)); } int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP) @@ -3055,7 +3162,7 @@ int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_GUESSNAME) != 0)); + ((WCC->CurRoom.QRFlags & QR_GUESSNAME) != 0)); } int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP) @@ -3063,7 +3170,7 @@ int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_DIRECTORY) != 0)); + ((WCC->CurRoom.QRFlags & QR_DIRECTORY) != 0)); } int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP) @@ -3071,7 +3178,7 @@ int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_UPLOAD) != 0)); + ((WCC->CurRoom.QRFlags & QR_UPLOAD) != 0)); } int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP) @@ -3079,7 +3186,7 @@ int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_DOWNLOAD) != 0)); + ((WCC->CurRoom.QRFlags & QR_DOWNLOAD) != 0)); } int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP) @@ -3087,7 +3194,7 @@ int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_VISDIR) != 0)); + ((WCC->CurRoom.QRFlags & QR_VISDIR) != 0)); } int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP) @@ -3095,7 +3202,7 @@ int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_ANONONLY) != 0)); + ((WCC->CurRoom.QRFlags & QR_ANONONLY) != 0)); } int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP) @@ -3103,7 +3210,7 @@ int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_ANONOPT) != 0)); + ((WCC->CurRoom.QRFlags & QR_ANONOPT) != 0)); } int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP) @@ -3111,7 +3218,7 @@ int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_NETWORK) != 0)); + ((WCC->CurRoom.QRFlags & QR_NETWORK) != 0)); } int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP) @@ -3119,7 +3226,7 @@ int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_PREFONLY) != 0)); + ((WCC->CurRoom.QRFlags & QR_PREFONLY) != 0)); } int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP) @@ -3127,7 +3234,7 @@ int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_READONLY) != 0)); + ((WCC->CurRoom.QRFlags & QR_READONLY) != 0)); } int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP) @@ -3135,7 +3242,7 @@ int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP) wcsession *WCC = WC; return ((WCC!=NULL) && - ((WCC->room_flags & QR_MAILBOX) != 0)); + ((WCC->CurRoom.QRFlags & QR_MAILBOX) != 0)); } @@ -3149,7 +3256,7 @@ int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP) return ( (WCC!= NULL) && ((WCC->axlevel >= 6) || (WCC->is_room_aide) || - (WCC->is_mailbox) )); + (WCC->CurRoom.is_inbox) )); } int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP) @@ -3162,7 +3269,7 @@ int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP) (TP->Tokens->Params[2]->len < 7)) return 0; - switch(WCC->wc_view) { + switch(WCC->CurRoom.view) { case VIEW_BBS: return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS")); case VIEW_MAILBOX: @@ -3235,10 +3342,13 @@ InitModule_ROOMOPS RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE); + RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE); + RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE); RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE); + RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE); RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE); RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG); @@ -3250,6 +3360,7 @@ void SessionDestroyModule_ROOMOPS (wcsession *sess) { + FlushFolder(&sess->CurRoom); if (sess->cache_fold != NULL) { free(sess->cache_fold); } diff --git a/webcit/roomops.h b/webcit/roomops.h index 19d151e29..8cdf095e0 100644 --- a/webcit/roomops.h +++ b/webcit/roomops.h @@ -74,14 +74,28 @@ typedef struct _folder { StrBuf **RoomNameParts; const floor *Floor; /* pint to the floor we're on.. */ - StrBuf *room; /* which roomname ??? */ - int hasnewmsgs; /* are there unread messages inside */ int is_inbox; /* is it a mailbox? */ + + + int selectable; /* can we select it ??? */ long num_rooms; /* If this is a floor, how many rooms does it have */ + +/* Only available from the GOTO context... */ + long nNewMessages; + long nTotalMessages; + long LastMessageRead; + long HighestRead; + int ShowInfo; + int UsersNewMAilboxMessages; /* should we notify the user about new messages? */ + int IsTrash; + }folder; HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP); +void vDeleteFolder(void *vFolder); +void FlushFolder(folder *room); +void ParseGoto(folder *proom, StrBuf *Line); diff --git a/webcit/smtpqueue.c b/webcit/smtpqueue.c index 16ae09ae1..dc8eb3eff 100644 --- a/webcit/smtpqueue.c +++ b/webcit/smtpqueue.c @@ -178,7 +178,7 @@ void display_smtpqueue_inner_div(void) { Buf = NewStrBufPlain(HKEY("__CitadelSMTPspoolout__")); gotoroom(Buf); FreeStrBuf(&Buf); - if (!strcasecmp(ChrPtr(WCC->wc_roomname), "__CitadelSMTPspoolout__")) { + if (!strcasecmp(ChrPtr(WCC->CurRoom.name), "__CitadelSMTPspoolout__")) { Stat.maxload = 10000; Stat.lowest_found = (-1); diff --git a/webcit/summary.c b/webcit/summary.c index 44a6bb35b..1e81a59d0 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -95,7 +95,8 @@ void tasks_section(void) { Buf = NewStrBufPlain(HKEY("_TASKS_")); gotoroom(Buf); FreeStrBuf(&Buf); - if (WCC->wc_view != VIEW_TASKS) { + + if (WCC->CurRoom.view != VIEW_TASKS) { num_msgs = 0; } else { @@ -143,7 +144,7 @@ void calendar_section(void) { Buf = NewStrBufPlain(HKEY("_CALENDAR_")); gotoroom(Buf); FreeStrBuf(&Buf); - if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) { + if ( (WC->CurRoom.view != VIEW_CALENDAR) && (WC->CurRoom.view != VIEW_CALBRIEF) ) { num_msgs = 0; } else { diff --git a/webcit/sysmsgs.c b/webcit/sysmsgs.c index f35097eb3..2ce5eabfc 100644 --- a/webcit/sysmsgs.c +++ b/webcit/sysmsgs.c @@ -85,7 +85,7 @@ void save_edit(char *description, char *enter_cmd, int regoto) serv_puts("000"); if (regoto) { - smart_goto(WC->wc_roomname); + smart_goto(WC->CurRoom.name); } else { sprintf(WC->ImportantMessage, _("%s has been saved."), diff --git a/webcit/tasks.c b/webcit/tasks.c index 7b9552e86..373da4fcf 100644 --- a/webcit/tasks.c +++ b/webcit/tasks.c @@ -133,7 +133,7 @@ int tasks_RenderView_or_Tail(SharedMessageStatus *Stat, p = icalcomponent_get_first_property(Cal->cal, ICAL_SUMMARY_PROPERTY); wc_printf("cal_msgnum); - urlescputs(ChrPtr(WC->wc_roomname)); + urlescputs(ChrPtr(WC->CurRoom.name)); wc_printf("\">"); /* wc_printf(" "); */ diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 787d7d51c..cca07c265 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -52,9 +52,9 @@ void display_addressbook(long msgnum, char alpha) { display_vcard(WC->WBuf, vcard_source, alpha, 0, NULL, msgnum); /* If it's my vCard I can edit it */ - if ( (!strcasecmp(ChrPtr(WC->wc_roomname), USERCONFIGROOM)) - || (!strcasecmp(&(ChrPtr(WC->wc_roomname)[11]), USERCONFIGROOM)) - || (WC->wc_view == VIEW_ADDRESSBOOK) + if ( (!strcasecmp(ChrPtr(WC->CurRoom.name), USERCONFIGROOM)) + || (!strcasecmp(&(ChrPtr(WC->CurRoom.name)[11]), USERCONFIGROOM)) + || (WC->CurRoom.view == VIEW_ADDRESSBOOK) ) { wc_printf("", diff --git a/webcit/webcit.c b/webcit/webcit.c index 59347777d..e284f22ac 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -653,11 +653,11 @@ void session_loop(void) * If we aren't in any room yet, but we have cookie data telling us where we're * supposed to be, and 'gotofirst' was not specified, then go there. */ - else if ( (StrLength(WCC->wc_roomname) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) { + else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) { int ret; lprintf(9, "We are in '%s' but cookie indicates '%s', going there...\n", - ChrPtr(WCC->wc_roomname), + ChrPtr(WCC->CurRoom.name), ChrPtr(WCC->Hdr->c_roomname) ); ret = gotoroom(WCC->Hdr->c_roomname); /* do quietly to avoid session output! */ diff --git a/webcit/webcit.h b/webcit/webcit.h index 3f3fc6b30..b38a9c975 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -89,8 +89,8 @@ #include "subst.h" #include "messages.h" #include "paramhandling.h" -#include "preferences.h" #include "roomops.h" +#include "preferences.h" #ifdef HAVE_OPENSSL /* Work around RedHat's b0rken OpenSSL includes */ @@ -116,7 +116,7 @@ extern char *ssl_cipher_list; #define DEVELOPER_ID 0 #define CLIENT_ID 4 #define CLIENT_VERSION 780 /* This version of WebCit */ -#define MINIMUM_CIT_VERSION 780 /* min required Citadel ver */ +#define MINIMUM_CIT_VERSION 770 /* min required Citadel ver */ #define LIBCITADEL_MIN 766 /* min required libcitadel ver */ #define DEFAULT_HOST "localhost" /* Default Citadel server */ #define DEFAULT_PORT "504" @@ -178,6 +178,7 @@ extern char *ssl_cipher_list; #define UA_POSTALLOWED 32 #define UA_ADMINALLOWED 64 #define UA_DELETEALLOWED 128 +#define UA_ISTRASH 256 /* Only available in room view... */ /* @@ -479,14 +480,16 @@ struct wcsession { int time_format_cache; /* which timeformat does our user like? */ /* current room related */ - StrBuf *wc_roomname; /* Room we are currently in */ - unsigned room_flags; /* flags associated with the current room */ - unsigned room_flags2; /* flags associated with the current room */ - int wc_view; /* view for the current room */ - int wc_default_view; /* default view for the current room */ - int wc_is_trash; /* nonzero == current room is a Trash folder */ - int wc_floor; /* floor number of current room */ - int is_mailbox; /* the current room is a private mailbox */ +/* StrBuf *wc_roomname; / * Room we are currently in */ +/* unsigned room_flags; / * flags associated with the current room */ +/* unsigned room_flags2; / * flags associated with the current room */ +/* int wc_view; / * view for the current room */ +/* int wc_default_view; / * default view for the current room */ +/* int wc_is_trash; / * nonzero == current room is a Trash folder */ +/* int wc_floor; / * floor number of current room */ +/* int is_mailbox; / * the current room is a private mailbox */ + + folder CurRoom; /* information about our current room */ /* next/previous room thingabob */ struct march *march; /* march mode room list */ @@ -769,7 +772,6 @@ int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf); int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize); int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize); int read_server_text(StrBuf *Buf, long *nLines); -int goto_config_room(StrBuf *Buf); long locate_user_vcard_in_this_room(message_summary **VCMsg, wc_mime_attachment **VCAtt); void sleeeeeeeeeep(int); diff --git a/webcit/wiki.c b/webcit/wiki.c index c4292f609..b8701d108 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -46,19 +46,19 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev if (StrLength(roomname) > 0) { /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { gotoroom(roomname); } /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); return; } } - if (WC->wc_view != VIEW_WIKI) { + if (WC->CurRoom.view != VIEW_WIKI) { wc_printf(_("'%s' is not a Wiki room."), ChrPtr(roomname)); return; } @@ -139,12 +139,12 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) if (StrLength(roomname) > 0) { /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { gotoroom(roomname); } /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); return; } @@ -261,12 +261,12 @@ void tmplput_display_wiki_pagelist(StrBuf *Target, WCTemplputParams *TP) roomname = sbstr("room"); if (StrLength(roomname) > 0) { /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { gotoroom(roomname); } /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->wc_roomname))) { + if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); return; } @@ -327,7 +327,7 @@ int wiki_Cleanup(void **ViewSpecific) { char pagename[5]; safestrncpy(pagename, "home", sizeof pagename); - display_wiki_page_backend(WC->wc_roomname, pagename, "", 0); + display_wiki_page_backend(WC->CurRoom.name, pagename, "", 0); wDumpContent(1); return 0; } -- 2.30.2