bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] Message ports


From: Chris Hall
Subject: [bug-mailutils] Message ports
Date: Tue, 05 Jun 2012 02:28:01 -1000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Its nice how you defined "message ports" -- very "schemey" (in a *good*
way)!

Input ports seems to work fine, output ports less so.

When I couldn't seem to mu-message-copy to work, I thought I'd do it the
hard way, i.e., something like:

(use-modules (mailutils mailutils))
(use-modules (ice-9 rdelim))
(define source-mbox (mu-mailbox-open
"mbox:///home/me/mail/mailboxes/RSS/Atlantic/mbox" "rw"))
(define target-mbox (mu-mailbox-open
"mbox:///home/me/mail/mailboxes/test.mbox" "crw"))
(define msg-in (mu-mailbox-get-message source-mbox 1))
(define msg-out (mu-message-create))

(define (mu-message-copy-body target-message source-message)
  (let* ((target-body-port (mu-message-get-port target-message "rw"))
        (source-body-port (mu-message-get-port source-message "r"))
        (source-line (read-line source-body-port)))
    (while
     (not (eof-object? source-line))
     (write-line source-line target-body-port)
     (set! source-line (read-line source-body-port)))))

(mu-message-copy-body msg-out msg-in)

This result in msg-out looking very like what I got with 
mu-message-copy: a blank message with a single envelope line.  I had a
display in there to show the what source-line contained, and it showed
all the lines of the input properly.

This make me think that maybe it might be related to the possible SCM
SMOB/mu_stream_copy issue I mentioned earlier.

Another thing I found out playing around was that if one does:

(define source-msg (mu-mailbox-get-message (mu-mailbox-open
"mbox:///var/mail/me" "r") 1))
(define new-msg (mu-message-create))
(mu-message-set-headers new-msg (mu-message-get-headers source-msg))

Afterwards the headers will be in a completely different (probably
reversed) order than the original message.  I'm *not* saying that this
is a bug, but just that people should be aware that maybe it should be

(mu-message-set-headers new-msg (reverse (mu-message-get-headers
source-msg)))


Happy hacking,

Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]