From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Local interface used for outbound network connections Date: 08 Jan 2003 17:39:18 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xbs2rh9zd.fsf@kfs2.cua.dk> References: <87ptr81sye.fsf@lexx.delysid.org> <5xof6rhncz.fsf@kfs2.cua.dk> <87u1gjzogj.fsf@lexx.delysid.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042040808 29144 80.91.224.249 (8 Jan 2003 15:46:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2003 15:46:48 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18WIPL-0007Yo-00 for ; Wed, 08 Jan 2003 16:46:19 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18WIUR-00064n-00 for ; Wed, 08 Jan 2003 16:51:36 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18WINv-0002sW-02 for emacs-devel@quimby.gnus.org; Wed, 08 Jan 2003 10:44:51 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18WIN6-0002Hm-00 for emacs-devel@gnu.org; Wed, 08 Jan 2003 10:44:00 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18WILW-0001A1-00 for emacs-devel@gnu.org; Wed, 08 Jan 2003 10:42:53 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18WIJ4-0008Q7-00 for emacs-devel@gnu.org; Wed, 08 Jan 2003 10:39:50 -0500 Original-Received: from kfs2.cua.dk.cua.dk (kfs2.local.filanet.dk [192.168.1.182]) by mail.filanet.dk (Postfix) with SMTP id B612D7C012; Wed, 8 Jan 2003 16:39:48 +0100 (CET) Original-To: Mario Lang In-Reply-To: <87u1gjzogj.fsf@lexx.delysid.org> Original-Lines: 28 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10582 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10582 Mario Lang writes: > > I definitely intended make-network-process to make this info > > available, but I forgot to implement it. Thanks for reminding me :-) > > > Thanks a lot! Tested, and works here. Good. > > (defun erc-dcc-get-host (proc) > (let ((sockaddr (plist-get (process-contact erc-process t) :local))) > (when sockaddr > (mapconcat #'number-to-string (subseq sockaddr 0 4) ".")))) I just installed a change to format-network-address, so you can now omit the port number from the result string. You may thus simplify your code like this (format-network-address returns nil if the address is nil): (defun erc-dcc-get-host (proc) (let ((sockaddr (plist-get (process-contact erc-process t) :local))) (format-network-address sockaddr t))) -- Kim F. Storm http://www.cua.dk