Gnus development mailing list
 help / color / mirror / Atom feed
* bbdb-search problem
@ 2002-09-03  7:37 Alexander Kotelnikov
  2002-09-03 13:19 ` Nevin Kapur
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kotelnikov @ 2002-09-03  7:37 UTC (permalink / raw)


Hello.

I have a function, which checks if incoming mail is from someone who
is in my ~/.bbdb:
(defun my-bbdb-split ()
  "We want people, who are in bbdb not to be splitted to spam"
  (let ((who (cadr
	      (gnus-extract-address-components (message-fetch-field "from"))
	      )))
    (if (bbdb-search (bbdb-records) nil nil who)
	nil
        '(: spam-split)
      )
    )
  )

And I got spam mail with From: that looks like
From: "Bullseye Stock Profiles" <Dreply-[-recipid-_r-5495489-58@1ad7bd.net>

and bbdb-search fails due to '[' presence in the address:
Debugger entered--Lisp error: (invalid-regexp "Unmatched [ or [^")
  string-match("Dreply-[-recipid-_r-5495489-58@1ad7bd.net" "theo@pdmi.ras.ru")
  (setq done (string-match who (car rest-of-nets)) rest-of-nets (cdr rest-of-nets))
  (while (and rest-of-nets (not done)) (setq done (string-match who ...) rest-of-nets (cdr rest-of-nets)))
  (if rest-of-nets (while (and rest-of-nets ...) (setq done ... rest-of-nets ...)) (setq done (string-match who "")))
  (let ((rest-of-nets ...) (done nil)) (if rest-of-nets (while ... ...) (setq done ...)) done)
  (or (let (... ...) (if rest-of-nets ... ...) done))
  (and (not invert) (or (let ... ... done)))
  (or (and invert (not ...)) (and (not invert) (or ...)))
  (if (or (and invert ...) (and ... ...)) (setq matches (cons record matches)))
  (while records (setq record (car records)) (if (or ... ...) (setq matches ...)) (setq records (cdr records)))
  (let ((matches ...) (case-fold-search bbdb-case-fold-search) (records ...) (invert ...) record) (while records (setq record ...) (if ... ...) (setq records ...)) (nreverse matches))
  (bbdb-search (bbdb-records) nil nil who)
  (if (bbdb-search (bbdb-records) nil nil who) nil (quote (: spam-split)))
  (let ((who ...)) (if (bbdb-search ... nil nil who) nil (quote ...)))
  my-bbdb-split()
  eval((my-bbdb-split))
  nnmail-split-it((: my-bbdb-split))
  nnmail-split-it((| (: pre-split) (: my-bbdb-split) (: ml-split) (: sj-split) (: post-split) "IMAP/junk"))
  nnmail-split-fancy()
  nnimap-split-fancy()
  nnimap-split-to-groups(nnimap-split-fancy)
  nnimap-split-articles(nil "giotto")
  nnimap-request-scan(nil "giotto")
  gnus-request-scan(nil (nnimap "giotto" (nnimap-address "giotto.sj.ru") (nnimap-stream shell) (nnimap-list-pattern ("INBOX" "IMAP/*"))))
  gnus-read-active-file-1((nnimap "giotto" (nnimap-address "giotto.sj.ru") (nnimap-stream shell) (nnimap-list-pattern ("INBOX" "IMAP/*"))) nil)
  gnus-read-active-file(nil nil)
  gnus-setup-news(nil nil nil)
  byte-code("\b└\x0e
  gnus-1(nil nil nil)
  gnus(nil)
* call-interactively(gnus)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

Probably, addresses should be quotted to avoid troubles like this.

-- 
Alexander Kotelnikov
Saint-Petersburg, Russia



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bbdb-search problem
  2002-09-03  7:37 bbdb-search problem Alexander Kotelnikov
@ 2002-09-03 13:19 ` Nevin Kapur
  0 siblings, 0 replies; 2+ messages in thread
From: Nevin Kapur @ 2002-09-03 13:19 UTC (permalink / raw)


Alexander Kotelnikov <sacha@giotto.sj.ru> writes:

> I have a function, which checks if incoming mail is from someone who
> is in my ~/.bbdb:

[...]

>     (if (bbdb-search (bbdb-records) nil nil who)

[...]

> And I got spam mail with From: that looks like
> From: "Bullseye Stock Profiles" <Dreply-[-recipid-_r-5495489-58@1ad7bd.net>
>
> and bbdb-search fails due to '[' presence in the address:

[...]

> Probably, addresses should be quotted to avoid troubles like this.

You can use regexp-quote in your function to make sure that the email
you are searching for gets quoted properly: change who to
(regexp-quote who) above.

-Nevin





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-03 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-03  7:37 bbdb-search problem Alexander Kotelnikov
2002-09-03 13:19 ` Nevin Kapur

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