should update flags
This commit is contained in:
@@ -2,8 +2,15 @@ import Imap, { ImapMessageAttributes, Box } from "imap";
|
||||
import { getMailbox, updateMailbox } from "../../db/imap/imap-db";
|
||||
import { Attrs, AttrsWithEnvelope } from "../../interfaces/mail/attrs.interface";
|
||||
import logger from "../../system/Logger";
|
||||
import RegisterMessageInApp from "../saveMessage";
|
||||
import { saveMessage } from "../storeMessage";
|
||||
import RegisterMessageInApp from "../message/saveMessage";
|
||||
import { saveMessage } from "../message/storeMessage";
|
||||
import updateMessage from "../message/updateMessage";
|
||||
|
||||
export interface ImapInfo {
|
||||
uid: number;
|
||||
modseq: string;
|
||||
flags: string[];
|
||||
}
|
||||
|
||||
export default class Mailbox {
|
||||
imap: Imap;
|
||||
@@ -38,6 +45,7 @@ export default class Mailbox {
|
||||
logger.log("Already up to date")
|
||||
}
|
||||
|
||||
// wait for new mails
|
||||
this.imap.on("mail", (numNewMsgs: number) => {
|
||||
if (!this.syncing) {
|
||||
// if not syncing restart a sync
|
||||
@@ -47,6 +55,11 @@ export default class Mailbox {
|
||||
this.msgToSync += numNewMsgs;
|
||||
}
|
||||
});
|
||||
|
||||
this.imap.on("update", (seqno: number, info: ImapInfo) => {
|
||||
const updateMsg = new updateMessage(info.uid, info.flags);
|
||||
updateMsg.updateFlags();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user