From fred at streamfocus.com Fri Mar 5 21:16:58 2010 From: fred at streamfocus.com (Fred Gibson) Date: Fri, 5 Mar 2010 13:16:58 -0800 Subject: [mel-base-devel] find-message bug - possible without using messages? Message-ID: <19290c161003051316i5ef9ad2eq93f6504b35f8b9b2@mail.gmail.com> I'm trying to use find-message on an imap folder without investing the time of calling messages on that folder. I get the following error when I try it: Sequence number 2 does not reference a message [Condition of type SIMPLE-ERROR] Restarts: 0: [RETRY] Retry SLIME REPL evaluation request. 1: [ABORT] Return to SLIME's top level. 2: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: ((SB-PCL::FAST-METHOD MEL.FOLDERS.IMAP::SEQUENCE-NUMBER-MESSAGE (MEL.FOLDERS.IMAP::SEQUENCE-TABLE-MIXIN T)) ..) 1: (SB-DEBUG::TRACE-CALL #) 2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-DEBUG::TRACE-CALL '#) #) 3: (SB-IMPL::ENCAPSULATION # 2) 4: ((SB-PCL::FAST-METHOD MEL.FOLDERS.IMAP::PROCESS-RESPONSE (MEL.FOLDERS.IMAP:IMAP-FOLDER)) ..)[:EXTERNAL] 5: (SB-DEBUG::TRACE-CALL #) 6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-DEBUG::TRACE-CALL '#) #) 7: (SB-IMPL::ENCAPSULATION # :ON-HEADER #) 8: ((SB-PCL::FAST-METHOD MEL.FOLDERS.IMAP::FETCH-MESSAGE-HEADER (MEL.FOLDERS.IMAP:IMAP-FOLDER T)) ..) 9: (SB-DEBUG::TRACE-CALL #) 10: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-DEBUG::TRACE-CALL '#) #) 11: (SB-IMPL::ENCAPSULATION # 2) 12: ((SB-PCL::FAST-METHOD MEL.INTERNAL:MESSAGE-HEADER-STREAM-USING-FOLDER (MEL.FOLDERS.IMAP:IMAP-FOLDER T)) ..) 13: (SB-DEBUG::TRACE-CALL #) 14: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-DEBUG::TRACE-CALL '#) #) 15: (SB-IMPL::ENCAPSULATION # #) 16: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MEL.PUBLIC:MESSAGE-HEADER-STREAM *) #) After calling messages on the folder, find-message works with no issues. Is there some way to use find-message without the messages call? My best, Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Fri Mar 5 21:29:18 2010 From: fred at streamfocus.com (Fred Gibson) Date: Fri, 5 Mar 2010 13:29:18 -0800 Subject: [mel-base-devel] Sensing imap connection timeout Message-ID: <19290c161003051329h7410b0f7nb13de47204d8634a@mail.gmail.com> Is there a way to probe the imap connection to find out if it is still open? I am a big fan of the mel-base message caching, and don't want to give that up unless the imap server has timed out. Unfortunately, ensure-connection does not sense when the imap server is gone and hangs if using cached objects from an earlier active connection. I tried using with-timeout and handler-case to control for this, but for some reason with-timeout does not work on my system (ubuntu/sbcl) when I have all my libraries and application loaded, nor do any timer functions work at all, a bug I couldn't solve. Any ideas would be greatly appreciated. My best, Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Wed Mar 17 01:07:28 2010 From: fred at streamfocus.com (Fred Gibson) Date: Tue, 16 Mar 2010 18:07:28 -0700 Subject: [mel-base-devel] Parse-address problem Message-ID: <19290c161003161807n10595ed7m9b8e44b1304b1203@mail.gmail.com> I ran into a problem with parse address in an email where < was represented with <, so I revised the function to be: diff --git a/lib/mel-base/rfc2822.lisp b/lib/mel-base/rfc2822.lisp index 704ce36..e7845af 100644 --- a/lib/mel-base/rfc2822.lisp +++ b/lib/mel-base/rfc2822.lisp @@ -622,7 +622,7 @@ (#\: (parse-group-address string :start start :end end :errorp errorp)) - ((#\< #\@ nil) (parse-mailbox-address string + ((#\< #\@ #\; nil) (parse-mailbox-address string :start start :end end :errorp errorp)))) This solved the problem. My best, Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC From fred at streamfocus.com Wed Mar 17 01:39:16 2010 From: fred at streamfocus.com (Fred Gibson) Date: Tue, 16 Mar 2010 18:39:16 -0700 Subject: [mel-base-devel] Parse-address (correction) Message-ID: <19290c161003161839l36976909xabdd453f5b636c1b@mail.gmail.com> Please ignore the previous email on this. To solve the problem, I added a string-search function to replace the < and > to < and > , and this solved the problem. diff --git a/lib/mel-base/rfc2822.lisp b/lib/mel-base/rfc2822.lisp index 704ce36..1c6d401 100644 --- a/lib/mel-base/rfc2822.lisp +++ b/lib/mel-base/rfc2822.lisp @@ -614,9 +614,32 @@ :display-name (subseq string start (1- list-start))) (1+ semikolon-start)))) +(defun string-replace (new old string) + (let ((str1 (string string)) + (str2 "") + (sub1 (string old)) + (sub2 (string new)) + (index1 0)) + (loop + (if (string-equal str1 sub1 + :start1 index1 + :end1 (min (length str1) + (+ index1 (length sub1)))) + (progn + (setq str2 (concatenate 'string str2 sub2)) + (incf index1 (length sub1))) + (progn + (setq str2 (concatenate 'string + str2 + (subseq str1 index1 (1+ index1)))) + (incf index1))) + (unless (< index1 (length str1)) + (return str2))))) + (defun parse-address (string &key (start 0) (end (length string)) (errorp t)) (restart-case - (let ((first-special (next-token-of-type string :special :start start :end end))) + (let* ((string (string-replace ">" ">" (string-replace "<" "<" string))) + (first-special (next-token-of-type string :special :start start :end end))) (ecase first-special #+nil((nil) (mime-parse-error "parsing address: No address found")) (#\: (parse-group-address string :start start -- Fred Gibson Founder / Software Developer http://www.streamfocus.com (c)2010 Organon Technologies LLC