Sha256: f326da18b7964ba854c59ca157dd5e54421299090c2d1fec1e60d8325cdb9213
Contents?: true
Size: 925 Bytes
Versions: 1
Compression:
Stored size: 925 Bytes
Contents
# frozen_string_literal: true require "net/imap" class Net::IMAP module Multiappend REQUIRED_CAPABILITIES = %w(LITERAL+ MULTIAPPEND).freeze class Message attr_reader :message attr_reader :flags attr_reader :date_time def initialize(message, flags: nil, date_time: nil) @message = message @flags = flags @date_time = date_time end def message_literal Literal.new(message) end end def multiappend(mailbox, messages) args = ([[]] + messages).reduce do |memo, m| memo.push(m.flags) if m.flags memo.push(m.date_time) if m.date_time memo.push(m.message_literal) memo end send_command("APPEND", mailbox, *args) end def can_multiappend? capabilities = capability REQUIRED_CAPABILITIES.all? { |c| capabilities.include?(c) } end end include Multiappend end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
net-imap-multiappend-0.1.0 | lib/net/imap/multiappend.rb |