[Evolution] I can't use my email address in Evolution

I just tried to use one of my email address <n ai> in the Email Address
field of a new Evolution account, and discovered it won't let me. 
Looking at the code to see why:

static gboolean
is_email (const char *address)
        const char *at, *hname;

        at = strchr (address, '@');
        /* make sure we have an '@' and that it's not the first or last
char */
        if (!at || at == address || *(at + 1) == '\0')
                return FALSE;

        hname = at + 1;
        /* make sure the first and last chars aren't '.' */
        if (*hname == '.' || hname[strlen (hname) - 1] == '.')
                return FALSE;

        return strchr (hname, '.') != NULL;

That last line is causing the problem; it's insisting that valid
hostnames have dots in them, which simply isn't true.

For example:

[iang janus iang]$ nslookup ai
Server:  caesar0.zks.net

Name:    ai

That's *not* a machine called "ai" in some unspecified local domain. 
That's the 2-letter country code "ai" (Anguilla), and this is the
top-level machine for the country.  I've got an account there called
"n", so my email address is <n ai>.  No dots.

Patch: change that last line to "return TRUE;".  If you wanted to be
more clever, there are only a handful of machine names out there with no
dots in them, and you could hardcode the exceptions list, or something.
Slightly different would be to simply allow any host part consisting
solely of 2 letters(*).  I guess it's better to allow things which
aren't actually valid address than to deny valid addresses.

(*) But those new TLDs like info and museum may someday add A records
for the TLD, so that's not strictly correct, either.  How about just
assume the user knows better than you what his email address is?

   - Ian

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]