func (mbox *Mailbox) Expunge() error {
	for i := len(mbox.Messages) - 1; i >= 0; i-- {
		msg := mbox.Messages[i]

		deleted := false
		for _, flag := range msg.Flags {
			if flag == imap.DeletedFlag {
				logrus.Infof("IMAP: deleting message %s", msg.ID)
				err := mbox.user.Client.RemoveMessageFromBox(mbox.user.Info.Address.Hash(), msg.ID, mbox.id)
				if err != nil {
					return err
				}
				deleted = true
				break
			}
		}

		if deleted {
			mbox.Messages = append(mbox.Messages[:i], mbox.Messages[i+1:]...)
		}
	}

	return nil
}
// Expunge will delete a message
Expunge will delete a message
// Expunge will delete a message
func (mbox *Mailbox) Expunge() error {
	for i := len(mbox.Messages) - 1; i >= 0; i-- {
		msg := mbox.Messages[i]
		deleted := false
		for _, flag := range msg.Flags {
			if flag == imap.DeletedFlag {
				logrus.Infof("IMAP: deleting message %s", msg.ID)
				err := mbox.user.Client.RemoveMessageFromBox(mbox.user.Info.Address.Hash(), msg.ID, mbox.id)
				if err != nil {
					return err
				}
				deleted = true
				break
			}
		}
		if deleted {
			mbox.Messages = append(mbox.Messages[:i], mbox.Messages[i+1:]...)
		}
	}
	return nil
}
func ( mbox * Mailbox ) Expunge ( ) error { for i := len ( mbox . Messages ) - 1 ; i >= 0 ; i -- { msg := mbox . Messages [ i ] deleted := false for _ , flag := range msg . Flags { if flag == imap . DeletedFlag { logrus . Infof ( " " , msg . ID ) err := mbox . user . Client . RemoveMessageFromBox ( mbox . user . Info . Address . Hash ( ) , msg . ID , mbox . id ) if err != nil { return err } deleted = true break } } if deleted { mbox . Messages = append ( mbox . Messages [ : i ] , mbox . Messages [ i + 1 : ] ... ) } } return nil }
Expunge will delete a message
Expunge will delete a message