From 1b6d5846a52d2bf273a581925286277b29790435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Fri, 15 Nov 2024 11:12:22 -0500 Subject: [PATCH] Roll the epoch back to zero if it hits 9007199254740991 It shouldn't though. --- exec/imapservice.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/exec/imapservice.js b/exec/imapservice.js index 1de55ce28d..36cf83710e 100644 --- a/exec/imapservice.js +++ b/exec/imapservice.js @@ -211,6 +211,13 @@ function untagged(msg) debug_log("Send: * "+msg.length+": "+msg, false); } +function next_epoch(last_epoch) +{ + if (last_epoch >= Number.MAX_SAFE_INTEGER) + return 0; + return last_epoch + 1; +} + /*************************************************************/ /* Fetch response generation... this is the tricky bit. :-) */ /*************************************************************/ @@ -313,7 +320,7 @@ function send_fetch_response(msgnum, fmat, uid) if(saved_config[index.code].Seen[msgnum] != 1) { seen_changed=true; saved_config[index.code].Seen[msgnum]=1; - applied_epoch = saved_config.__config_epoch__ + 1; + applied_epoch = next_epoch(saved_config.__config_epoch__); index.idx[msgnum].attr |= MSG_READ; } idx.attr |= MSG_READ; @@ -1516,7 +1523,7 @@ function save_cfg(lck) if(user.number > 0) { for (sub in saved_config) { if (sub == '__config_epoch__') { - new_cfg[sub] = saved_config[sub] + 1; + new_cfg[sub] = next_epoch(saved_config[sub]); } else { scpy = undefined; -- GitLab