nixpkgs/pkgs/applications/networking/mailreaders/neomutt/fix-open-very-large-mailbox.patch
Raito Bezarius 582a09df26 neomutt: 20220429 -> 20230407
neomutt-test-files: updated to latest version.

Cleaned up old hacks (?) now that pkg-config is used.
Exposes Lua feature as `enableLua` flag in function signature.
2023-04-24 21:30:02 +02:00

52 lines
1.3 KiB
Diff

diff --git a/mutt_mailbox.c b/mutt_mailbox.c
index 5581a8187..22f0ca21a 100644
--- a/mutt_mailbox.c
+++ b/mutt_mailbox.c
@@ -160,6 +160,9 @@ int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
st_ctx.st_dev = 0;
st_ctx.st_ino = 0;
+ if (kInMboxOpen)
+ return 0;
+
#ifdef USE_IMAP
if (flags & MUTT_MAILBOX_CHECK_FORCE)
mutt_update_num_postponed();
diff --git a/mx.c b/mx.c
index 4bf5af141..a4e9f83f5 100644
--- a/mx.c
+++ b/mx.c
@@ -295,6 +295,8 @@ bool mx_mbox_ac_link(struct Mailbox *m)
return true;
}
+int kInMboxOpen = 0;
+
/**
* mx_mbox_open - Open a mailbox and parse it
* @param m Mailbox to open
@@ -386,8 +388,10 @@ bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
m->msg_tagged = 0;
m->vcount = 0;
+ kInMboxOpen = 1;
enum MxOpenReturns rc = m->mx_ops->mbox_open(m);
m->opened++;
+ kInMboxOpen = 0;
if ((rc == MX_OPEN_OK) || (rc == MX_OPEN_ABORT))
{
diff --git a/mx.h b/mx.h
index 741431570..43e40bf32 100644
--- a/mx.h
+++ b/mx.h
@@ -38,6 +38,8 @@ extern const struct MxOps *mx_ops[];
extern struct EnumDef MboxTypeDef;
+extern int kInMboxOpen;
+
typedef uint8_t MsgOpenFlags; ///< Flags for mx_msg_open_new(), e.g. #MUTT_ADD_FROM
#define MUTT_MSG_NO_FLAGS 0 ///< No flags are set
#define MUTT_ADD_FROM (1 << 0) ///< add a From_ line