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

Commits (3)
......@@ -180,7 +180,7 @@ set_file_properties(JSContext *cx, JSObject* obj, file_t* f, enum file_detail de
|| !JS_DefineProperty(cx, obj, "name", STRING_TO_JSVAL(js_str), NULL, NULL, flags))
return false;
if(f->from != NULL
if(f->from != NULL || detail > file_detail_extdesc
&& ((js_str = JS_NewStringCopyZ(cx, f->from)) == NULL
|| !JS_DefineProperty(cx, obj, "from", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
......@@ -190,12 +190,17 @@ set_file_properties(JSContext *cx, JSObject* obj, file_t* f, enum file_detail de
&& !JS_DefineProperty(cx, obj, "anon", val, NULL, NULL, flags))
return false;
if(f->desc != NULL
if(f->tags != NULL || detail > file_detail_extdesc
&& ((js_str = JS_NewStringCopyZ(cx, f->tags)) == NULL
|| !JS_DefineProperty(cx, obj, "tags", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
if(f->desc != NULL || detail > file_detail_extdesc
&& ((js_str = JS_NewStringCopyZ(cx, f->desc)) == NULL
|| !JS_DefineProperty(cx, obj, "desc", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
if(f->extdesc != NULL && *f->extdesc != '\0'
if((f->extdesc != NULL && *f->extdesc != '\0') || detail > file_detail_extdesc
&& ((js_str = JS_NewStringCopyZ(cx, f->extdesc)) == NULL
|| !JS_DefineProperty(cx, obj, "extdesc", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
......@@ -249,10 +254,6 @@ set_file_properties(JSContext *cx, JSObject* obj, file_t* f, enum file_detail de
|| !JS_DefineProperty(cx, obj, "sha1", STRING_TO_JSVAL(js_str), NULL, NULL, flags))
return false;
}
if(f->tags != NULL
&& ((js_str = JS_NewStringCopyZ(cx, f->tags)) == NULL
|| !JS_DefineProperty(cx, obj, "tags", STRING_TO_JSVAL(js_str), NULL, NULL, flags)))
return false;
return true;
}
......@@ -356,7 +357,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError(cx, "Invalid '%s' string in file object", prop_name);
return SMB_FAILURE;
}
if((result = smb_new_hfield_str(file, SMB_FILEUPLOADER, cp)) != SMB_SUCCESS) {
if((file->from != NULL || *cp != '\0') && (result = smb_new_hfield_str(file, SMB_FILEUPLOADER, cp)) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
......@@ -371,7 +372,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError(cx, "Invalid '%s' string in file object", prop_name);
return SMB_FAILURE;
}
if((result = smb_new_hfield_str(file, SMB_FILEDESC, cp)) != SMB_SUCCESS) {
if((file->desc != NULL || *cp != '\0') && (result = smb_new_hfield_str(file, SMB_FILEDESC, cp)) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
......@@ -397,7 +398,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError(cx, "Invalid '%s' string in file object", prop_name);
return SMB_FAILURE;
}
if((result = smb_new_hfield_str(file, SMB_TAGS, cp)) != SMB_SUCCESS) {
if((file->tags != NULL || *cp != '\0') && (result = smb_new_hfield_str(file, SMB_TAGS, cp)) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
......@@ -411,7 +412,7 @@ parse_file_properties(JSContext *cx, JSObject* obj, file_t* file, char** extdesc
JS_ReportError(cx, "Error converting adding '%s' property to Uint32", prop_name);
return SMB_FAILURE;
}
if((result = smb_new_hfield(file, SMB_COST, sizeof(cost), &cost)) != SMB_SUCCESS) {
if((file->cost != 0 || cost != 0) && (result = smb_new_hfield(file, SMB_COST, sizeof(cost), &cost)) != SMB_SUCCESS) {
free(cp);
JS_ReportError(cx, "Error %d adding '%s' property to file object", result, prop_name);
return result;
......
......@@ -335,8 +335,10 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
if(!stricmp(cfg->dir[i]->sname,"SYSOP")) /* Sysop upload directory */
cfg->sysop_dir=i;
#if 0 // TODO: Remove or re-implement
else if(!stricmp(cfg->dir[i]->sname,"USER")) /* User to User xfer dir */
cfg->user_dir=i;
#endif
else if(!stricmp(cfg->dir[i]->sname,"UPLOADS")) /* Upload directory */
cfg->upload_dir=i;
else if(!stricmp(cfg->dir[i]->sname,"OFFLINE")) /* Offline files dir */
......
......@@ -543,6 +543,7 @@ static void
js_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
{
char line[64];
char user[LEN_ALIAS * 2] = "";
char file[MAX_PATH+1];
char* prot="???";
SOCKET sock=0;
......@@ -554,6 +555,8 @@ js_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
if((client=(service_client_t*)JS_GetContextPrivate(cx))!=NULL) {
prot=client->service->protocol;
sock=client->socket;
if(client->user.number)
SAFEPRINTF(user, " <%s>", client->user.alias);
}
if(report==NULL) {
......@@ -583,8 +586,9 @@ js_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
}
rc=JS_SUSPENDREQUEST(cx);
if(client == NULL || client->service == NULL || client->service->log_level >= log_level)
lprintf(log_level,"%04d %s !JavaScript %s%s%s: %s",sock,prot,warning,file,line,message);
if(client == NULL || client->service == NULL || client->service->log_level >= log_level) {
lprintf(log_level,"%04d %s%s !JavaScript %s%s%s: %s", sock, prot, user, warning, file, line, message);
}
JS_RESUMEREQUEST(cx, rc);
}
......