lib/imap/backup/serializer/appender.rb in imap-backup-6.3.0 vs lib/imap/backup/serializer/appender.rb in imap-backup-7.0.0.rc1

- old
+ new

@@ -8,33 +8,34 @@ @folder = folder @imap = imap @mbox = mbox end - def run(uid:, message:) + def run(uid:, message:, flags:) raise "Can't add messages without uid_validity" if !imap.uid_validity uid = uid.to_i if imap.include?(uid) Logger.logger.debug( "[#{folder}] message #{uid} already downloaded - skipping" ) return end - do_append uid, message + do_append uid, message, flags end private - def do_append(uid, message) + def do_append(uid, message, flags) mboxrd_message = Email::Mboxrd::Message.new(message) initial = mbox.length || 0 mbox_appended = false begin - mbox.append mboxrd_message.to_serialized + serialized = mboxrd_message.to_serialized + mbox.append serialized mbox_appended = true - imap.append uid + imap.append uid, serialized.length, flags rescue StandardError => e mbox.rewind(initial) if mbox_appended message = <<-ERROR.gsub(/^\s*/m, "") [#{folder}] failed to append message #{uid}: