Sha256: 91821cbc6bba962a10fb6c91d4594154324b7a5a9275c8e2b7490bd3ca9893b5

Contents?: true

Size: 678 Bytes

Versions: 4

Compression:

Stored size: 678 Bytes

Contents

# encoding: utf-8

module Imap
  module Backup
    module Account
      class Folder

        REQUESTED_ATTRIBUTES = ['RFC822', 'FLAGS', 'INTERNALDATE']

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

        def uids
          @connection.imap.examine(@folder)
          @connection.imap.uid_search(['ALL']).sort
        end

        def fetch(uid)
          @connection.imap.examine(@folder)
          message = @connection.imap.uid_fetch([uid.to_i], REQUESTED_ATTRIBUTES)[0][1]
          message['RFC822'].force_encoding('utf-8') if RUBY_VERSION > '1.9'
          message
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
imap-backup-0.0.5 lib/imap/backup/account/folder.rb
imap-backup-0.0.4 lib/imap/backup/account/folder.rb
imap-backup-0.0.3 lib/imap/backup/account/folder.rb
imap-backup-0.0.2 lib/imap/backup/account/folder.rb