Re: [evolution-patches] Patch for the receipt bounty (#127534) (fwd)



On Fri, 2005-04-08 at 13:22 -0400, Jeffrey Stedfast wrote:
> +void
> +em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message)
> +{
> +       /* See RFC #2298 for a description of message receipts */
> +
> +       EAccount *account = guess_account (message, folder);
> +
> +       CamelMimeMessage *receipt = camel_mime_message_new ();
> 
> the extra blank lines should be removed as they will cause compile
> problems with some compilers (e.g. non-gcc)
> 
> +       /* We use camel_header_msgid_generate () to get a canonical
> +        * hostname, then skip the part leading to '@' */
> +       fake_msgid = camel_header_msgid_generate ();
> +       for (hostname = fake_msgid; hostname && *hostname != '@';
> ++hostname);
> +       ++hostname;
> 
> you check that hostname != NULL in the for-loop but then never expect
> that it could be NULL afterward?
> 
> I don't think it's possible for 'hostname' to ever be NULL so that check
> should be removed...
> 
> also, because of the way it's written, that for-loop can easily be
> misread (e.g. it's easy to look at it and think that the following line
> is part of the for-loop if you are just skimming the code)
> 
> 2 possible solutions to this might be:
> 
> fake_msgid = camel_header_msgid_generate ();
> for (hostname = fake_msgid; *hostname != '@'; hostname++)
>         ;
> 
> or
> 
> hostname = fake_msgid = camel_header_msgid_generate ();
> while (*hostname != '@')
>         hostname++;
> 
> I personally prefer the latter, but I suppose either would be fine.

er... what was I thinking? easier still to just use strchr()

I've committed a patch to make it simpy sue strchr() in HEAD.

> 
> and then I have to wonder if there isn't a better way of getting the
> hostname than generating a msgid that we don't actually use.
> 
-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature



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