Commits (1)
...@@ -117,13 +117,15 @@ void sbbs_t::showfileinfo(file_t* f, bool show_extdesc) ...@@ -117,13 +117,15 @@ void sbbs_t::showfileinfo(file_t* f, bool show_extdesc)
/* Returns padded file specification. */ /* Returns padded file specification. */
/* Returns NULL if input was aborted. */ /* Returns NULL if input was aborted. */
/****************************************************************************/ /****************************************************************************/
char * sbbs_t::getfilespec(char *str) char* sbbs_t::getfilespec(char *str)
{ {
bputs(text[FileSpecStarDotStar]); bputs(text[FileSpecStarDotStar]);
if(!getstr(str, MAX_FILENAME_LEN, K_NONE)) if(!getstr(str, MAX_FILENAME_LEN, K_NONE))
strcpy(str, ALLFILES); strcpy(str, ALLFILES);
if(sys_status&SS_ABORT) if(msgabort()) {
return(0); clearabort();
return NULL;
}
return(str); return(str);
} }
...@@ -205,8 +207,10 @@ bool sbbs_t::removefcdt(file_t* f) ...@@ -205,8 +207,10 @@ bool sbbs_t::removefcdt(file_t* f)
ultoa(cdt, str, 10); ultoa(cdt, str, 10);
bputs(text[CreditsToRemove]); bputs(text[CreditsToRemove]);
getstr(str, 10, K_NUMBER|K_LINE|K_EDIT|K_AUTODEL); getstr(str, 10, K_NUMBER|K_LINE|K_EDIT|K_AUTODEL);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
}
cdt = atol(str); cdt = atol(str);
} }
adjustuserrec(&cfg,u,U_CDT,10,-cdt); adjustuserrec(&cfg,u,U_CDT,10,-cdt);
...@@ -285,23 +289,26 @@ bool sbbs_t::editfilename(file_t* f) ...@@ -285,23 +289,26 @@ bool sbbs_t::editfilename(file_t* f)
SAFECOPY(str, f->name); SAFECOPY(str, f->name);
if(!getstr(str, sizeof(str) - 1, K_EDIT|K_AUTODEL)) if(!getstr(str, sizeof(str) - 1, K_EDIT|K_AUTODEL))
return false; return false;
if(strcmp(str,f->name) != 0) { /* rename */ if(msgabort()) {
if(stricmp(str,f->name) clearabort();
&& findfile(&cfg, f->dir, path, NULL)) return false;
bprintf(text[FileAlreadyThere],path);
else {
SAFEPRINTF2(path,"%s%s",dirpath,f->name);
SAFEPRINTF2(tmp,"%s%s",dirpath,str);
if(fexistcase(path) && rename(path,tmp))
bprintf(text[CouldntRenameFile],path,tmp);
else {
bprintf(text[FileRenamed],path,tmp);
smb_new_hfield_str(f, SMB_FILENAME, str);
updatefile(&cfg, f);
}
}
} }
return true; if(strcmp(str,f->name) == 0)
return true;
/* rename */
if(stricmp(str,f->name) && findfile(&cfg, f->dir, path, NULL)) {
bprintf(text[FileAlreadyThere],path);
return false;
}
SAFEPRINTF2(path,"%s%s",dirpath,f->name);
SAFEPRINTF2(tmp,"%s%s",dirpath,str);
if(fexistcase(path) && rename(path,tmp) != 0) {
bprintf(text[CouldntRenameFile],path,tmp);
return false;
}
bprintf(text[FileRenamed],path,tmp);
smb_new_hfield_str(f, SMB_FILENAME, str);
return updatefile(&cfg, f);
} }
bool sbbs_t::editfiledesc(file_t* f) bool sbbs_t::editfiledesc(file_t* f)
...@@ -311,11 +318,13 @@ bool sbbs_t::editfiledesc(file_t* f) ...@@ -311,11 +318,13 @@ bool sbbs_t::editfiledesc(file_t* f)
char fdesc[LEN_FDESC + 1]; char fdesc[LEN_FDESC + 1];
SAFECOPY(fdesc, f->desc); SAFECOPY(fdesc, f->desc);
getstr(fdesc, sizeof(fdesc)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM); getstr(fdesc, sizeof(fdesc)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
if(strcmp(fdesc, f->desc)) }
smb_new_hfield_str(f, SMB_FILEDESC, fdesc); if(strcmp(fdesc, f->desc) == 0)
return true;
smb_new_hfield_str(f, SMB_FILEDESC, fdesc);
return updatefile(&cfg, f); return updatefile(&cfg, f);
} }
...@@ -330,17 +339,21 @@ bool sbbs_t::editfileinfo(file_t* f) ...@@ -330,17 +339,21 @@ bool sbbs_t::editfileinfo(file_t* f)
if(f->tags != NULL) if(f->tags != NULL)
SAFECOPY(tags, f->tags); SAFECOPY(tags, f->tags);
getstr(tags, sizeof(tags)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM); getstr(tags, sizeof(tags)-1, K_LINE|K_EDIT|K_AUTODEL|K_TRIM);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
}
if((f->tags == NULL && *tags != '\0') || (f->tags != NULL && strcmp(tags, f->tags))) if((f->tags == NULL && *tags != '\0') || (f->tags != NULL && strcmp(tags, f->tags)))
smb_new_hfield_str(f, SMB_TAGS, tags); smb_new_hfield_str(f, SMB_TAGS, tags);
} }
#if 0
// Extended Description // Extended Description
if(f->extdesc != NULL && *f->extdesc) { if(f->extdesc != NULL && *f->extdesc) {
if(!noyes(text[DeleteExtDescriptionQ])) { if(!noyes(text[DeleteExtDescriptionQ])) {
// TODO // TODO
} }
} }
#endif
if(dir_op(f->dir)) { if(dir_op(f->dir)) {
char uploader[LEN_ALIAS + 1]; char uploader[LEN_ALIAS + 1];
SAFECOPY(uploader, f->from); SAFECOPY(uploader, f->from);
...@@ -351,18 +364,24 @@ bool sbbs_t::editfileinfo(file_t* f) ...@@ -351,18 +364,24 @@ bool sbbs_t::editfileinfo(file_t* f)
ultoa(f->cost,str,10); ultoa(f->cost,str,10);
bputs(text[EditCreditValue]); bputs(text[EditCreditValue]);
getstr(str,10,K_NUMBER|K_EDIT|K_AUTODEL); getstr(str,10,K_NUMBER|K_EDIT|K_AUTODEL);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
}
f->cost = atol(str); f->cost = atol(str);
smb_new_hfield(f, SMB_COST, sizeof(f->cost), &f->cost); smb_new_hfield(f, SMB_COST, sizeof(f->cost), &f->cost);
ultoa(f->hdr.times_downloaded,str,10); ultoa(f->hdr.times_downloaded,str,10);
bputs(text[EditTimesDownloaded]); bputs(text[EditTimesDownloaded]);
getstr(str,5,K_NUMBER|K_EDIT|K_AUTODEL); getstr(str,5,K_NUMBER|K_EDIT|K_AUTODEL);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
}
f->hdr.times_downloaded=atoi(str); f->hdr.times_downloaded=atoi(str);
if(sys_status&SS_ABORT) if(msgabort()) {
clearabort();
return false; return false;
}
inputnstime32((time32_t*)&f->hdr.when_imported.time); inputnstime32((time32_t*)&f->hdr.when_imported.time);
} }
return updatefile(&cfg, f); return updatefile(&cfg, f);
......
...@@ -738,6 +738,7 @@ public: ...@@ -738,6 +738,7 @@ public:
char putmsg(const char *str, long mode, long org_cols = 0, JSObject* obj = NULL); char putmsg(const char *str, long mode, long org_cols = 0, JSObject* obj = NULL);
char putmsgfrag(const char* str, long& mode, long org_cols = 0, JSObject* obj = NULL); char putmsgfrag(const char* str, long& mode, long org_cols = 0, JSObject* obj = NULL);
bool msgabort(void); bool msgabort(void);
void clearabort() { sys_status &= ~SS_ABORT; }
bool email(int usernumber, const char *top = NULL, const char *title = NULL bool email(int usernumber, const char *top = NULL, const char *title = NULL
, long mode = WM_NONE, smb_t* resmb = NULL, smbmsg_t* remsg = NULL); , long mode = WM_NONE, smb_t* resmb = NULL, smbmsg_t* remsg = NULL);
bool forwardmsg(smb_t*, smbmsg_t*, const char* to, const char* subject = NULL, const char* comment = NULL); bool forwardmsg(smb_t*, smbmsg_t*, const char* to, const char* subject = NULL, const char* comment = NULL);
......