X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fdownloads.c;h=f39622495cc9ca918faf1b3624a1ed4e08cd9b41;hb=5d38a76f8f06640e3a3f097d584ac52336110f7c;hp=eb01d64d051404a6ce62308717ecd0496fa002e6;hpb=ec636368885b210420016b3f544edcbab9189880;p=citadel.git diff --git a/webcit/downloads.c b/webcit/downloads.c index eb01d64d0..f39622495 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -3,22 +3,18 @@ * * 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. - * - * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * - * - * */ #include "webcit.h" #include "webserver.h" +CtxType CTX_FILELIST = CTX_NONE; + extern void output_static(const char* What); extern char* static_dirs[]; @@ -44,22 +40,22 @@ void FreeFiles(void *vFile) /* -------------------------------------------------------------------------------- */ void tmplput_FILE_NAME(StrBuf *Target, WCTemplputParams *TP) { - FileListStruct *F = (FileListStruct*) CTX; + FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST); StrBufAppendTemplate(Target, TP, F->Filename, 0); } void tmplput_FILE_SIZE(StrBuf *Target, WCTemplputParams *TP) { - FileListStruct *F = (FileListStruct*) CTX; + FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST); StrBufAppendPrintf(Target, "%ld", F->FileSize); } void tmplput_FILEMIMETYPE(StrBuf *Target, WCTemplputParams *TP) { - FileListStruct *F = (FileListStruct*) CTX; + FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST); StrBufAppendTemplate(Target, TP, F->MimeType, 0); } void tmplput_FILE_COMMENT(StrBuf *Target, WCTemplputParams *TP) { - FileListStruct *F = (FileListStruct*) CTX; + FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST); StrBufAppendTemplate(Target, TP, F->Comment, 0); } @@ -67,7 +63,7 @@ void tmplput_FILE_COMMENT(StrBuf *Target, WCTemplputParams *TP) int Conditional_FILE_ISPIC(StrBuf *Target, WCTemplputParams *TP) { - FileListStruct *F = (FileListStruct*) CTX; + FileListStruct *F = (FileListStruct*) CTX(CTX_FILELIST); return F->IsPic; } @@ -426,6 +422,7 @@ void InitModule_DOWNLOAD (void) { + RegisterCTX(CTX_FILELIST); RegisterIterator("ROOM:FILES", 0, NULL, LoadFileList, NULL, DeleteHash, CTX_FILELIST, CTX_NONE,