[Evolution-hackers] mail address validation



I was re-working the patch at
https://bugzilla.gnome.org/show_bug.cgi?id=213724 after reading the
comment from Milan Crha (that I just now saw, with a pair of months of
delay :-P ), but it is unclear to me now to validate a mail address
using camel_*address_* functions.

Here a little test I've done:

//////////////////////////////////////////////////////

#include <stdio.h>
#include <camel/camel.h>

static void test (const gchar *address) {
        int ret;
        CamelInternetAddress *addr;

        addr = camel_internet_address_new ();
        ret = camel_address_decode (CAMEL_ADDRESS (addr), address);
        if (ret == -1)
                printf ("%s: FAIL!\n", address);
        else
                printf ("%s: OK\n", address);
}

int main () {
        g_type_init ();
        g_thread_init (NULL);
        test ("madbob");
        test ("2345678");
        test ("madbob example org");
        exit (0);
}

//////////////////////////////////////////////////////

The test results always positive, with any string I submit, I'm sure I'm
missing something but don't know what.

Suggestions?
Thanks :-)

-- 
Roberto -MadBob- Guido
http://claimid.com/madbob




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