Changeset 387:dc344c0405d3 for alias.c

Show
Ignore:
Timestamp:
1998-08-23 03:05:27 (10 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
mutt-0-94
Message:

[patch-0.94.3i.tlr.hidden_host.1] Replace the
--enable-hidden-host configure switch by a configuration
variable $hidden_host which can be changed at run-time.
This variable will _not_ affect the generation of
message-IDs since we'll get into uniqueness problems if we
just use the domain here.

Needs to be documented.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • alias.c

    r348 r387  
    3939  LIST *u; 
    4040  char i; 
    41  
     41  const char *fqdn; 
     42   
    4243  while (a) 
    4344  { 
     
    109110  } 
    110111 
    111   if (option (OPTUSEDOMAIN) && Fqdn && Fqdn[0] != '@') 
     112  if (option (OPTUSEDOMAIN) && (fqdn = mutt_fqdn(1))) 
    112113  { 
    113114    /* now qualify all local addresses */ 
    114     rfc822_qualify (head, Fqdn); 
     115    rfc822_qualify (head, fqdn); 
    115116  } 
    116117 
     
    373374} 
    374375 
     376static int string_is_address(const char *str, const char *u, const char *d) 
     377{ 
     378  char buf[LONG_STRING]; 
     379   
     380  snprintf(buf, sizeof(buf), "%s@%s", NONULL(u), NONULL(d)); 
     381  if (strcasecmp(str, buf) == 0) 
     382    return 1; 
     383   
     384  return 0; 
     385} 
     386 
    375387/* returns TRUE if the given address belongs to the user. */ 
    376388int mutt_addr_is_user (ADDRESS *addr) 
    377389{ 
    378   char buf[LONG_STRING]; 
    379  
    380390  /* NULL address is assumed to be the user. */ 
    381391  if (!addr) 
     
    383393  if (!addr->mailbox) 
    384394    return 0; 
     395 
    385396  if (strcasecmp (addr->mailbox, NONULL(Username)) == 0) 
    386397    return 1; 
    387   snprintf (buf, sizeof (buf), "%s@%s", NONULL(Username), NONULL(Hostname)); 
    388   if (strcasecmp (addr->mailbox, buf) == 0) 
    389     return 1; 
    390   snprintf (buf, sizeof (buf), "%s@%s", NONULL(Username), NONULL(Fqdn)); 
    391   if (strcasecmp (addr->mailbox, buf) == 0) 
     398  if(string_is_address(addr->mailbox, Username, Hostname)) 
     399    return 1; 
     400  if(string_is_address(addr->mailbox, Username, mutt_fqdn(0))) 
     401    return 1; 
     402  if(string_is_address(addr->mailbox, Username, mutt_fqdn(1))) 
    392403    return 1; 
    393404 
     
    395406      regexec (Alternates.rx, addr->mailbox, 0, NULL, 0) == 0) 
    396407    return 1; 
     408   
    397409  return 0; 
    398410}