>>>>> "IF" == Ian Flanigan <[EMAIL PROTECTED]> writes:
IF> I've another question. I get a lot of DECNet mail coing my way which
IF> has addresses of the form:
IF> Ian Flanigan <xstacy::iflanigan>
Here's my way of dealing with this. It may be that some of this will
interact badly with RFC-822 list syntax, but one rarely actually sees
that...
There was a change somewhere between Emacs 19.22 and 19.27 that caused
me to add the first clause in here - these addressed are getting the
first colon removed, which is very odd, but now this works pretty
well.
I also have it set up to fully qualify the names so that they'll be
more portable when my contract here comes to an end.
----------------------------------------------------------------
(setq sdl/bbdb-default-domain "dechub.lkg.dec.com")
(setq bbdb-canonicalize-redundant-nets-p 't)
(setq bbdb-canonicalize-net-hook 'sdl/canonical-netaddr)
(defun sdl/canonical-netaddr (addr)
(cond
;;
;; foo :bar -> foo::bar
;; A workaround for a 19.27 bug...
;; VMSmail '::' addresses are getting treated as rfc822 lists
;; or something and presented with the first colon turned into
;; a space.
;;
((string-match "\\`\\([-a-zA-Z0-9_]+\\) :\\(.+\\)"
addr)
(concat
(substring addr (match-beginning 1) (match-end 1))
"::"
(substring addr (match-beginning 2))
)
)
;;
;; foo::bar::batz -> bar::batz
;; maybe a shakey thing to do, but it makes life so much
;; easier that I'm gonna do it anyway; the only people this
;; penalizes are those who send VMS mail from hidden nodes,
;; and they deserve to not get answers.
;;
((string-match "\\`\\([-a-zA-Z0-9_]+::\\)\\([-a-zA-Z0-9_-]+\\)::"
addr)
(substring addr (match-beginning 2))
)
;;
;; gateway::"foo@bar" -> foo@bar
;; or
;; gateway::foo@bar -> foo@bar
;;
((string-match "\\`\\([-a-zA-Z0-9_]+\\)::\"?\\(.+@[^\"]+\\)\"?\\'"
addr)
(concat
(substring addr (match-beginning 2) (match-end 2) )
)
)
;;
;; foo::bar -> [EMAIL PROTECTED]
;;
((string-match "\\`\\([-a-zA-Z0-9_]+\\)::\\([-a-zA-Z0-9_]+\\)\\'"
addr)
(concat
(substring addr (match-beginning 2) (match-end 2) )
"@"
(substring addr (match-beginning 1) (match-end 1) )
".enet.dec.com"
)
)
;;
;; Internal DEC Specific - this works only within Digital
;; [EMAIL PROTECTED] -> [EMAIL PROTECTED]
;;
((string-match "\\`\\([-a-zA-Z0-9_]+\\)@\\([-a-zA-Z0-9_]+\\)\\.dnet\\'"
addr)
(concat
(substring addr (match-beginning 1) (match-end 1) )
"@"
(substring addr (match-beginning 2) (match-end 2) )
".enet.dec.com"
)
)
;;
;; Internal DEC Specific -
;; [EMAIL PROTECTED] -> [EMAIL PROTECTED]
;;
((string-match
"\\`\\([-a-zA-Z0-9_]+\\)%\\([-a-zA-Z0-9_]+\\)\\.dnet@[-a-zA-Z0-9._]+.dec\\.com\\'"
addr)
(concat
(substring addr (match-beginning 1) (match-end 1) )
"@"
(substring addr (match-beginning 2) (match-end 2) )
".enet.dec.com"
)
)
;;
;; foo -> foo@<default>
;;
((string-match "\\`[-a-zA-Z0-9_]+\\'"
addr)
(concat addr "@" sdl/bbdb-default-domain )
)
(t addr)
)
)