예제 #1
0
파일: rfc822.c 프로젝트: 2ion/mutt-1.5.22
static const char *
parse_address (const char *s,
               char *token, size_t *tokenlen, size_t tokenmax,
	       char *comment, size_t *commentlen, size_t commentmax,
	       ADDRESS *addr)
{
  s = parse_mailboxdomain (s, ".\"(\\",
			   token, tokenlen, tokenmax,
			   comment, commentlen, commentmax);
  if (!s)
    return NULL;

  if (*s == '@')
  {
    if (*tokenlen < tokenmax)
      token[(*tokenlen)++] = '@';
    s = parse_mailboxdomain (s + 1, ".([]\\",
			     token, tokenlen, tokenmax,
			     comment, commentlen, commentmax);
    if (!s)
      return NULL;
  }

  terminate_string (token, *tokenlen, tokenmax);
  addr->mailbox = safe_strdup (token);

  if (*commentlen && !addr->personal)
  {
    terminate_string (comment, *commentlen, commentmax);
    addr->personal = safe_strdup (comment);
  }

  return s;
}
예제 #2
0
LPCSTR parse_address( LPCSTR s,
               LPSTR token, size_t *tokenlen, size_t tokenmax,
         LPSTR comment, size_t *commentlen, size_t commentmax,
         PPerson addr )
{
  s = parse_mailboxdomain (s, ".\"(\\",
    token, tokenlen, tokenmax,
    comment, commentlen, commentmax);
  if (!s)
    return NULL;

  if (*s == '@')
  {
    if (*tokenlen < tokenmax)
      token[(*tokenlen)++] = '@';
    s = parse_mailboxdomain (s + 1, ".([]\\",
      token, tokenlen, tokenmax,
      comment, commentlen, commentmax);
    if (!s)
      return NULL;
  }

  terminate_string (token, *tokenlen, tokenmax);
  addr->Addr =token;

  if ( *commentlen && addr->Name.IsEmpty() )
  {
    terminate_string (comment, *commentlen, commentmax);
    addr->Name = comment;
  }

  return s;
}