From 24994fb150f0e1bf37961ff1be0c17bd2d992361 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Mon, 8 Jan 2018 14:02:43 +1000 Subject: [PATCH] Attempt to add new files only option to file list --- magicka.strings | 2 +- src/files.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/magicka.strings b/magicka.strings index fdd6402..15a8f99 100644 --- a/magicka.strings +++ b/magicka.strings @@ -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 diff --git a/src/files.c b/src/files.c index b8b5f20..cfc33af 100644 --- a/src/files.c +++ b/src/files.c @@ -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);