Commit 79051b66 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Add batch_list_sort() to sort up/download batch xfer list files

parent 04cec7e1
......@@ -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*);
......
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