Re: A question about TnyCamelHeader



On Thu, 2007-01-25 at 12:38 +0100, Sergio Villar Senin wrote:
> Hi tinymailers :),

Hey Modesters :),

> the Camel implementation of TnyHeader returns the special string
> "Invalid" for all the get_xxx (where xxx is a field of the header)
> whenever the header does not have this value set.
> 
> This behavior is not present in the contract of these interfaces, and
> could be obviously different for each possible implementation. So the
> caller should always check if the returned value is not "Invalid" in
> order to know if it's right or not (well we could do it more generic,
> checking that the returned value is a valid email address). So I guess,
> why returning "Invalid" instead of NULL for example?

I agree that perhaps NULL would be better. The problem, however, was
that the GtkTreeView does not like NULL and that it's difficult to get
this right (or, was, in the beginning of the project and during the
first experiments, back when most of the tinymail code was very
incorrect and doing all sorts of things incorrectly and wrong).

> As I saw, all the calls to this getters inside tinymail assume that the
> returned value is not NULL, but it won't be too difficult to change all
> of them.

I would agree with a change (a patch) that adds checks for NULL
everywhere and removes the "Invalid" string.

"Invalid" is indeed meaningless for the end-user.





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