From ad4801a14334e5e55f058445d13334c279804e37 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 14 Aug 2021 11:50:37 -0400 Subject: [PATCH] Additional work on the alias table. This is taking longer than it ought to because I am using it to prototype a design pattern for WebCit-NG. Also began removing some of the cached session stuff. --- webcit/po/webcit/create-pot.sh | 1 + webcit/siteconfig.c | 53 ++--- webcit/sitemap.c | 8 +- webcit/static.c | 12 +- .../static/t/aide/siteconfig/tab_aliases.html | 34 ++- webcit/static/wclib.js | 43 +++- webcit/summary.c | 14 +- webcit/sysdep.c | 7 +- webcit/tasks.c | 15 +- webcit/tcp_sockets.c | 213 +++++++++--------- webcit/useredit.c | 7 +- webcit/vcard_edit.c | 39 ++-- webcit/who.c | 3 +- webcit/wiki.c | 14 +- 14 files changed, 238 insertions(+), 225 deletions(-) diff --git a/webcit/po/webcit/create-pot.sh b/webcit/po/webcit/create-pot.sh index c2ac2117f..b3d942df9 100755 --- a/webcit/po/webcit/create-pot.sh +++ b/webcit/po/webcit/create-pot.sh @@ -2,6 +2,7 @@ CSOURCES=`find ../.. -name \*.c` HSOURCES=`find ../.. -name \*.html` +JSOURCES=`find ../.. -name \*.js` echo Updating webcit.pot from strings in the source code ... xgettext \ diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index 4fa5541b1..fc8cd1181 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -1,7 +1,7 @@ /* * Administrative screen for site-wide configuration * - * Copyright (c) 1996-2014 by the citadel.org team + * Copyright (c) 1996-2021 by the citadel.org team * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. @@ -39,7 +39,6 @@ ConstStr ExpirePolicyStrings[][2] = { void LoadExpirePolicy(GPEXWhichPolicy which) { StrBuf *Buf; - wcsession *WCC = WC; long State; const char *Pos = NULL; @@ -48,8 +47,8 @@ void LoadExpirePolicy(GPEXWhichPolicy which) StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, &State) == 2) { Pos = ChrPtr(Buf) + 4; - WCC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|'); - WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|'); + WC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|'); + WC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|'); } else if (State == 550) AppendImportantMessage(_("Higher access is required to access this function."), -1); @@ -76,7 +75,6 @@ void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which) int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP) { - wcsession *WCC = WC; GPEXWhichPolicy which; int CompareWith; @@ -85,28 +83,26 @@ int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP) LoadExpirePolicy(which); - return WCC->Policy[which].expire_mode == CompareWith; + return WC->Policy[which].expire_mode == CompareWith; } void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP) { GPEXWhichPolicy which; - wcsession *WCC = WC; which = GetTemplateTokenNumber(Target, TP, 0, 0); LoadExpirePolicy(which); - StrBufAppendPrintf(Target, "%d", WCC->Policy[which].expire_value); + StrBufAppendPrintf(Target, "%d", WC->Policy[which].expire_value); } void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP) { GPEXWhichPolicy which; - wcsession *WCC = WC; which = GetTemplateTokenNumber(Target, TP, 2, 0); LoadExpirePolicy(which); - StrBufAppendPrintf(Target, "%d", WCC->Policy[which].expire_mode); + StrBufAppendPrintf(Target, "%d", WC->Policy[which].expire_mode); } @@ -232,15 +228,14 @@ CfgMapping ServerConfig[] = { */ void load_siteconfig(void) { - wcsession *WCC = WC; StrBuf *Buf; HashList *Cfg; long len; int i, j; - if (WCC->ServCfg == NULL) - WCC->ServCfg = NewHash(1, NULL); - Cfg = WCC->ServCfg; + if (WC->ServCfg == NULL) + WC->ServCfg = NewHash(1, NULL); + Cfg = WC->ServCfg; Buf = NewStrBuf(); @@ -290,7 +285,6 @@ void load_siteconfig(void) */ void siteconfig(void) { - wcsession *WCC = WC; int i, value; StrBuf *Line; @@ -341,24 +335,25 @@ void siteconfig(void) SaveExpirePolicyFromHTTP(sitepolicy); SaveExpirePolicyFromHTTP(mailboxespolicy); - FreeStrBuf(&WCC->serv_info->serv_default_cal_zone); - WCC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone")); + FreeStrBuf(&WC->serv_info->serv_default_cal_zone); + WC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone")); AppendImportantMessage(_("Your system configuration has been updated."), -1); - DeleteHash(&WCC->ServCfg); + DeleteHash(&WC->ServCfg); display_aide_menu(); } + +// if WebCit Classic wasn't obsolete we would replace this with a "CONF GETVAL" type of thing void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP) { - wcsession *WCC = WC; void *vBuf; StrBuf *Buf; - if (WCC->is_aide) { - if (WCC->ServCfg == NULL) + if (WC->is_aide) { + if (WC->ServCfg == NULL) load_siteconfig(); - GetHash(WCC->ServCfg, TKEY(0), &vBuf); + GetHash(WC->ServCfg, TKEY(0), &vBuf); Buf = (StrBuf*) vBuf; StrBufAppendTemplate(Target, TP, Buf, 1); } @@ -366,14 +361,13 @@ void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP) int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP) { - wcsession *WCC = WC; void *vBuf; StrBuf *Buf; - if (WCC->is_aide) { - if (WCC->ServCfg == NULL) + if (WC->is_aide) { + if (WC->ServCfg == NULL) load_siteconfig(); - GetHash(WCC->ServCfg, TKEY(2), &vBuf); + GetHash(WC->ServCfg, TKEY(2), &vBuf); if (vBuf == NULL) return 0; Buf = (StrBuf*) vBuf; if (TP->Tokens->nParameters == 3) { @@ -398,15 +392,14 @@ int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP) int ConditionalServCfgCTXStrBuf(StrBuf *Target, WCTemplputParams *TP) { - wcsession *WCC = WC; void *vBuf; StrBuf *Buf; StrBuf *ZoneToCheck = (StrBuf*) CTX(CTX_STRBUF); - if ((WCC->is_aide) || (ZoneToCheck == NULL)) { - if (WCC->ServCfg == NULL) + if ((WC->is_aide) || (ZoneToCheck == NULL)) { + if (WC->ServCfg == NULL) load_siteconfig(); - GetHash(WCC->ServCfg, TKEY(2), &vBuf); + GetHash(WC->ServCfg, TKEY(2), &vBuf); if (vBuf == NULL) return 0; Buf = (StrBuf*) vBuf; diff --git a/webcit/sitemap.c b/webcit/sitemap.c index f4b67805f..4a6448b82 100644 --- a/webcit/sitemap.c +++ b/webcit/sitemap.c @@ -1,7 +1,7 @@ /* * XML sitemap generator * - * Copyright (c) 2010-2012 by the citadel.org team + * Copyright (c) 2010-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3. @@ -20,7 +20,6 @@ * XML sitemap generator -- go through the message list for a BBS room */ void sitemap_do_bbs(void) { - wcsession *WCC = WC; int num_msgs = 0; int i; SharedMessageStatus Stat; @@ -34,7 +33,7 @@ void sitemap_do_bbs(void) { if (num_msgs < 1) return; for (i=0; isumm); + Msg = GetMessagePtrAt(i, WC->summ); if (Msg != NULL) { wc_printf("%s/readfwd", ChrPtr(site_prefix)); wc_printf("?go="); @@ -50,7 +49,6 @@ void sitemap_do_bbs(void) { * XML sitemap generator -- go through the message list for a wiki room */ void sitemap_do_wiki(void) { - wcsession *WCC = WC; int num_msgs = 0; int i; SharedMessageStatus Stat; @@ -65,7 +63,7 @@ void sitemap_do_wiki(void) { if (num_msgs < 1) return; for (i=0; isumm); + Msg = GetMessagePtrAt(i, WC->summ); if (Msg != NULL) { serv_printf("MSG0 %ld|3", Msg->msgnum); diff --git a/webcit/static.c b/webcit/static.c index 34a656ee2..58e447047 100644 --- a/webcit/static.c +++ b/webcit/static.c @@ -286,13 +286,12 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) void output_flat_static(void) { - wcsession *WCC = WC; void *vFile; StrBuf *File; - if (WCC->Hdr->HR.Handler == NULL) + if (WC->Hdr->HR.Handler == NULL) return; - if (GetHash(StaticFilemappings[0], SKEY(WCC->Hdr->HR.Handler->Name), &vFile) && + if (GetHash(StaticFilemappings[0], SKEY(WC->Hdr->HR.Handler->Name), &vFile) && (vFile != NULL)) { File = (StrBuf*) vFile; @@ -302,12 +301,11 @@ void output_flat_static(void) void output_static_safe(HashList *DirList) { - wcsession *WCC = WC; void *vFile; StrBuf *File; const char *MimeType; - if (GetHash(DirList, SKEY(WCC->Hdr->HR.ReqLine), &vFile) && + if (GetHash(DirList, SKEY(WC->Hdr->HR.ReqLine), &vFile) && (vFile != NULL)) { File = (StrBuf*) vFile; @@ -315,8 +313,8 @@ void output_static_safe(HashList *DirList) } else { syslog(LOG_INFO, "output_static_safe() file %s not found. \n", - ChrPtr(WCC->Hdr->HR.ReqLine)); - MimeType = GuessMimeByFilename(SKEY(WCC->Hdr->HR.ReqLine)); + ChrPtr(WC->Hdr->HR.ReqLine)); + MimeType = GuessMimeByFilename(SKEY(WC->Hdr->HR.ReqLine)); if (strstr(MimeType, "image/") != NULL) { output_error_pic("the file you requested isn't known to our cache", "maybe reload webcit?"); diff --git a/webcit/static/t/aide/siteconfig/tab_aliases.html b/webcit/static/t/aide/siteconfig/tab_aliases.html index 5058d0512..81cc06517 100644 --- a/webcit/static/t/aide/siteconfig/tab_aliases.html +++ b/webcit/static/t/aide/siteconfig/tab_aliases.html @@ -1,10 +1,14 @@ -
+
+

+ + - - diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index e9f88042e..59bbc84b2 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -999,7 +999,7 @@ function create_blog() create_blog_room: { nonce: Nonce, er_name: roomname, - type: 'public', + type: 'public', er_view: er_view_blog, er_floor: floorID, template: "room_result_json", @@ -1008,8 +1008,8 @@ function create_blog() setflags_blog_room: { nonce: Nonce, er_name: roomname, - go: roomname, - type: 'public', + go: roomname, + type: 'public', er_floor: floorID, directory: "yes", @@ -1019,7 +1019,7 @@ function create_blog() ulmsg: "no", visdir: "no", - anon: "no", + anon: "no", last_tabsel: 1, er_view: er_view_blog, template: "room_result_json", @@ -1028,7 +1028,7 @@ function create_blog() create_blog_edit_room: { nonce: Nonce, er_name: editroomname, - type: type_edit, + type: type_edit, er_view: vselectedMarkup, er_floor: floorID, er_password: passvoid, @@ -1038,8 +1038,8 @@ function create_blog() setflags_blog_edit_room: { nonce: Nonce, er_name: editroomname, - go: editroomname, - type: type_edit, + go: editroomname, + type: type_edit, er_floor: floorID, directory: "yes", @@ -1049,7 +1049,7 @@ function create_blog() ulmsg: "no", visdir: "yes", - anon: "no", + anon: "no", last_tabsel: 1, er_view: er_view_blog, template: "room_result_json", @@ -1058,7 +1058,7 @@ function create_blog() blog_wiki_startmessage : { nonce: Nonce, force_room: editroomname, - page: "home", + page: "home", markdown: (isHtmlWiki)?0:1, msgtext: starttext @@ -1141,4 +1141,27 @@ function publishMessage() wCLog(transport.responseText); } }); -} \ No newline at end of file +} + + + + +// Generate a random string of the specified length +// Useful for generating one-time-use div names +// +function randomString(length) { + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz'.split(''); + var str = ''; + + if (!length) { + length = Math.floor(Math.random() * chars.length); + } + for (var i = 0; i < length; i++) { + str += chars[Math.floor(Math.random() * chars.length)]; + } + return str; +} + + + + diff --git a/webcit/summary.c b/webcit/summary.c index faa4f45b2..5dbe60435 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -1,7 +1,7 @@ /* * Displays the "Summary Page" * - * Copyright (c) 1996-2012 by the citadel.org team + * Copyright (c) 1996-2021 by the citadel.org team * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. @@ -94,7 +94,6 @@ void tasks_section(void) { long HKLen; void *vMsg; message_summary *Msg; - wcsession *WCC = WC; StrBuf *Buf; SharedMessageStatus Stat; @@ -107,7 +106,7 @@ void tasks_section(void) { gotoroom(Buf); FreeStrBuf(&Buf); - if (WCC->CurRoom.view != VIEW_TASKS) { + if (WC->CurRoom.view != VIEW_TASKS) { num_msgs = 0; } else { @@ -115,8 +114,8 @@ void tasks_section(void) { } if (num_msgs > 0) { - at = GetNewHashPos(WCC->summ, 0); - while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) { + at = GetNewHashPos(WC->summ, 0); + while (GetNextHashPos(WC->summ, at, &HKLen, &HashKey, &vMsg)) { Msg = (message_summary*) vMsg; tasks_LoadMsgFromServer(NULL, NULL, Msg, 0, 0); } @@ -143,7 +142,6 @@ void calendar_section(void) { long HKLen; void *vMsg; message_summary *Msg; - wcsession *WCC = WC; StrBuf *Buf; void *v = NULL; SharedMessageStatus Stat; @@ -172,8 +170,8 @@ void calendar_section(void) { if (num_msgs > 0) { - at = GetNewHashPos(WCC->summ, 0); - while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) { + at = GetNewHashPos(WC->summ, 0); + while (GetNextHashPos(WC->summ, at, &HKLen, &HashKey, &vMsg)) { Msg = (message_summary*) vMsg; calendar_LoadMsgFromServer(NULL, &v, Msg, 0, 0); } diff --git a/webcit/sysdep.c b/webcit/sysdep.c index bba4147aa..e5fcc2a80 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -1,7 +1,7 @@ /* * WebCit "system dependent" code. * - * Copyright (c) 1996-2012 by the citadel.org team + * Copyright (c) 1996-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3. @@ -133,10 +133,9 @@ void LoadMimeBlacklist(void) void CheckGZipCompressionAllowed(const char *MimeType, long MLen) { void *v; - wcsession *WCC = WC; - if (WCC->Hdr->HR.gzip_ok) - WCC->Hdr->HR.gzip_ok = GetHash(GZMimeBlackList, MimeType, MLen, &v) == 0; + if (WC->Hdr->HR.gzip_ok) + WC->Hdr->HR.gzip_ok = GetHash(GZMimeBlackList, MimeType, MLen, &v) == 0; } void InitialiseSemaphores(void) diff --git a/webcit/tasks.c b/webcit/tasks.c index 66b05e3e0..b3543826f 100644 --- a/webcit/tasks.c +++ b/webcit/tasks.c @@ -87,7 +87,6 @@ int tasks_RenderView_or_Tail(SharedMessageStatus *Stat, time_t due; char buf[SIZ]; icalproperty *p; - wcsession *WCC = WC; wc_printf("\n\n
"); wc_printf(_("Completed?")); @@ -115,8 +114,8 @@ int tasks_RenderView_or_Tail(SharedMessageStatus *Stat, task_completed_cmp); } - Pos = GetNewHashPos(WCC->disp_cal_items, 0); - while (GetNextHashPos(WCC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) { + Pos = GetNewHashPos(WC->disp_cal_items, 0); + while (GetNextHashPos(WC->disp_cal_items, Pos, &hklen, &HashKey, &vCal)) { icalproperty_status todoStatus; int is_date; @@ -176,7 +175,6 @@ int tasks_RenderView_or_Tail(SharedMessageStatus *Stat, void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, char *from, int unread, calview *calv) { - wcsession *WCC = WC; icalcomponent *vtodo; icalproperty *p; struct icaltimetype IcalTime; @@ -233,7 +231,7 @@ void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum, ch wc_printf("
\n "); wc_printf("WBuf, WCC->CurRoom.name, NULL, 0, 0); + StrEscAppend(WC->WBuf, WC->CurRoom.name, NULL, 0, 0); wc_printf("\">\n"); wc_printf("\n", WC->nonce); @@ -603,7 +601,6 @@ void load_task(icalcomponent *event, long msgnum, char *from, int unread, calvie { icalproperty *ps = NULL; struct icaltimetype dtstart, dtend; - wcsession *WCC = WC; disp_cal *Cal; size_t len; icalcomponent *cptr = NULL; @@ -611,8 +608,8 @@ void load_task(icalcomponent *event, long msgnum, char *from, int unread, calvie dtstart = icaltime_null_time(); dtend = icaltime_null_time(); - if (WCC->disp_cal_items == NULL) { - WCC->disp_cal_items = NewHash(0, Flathash); + if (WC->disp_cal_items == NULL) { + WC->disp_cal_items = NewHash(0, Flathash); } Cal = (disp_cal*) malloc(sizeof(disp_cal)); @@ -655,7 +652,7 @@ void load_task(icalcomponent *event, long msgnum, char *from, int unread, calvie /* Store it in the hash list. */ /* syslog(LOG_DEBUG, "INITIAL: %s", ctime(&Cal->event_start)); */ - Put(WCC->disp_cal_items, + Put(WC->disp_cal_items, (char*) &Cal->event_start, sizeof(Cal->event_start), Cal, diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index ad4903afc..ff07fc63d 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1987-2017 by the citadel.org team + * Copyright (c) 1987-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3. @@ -161,19 +161,18 @@ int tcp_connectsock(char *host, char *service) */ int serv_getln(char *strbuf, int bufsize) { - wcsession *WCC = WC; int len; *strbuf = '\0'; - StrBuf_ServGetln(WCC->MigrateReadLineBuf); - len = StrLength(WCC->MigrateReadLineBuf); + StrBuf_ServGetln(WC->MigrateReadLineBuf); + len = StrLength(WC->MigrateReadLineBuf); if (len > bufsize) len = bufsize - 1; - memcpy(strbuf, ChrPtr(WCC->MigrateReadLineBuf), len); - FlushStrBuf(WCC->MigrateReadLineBuf); + memcpy(strbuf, ChrPtr(WC->MigrateReadLineBuf), len); + FlushStrBuf(WC->MigrateReadLineBuf); strbuf[len] = '\0'; #ifdef SERV_TRACE - syslog(LOG_DEBUG, "%3d<<<%s\n", WCC->serv_sock, strbuf); + syslog(LOG_DEBUG, "%3d<<<%s\n", WC->serv_sock, strbuf); #endif return len; } @@ -181,18 +180,17 @@ int serv_getln(char *strbuf, int bufsize) int StrBuf_ServGetln(StrBuf *buf) { - wcsession *WCC = WC; const char *ErrStr = NULL; int rc; - if (!WCC->connected) + if (!WC->connected) return -1; FlushStrBuf(buf); rc = StrBufTCP_read_buffered_line_fast(buf, - WCC->ReadBuf, - &WCC->ReadPos, - &WCC->serv_sock, + WC->ReadBuf, + &WC->ReadPos, + &WC->serv_sock, 5, 1, &ErrStr); if (rc < 0) @@ -200,17 +198,17 @@ int StrBuf_ServGetln(StrBuf *buf) syslog(LOG_INFO, "StrBuf_ServGetln(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); wc_backtrace(LOG_INFO); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; } #ifdef SERV_TRACE else { long pos = 0; - if (WCC->ReadPos != NULL) - pos = WCC->ReadPos - ChrPtr(WCC->ReadBuf); + if (WC->ReadPos != NULL) + pos = WC->ReadPos - ChrPtr(WC->ReadBuf); syslog(LOG_DEBUG, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf)); } #endif @@ -219,14 +217,13 @@ int StrBuf_ServGetln(StrBuf *buf) int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) { - wcsession *WCC = WC; const char *ErrStr; int rc; rc = StrBufReadBLOBBuffered(buf, - WCC->ReadBuf, - &WCC->ReadPos, - &WCC->serv_sock, + WC->ReadBuf, + &WC->ReadPos, + &WC->serv_sock, 1, BlobSize, NNN_TERM, @@ -236,10 +233,10 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) syslog(LOG_INFO, "StrBuf_ServGetBLOBBuffered(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); wc_backtrace(LOG_INFO); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; } #ifdef SERV_TRACE else @@ -251,21 +248,20 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize) { - wcsession *WCC = WC; const char *ErrStr; int rc; - WCC->ReadPos = NULL; - rc = StrBufReadBLOB(buf, &WCC->serv_sock, 1, BlobSize, &ErrStr); + WC->ReadPos = NULL; + rc = StrBufReadBLOB(buf, &WC->serv_sock, 1, BlobSize, &ErrStr); if (rc < 0) { syslog(LOG_INFO, "StrBuf_ServGetBLOB(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); wc_backtrace(LOG_INFO); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; } #ifdef SERV_TRACE else @@ -281,21 +277,20 @@ void FlushReadBuf (void) long len; const char *pch; const char *pche; - wcsession *WCC = WC; - len = StrLength(WCC->ReadBuf); + len = StrLength(WC->ReadBuf); if ((len > 0) && - (WCC->ReadPos != NULL) && - (WCC->ReadPos != StrBufNOTNULL)) + (WC->ReadPos != NULL) && + (WC->ReadPos != StrBufNOTNULL)) { - pch = ChrPtr(WCC->ReadBuf); + pch = ChrPtr(WC->ReadBuf); pche = pch + len; - if (WCC->ReadPos != pche) + if (WC->ReadPos != pche) { syslog(LOG_ERR, "ERROR: somebody didn't eat his soup! Remaing Chars: %ld [%s]\n", - (long)(pche - WCC->ReadPos), + (long)(pche - WC->ReadPos), pche ); syslog(LOG_ERR, @@ -307,8 +302,8 @@ void FlushReadBuf (void) } } - FlushStrBuf(WCC->ReadBuf); - WCC->ReadPos = NULL; + FlushStrBuf(WC->ReadBuf); + WC->ReadPos = NULL; } @@ -321,22 +316,21 @@ void FlushReadBuf (void) */ int serv_write(const char *buf, int nbytes) { - wcsession *WCC = WC; int bytes_written = 0; int retval; FlushReadBuf(); while (bytes_written < nbytes) { - retval = write(WCC->serv_sock, &buf[bytes_written], + retval = write(WC->serv_sock, &buf[bytes_written], nbytes - bytes_written); if (retval < 1) { const char *ErrStr = strerror(errno); syslog(LOG_INFO, "serv_write(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; return 0; } bytes_written = bytes_written + retval; @@ -413,7 +407,6 @@ int serv_printf(const char *format,...) */ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) { - wcsession *WCC = WC; size_t bytes_read = 0; size_t this_block = 0; int rc = 6; @@ -425,7 +418,7 @@ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) while ((bytes_read < total_len) && (ServerRc == 6)) { - if (WCC->serv_sock==-1) { + if (WC->serv_sock==-1) { FlushStrBuf(Ret); return -1; } @@ -442,10 +435,10 @@ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) if (rc < 0) { syslog(LOG_INFO, "Server connection broken during download\n"); wc_backtrace(LOG_INFO); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; return rc; } bytes_read += rc; @@ -458,7 +451,6 @@ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) int client_write(StrBuf *ThisBuf) { - wcsession *WCC = WC; const char *ptr, *eptr; long count; ssize_t res = 0; @@ -471,18 +463,18 @@ int client_write(StrBuf *ThisBuf) fdflags = fcntl(WC->Hdr->http_sock, F_GETFL); - while ((ptr < eptr) && (WCC->Hdr->http_sock != -1)) { + while ((ptr < eptr) && (WC->Hdr->http_sock != -1)) { if ((fdflags & O_NONBLOCK) == O_NONBLOCK) { FD_ZERO(&wset); - FD_SET(WCC->Hdr->http_sock, &wset); - if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { + FD_SET(WC->Hdr->http_sock, &wset); + if (select(WC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { syslog(LOG_INFO, "client_write: Socket select failed (%s)\n", strerror(errno)); return -1; } } - if ((WCC->Hdr->http_sock == -1) || - ((res = write(WCC->Hdr->http_sock, ptr, count)), + if ((WC->Hdr->http_sock == -1) || + ((res = write(WC->Hdr->http_sock, ptr, count)), (res == -1))) { syslog(LOG_INFO, "client_write: Socket write failed (%s)\n", strerror(errno)); @@ -506,7 +498,6 @@ read_serv_chunk( { int rc; int ServerRc; - wcsession *WCC = WC; serv_printf("READ "SIZE_T_FMT"|"SIZE_T_FMT, *bytes_read, total_len-(*bytes_read)); if ( (rc = StrBuf_ServGetln(Buf) > 0) && @@ -519,14 +510,14 @@ read_serv_chunk( StrBufCutLeft(Buf, 4); this_block = StrTol(Buf); - rc = StrBuf_ServGetBLOBBuffered(WCC->WBuf, this_block); + rc = StrBuf_ServGetBLOBBuffered(WC->WBuf, this_block); if (rc < 0) { syslog(LOG_INFO, "Server connection broken during download\n"); wc_backtrace(LOG_INFO); - if (WCC->serv_sock > 0) close(WCC->serv_sock); - WCC->serv_sock = (-1); - WCC->connected = 0; - WCC->logged_in = 0; + if (WC->serv_sock > 0) close(WC->serv_sock); + WC->serv_sock = (-1); + WC->connected = 0; + WC->logged_in = 0; return rc; } *bytes_read += rc; @@ -550,7 +541,6 @@ static inline int send_http(StrBuf *Buf) void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, int detect_mime) { int ServerRc = 6; - wcsession *WCC = WC; size_t bytes_read = 0; int first = 1; int client_con_state = 0; @@ -567,15 +557,15 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, Buf = NewStrBuf(); - if (WCC->Hdr->HaveRange) + if (WC->Hdr->HaveRange) { - WCC->Hdr->HaveRange++; - WCC->Hdr->TotalBytes = total_len; + WC->Hdr->HaveRange++; + WC->Hdr->TotalBytes = total_len; /* open range? or beyound file border? correct the numbers. */ - if ((WCC->Hdr->RangeTil == -1) || (WCC->Hdr->RangeTil>= total_len)) - WCC->Hdr->RangeTil = total_len - 1; - bytes_read = WCC->Hdr->RangeStart; - total_len = WCC->Hdr->RangeTil; + if ((WC->Hdr->RangeTil == -1) || (WC->Hdr->RangeTil>= total_len)) + WC->Hdr->RangeTil = total_len - 1; + bytes_read = WC->Hdr->RangeStart; + total_len = WC->Hdr->RangeTil; } else chunked = total_len > SIZ * 10; /* TODO: disallow for HTTP / 1.0 */ @@ -602,8 +592,8 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, FreeStrBuf(&Buf); return; } - CT = GuessMimeType(SKEY(WCC->WBuf)); - FlushStrBuf(WCC->WBuf); + CT = GuessMimeType(SKEY(WC->WBuf)); + FlushStrBuf(WC->WBuf); StrBufPlain(MimeType, CT, -1); CheckGZipCompressionAllowed(SKEY(MimeType)); detect_mime = 0; @@ -611,7 +601,7 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, } memset(&WriteBuffer, 0, sizeof(IOBuffer)); - if (chunked && !DisableGzip && WCC->Hdr->HR.gzip_ok) + if (chunked && !DisableGzip && WC->Hdr->HR.gzip_ok) { is_gzip = 1; SC = StrBufNewStreamContext (eZLibEncode, &Err); @@ -622,21 +612,21 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, } memset(&ReadBuffer, 0, sizeof(IOBuffer)); - ReadBuffer.Buf = WCC->WBuf; + ReadBuffer.Buf = WC->WBuf; WriteBuffer.Buf = NewStrBufPlain(NULL, SIZ*2);; pBuf = WriteBuffer.Buf; } else { - pBuf = WCC->WBuf; + pBuf = WC->WBuf; } if (!detect_mime) { http_transmit_headers(ChrPtr(MimeType), is_static, chunked, is_gzip); - if (send_http(WCC->HBuf) < 0) + if (send_http(WC->HBuf) < 0) { FreeStrBuf(&Buf); FreeStrBuf(&WriteBuffer.Buf); @@ -653,8 +643,8 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, (client_con_state == 0)) { - if (WCC->serv_sock==-1) { - FlushStrBuf(WCC->WBuf); + if (WC->serv_sock==-1) { + FlushStrBuf(WC->WBuf); FreeStrBuf(&Buf); FreeStrBuf(&WriteBuffer.Buf); FreeStrBuf(&BufHeader); @@ -677,15 +667,15 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, const char *CT; detect_mime = 0; - CT = GuessMimeType(SKEY(WCC->WBuf)); + CT = GuessMimeType(SKEY(WC->WBuf)); StrBufPlain(MimeType, CT, -1); if (is_gzip) { CheckGZipCompressionAllowed(SKEY(MimeType)); - is_gzip = WCC->Hdr->HR.gzip_ok; + is_gzip = WC->Hdr->HR.gzip_ok; } http_transmit_headers(ChrPtr(MimeType), is_static, chunked, is_gzip); - client_con_state = send_http(WCC->HBuf); + client_con_state = send_http(WC->HBuf); } if (is_gzip) @@ -710,7 +700,7 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, } } while ((rc == 1) && (StrLength(pBuf) > 0)); } - FlushStrBuf(WCC->WBuf); + FlushStrBuf(WC->WBuf); } else { if ((chunked) && (client_con_state == 0)) @@ -1051,16 +1041,15 @@ void begin_burst(void) */ long end_burst(void) { - wcsession *WCC = WC; const char *ptr, *eptr; long count; ssize_t res = 0; fd_set wset; int fdflags; - if (!DisableGzip && (WCC->Hdr->HR.gzip_ok)) + if (!DisableGzip && (WC->Hdr->HR.gzip_ok)) { - if (CompressBuffer(WCC->WBuf) > 0) + if (CompressBuffer(WC->WBuf) > 0) hprintf("Content-encoding: gzip\r\n"); else { syslog(LOG_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno)); @@ -1068,44 +1057,44 @@ long end_burst(void) } } - if (WCC->WFBuf != NULL) { - WildFireSerializePayload(WCC->WFBuf, WCC->HBuf, &WCC->Hdr->nWildfireHeaders, NULL); - FreeStrBuf(&WCC->WFBuf); + if (WC->WFBuf != NULL) { + WildFireSerializePayload(WC->WFBuf, WC->HBuf, &WC->Hdr->nWildfireHeaders, NULL); + FreeStrBuf(&WC->WFBuf); } - if (WCC->Hdr->HR.prohibit_caching) + if (WC->Hdr->HR.prohibit_caching) hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n"); - hprintf("Content-length: %d\r\n\r\n", StrLength(WCC->WBuf)); + hprintf("Content-length: %d\r\n\r\n", StrLength(WC->WBuf)); - ptr = ChrPtr(WCC->HBuf); - count = StrLength(WCC->HBuf); + ptr = ChrPtr(WC->HBuf); + count = StrLength(WC->HBuf); eptr = ptr + count; #ifdef HAVE_OPENSSL if (is_https) { - client_write_ssl(WCC->HBuf); - client_write_ssl(WCC->WBuf); + client_write_ssl(WC->HBuf); + client_write_ssl(WC->WBuf); return (count); } #endif - if (WCC->Hdr->http_sock == -1) { + if (WC->Hdr->http_sock == -1) { return -1; } fdflags = fcntl(WC->Hdr->http_sock, F_GETFL); - while ((ptr < eptr) && (WCC->Hdr->http_sock != -1)) { + while ((ptr < eptr) && (WC->Hdr->http_sock != -1)) { if ((fdflags & O_NONBLOCK) == O_NONBLOCK) { FD_ZERO(&wset); - FD_SET(WCC->Hdr->http_sock, &wset); - if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { + FD_SET(WC->Hdr->http_sock, &wset); + if (select(WC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { syslog(LOG_DEBUG, "client_write: Socket select failed (%s)\n", strerror(errno)); return -1; } } - if ((WCC->Hdr->http_sock == -1) || - (res = write(WCC->Hdr->http_sock, + if ((WC->Hdr->http_sock == -1) || + (res = write(WC->Hdr->http_sock, ptr, count)) == -1) { syslog(LOG_DEBUG, "client_write: Socket write failed (%s)\n", strerror(errno)); @@ -1116,22 +1105,22 @@ long end_burst(void) ptr += res; } - ptr = ChrPtr(WCC->WBuf); - count = StrLength(WCC->WBuf); + ptr = ChrPtr(WC->WBuf); + count = StrLength(WC->WBuf); eptr = ptr + count; - while ((ptr < eptr) && (WCC->Hdr->http_sock != -1)) { + while ((ptr < eptr) && (WC->Hdr->http_sock != -1)) { if ((fdflags & O_NONBLOCK) == O_NONBLOCK) { FD_ZERO(&wset); - FD_SET(WCC->Hdr->http_sock, &wset); - if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { + FD_SET(WC->Hdr->http_sock, &wset); + if (select(WC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { syslog(LOG_INFO, "client_write: Socket select failed (%s)\n", strerror(errno)); return -1; } } - if ((WCC->Hdr->http_sock == -1) || - (res = write(WCC->Hdr->http_sock, + if ((WC->Hdr->http_sock == -1) || + (res = write(WC->Hdr->http_sock, ptr, count)) == -1) { syslog(LOG_INFO, "client_write: Socket write failed (%s)\n", strerror(errno)); @@ -1142,7 +1131,7 @@ long end_burst(void) ptr += res; } - return StrLength(WCC->WBuf); + return StrLength(WC->WBuf); } diff --git a/webcit/useredit.c b/webcit/useredit.c index e1fb110ff..80371dc9f 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996-2020 by the citadel.org team + * Copyright (c) 1996-2021 by the citadel.org team * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. @@ -529,7 +529,6 @@ int Conditional_USER_HAS_PIC(StrBuf *Target, WCTemplputParams *TP) */ long locate_user_vcard_in_this_room(message_summary **VCMsg, wc_mime_attachment **VCAtt) { - wcsession *WCC = WC; HashPos *at; HashPos *att; const char *HashKey; @@ -553,8 +552,8 @@ TRYAGAIN: Stat.highest_found = (-1); /* Search for the user's vCard */ if (load_msg_ptrs("MSGS ALL||||1", NULL, NULL, &Stat, NULL, NULL, NULL, NULL, 0) > 0) { - at = GetNewHashPos(WCC->summ, 0); - while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) { + at = GetNewHashPos(WC->summ, 0); + while (GetNextHashPos(WC->summ, at, &HKLen, &HashKey, &vMsg)) { Msg = (message_summary*) vMsg; Msg->MsgBody = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment)); memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment)); diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 9327ec291..d1a16d383 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996-2020 by the citadel.org team + * Copyright (c) 1996-2021 by the citadel.org team * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. @@ -545,18 +545,17 @@ void display_vcard_photo_img(void) struct vCard *v; char *photosrc; const char *contentType; - wcsession *WCC = WC; - msgnum = StrBufExtract_long(WCC->Hdr->HR.ReqLine, 0, '/'); + msgnum = StrBufExtract_long(WC->Hdr->HR.ReqLine, 0, '/'); vcard = load_mimepart(msgnum,"1"); v = VCardLoad(vcard); photosrc = vcard_get_prop(v, "PHOTO", 1,0,0); - FlushStrBuf(WCC->WBuf); - StrBufAppendBufPlain(WCC->WBuf, photosrc, -1, 0); - if (StrBufDecodeBase64(WCC->WBuf) <= 0) { - FlushStrBuf(WCC->WBuf); + FlushStrBuf(WC->WBuf); + StrBufAppendBufPlain(WC->WBuf, photosrc, -1, 0); + if (StrBufDecodeBase64(WC->WBuf) <= 0) { + FlushStrBuf(WC->WBuf); hprintf("HTTP/1.1 500 %s\n","Unable to get photo"); output_headers(0, 0, 0, 0, 0, 0); @@ -566,7 +565,7 @@ void display_vcard_photo_img(void) end_burst(); return; } - contentType = GuessMimeType(ChrPtr(WCC->WBuf), StrLength(WCC->WBuf)); + contentType = GuessMimeType(ChrPtr(WC->WBuf), StrLength(WC->WBuf)); http_transmit_thing(contentType, 0); free(v); free(photosrc); @@ -626,7 +625,6 @@ void do_edit_vcard(long msgnum, char *partnum, const char *return_to, const char *force_room) { WCTemplputParams SubTP; - wcsession *WCC = WC; message_summary *Msg = NULL; wc_mime_attachment *VCMime = NULL; struct vCard *v; @@ -662,7 +660,7 @@ void do_edit_vcard(long msgnum, char *partnum, v = VCardLoad(VCAtt->Data); } - parse_vcard(WCC->WBuf, v, ab.VC, NULL); + parse_vcard(WC->WBuf, v, ab.VC, NULL); vcard_free(v); @@ -675,7 +673,7 @@ void do_edit_vcard(long msgnum, char *partnum, StackContext(TP, &SubTP, &ab, CTX_VCARD, 0, NULL); - DoTemplate(HKEY("vcard_edit"), WCC->WBuf, &SubTP); + DoTemplate(HKEY("vcard_edit"), WC->WBuf, &SubTP); UnStackContext(&SubTP); } DeleteHash(&ab.VC); @@ -910,7 +908,6 @@ int vcard_LoadMsgFromServer(SharedMessageStatus *Stat, int is_new, int i) { - wcsession *WCC = WC; WCTemplputParams *TP = NULL; WCTemplputParams SubTP; vcardview_struct *VS; @@ -934,13 +931,13 @@ int vcard_LoadMsgFromServer(SharedMessageStatus *Stat, abEntry->VC = NewHash(0, lFlathash); abEntry->ab_msgnum = Msg->msgnum; - parse_vcard(WCC->WBuf, v, abEntry->VC, VCMime); + parse_vcard(WC->WBuf, v, abEntry->VC, VCMime); memset(&SubTP, 0, sizeof(WCTemplputParams)); StackContext(TP, &SubTP, abEntry, CTX_VCARD, 0, NULL); // No, don't display the name, it just shits all over the screen - // DoTemplate(HKEY("vcard_list_name"), WCC->WBuf, &SubTP); + // DoTemplate(HKEY("vcard_list_name"), WC->WBuf, &SubTP); UnStackContext(&SubTP); @@ -972,7 +969,6 @@ void do_addrbook_view(vcardview_struct* VS) { StrBuf **tablabels; int num_ab = GetCount(VS->addrbook); HashList *headlines; - wcsession *WCC = WC; WCTemplputParams *TP = NULL; WCTemplputParams SubTP; @@ -1027,11 +1023,11 @@ void do_addrbook_view(vcardview_struct* VS) { StrTabbedDialog(WC->WBuf, num_pages, tablabels); StackContext(TP, &SubTP, VS->addrbook, CTX_VCARD_LIST, 0, NULL); - DoTemplate(HKEY("vcard_list"), WCC->WBuf, &SubTP); + DoTemplate(HKEY("vcard_list"), WC->WBuf, &SubTP); UnStackContext(&SubTP); DeleteHash(&headlines); free(tablabels); - StrBufAppendBufPlain(WCC->WBuf, HKEY("
"), 0);/* closes: id=global */ + StrBufAppendBufPlain(WC->WBuf, HKEY(""), 0);/* closes: id=global */ } @@ -1070,7 +1066,6 @@ int vcard_Cleanup(void **ViewSpecific) void render_MIME_VCard(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset) { wc_mime_attachment *Mime = (wc_mime_attachment *) CTX(CTX_MIME_ATACH); - wcsession *WCC = WC; if (StrLength(Mime->Data) == 0) { MimeLoadData(Mime); } @@ -1080,10 +1075,10 @@ void render_MIME_VCard(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharse Buf = NewStrBuf(); /** If it's my vCard I can edit it */ - if ( (!strcasecmp(ChrPtr(WCC->CurRoom.name), USERCONFIGROOM)) - || ((StrLength(WCC->CurRoom.name) > 11) && - (!strcasecmp(&(ChrPtr(WCC->CurRoom.name)[11]), USERCONFIGROOM))) - || (WCC->CurRoom.view == VIEW_ADDRESSBOOK) + if ( (!strcasecmp(ChrPtr(WC->CurRoom.name), USERCONFIGROOM)) + || ((StrLength(WC->CurRoom.name) > 11) && + (!strcasecmp(&(ChrPtr(WC->CurRoom.name)[11]), USERCONFIGROOM))) + || (WC->CurRoom.view == VIEW_ADDRESSBOOK) ) { StrBufAppendPrintf(Buf, "", Mime->msgnum, ChrPtr(Mime->PartNum)); diff --git a/webcit/who.c b/webcit/who.c index 11c68d86c..dee492caf 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -43,7 +43,6 @@ int CompareUserStruct(const void *VUser1, const void *VUser2) int GetWholistSection(HashList *List, time_t now, StrBuf *Buf, const char *FilterName, long FNLen) { - wcsession *WCC = WC; UserStateStruct *User, *OldUser; void *VOldUser; size_t BufLen; @@ -94,7 +93,7 @@ int GetWholistSection(HashList *List, time_t now, StrBuf *Buf, const char *Filte OldUser = VOldUser; OldUser->SessionCount++; if (!User->Idle) { - if (User->Session == WCC->ctdl_pid) + if (User->Session == WC->ctdl_pid) OldUser->Session = User->Session; OldUser->Idle = User->Idle; diff --git a/webcit/wiki.c b/webcit/wiki.c index b1822e951..5c522eb4a 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -1,7 +1,7 @@ /* * Functions pertaining to rooms with a wiki view * - * Copyright (c) 2009-2018 by the citadel.org team + * Copyright (c) 2009-2021 by the citadel.org team * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. @@ -32,14 +32,13 @@ void str_wiki_index(StrBuf *s) */ void display_wiki_page_backend(StrBuf *pagename, char *rev, int do_revert) { - wcsession *WCC = WC; const StrBuf *Mime; long msgnum = (-1L); char buf[256]; - if ((WCC->CurRoom.view != VIEW_WIKI) && - (WCC->CurRoom.view != VIEW_WIKIMD)) { - wc_printf(_("'%s' is not a Wiki room."), ChrPtr(WCC->CurRoom.name) ); + if ((WC->CurRoom.view != VIEW_WIKI) && + (WC->CurRoom.view != VIEW_WIKIMD)) { + wc_printf(_("'%s' is not a Wiki room."), ChrPtr(WC->CurRoom.name) ); return; } @@ -63,7 +62,7 @@ void display_wiki_page_backend(StrBuf *pagename, char *rev, int do_revert) } if (msgnum >= 0L) { - read_message(WCC->WBuf, HKEY("view_message"), msgnum, NULL, &Mime, NULL); + read_message(WC->WBuf, HKEY("view_message"), msgnum, NULL, &Mime, NULL); return; } putbstr("pagename", pagename); @@ -270,12 +269,11 @@ int ConditionalHaveWikiPage(StrBuf *Target, WCTemplputParams *TP) int ConditionalHavewikiType(StrBuf *Target, WCTemplputParams *TP) { - wcsession *WCC = WC; const char *pch; long len; GetTemplateTokenString(Target, TP, 2, &pch, &len); - return bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), pch) != NULL; + return bmstrcasestr((char *)ChrPtr(WC->Hdr->HR.ReqLine), pch) != NULL; } -- 2.30.2