That won't actually work (at least not very well). The Camel address
decoding functions assume their input is supposed to be valid and so it
will do whatever it has to do to make it work. It would have to be
extremely broken for it to fail.

What you'll probably have to do is write similar functionality that is
much more strict in what it accepts.

Jeff

Roberto -MadBob- Guido wrote:
> 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 ("[email protected]");
>         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 :-)
>
>   

_______________________________________________
Evolution-hackers mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-hackers

Reply via email to