Sha256: 042b060cd6bf9ca6fed793bb55ced35040239b3f8b99d4e25c5d315fbe99a49a

Contents?: true

Size: 631 Bytes

Versions: 11

Compression:

Stored size: 631 Bytes

Contents

module Imap; end

module Imap::Backup
  class LocalOnlyMessageDeleter
    attr_reader :folder
    attr_reader :serializer

    def initialize(folder, serializer)
      @folder = folder
      @serializer = serializer
    end

    # TODO: this method is very slow as it copies all messages.
    # A quicker method would only remove UIDs from the .imap file,
    # but that would require a garbage collection later.
    def run
      local_only_uids = serializer.uids - folder.uids
      return if local_only_uids.empty?

      serializer.filter do |message|
        !local_only_uids.include?(message.uid)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
imap-backup-13.2.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-13.1.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-13.0.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-12.1.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-12.0.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-11.1.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-11.1.0.rc1 lib/imap/backup/local_only_message_deleter.rb
imap-backup-11.0.1 lib/imap/backup/local_only_message_deleter.rb
imap-backup-11.0.0 lib/imap/backup/local_only_message_deleter.rb
imap-backup-11.0.0.rc1 lib/imap/backup/local_only_message_deleter.rb
imap-backup-10.0.1 lib/imap/backup/local_only_message_deleter.rb