This patch adds support for unique sequence IDs to be logged. Each
new imap account is assigned an ID letter (seqid) which increments
to the next letter (and wraps at 'z') each time a new imap account
is created.
Signed-off-by: Mark Stenglein <mark@stengle.in>
cmd = adata->cmds + adata->nextcmd;
adata->nextcmd = (adata->nextcmd + 1) % adata->cmdslots;
- snprintf(cmd->seq, sizeof(cmd->seq), "a%04u", adata->seqno++);
+ snprintf(cmd->seq, sizeof(cmd->seq), "%c%04u", adata->seqid, adata->seqno++);
if (adata->seqno > 9999)
adata->seqno = 0;
* it's just no fun to get the same information twice */
char *capstr;
unsigned char capabilities[(IMAP_CAP_MAX + 7) / 8];
- unsigned int seqno; ///< tag sequence number, e.g. 'a0001'
+ unsigned char seqid; /* tag sequence prefix */
+ unsigned int seqno; ///< tag sequence number, e.g. '{seqid}0001'
time_t lastread; /**< last time we read a command for the server */
char *buf;
size_t blen;
struct ImapAccountData *imap_adata_new(void)
{
struct ImapAccountData *adata = mutt_mem_calloc(1, sizeof(struct ImapAccountData));
+ static unsigned char new_seqid = 'a';
+ adata->seqid = new_seqid;
adata->cmdbuf = mutt_buffer_new();
adata->cmdslots = ImapPipelineDepth + 2;
adata->cmds = mutt_mem_calloc(adata->cmdslots, sizeof(*adata->cmds));
+ if (++new_seqid > 'z')
+ new_seqid = 'a';
+
return adata;
}