From fred at streamfocus.com Fri Feb 12 15:47:56 2010 From: fred at streamfocus.com (Fred Gibson) Date: Fri, 12 Feb 2010 07:47:56 -0800 Subject: [mel-base-devel] Compile problem with environment.lisp on SBCL 1.0.34 Message-ID: <19290c161002120747t4db287e2ob82696a59f922ae3@mail.gmail.com> Because of a bug in the current SBCL release < http://bugs.launchpad.net/sbcl/+bug/495044 > I had to make the following changes to get environment.lisp to compile: diff --git a/lib/mel-base/lisp-dep/environment.lisp b/lib/mel-base/lisp-dep/environment.lisp index 573779c..3c2a737 100644 --- a/lib/mel-base/lisp-dep/environment.lisp +++ b/lib/mel-base/lisp-dep/environment.lisp @@ -110,13 +110,14 @@ custom:*FOREIGN-ENCODING*) (and unix #.(cl:if (cl:find-package "UFFI") '(and) '(or)))) (defun gethostname () "Returns the hostname" + (declare (optimize (speed 0)));because of sbcl bug http://bugs.launchpad.net/sbcl/+bug/495044 (uffi:with-foreign-object (name '(:array :unsigned-char 256)) (if (zerop (c-gethostname (uffi:char-array-to-pointer name) 256)) (uffi:convert-from-foreign-string name) (error "gethostname() failed.")))) ;; If no GETHOSTNAME is yet defined - generate a dummy stub -#-#. (cl:if (cl:fboundp 'gethostname) '(and) '(or)) +#-#.(cl:if (cl:or sbcl (cl:fboundp 'gethostname)) '(and) '(or)) (progn (warn "Uses dummy GETHOSTNAME function - try loading UFFI before compiling mel-base") (defun gethostname () Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Sun Feb 14 21:00:15 2010 From: fred at streamfocus.com (Fred Gibson) Date: Sun, 14 Feb 2010 13:00:15 -0800 Subject: [mel-base-devel] Ensure-Connection problem with imaps-folder Message-ID: <19290c161002141300v36bbe294n3fe6fb461d8dca57@mail.gmail.com> I'm working with imaps-folder's and noticed a problem where ensure connection tries to reconnect using the non-ssl make-imap-connection method. This fix seems to solve the problem: diff --git a/lib/mel-base/folders/imap/folder.lisp b/lib/mel-base/folders/imap/folder.lisp index f855744..bfaf9c6 100644 --- a/lib/mel-base/folders/imap/folder.lisp +++ b/lib/mel-base/folders/imap/folder.lisp @@ -532,7 +532,9 @@ (defmethod ensure-connection ((folder imap-folder)) (when (eq (state folder) :disconnected) - (setf (connection folder) (make-imap-connection folder)) + (setf (connection folder) (if (eq (type-of *) 'mel.folders.imap:imaps-folder) + (make-imaps-connection folder) + (make-imap-connection folder))) (setf (state folder) :connected) (select-mailbox folder)) (handler-case My best, -- Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Mon Feb 15 14:32:41 2010 From: fred at streamfocus.com (Fred Gibson) Date: Mon, 15 Feb 2010 06:32:41 -0800 Subject: [mel-base-devel] part-body-stream bug reading from imap folder Message-ID: <19290c161002150632u7e0bd64n28ba88c3f163608e@mail.gmail.com> I fixed the following bug in part-body-stream when reading from an imap folder (rather than return the stream, it was returning the header string): diff --git a/lib/mel-base/multiparts.lisp b/lib/mel-base/multiparts.lisp index e98c58e..dce8cc2 100644 --- a/lib/mel-base/multiparts.lisp +++ b/lib/mel-base/multiparts.lisp @@ -402,7 +402,8 @@ (defmethod part-body-stream ((part part)) "Skip header to beginning of part body and return stream" (let ((part-stream (part-stream part))) - (read-rfc2822-header part-stream))) + (skip-rfc2822-header part-stream) + part-stream)) (defmethod open-message-input-stream-using-folder (folder (part part) start) My best, Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Wed Feb 17 15:48:15 2010 From: fred at streamfocus.com (Fred Gibson) Date: Wed, 17 Feb 2010 07:48:15 -0800 Subject: [mel-base-devel] skip-rfc2822-header problem with html document Message-ID: <19290c161002170748h51fc05f6kcbc48344c828bd8c@mail.gmail.com> With email that has no parts and comprise and entire webpage beginning after the main email header with: The skip-rfc2822-header mistakenly skips this and quite a bit more of the initial html tags of the document. To solve this, I added a check that, if the character #\< is the first character in the stream, then the following cannot be a header and the function returns without changing the stream position: diff --git a/lib/mel-base/rfc2822.lisp b/lib/mel-base/rfc2822.lisp index 29888fd..704ce36 100644 --- a/lib/mel-base/rfc2822.lisp +++ b/lib/mel-base/rfc2822.lisp @@ -188,20 +188,21 @@ :courier) (t :mac))) (#\linefeed :unix)))))) - - (loop with line-ending-style = :rfc - for style = (skip-to-cr/lf) - do - (unless (eq line-ending-style style) - (buggy "Switched lineending-style") - (setf line-ending-style style)) - (case line-ending-style - (:mac (when (accept-char #\return stream) (return (1+ file-position)))) - (:unix (when (accept-char #\linefeed stream) (return (1+ file-position)))) - (:rfc (when (accept-crlf stream) (return (+ 2 file-position)))) - (:courier (when (and (accept-char #\return stream)(accept-crlf stream)) - (return (+ 3 file-position)))) - )))) + (let ((first-char (peek-char nil stream nil nil))) + (unless (char= #\< first-char);Start of html document + (loop with line-ending-style = :rfc + for style = (skip-to-cr/lf) + do + (unless (eq line-ending-style style) + (buggy "Switched lineending-style") + (setf line-ending-style style)) + (case line-ending-style + (:mac (when (accept-char #\return stream) (return (1+ file-position)))) + (:unix (when (accept-char #\linefeed stream) (return (1+ file-position)))) + (:rfc (when (accept-crlf stream) (return (+ 2 file-position)))) + (:courier (when (and (accept-char #\return stream)(accept-crlf stream)) + (return (+ 3 file-position)))) + )))))) (defun read-rfc2822-header (stream) (let ((octets 0) fields Does that make sense? My best, Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC