From: Jake Colman <colman@ppllc.com>
Cc: Simon Josefsson <sj@extundo.com>
Subject: Help defadvising nnimap-open-connection
Date: 03 Jan 2001 13:42:28 -0500 [thread overview]
Message-ID: <767l4c5vfv.fsf@newjersey.ppllc.com> (raw)
In a previous post on this list, Christoph Conrad discusses a problem with
nntp-open-network-stream with respect to hangs when a connection problem
occurs. He resolved the problem with with the following piece of advice:
(defadvice open-network-stream
( before nntp-open-network-stream-resolve act )
(when (not (string-match "[0-9.]+" (ad-get-arg 2)))
(ad-set-arg 2 (cc-resolve-address nntp-address))))
The function cc-resolve-address converts a host name to a host IP address
using nslookup.
Since I see the same problem quite regularly when connecting to my imap
server, I attempted the following piece of advice:
(defadvice nnimap-open-connection
(before nnimap-open-connection-resolve act)
(when (not (string-match "[0-9.]+" (ad-get-arg 0)))
(ad-set-arg 0 (cc-resolve-address nnimap-address))))
When I do this, I end up crashing because nnimap-server-buffer is nil in
nnimap-open-server. Can someone (Simon?) help me figure out how to do this?
Basically, I want to transparently replace the imap host name with the imap
IP address so that the actual connection is done via the address.
For completeness sake, here is the cc-resolve-address function:
(defun cc-resolve-address( domain )
"Helper function for advised open-network-stream function"
(save-excursion
(let ((output-buf (generate-new-buffer " *resolve-address*")))
(unwind-protect
(progn
(set-buffer output-buf)
(and (eq (call-process
"/usr/sbin/nslookup" nil output-buf nil
"-retries=1" domain)
0)
(> (point-max) 2)
(goto-char (point-max))
(when (re-search-backward (concat "^Name: [ ]*"
domain
"\n"
"Address: [ ]*\\(.*\\)$")
nil t)
(match-string 1))))
;; unwind-protect cleanup
(kill-buffer output-buf)))))
TIA!
--
Jake Colman
Principia Partners LLC Phone: (201) 946-0300
Harborside Financial Center Fax: (201) 946-0320
902 Plaza II Beeper: (800) 928-4640
Jersey City, NJ 07311 E-mail: colman@ppllc.com
E-mail: jcolman@jnc.com
web: http://www.ppllc.com
microsoft: "where do you want to go today?"
linux: "where do you want to go tomorrow?"
BSD: "are you guys coming, or what?"
next reply other threads:[~2001-01-03 18:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-03 18:42 Jake Colman [this message]
2001-01-03 23:00 ` Christoph Conrad
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=767l4c5vfv.fsf@newjersey.ppllc.com \
--to=colman@ppllc.com \
--cc=sj@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).