X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fimap.rb;h=6c04d885d5856a719ba46460b465f51186034a3e;hb=dcd7a7e4c33778d38dd8b1c4059d4b6c99add3fe;hp=4eb13f4ed619d3259df4894eec4a8b66c11c326e;hpb=25d762eeebe5bf69f2c952ce369ba348a6d55a24;p=sup diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index 4eb13f4..6c04d88 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -93,7 +93,7 @@ class IMAP < Source def == o; o.is_a?(IMAP) && o.uri == self.uri && o.username == self.username; end def load_header id - MBox::read_header StringIO.new(raw_header(id)) + parse_raw_email_header StringIO.new(raw_header(id)) end def load_message id @@ -111,6 +111,14 @@ class IMAP < Source end synchronized :raw_header + def store_message date, from_email, &block + message = StringIO.new + yield message + message.string.gsub! /\n/, "\r\n" + + safely { @imap.append mailbox, message.string, [:Seen], Time.now } + end + def raw_message id unsynchronized_scan_mailbox get_imap_fields(id, 'RFC822').first.gsub(/\r\n/, "\n")