On Sun, May 14, 2006 at 09:59:47PM +0300, Mattias Nordstrom wrote:
> Florin Iucha wrote:
> > Your code runs fine. Mine crashes, and the difference is... dumping the
> > second header!
> 
> [SNIP]
> 
> > You can replace hdr->From() with hdr->To(), with no change in the observable
> > behavior.
> 
> The problem is probably the fact that From() does not return the same
> thing as a Subject(), which is only text.
> 
> To extract From, you need to do something like this:
> 
> std::cout << "From: " <<
> hdr->From()->getValue().dynamicCast<vmime::mailbox>()->getName().getConvertedText(ch)
> << " <" <<
> hdr->From()->getValue().dynamicCast<vmime::mailbox>()->getEmail() << ">"
> << std::endl;
> 
> This should fix the segfault. If you take a look at the docs you'll see
> that To and Cc also require special treatment, as they contain an array
> of addresses.

Oh, I re-read the manual and indeed one has to use vmime::mailbox instead
of vmime::text. You can close this Bug report as operator error.

However...

I did all the voodoo with dynamic cast to vmime::text and stuff, I
expect to get a decent error message back at runtime. Otherwise, what
is the purpose of all the song and dance and all the complicated type
traits and templates?

florin

-- 
There was a typo, but on the wrong page.
   -- Vipin Kumar

Attachment: signature.asc
Description: Digital signature

Reply via email to