logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

nnimap-folder-list-from-bbdb almost: msg#00006

emacs.bbdb.user

Subject: nnimap-folder-list-from-bbdb almost


Hello

Some weeks ago I asked about a function which would generate a entry
in the nnimap-split-fancy method. This entry would be
based on a relevant entry in the bbdb entry, in this example
imap.

Now I digged out a function in google which almost does what I
want. See below.

However in generates a entry of the form



(("From" "oub@mat\\.ucm\\.es" "testimap"))
instead of
("From" "oub@mat\\.ucm\\.es" "testimap")

I debugged the function and it seems the problem is
(setq new-elmnt-list
(cons (list


Which seems to cause the ((

Could anybody please give me a hint how to eliminate on of the
parenthesis.

Than I could just plug in that function into the gnus-splitting
method, like
nnimap-split-fancy
'(|
(: my:nnimap-folder-list-from-bbdb)

Thanks




Uwe Brauer
Here comes the function.



(defun my:nnimap-folder-list-from-bbdb ()
"Return a list of \(From email-regexp folder-name\) tuples based on the
contents of the bbdb.

The folder-name is the value of the 'imap attribute on the bbdb
record; the email-regexp consists of all the email addresses for the
bbdb record concatenated with with OR. bbdb records without a
'imap attribute are ignored. This function uses regexp-opt to
generate the email-regexp which automatically regexp-quotes its
arguments."
;(interactive)
(let (;; the raw-notes attribute of a bbdb record
notes-attr
;; the value of the 'imap attribute of a bbdb record
folder-attr
;; strings to put before and after the folder-attr
(folder-prefix "")
(folder-postfix "")
;; a regexp matching all the email addresses from a bbdb record
email-regexp
;; the list of (folder email) tuples to return
new-elmnt-list
)
;; loop over the bbdb-records; if a imap attribute exists on
;; the record, generate a regexp matching all the email addresses
;; and add a tuple (folder email-regexp) to the new-elmnt-list
(dolist (record (bbdb-records))
(setq notes-attr (bbdb-record-raw-notes record))
(when (and (listp notes-attr)
(setq folder-attr (cdr (assq 'imap
notes-attr))))
(setq email-regexp (regexp-opt (mapcar 'downcase
(bbdb-record-net record))))
(unless (zerop (length email-regexp))
(setq new-elmnt-list
(cons (list "From" email-regexp (concat folder-prefix
folder-attr folder-postfix))
new-elmnt-list)))))
new-elmnt-list))



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
bbdb-info@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/



<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo