From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/34032 Path: main.gmane.org!not-for-mail From: Christoph Conrad Newsgroups: gmane.emacs.gnus.general Subject: Re: Help defadvising nnimap-open-connection Date: 04 Jan 2001 00:00:57 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: References: <767l4c5vfv.fsf@newjersey.ppllc.com> Reply-To: Christoph Conrad NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035170033 28300 80.91.224.250 (21 Oct 2002 03:13:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 03:13:53 +0000 (UTC) Cc: ding@gnus.org, Simon Josefsson Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by mailhost.sclp.com (Postfix) with ESMTP id 0EA16D049D for ; Wed, 3 Jan 2001 18:02:40 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id RAB00848; Wed, 3 Jan 2001 17:02:22 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 03 Jan 2001 17:01:22 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@66-209.196.61.interliant.com [209.196.61.66] (may be forged)) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id RAA21890 for ; Wed, 3 Jan 2001 17:01:12 -0600 (CST) Original-Received: from mutzel.brumpf.de (A635b.pppool.de [213.6.99.91]) by mailhost.sclp.com (Postfix) with ESMTP id 25B37D049D for ; Wed, 3 Jan 2001 18:01:34 -0500 (EST) Original-Received: (from cc@localhost) by mutzel.brumpf.de (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id AAA29499; Thu, 4 Jan 2001 00:00:58 +0100 X-Authentication-Warning: mutzel.brumpf.de: cc set sender to christoph.conrad@gmx.de using -f X-Draft-From: ("nntp+quimby.gnus.org:gnus.ding" 30232) Original-To: Jake Colman X-Public-Key: http://pgp5.ai.mit.edu:11371/pks/lookup?op=get&search=0x1B488DEA In-Reply-To: <767l4c5vfv.fsf@newjersey.ppllc.com> User-Agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 Precedence: list X-Majordomo: 1.94.jlt7 Original-Lines: 46 Xref: main.gmane.org gmane.emacs.gnus.general:34032 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:34032 Hi Jake, you wrote: > (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)))) I had a look in the relevant sources. Since `nnimap-open-connection' in nnimap.el uses (defun imap-open (server &optional port stream auth buffer) in imap.el you should advice this function. The server argument from `nnimap-open-connection' seems to be something other. So i would try (untested): (defadvice imap-open ( before imap-open-resolve act ) (let ( (host (ad-get-arg 0)) ) (when (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" host)) (ad-set-arg 0 (cc-resolve-address host))))) Annotation: my original function had a bug which didn't had effects, i changed it to (yet untested) ;; Args are NAME BUFFER HOST SERVICE. (defadvice open-network-stream ( before open-network-stream-resolve act ) (let ( (host (ad-get-arg 2)) ) (when (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" host)) (ad-set-arg 2 (cc-resolve-address host))))) ;; test ;; (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" "1.1.1.1")) ;; (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" "news.cis.dfn.de")) Best regards, cu, -cc- -- => GNU Emacs Webring @ <= Look Ma, this man can twist his fingers as if they were made of rubber, isn't that amazing? -- Not really, he's been using emacs for years...!