Attempt to add new files only option to file list

This commit is contained in:
Andrew Pamment 2018-01-08 14:02:43 +10:00
parent d7d984cc57
commit 24994fb150
2 changed files with 8 additions and 2 deletions

View File

@ -231,7 +231,7 @@ File exists!\r\n
\r\n\e[1;37mAre you sure you want to reset \e[1;31mall messages \e[1;37min all bases to unread? \e[0m
\r\n\r\n\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;33m%3ddloads \e[1;36m%4d%c \e[1;37m%-56s\r\n \e[1;31mNEW \e[0;32m
\r\nScan for new files? (Y/N) :
\r\n\e[1;37mOrder by (\e[1;32mF\e[1;37m)ilename, (\e[1;32mU\e[1;37m)pload Date, (\e[1;32mP\e[1;37m)opularity : \e[0m
\r\n\e[1;37mOrder by (\e[1;32mF\e[1;37m)ilename, (\e[1;32mU\e[1;37m)pload Date, (\e[1;32mP\e[1;37m)opularity, (\e[1;32mN\e[1;37m)ew Files Only: \e[0m
\e[24;1H\e[1;32mUp / Down\e[1;37m to Scroll, \e[1;32mLeft / Right \e[1;37mChange Message, \e[1;32mR \e[1;37mReply, \e[1;32mJ \e[1;37mNext Area, \e[1;32mQ \e[1;37mQuit\e[K\e[0m
\e[0;36mB. \e[1;37mBluewave Packet Style (\e[1;33m%s\e[1;37m)\r\n
\r\n\e[1;37mSearch by (\e[1;32mF\e[1;37m)ilename, (\e[1;32mD\e[1;37m)escription or (\e[1;32mB\e[1;37m)oth:\e[0m

View File

@ -1260,6 +1260,7 @@ void list_files(struct user_record *user) {
char *dsql = "select filename, description, size, dlcount, uploaddate from files where approved=1 ORDER BY uploaddate DESC";
char *fsql = "select filename, description, size, dlcount, uploaddate from files where approved=1 ORDER BY filename";
char *psql = "select filename, description, size, dlcount, uploaddate from files where approved=1 ORDER BY dlcount DESC";
char *nsql = "select filename, description, size, dlcount, uploaddate from files where approved=1 ORDER BY uploaddate DESC WHERE uploaddate > ?";
char *sql;
char buffer[PATH_MAX];
sqlite3 *db;
@ -1280,6 +1281,9 @@ void list_files(struct user_record *user) {
case 'p':
sql = psql;
break;
case 'n':
sql = nsql;
break;
default:
sql = fsql;
break;
@ -1297,7 +1301,9 @@ void list_files(struct user_record *user) {
}
sqlite3_busy_timeout(db, 5000);
rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
if (sql == nsql) {
sqlite3_bind_int(res, 1, userlaston);
}
if (rc != SQLITE_OK) {
sqlite3_finalize(res);
sqlite3_close(db);