Re: [Evolution-hackers] Raw access to message

2010-03-12 Thread Stefan Schulze Frielinghaus
On Do, 2010-03-11 at 12:58 -0500, Jeffrey Stedfast wrote:
 Stefan Schulze Frielinghaus wrote:
  On Do, 2010-03-11 at 10:45 -0500, Jeffrey Stedfast wrote:

  On 03/11/2010 09:16 AM, Stefan Schulze Frielinghaus wrote:
  
  Hi,
 
  Is it possible to get raw access to an email (including header and
  body)? Or, if that is not possible, raw access to the body of the
  message?
 
  Raw access is important for me because I want to write a plugin which
  uses some kind of cryptography, e.g. character encoding is important to
  me.


  You can get the raw message from a CamelMimeMessage object by writing it
  to a stream buffer.
  
 
  This sounds great. I'm quite new to evolution could you give me a hint
  how to do that? I'm starting with an EMEventTargetMessage object where I
  can get an CamelMimeMessage object from. But how can I dump this one
  into a stream? Writing to a stream requires a buffer of type gchar, but
  I have a CamelMimeMessage object and I even do not know the length of
  the message. What function calls could I look at?

 
 CamelStream *stream = camel_stream_mem_new ();
 camel_data_wrapper_write_to_stream (message, stream);
 
 It's been 4 or 5 years since I did any evo hacking, so the above code
 might not be quite right - but it should give you a general idea.

Ah perfect, thanks! I was not aware of a function like
camel_data_wrapper_write_to_stream().

Just for the records if someone else is looking for a similar solution:

CamelStreamMem *stream = (CamelStreamMem *)camel_stream_mem_new ();
camel_data_wrapper_write_to_stream ((CamelDataWrapper*)t-message,
(CamelStream *)stream);

And then you can access the message via

stream-buffer-data;

and

stream-buffer-len;

cheers,
Stefan

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Raw access to message

2010-03-11 Thread Xavier Bestel
Hi,

On Thu, 2010-03-11 at 15:16 +0100, Stefan Schulze Frielinghaus wrote:
 Hi,
 
 Is it possible to get raw access to an email (including header and
 body)? Or, if that is not possible, raw access to the body of the
 message?

Do you  mean, something more low-level than Ctrl-U ?

Xav

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Raw access to message

2010-03-11 Thread Jeffrey Stedfast
On 03/11/2010 09:16 AM, Stefan Schulze Frielinghaus wrote:
 Hi,

 Is it possible to get raw access to an email (including header and
 body)? Or, if that is not possible, raw access to the body of the
 message?

 Raw access is important for me because I want to write a plugin which
 uses some kind of cryptography, e.g. character encoding is important to
 me.
   

You can get the raw message from a CamelMimeMessage object by writing it
to a stream buffer.

Jeff

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Raw access to message

2010-03-11 Thread Stefan Schulze Frielinghaus
On Do, 2010-03-11 at 16:41 +0100, Xavier Bestel wrote:
 Hi,
 
 On Thu, 2010-03-11 at 15:16 +0100, Stefan Schulze Frielinghaus wrote:
  Hi,
  
  Is it possible to get raw access to an email (including header and
  body)? Or, if that is not possible, raw access to the body of the
  message?
 
 Do you  mean, something more low-level than Ctrl-U ?
 
   Xav

Ups, sorry, maybe I should be more precise. I'm trying to build a new
plugin, so the question was from an C programmers point of view.

Meanwhile I tried to reconstruct the header via the function
camel_medium_get_headers(). But this is not that perfect for me. I also
need the body of the message.

Summarized a function which returns a pointer into the message body or
even at the beginning of the whole email (header + body) would be really
nice. In the end I just need a raw copy of the email. If everything
fails I will try to reconstruct the email.

Any ideas/hints?

cheers,
Stefan

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Raw access to message

2010-03-11 Thread Stefan Schulze Frielinghaus
On Do, 2010-03-11 at 10:45 -0500, Jeffrey Stedfast wrote:
 On 03/11/2010 09:16 AM, Stefan Schulze Frielinghaus wrote:
  Hi,
 
  Is it possible to get raw access to an email (including header and
  body)? Or, if that is not possible, raw access to the body of the
  message?
 
  Raw access is important for me because I want to write a plugin which
  uses some kind of cryptography, e.g. character encoding is important to
  me.

 
 You can get the raw message from a CamelMimeMessage object by writing it
 to a stream buffer.

This sounds great. I'm quite new to evolution could you give me a hint
how to do that? I'm starting with an EMEventTargetMessage object where I
can get an CamelMimeMessage object from. But how can I dump this one
into a stream? Writing to a stream requires a buffer of type gchar, but
I have a CamelMimeMessage object and I even do not know the length of
the message. What function calls could I look at?

cheers,
Stefan

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Raw access to message

2010-03-11 Thread Jeffrey Stedfast
Stefan Schulze Frielinghaus wrote:
 On Do, 2010-03-11 at 10:45 -0500, Jeffrey Stedfast wrote:
   
 On 03/11/2010 09:16 AM, Stefan Schulze Frielinghaus wrote:
 
 Hi,

 Is it possible to get raw access to an email (including header and
 body)? Or, if that is not possible, raw access to the body of the
 message?

 Raw access is important for me because I want to write a plugin which
 uses some kind of cryptography, e.g. character encoding is important to
 me.
   
   
 You can get the raw message from a CamelMimeMessage object by writing it
 to a stream buffer.
 

 This sounds great. I'm quite new to evolution could you give me a hint
 how to do that? I'm starting with an EMEventTargetMessage object where I
 can get an CamelMimeMessage object from. But how can I dump this one
 into a stream? Writing to a stream requires a buffer of type gchar, but
 I have a CamelMimeMessage object and I even do not know the length of
 the message. What function calls could I look at?
   

CamelStream *stream = camel_stream_mem_new ();
camel_data_wrapper_write_to_stream (message, stream);

It's been 4 or 5 years since I did any evo hacking, so the above code
might not be quite right - but it should give you a general idea.

Jeff
___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers