Gnus development mailing list
 help / color / mirror / Atom feed
From: Simon Josefsson <jas@extundo.com>
Subject: Re: regular and adaptive scoring with nnimap
Date: Wed, 05 Feb 2003 06:52:07 +0100	[thread overview]
Message-ID: <iluu1fj6zqw.fsf@latte.josefsson.org> (raw)
In-Reply-To: <4nk7gfd7q6.fsf@lockgroove.bwh.harvard.edu> (Ted Zlatanov's message of "Tue, 04 Feb 2003 17:03:13 -0500")

Ted Zlatanov <tzz@lifelogs.com> writes:

> How does this look, for retrieving an article and searching a group by
> any parameter?
>
> (defun nnimap-db-get-article-contents (article group &optional server)
>   (let ((data))
>     (when (numberp article)
>       (with-current-buffer (nnimap-get-server-buffer server)
> 	(let ((saved (imap-current-mailbox)))
> 	  (with-temp-buffer
> 	    (nnimap-request-article article group server (buffer-name))
> 	    (setq data (buffer-string)))
> 	  (nnimap-possibly-change-group saved server))))
>     data))

Looks good.  You might want to remove the store-and-restore current
mailbox, I don't think it is necessary and on some servers it will be
really slow.

> (defun nnimap-db-get-uids-for-parameter (group parameter subject &optional server)
>   (let ((articles))
>     (when (and (stringp subject) (stringp parameter) (stringp group))
>       (with-current-buffer (nnimap-get-server-buffer server)
> 	(let ((saved (imap-current-mailbox)))
> 	  (nnimap-possibly-change-group group server)
> 	  (setq articles (imap-search (format "HEADER %s \"%s\"" parameter subject)))
> 	  (nnimap-possibly-change-group saved server))))
>     articles))

Looks good, with the same comment as above.

> ;; (nnimap-db-get-uids-for-parameter "ding" "Subject" "spam")
> ;; (nnimap-db-get-uids-for-parameter "ding" "Message-Id" "<ilu4r7k83j5.fsf@latte.josefsson.org>")
>
> I'm assuming two things:
>
> 1) (nnimap-possibly-change-group nil) is harmless
> 2) (nnimap-possibly-change-group nil) returns the current group
>
> Are both true?

n-p-c-g is actually somewhat broken (uidvalidity), so I suggest not
using it.  Instead, either use

      (if (imap-current-mailbox-p group)
	  imap-current-mailbox
	(if (imap-mailbox-select group)
           imap-current-mailbox
         (error "Could not select group: %s" (imap-error-text)))

or something.

> I would use imap exclusively, but nnimap-possibly-change-group and the
> other functions it offers are too useful :)

Maybe the above code should be added as imap-possibly-change-group.  Hm.

> Also, do I need to do
>
> (setq gnus-newsgroup-active (gnus-activate-group group))
>
> before each operation in case the nnimap server is not activated?

You should try to make sure the server is open, yes.  Setting that
variable is probably not the right thing though, I think it is buffer
local to summary buffers. g-a-g calls various hooks and stuff too, so
perhaps it is not perfect to use.




  reply	other threads:[~2003-02-05  5:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-25 16:39 Ted Zlatanov
2003-01-25 21:39 ` Kai Großjohann
2003-01-26  0:16   ` Simon Josefsson
2003-01-26  0:43     ` Ted Zlatanov
2003-01-26  1:13       ` Simon Josefsson
2003-01-26 14:36       ` Kai Großjohann
2003-01-27 18:37         ` Ted Zlatanov
2003-01-27 20:26           ` Kai Großjohann
2003-02-03 20:53             ` Ted Zlatanov
2003-02-04  6:48               ` Kai Großjohann
2003-02-04 19:54                 ` Ted Zlatanov
2003-02-04 20:08                   ` Kai Großjohann
2003-02-04  9:16               ` Andreas Fuchs
2003-02-04 19:45                 ` Ted Zlatanov
2003-02-04 20:10                   ` Kai Großjohann
2003-02-04 20:32                     ` Ted Zlatanov
2003-02-04 15:32               ` Simon Josefsson
2003-02-04 19:50                 ` Ted Zlatanov
2003-02-04 22:03                 ` Ted Zlatanov
2003-02-05  5:52                   ` Simon Josefsson [this message]
2003-02-05 20:35                     ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iluu1fj6zqw.fsf@latte.josefsson.org \
    --to=jas@extundo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).