Commits (2)
......@@ -92,9 +92,13 @@ void sbbs_t::batchmenu()
start_batch_download();
break;
case 'L':
{
bool sort = !noyes(text[SortAlphaQ]);
ini = batch_list_read(&cfg, useron.number, XFER_BATCH_UPLOAD);
filenames = iniGetSectionList(ini, NULL);
if(strListCount(filenames)) {
if(sort)
strListSortAlphaCase(filenames);
bputs(text[UploadQueueLstHdr]);
for(size_t i = 0; filenames[i]; ++i) {
const char* filename = filenames[i];
......@@ -114,6 +118,8 @@ void sbbs_t::batchmenu()
ini = batch_list_read(&cfg, useron.number, XFER_BATCH_DOWNLOAD);
filenames = iniGetSectionList(ini, NULL);
if(strListCount(filenames)) {
if(sort)
strListSortAlphaCase(filenames);
bputs(text[DownloadQueueLstHdr]);
for(size_t i = 0; filenames[i]; ++i) {
const char* filename = filenames[i];
......@@ -144,6 +150,7 @@ void sbbs_t::batchmenu()
iniFreeStringList(filenames);
iniFreeStringList(ini);
break;
}
case 'R':
if((n = batup_total()) > 0) {
bprintf(text[RemoveWhichFromUlQueue], n);
......
......@@ -421,6 +421,18 @@ bool batch_list_clear(scfg_t* cfg, uint usernumber, enum XFER_TYPE type)
return remove(batch_list_name(cfg, usernumber, type, path, sizeof(path))) == 0;
}
bool batch_list_sort(scfg_t* cfg, uint usernumber, enum XFER_TYPE type)
{
str_list_t ini = batch_list_read(cfg, usernumber, type);
if(ini == NULL)
return true;
bool result = iniSortSections(&ini, /* prefix: */NULL, /* sort_keys: */FALSE);
if(result)
result = batch_list_write(cfg, usernumber, type, ini);
iniFreeStringList(ini);
return result;
}
size_t batch_file_count(scfg_t* cfg, uint usernumber, enum XFER_TYPE type)
{
FILE* fp = batch_list_open(cfg, usernumber, type, /* create: */false);
......
......@@ -82,6 +82,7 @@ DLLEXPORT char* batch_list_name(scfg_t* , uint usernumber, enum XFER_TYPE, cha
DLLEXPORT FILE* batch_list_open(scfg_t* , uint usernumber, enum XFER_TYPE, bool create);
DLLEXPORT str_list_t batch_list_read(scfg_t* , uint usernumber, enum XFER_TYPE);
DLLEXPORT bool batch_list_write(scfg_t*, uint usernumber, enum XFER_TYPE, str_list_t list);
DLLEXPORT bool batch_list_sort(scfg_t*, uint usernumber, enum XFER_TYPE);
DLLEXPORT bool batch_list_clear(scfg_t*, uint usernumber, enum XFER_TYPE);
DLLEXPORT bool batch_file_add(scfg_t*, uint usernumber, enum XFER_TYPE, file_t*);
......