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

Re: Conversation View



At Sun, 22 Aug 2010 11:08:46 -0800,
Dave Abrahams wrote:
> 
> On Fri, Aug 20, 2010 at 12:07 PM, Erik Hetzner <ehetzner@gmail.com> wrote:
> > The real trouble is that we need to
> > follow the trail of references up to the first message to really get
> > the full thread, which entails a back-and-forth with the IMAP server.
> 
> AHA!  So I was reading through your code and wondered about this bit:
> 
> > (defun egh:wl-all-folder ()
> >  "%xxx:xxx@xxx.com:993!")
> >
> > (defun egh:wl-summary-visit-conversation ()
> >  (interactive)
> >  (let* ((f (lambda (str)
> >              (mapcar (lambda (msgid)
> >                        (substring msgid 1 -1))
> >                      (split-string str " "))))
>                                          ^^^
> ...because from looking at raw messages, I know that message ids in
> "References:" are often split by all kinds of whitespace.  In particular,
> newlines are common.  So then I traced through some of this code with Edebug
> and discovered that...
> 
> >         (msg (elmo-message-entity
> >               wl-summary-buffer-elmo-folder
> >               wl-summary-buffer-current-msg))
> >         (ids (append
> >               (funcall f (elmo-message-entity-field msg 'message-id))
> >               (funcall f (elmo-message-entity-field msg 'references)))))
>                             ^^^^^^^^^^^^^^^^^^^^^^^^^
> ...here, elmo was returning only the very last message-ID in all the entity's
> References:, which was on a line by itself (maybe why you thought splitting
> on spaces was OK?").  So I think we have an elmo bug that presumably
> could be easily
> fixed!

Hi Dave,

Thanks for debugging my code & my thinking! You are correct. I assumed
we needed to gather more references because my code wasn’t working as
expected, but it does seem we are not getting all references from the
msgdb.

I don’t know why the msgdb is not keeping all the references
around. Here is another version based on the code in
wl-summary-jump-to-parent-message which works around the problem.

I notice when turning on elmo-imap4-debug that WL does a search for:

  uid search all undeleted

when performing this filter, which retrieves all uids. Does anybody
know why this is happening, or how it might be prevented?

best, Erik

(defun egh:wl-summary-visit-conversation ()
  (interactive)
  (let ((folder-name))
    (save-excursion
      (wl-summary-set-message-buffer-or-redisplay)
      (set-buffer (wl-message-get-original-buffer))
      (let* ((clean-and-split-ids (lambda (str)
                                    (mapcar (lambda (msgid)
                                              (substring msgid 1 -1))
                                            (split-string str))))
             (ids (append
                   (funcall clean-and-split-ids (std11-field-body "Message-Id"))
                   (funcall clean-and-split-ids (std11-field-body "References"))))
             (search-condition (mapconcat
                                (lambda (ref)
                                  (concat "message-id:\"" ref
                                          "\"|references:\"" ref "\""))
                                ids "|")))
        (setq folder-name (concat "/" search-condition
                                  "/" (egh:wl-all-folder)))))
    (wl-summary-goto-folder-subr folder-name 'update nil nil t)))

Attachment: pgpHUWlQRT2vb.pgp
Description: PGP signature