[mel-base-devel] Parsing message from string
Jochen Schmidt
js at crispylogics.com
Sat Jan 23 10:52:00 UTC 2010
Am 14.01.2010 um 00:18 schrieb Michael Gardner:
> I'm writing a simple NNTP->IMAP cron tool. It pulls each NNTP article as a single string, and then must turn that string into a mel-base message somehow for upload to an IMAP server.
>
> But I can't figure out how to get mel-base to parse a string into an email directly. I can output to a temporary file (or named pipe) and then use make-message-from-file, but it seems like there should be an easier way to do this. Am I missing something?
There currently is indeed no function to directly do that, but its actually quite easy given the tools available. You have to implement a minimal folder protocol for strings then:
(defclass basic-receiver-from-string (mel:basic-receiver)
((string :initarg :string)))
(defmethod mel:open-message-input-stream-using-folder ((folder basic-receiver-from-string) (message mel:message) start)
(make-string-input-stream (slot-value folder 'string) start))
(defun make-message-from-string (string)
(make-instance 'mel:mime-message :folder (make-instance 'basic-receiver-from-string :string string)))
Simple enough? ;-)
Yes I will add something like that so that it works out of the box.
ciao,
Jochen
--
Jochen Schmidt
CRISPYLOGICS
Uhlandstr. 9, 90408 Nuremberg
Fon +49 (0)911 517 999 82
Fax +49 (0)911 517 999 83
mailto:(format nil "~(~36r@~36r.~36r~)" 870180 1680085828711918828 16438) http://www.crispylogics.com
More information about the mel-base-devel
mailing list