Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 2a8e1c11 authored by Rob Swindell's avatar Rob Swindell 💬

DIZ enhancements: Read/use SAUCE data, support ANSI, increase max 1->4K

Inspired by Blocktronics (and other ANSI art group) packs' FILE_ID.DIZ/ANS files:
* Support (and prioritize) FILE_ID.ANS
* Convert ANSI color/attribute sequences in DIZ files to Ctrl-A equivalent (uses SAUCE width and ICE color, if specified)
* Don't treat DIZ as a series of lines, they're not always nowadays.
* New putmsg() mode: P_INDENT to print files indented by current column
* Display full (up to 64-char) filenames in lists when using 132+ column terminal.
* Use the Author, Group, and Title fields from the SAUCE if present/non-blank
* 2 new text.dat strings: 301 (FiAuthor) and 302 (FiGroup)
* Also fix bug with repeated Cost header field on bulk-uploaded files.

I know this'll break the *nix build (sauce.c dependency), but I'll fix that next.
parent 9b28970b
Pipeline #1996 failed with stage
in 6 minutes and 23 seconds
......@@ -125,9 +125,9 @@ bool get_file_diz(file_t* f, char* ext, size_t maxlen)
return false;
}
printf("Parsing DIZ: %s\n", diz_fpath);
str_list_t lines = read_diz(diz_fpath);
format_diz(lines, ext, maxlen, /* allow_ansi: */false);
strListFree(&lines);
char* lines = read_diz(diz_fpath, NULL);
format_diz(lines, ext, maxlen, 0, false);
free(lines);
remove(diz_fpath);
if(mode&ASCII_ONLY)
......
......@@ -174,6 +174,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="userdat.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -162,6 +162,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="userdat.c" />
</ItemGroup>
<ItemGroup>
......
......@@ -162,6 +162,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="userdat.c" />
</ItemGroup>
<ItemGroup>
......
......@@ -30,6 +30,7 @@ void sbbs_t::showfileinfo(file_t* f, bool show_extdesc)
char tmp[512];
char tmp2[64];
char path[MAX_PATH+1];
bool is_op = dir_op(f->dir);
current_file = f;
getfilepath(&cfg, f, path);
......@@ -63,9 +64,21 @@ void sbbs_t::showfileinfo(file_t* f, bool show_extdesc)
bprintf(P_TRUNCATE, text[FiDescription],f->desc);
if(f->tags && f->tags[0])
bprintf(P_TRUNCATE, text[FiTags], f->tags);
if(f->author)
bprintf(P_TRUNCATE, text[FiAuthor], f->author);
if(f->author_org)
bprintf(P_TRUNCATE, text[FiGroup], f->author_org);
char* p = f->hdr.attr&MSG_ANONYMOUS ? text[UNKNOWN_USER] : f->from;
if(p != NULL && *p != '\0')
bprintf(P_TRUNCATE, text[FiUploadedBy], p);
if(is_op) {
if(f->from_ip != NULL)
bprintf(P_TRUNCATE, text[FiUploadedBy], f->from_ip);
if(f->from_host != NULL)
bprintf(P_TRUNCATE, text[FiUploadedBy], f->from_host);
if(f->from_prot != NULL)
bprintf(P_TRUNCATE, text[FiUploadedBy], f->from_prot);
}
if(f->to_list != NULL && *f->to_list != '\0')
bprintf(P_TRUNCATE, text[FiUploadedTo], f->to_list);
bprintf(P_TRUNCATE, text[FiDateUled],timestr(f->hdr.when_imported.time));
......@@ -81,10 +94,7 @@ void sbbs_t::showfileinfo(file_t* f, bool show_extdesc)
char* p = f->extdesc;
SKIP_CRLF(p);
truncsp(p);
long p_mode = P_NOATCODES;
if(!(console&CON_RAW_IN))
p_mode |= P_WORDWRAP;
putmsg(p, p_mode);
putmsg(p, P_NOATCODES | P_CPM_EOF);
newline();
}
if(f->size == -1) {
......
......@@ -28,6 +28,7 @@
#include "smblib.h"
#include "load_cfg.h" // smb_open_dir()
#include "scfglib.h"
#include "sauce.h"
/* libarchive: */
#include <archive.h>
......@@ -606,6 +607,25 @@ int file_client_hfields(file_t* f, client_t* client)
return SMB_SUCCESS;
}
int file_sauce_hfields(file_t* f, struct sauce_charinfo* info)
{
int i;
if(info == NULL)
return -1;
if(*info->author && (i = smb_hfield_str(f, SMB_AUTHOR, info->author)) != SMB_SUCCESS)
return i;
if(*info->group && (i = smb_hfield_str(f, SMB_AUTHOR_ORG, info->group)) != SMB_SUCCESS)
return i;
if(f->desc == NULL && *info->title && (i = smb_hfield_str(f, SMB_FILEDESC, info->title)) != SMB_SUCCESS)
return i;
return SMB_SUCCESS;
}
bool addfile(scfg_t* cfg, uint dirnum, file_t* f, const char* extdesc, client_t* client)
{
char fpath[MAX_PATH + 1];
......@@ -892,7 +912,7 @@ bool extract_diz(scfg_t* cfg, file_t* f, str_list_t diz_fnames, char* path, size
{
int i;
char archive[MAX_PATH + 1];
char* default_diz_fnames[] = { "FILE_ID.DIZ", "DESC.SDI", NULL };
char* default_diz_fnames[] = { "FILE_ID.ANS", "FILE_ID.DIZ", "DESC.SDI", NULL };
getfilepath(cfg, f, archive);
if(diz_fnames == NULL)
......@@ -945,39 +965,56 @@ bool extract_diz(scfg_t* cfg, file_t* f, str_list_t diz_fnames, char* path, size
return false;
}
str_list_t read_diz(const char* path)
char* read_diz(const char* path, struct sauce_charinfo* sauce)
{
FILE* fp = fopen(path, "r");
if(sauce != NULL)
memset(sauce, 0, sizeof(*sauce));
off_t len = flength(path);
FILE* fp = fopen(path, "rb");
if(fp == NULL)
return NULL;
str_list_t lines = strListReadFile(fp, NULL, /* max_line_len: */255);
if(sauce != NULL)
sauce_fread_charinfo(fp, /* type: */NULL, sauce);
if(len > LEN_EXTDESC)
len = LEN_EXTDESC;
char* buf = calloc((size_t)len + 1, 1);
if(buf != NULL)
fread(buf, (size_t)len, 1, fp);
fclose(fp);
return lines;
char* eof = strchr(buf, CTRL_Z); // CP/M EOF
if(eof != NULL)
*eof = '\0';
return buf;
}
char* format_diz(str_list_t lines, char* str, size_t maxlen, bool allow_ansi)
char* format_diz(const char* src, char* dest, size_t maxlen, int width, bool ice)
{
if(lines == NULL) {
*str = '\0';
return NULL;
}
strListTruncateTrailingWhitespaces(lines);
if(!allow_ansi) {
for(size_t i = 0; lines[i] != NULL; i++) {
strip_ansi(lines[i]);
strip_ctrl(lines[i], lines[i]);
}
if(src == NULL) {
*dest = '\0';
return dest;
}
strListFastDeleteBlanks(lines);
return strListCombine(lines, str, maxlen, "\r\n");
convert_ansi(src, dest, maxlen - 1, width, ice);
return dest;
}
// Take a verbose extended description (e.g. FILE_ID.DIZ)
// and convert to suitable short description
char* prep_file_desc(const char *src, char* dest)
char* prep_file_desc(const char* ext, char* dest)
{
int out;
char* src;
char* buf = strdup(ext);
if(buf == NULL)
src = (char*)ext;
else {
src = buf;
strip_ctrl(src, src);
}
FIND_ALPHANUMERIC(src);
for(out = 0; *src != '\0' && out < LEN_FDESC; src++) {
......@@ -995,6 +1032,7 @@ char* prep_file_desc(const char *src, char* dest)
dest[out++] = *src;
}
dest[out] = '\0';
free(buf);
return dest;
}
......
......@@ -57,10 +57,11 @@ DLLEXPORT bool addfile(scfg_t*, uint dirnum, file_t*, const char* extdesc, cli
DLLEXPORT bool removefile(scfg_t*, uint dirnum, const char* filename);
DLLEXPORT char* format_filename(const char* fname, char* buf, size_t, bool pad);
DLLEXPORT bool extract_diz(scfg_t*, file_t*, str_list_t diz_fname, char* path, size_t);
DLLEXPORT str_list_t read_diz(const char* path);
DLLEXPORT char* format_diz(str_list_t lines, char*, size_t maxlen, bool allow_ansi);
DLLEXPORT char* read_diz(const char* path, struct sauce_charinfo*);
DLLEXPORT char* format_diz(const char* src, char* dest, size_t maxlen, int width, bool ice_color);
DLLEXPORT char* prep_file_desc(const char *src, char* dst);
DLLEXPORT int file_client_hfields(file_t*, client_t*);
DLLEXPORT int file_sauce_hfields(file_t*, struct sauce_charinfo*);
DLLEXPORT str_list_t directory(const char* path);
DLLEXPORT long create_archive(const char* archive, const char* format
......
......@@ -170,6 +170,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="userdat.c" />
</ItemGroup>
<ItemGroup>
......
......@@ -42,6 +42,7 @@
#include "cryptlib.h"
#include "xpprintf.h" // vasprintf
#include "md5.h"
#include "sauce.h"
#include "git_branch.h"
#include "git_hash.h"
......@@ -1074,19 +1075,22 @@ static void receive_thread(void* arg)
if(scfg.dir[f.dir]->misc&DIR_DIZ) {
lprintf(LOG_DEBUG,"%04d <%s> DATA Extracting DIZ from: %s",xfer.ctrl_sock, xfer.user->alias,xfer.filename);
if(extract_diz(&scfg, &f, /* diz_fnames */NULL, tmp, sizeof(tmp))) {
struct sauce_charinfo sauce;
lprintf(LOG_DEBUG,"%04d <%s> DATA Parsing DIZ: %s",xfer.ctrl_sock, xfer.user->alias,tmp);
str_list_t lines = read_diz(tmp);
format_diz(lines, extdesc, sizeof(extdesc), /* allow_ansi: */false);
strListFree(&lines);
char* lines = read_diz(tmp, &sauce);
format_diz(lines, extdesc, sizeof(extdesc), sauce.width, sauce.ice_color);
free(lines);
if(!fdesc[0]) { /* use for normal description */
prep_file_desc(extdesc, fdesc); /* strip control chars and dupe chars */
}
file_sauce_hfields(&f, &sauce);
ftp_remove(xfer.ctrl_sock, __LINE__, tmp, xfer.user->alias);
} else
lprintf(LOG_DEBUG,"%04d <%s> DATA DIZ does not exist in: %s",xfer.ctrl_sock, xfer.user->alias ,xfer.filename);
} /* FILE_ID.DIZ support */
smb_hfield_str(&f, SMB_FILEDESC, fdesc);
if(f.desc == NULL)
smb_new_hfield_str(&f, SMB_FILEDESC, fdesc);
if(filedat) {
if(!updatefile(&scfg, &f))
lprintf(LOG_ERR,"%04d <%s> !DATA ERROR updating file (%s) in database"
......
......@@ -20,6 +20,7 @@
****************************************************************************/
#include "sbbs.h"
#include "sauce.h"
#include "filedat.h"
#include "js_request.h"
#include <stdbool.h>
......@@ -205,6 +206,16 @@ set_file_properties(JSContext *cx, JSObject* obj, file_t* f, enum file_detail de
|| !JS_DefineProperty(cx, obj, "from_port", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
if(((f->author != NULL && *f->author != '\0') || detail > file_detail_extdesc)
&& ((js_str = JS_NewStringCopyZ(cx, f->author)) == NULL
|| !JS_DefineProperty(cx, obj, "author", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
if(((f->author_org != NULL && *f->author_org != '\0') || detail > file_detail_extdesc)
&& ((js_str = JS_NewStringCopyZ(cx, f->author_org)) == NULL
|| !JS_DefineProperty(cx, obj, "author_org", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
if(((f->to_list != NULL && *f->to_list != '\0') || detail > file_detail_extdesc)
&& ((js_str = JS_NewStringCopyZ(cx, f->to_list)) == NULL
|| !JS_DefineProperty(cx, obj, "to_list", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
......@@ -464,6 +475,36 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
}
}
prop_name = "author";
if(JS_GetProperty(cx, obj, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx, cp);
if(cp == NULL) {
JS_ReportError(cx, "Invalid '%s' string in file object", prop_name);
return SMB_FAILURE;
}
if(smb_hfield_str(file, SMB_AUTHOR, cp) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
}
}
prop_name = "author_org";
if(JS_GetProperty(cx, obj, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx, cp);
if(cp == NULL) {
JS_ReportError(cx, "Invalid '%s' string in file object", prop_name);
return SMB_FAILURE;
}
if(smb_hfield_str(file, SMB_AUTHOR_ORG, cp) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
}
}
prop_name = "desc";
if(JS_GetProperty(cx, obj, prop_name, &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
......@@ -1049,12 +1090,14 @@ static void get_diz(scfg_t* scfg, file_t* file, char** extdesc)
char diz_fpath[MAX_PATH + 1];
if(extract_diz(scfg, file, /* diz_fnames: */NULL, diz_fpath, sizeof(diz_fpath))) {
char extbuf[LEN_EXTDESC + 1] = "";
str_list_t lines = read_diz(diz_fpath);
struct sauce_charinfo sauce;
char* lines = read_diz(diz_fpath, &sauce);
if(lines != NULL) {
format_diz(lines, extbuf, sizeof(extbuf), /* allow_ansi: */false);
strListFree(&lines);
format_diz(lines, extbuf, sizeof(extbuf), sauce.width, sauce.ice_color);
free(lines);
free(*extdesc);
*extdesc = strdup(extbuf);
file_sauce_hfields(file, &sauce);
if(file->desc == NULL)
smb_new_hfield_str(file, SMB_FILEDESC, prep_file_desc(extbuf, extbuf));
}
......
......@@ -45,6 +45,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
file_t* bf[BF_MAX]; /* bf is batch flagged files */
smb_t smb;
ulong file_row[26];
size_t longest = 0;
if(!smb_init_dir(&cfg, &smb, dirnum))
return 0;
......@@ -69,6 +70,12 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
return 0;
}
for(i = 0; i < file_count; i++) {
size_t len = strlen(file_list[i].name);
if(len > longest)
longest = len;
}
if(!tofile) {
action=NODE_LFIL;
getnodedat(cfg.node_num,&thisnode,0);
......@@ -263,9 +270,9 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
else if(tofile)
listfiletofile(f, tofile);
else if(mode&FL_FINDDESC)
disp=listfile(f, dirnum, filespec, letter);
disp=listfile(f, dirnum, filespec, letter, longest);
else
disp=listfile(f, dirnum, nulstr, letter);
disp=listfile(f, dirnum, nulstr, letter, longest);
if(!disp && letter>'A') {
next=m-1;
letter--;
......@@ -340,9 +347,9 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
/* Prints one file's information on a single line */
/* Return 1 if displayed, 0 otherwise */
/****************************************************************************/
bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char letter)
bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char letter, size_t namelen)
{
char *ptr,*cr,*lf;
char *ptr;
bool exist = true;
char* ext=NULL;
char path[MAX_PATH+1];
......@@ -356,9 +363,14 @@ bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char let
return false;
}
cond_newline();
attr(cfg.color[clr_filename]);
char fname[13]; /* This is one of the only 8.3 filename formats left! (used for display purposes only) */
bprintf("%-*s", (int)sizeof(fname)-1, format_filename(f->name, fname, sizeof(fname)-1, /* pad: */TRUE));
char fname[SMB_FILEIDX_NAMELEN + 1];
if(namelen < 12 || cols < 132)
namelen = 12;
else if(namelen > sizeof(fname) - 1)
namelen = sizeof(fname) - 1;
bprintf("%-*s", namelen, format_filename(f->name, fname, namelen, /* pad: */TRUE));
getfilepath(&cfg, f, path);
if(f->extdesc != NULL && *f->extdesc && !(useron.misc&EXTDESC))
......@@ -427,35 +439,13 @@ bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char let
}
CRLF;
} else {
char* ext_desc = strdup((char*)ext);
truncsp(ext_desc);
ptr=(char*)ext_desc;
SKIP_CRLF(ptr);
while(ptr && *ptr && !msgabort()) {
cr=strchr(ptr,CR);
lf=strchr(ptr,LF);
if(lf && (lf<cr || !cr)) cr=lf;
if(cr>ptr+LEN_FDESC)
cr=ptr+LEN_FDESC;
else if(cr)
*cr=0;
char str[256];
sprintf(str,"%.*s\r\n",LEN_FDESC,ptr);
putmsg(str,P_NOATCODES|P_SAVEATR);
if(!cr) {
if(strlen(ptr)>LEN_FDESC)
cr=ptr+LEN_FDESC;
else
break;
}
if(!(*(cr+1)) || !(*(cr+2)))
break;
bprintf("%21s",nulstr);
ptr=cr;
if(!(*ptr)) ptr++;
while(*ptr==LF || *ptr==CR) ptr++;
}
free(ext_desc);
truncsp(ext);
while(strncmp(ext, "\r\n", 2) == 0
|| strnicmp(ext, "\001N", 2) == 0
|| strnicmp(ext, "\0010", 2) == 0
|| strnicmp(ext, "\001W", 2) == 0)
ext += 2;
putmsg(ext, P_INDENT | P_NOATCODES | P_CPM_EOF | P_TRUNCATE);
}
return true;
}
......
......@@ -91,6 +91,7 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
uchar exatr=0;
char mark = '\0';
int i;
long col = column;
ulong l=0;
uint lines_printed = 0;
struct mouse_hotspot hot_spot = {0};
......@@ -143,7 +144,9 @@ char sbbs_t::putmsgfrag(const char* buf, long* mode, long org_cols, JSObject* ob
}
// fallthrough
default: // printing char
if(((*mode)&P_TRUNCATE) && column >= (cols - 1)) {
if(((*mode) & P_INDENT) && column < col)
cursor_right(col - column);
else if(((*mode)&P_TRUNCATE) && column >= (cols - 1)) {
l++;
continue;
} else if((*mode)&P_WRAP) {
......
......@@ -1049,7 +1049,7 @@ public:
long delfiles(const char *inpath, const char *spec, size_t keep = 0);
/* listfile.cpp */
bool listfile(file_t*, uint dirnum, const char *search, const char letter);
bool listfile(file_t*, uint dirnum, const char *search, const char letter, size_t namelen);
int listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode);
int listfileinfo(uint dirnum, const char *filespec, long mode);
void listfiletofile(file_t*, FILE*);
......
......@@ -646,6 +646,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="scandirs.cpp">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -753,6 +753,7 @@ typedef enum { /* Values for xtrn_t.event */
#define P_MARKUP (1<<16) /* Support StyleCodes/Rich/StructuredText */
#define P_HIDEMARKS (1<<17) /* Hide the mark-up characters */
#define P_REMOTE (1<<18) /* Only print when online == ON_REMOTE */
#define P_INDENT (1<<19) /* Indent lines to current cursor column */
/* Bits in 'mode' for listfiles */
#define FL_ULTIME (1<<0) /* List files by upload time */
......
......@@ -177,6 +177,7 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="sauce.c" />
<ClCompile Include="sbbsecho.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
......
......@@ -311,8 +311,8 @@ enum {
,TagFilePrompt
,Unused299
,Unused300
,Unused301
,Unused302
,FiAuthor
,FiGroup
,FileAlreadyInQueue
,FileIsNotOnline
,FileAddedToBatDlQueue
......
......@@ -479,8 +479,8 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x3a\x20" // 298 TagFilePrompt
,"\x55\x4e\x55\x53\x45\x44\x32\x39\x39" // 299 Unused299
,"\x55\x4e\x55\x53\x45\x44\x33\x30\x30" // 300 Unused300
,"\x55\x4e\x55\x53\x45\x44\x33\x30\x31" // 301 Unused301
,"\x55\x4e\x55\x53\x45\x44\x33\x30\x32" // 302 Unused302
,"\x0d\x0a\x01\x6e\x01\x67\x41\x75\x74\x68\x6f\x72\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 301 FiAuthor
,"\x0d\x0a\x01\x6e\x01\x67\x47\x72\x6f\x75\x70\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x01\x68\x20\x25\x73" // 302 FiGroup
,"\x01\x77\x01\x68\x0d\x0a\x25\x73\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x69\x6e\x20\x74\x68\x65\x20\x71\x75\x65\x75\x65"
"\x2e\x0d\x0a" // 303 FileAlreadyInQueue
,"\x01\x77\x01\x68\x01\x2f\x46\x69\x6c\x65\x20\x69\x73\x20\x6e\x6f\x74\x20\x6f\x6e\x6c\x69\x6e\x65\x2e\x0d\x0a" // 304 FileIsNotOnline
......
......@@ -94,6 +94,7 @@
<ItemGroup>
<ClCompile Include="dat_rec.c" />
<ClCompile Include="filedat.c" />
<ClCompile Include="sauce.c" />
<ClCompile Include="upgrade_to_v319.c" />
<ClCompile Include="userdat.c" />
</ItemGroup>
......
......@@ -20,6 +20,7 @@
****************************************************************************/
#include "sbbs.h"
#include "sauce.h"
#include "filedat.h"
/****************************************************************************/
......@@ -152,15 +153,17 @@ bool sbbs_t::uploadfile(file_t* f)
if(cfg.dir[f->dir]->misc&DIR_DIZ) {
lprintf(LOG_DEBUG, "Extracting DIZ from: %s", path);
if(extract_diz(&cfg, f, /* diz_fnames: */NULL, str, sizeof(str))) {
struct sauce_charinfo sauce;
lprintf(LOG_DEBUG, "Parsing DIZ: %s", str);
str_list_t lines = read_diz(str);
char* lines = read_diz(str, &sauce);
if(lines != NULL)
format_diz(lines, ext, sizeof(ext), /* allow_ansi: */false);
strListFree(&lines);
format_diz(lines, ext, sizeof(ext), sauce.width, sauce.ice_color);
free(lines);
file_sauce_hfields(f, &sauce);
if(f->desc == NULL || f->desc[0] == 0) {
char desc[LEN_FDESC];
char desc[LEN_FDESC + 1];
SAFECOPY(desc, (char*)ext);
strip_exascii(desc, desc);
prep_file_desc(desc, desc);
......@@ -169,7 +172,7 @@ bool sbbs_t::uploadfile(file_t* f)
break;
if(desc[i] == '\0')
i = 0;
smb_hfield_str(f, SMB_FILEDESC, desc + i);
smb_new_hfield_str(f, SMB_FILEDESC, desc + i);
}
remove(str);
} else
......@@ -537,7 +540,6 @@ bool sbbs_t::bulkupload(uint dirnum)
smb_freemsgmem(&f);
smb_hfield_str(&f, SMB_FILENAME, dirent->d_name);
uint32_t cdt = (uint32_t)flength(str);
smb_hfield_bin(&f, SMB_COST, cdt);
bprintf(text[BulkUploadDescPrompt], format_filename(f.name, fname, 12, /* pad: */FALSE), cdt/1024);
if(strcmp(f.name, fname) != 0)
SAFECOPY(desc, f.name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment