Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: regular and adaptive scoring with nnimap
Date: Tue, 04 Feb 2003 17:03:13 -0500	[thread overview]
Message-ID: <4nk7gfd7q6.fsf@lockgroove.bwh.harvard.edu> (raw)
In-Reply-To: <ilu4r7k83j5.fsf@latte.josefsson.org>

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))

;; (nnimap-db-get-article-contents 4388 "ding")

(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))
	
;; (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?

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

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?

Thanks
Ted



  parent reply	other threads:[~2003-02-04 22:03 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 [this message]
2003-02-05  5:52                   ` Simon Josefsson
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=4nk7gfd7q6.fsf@lockgroove.bwh.harvard.edu \
    --to=tzz@lifelogs.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).