Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: <ding@gnus.org>
Subject: Re: nnimap ignoring server options?
Date: Tue, 19 Oct 2010 13:28:08 -0500	[thread overview]
Message-ID: <87lj5uox53.fsf@lifelogs.com> (raw)
In-Reply-To: <m3k4ledq59.fsf@quimbies.gnus.org> (Lars Magne Ingebrigtsen's message of "Tue, 19 Oct 2010 19:54:42 +0200")

On Tue, 19 Oct 2010 19:54:42 +0200 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Ted Zlatanov <tzz@lifelogs.com> writes:
>> That seems easy to fix:
>> 
>> (when (symbolp port) (setq port (symbol-name port)))
>> 
>> ...and I think it would be a good fit, generally, since service names
>> tend to be within the symbol character set.  Any reasons not to do this?

LMI> This should be done in the code that maps service names to numbers to
LMI> avoid having some taking 'imaps and other taking "imaps".  That would
LMI> probably be Fmake_network_process.

Here's a patch.  It also corrects the docs (getservbyname will be called
if getaddrinfo is not available, so either way a string will work, which
is not what the docs say).  WDYT?

Ted

=== modified file 'src/process.c'
--- src/process.c       2010-10-08 10:14:47 +0000
+++ src/process.c       2010-10-19 18:26:51 +0000
@@ -2978,10 +2978,11 @@
 host, and only clients connecting to that address will be accepted.
 
 :service SERVICE -- SERVICE is name of the service desired, or an
-integer specifying a port number to connect to.  If SERVICE is t,
-a random port number is selected for the server.  (If Emacs was
-compiled with getaddrinfo, a port number can also be specified as a
-string, e.g. "80", as well as an integer.  This is not portable.)
+integer specifying a port number to connect to.  If SERVICE is t, a
+random port number is selected for the server.  A port number can also
+be specified as a string, e.g. "80", or a symbol whose name will be
+used, as well as an integer.  This is not necessarily portable; either
+getaddrinfo or getservbyname will be used to look up the port number.
 
 :type TYPE -- TYPE is the type of connection.  The default (nil) is a
 stream type connection, `datagram' creates a datagram type connection,
@@ -3303,6 +3304,11 @@
      Otherwise, use getservbyname to lookup the service.  */
   if (!NILP (host))
     {
+      /* Take a symbol as the service and convert it to a string.  */
+      if (SYMBOLP (service))
+       {
+         service = Fsymbol_name (service);
+       }
 
       /* SERVICE can either be a string or int.
         Convert to a C string for later use by getaddrinfo.  */
@@ -3347,6 +3353,12 @@
   /* We end up here if getaddrinfo is not defined, or in case no hostname
      has been specified (e.g. for a local server process).  */
 
+  /* Take a symbol as the service and convert it to a string.  */
+  if (SYMBOLP (service))
+    {
+      service = Fsymbol_name (service);
+    }
+
   if (EQ (service, Qt))
     port = 0;
   else if (INTEGERP (service))




  reply	other threads:[~2010-10-19 18:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11  1:30 Andrew J Cosgriff
2010-10-11 18:03 ` Lars Magne Ingebrigtsen
2010-10-11 21:19   ` Andrew J Cosgriff
2010-10-12 12:43     ` Lars Magne Ingebrigtsen
2010-10-13 22:33       ` Andrew J Cosgriff
2010-10-13 22:59         ` Lars Magne Ingebrigtsen
2010-10-14 23:29           ` Andrew J Cosgriff
2010-10-15  7:43             ` Lars Magne Ingebrigtsen
2010-10-15  9:53               ` Andrew J Cosgriff
2010-10-15 14:02                 ` Lars Magne Ingebrigtsen
2010-10-17 21:54                   ` Andrew J Cosgriff
2010-10-17 22:00                     ` Lars Magne Ingebrigtsen
2010-10-18 21:07                       ` Andrew J Cosgriff
2010-10-18 21:59                         ` Lars Magne Ingebrigtsen
2010-10-18 23:47                           ` Andrew J Cosgriff
2010-10-18 23:52                             ` Lars Magne Ingebrigtsen
2010-10-19  0:41                               ` Katsumi Yamaoka
2010-10-19 17:52                                 ` Lars Magne Ingebrigtsen
2010-10-19 18:36                                 ` Andreas Schwab
2010-10-19 18:30                               ` Andreas Schwab
2010-10-19 14:13                           ` Ted Zlatanov
2010-10-19 17:54                             ` Lars Magne Ingebrigtsen
2010-10-19 18:28                               ` Ted Zlatanov [this message]
2010-10-19 18:30                                 ` Lars Magne Ingebrigtsen
2010-10-12  4:00   ` Bruno Tavernier
2010-10-12  8:23     ` Andrew J Cosgriff
2010-10-12 12:43     ` Lars Magne Ingebrigtsen

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=87lj5uox53.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=ding@gnus.org \
    /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).