diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit 192a00e467b195ff46a0e86491fbd8e0cfe82374
parent 938a09664fcaa39a7bce5705d796b33f665d291e
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Fri, 24 Jun 2022 14:17:15 +0200

fix sync confirm logic for (a)ll

Diffstat:
Msrc/caldav.c | 12++++++------
Msrc/diary.c | 4++--
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/caldav.c b/src/caldav.c @@ -825,16 +825,16 @@ int caldav_sync(struct tm* date, noecho(); pthread_cancel(progress_tid); wclear(header); - } - // ask for confirmation - strftime(dstr, sizeof dstr, CONFIG.fmt, date); - mvwprintw(header, 0, 0, "Remote event is more recent. Sync entry '%s' and overwrite local file? [(Y)es/(a)ll/(n)o/(c)ancel] ", dstr); - char* i; + // ask for confirmation + strftime(dstr, sizeof dstr, CONFIG.fmt, date); + mvwprintw(header, 0, 0, "Remote event is more recent. Sync entry '%s' and overwrite local file? [(Y)es/(a)ll/(n)o/(c)ancel] ", dstr); + conf_ch = wgetch(header); + } - conf_ch = wgetch(header); if (conf_ch == 'y' || conf_ch == 'Y' || conf_ch == 'a' || conf_ch == '\n' || !confirm) { //fprintf(stderr, "Info - Remote file is newer. Extracting description from remote.\n"); + char* i; // persist downloaded buffer to local file FILE* cursordate_file = fopen(path, "wb"); diff --git a/src/diary.c b/src/diary.c @@ -863,8 +863,8 @@ int main(int argc, char** argv) { // cancel all break; } else if (conf_ch == 'a') { - // yes to (a)ll - conf_ch = caldav_sync(&new_date, header, cal, pad_pos, CONFIG.dir, diary_dir_size, false); + // yes to (a)ll, don't read returned conf_ch, since this will be reset to 0 + caldav_sync(&new_date, header, cal, pad_pos, CONFIG.dir, diary_dir_size, false); } else { // show confirmation dialogue before overwriting local files conf_ch = caldav_sync(&new_date, header, cal, pad_pos, CONFIG.dir, diary_dir_size, true);