Changing of Content-Type

This forum is for discussions regarding Enigmail alpha and beta versions (Nightly Builds). The versions discussed in this forum are not stable and should not be used in production.

Changing of Content-Type

Postby tehhz » 12th Dec 2011 04:31

Hi all,

I am not sure whether anyone knows how to change the email content-type as It was unsuccessful, even after going through the Enigmail 1.3.3 source codes. I intend to customize the email content-type for another open-source project. What files do I need to modify?

Appreciate if anyone can help me with this. Thank you.

Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 12th Dec 2011 19:23

I assume you talk about changing the content-type for outgoing messages. This is not an easy task at all, as you'll need to create a new handler object of type nsIMsgComposeSecure for outgoing "encrypted" mail which needs to be registered in Thunderbird. That handler will need to parse receive a stream containing the message, parse it to replace the content-type and write the result back to a new stream.

You'll find this mainly in nsEnigMsgCompose.cpp. But as you can see, we talk about roughly 1000 lines of C++ code.
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 13th Dec 2011 09:32

Hi Patrick,

Thank you for your guidance. With this information, hopefully I will be able to customize it without any issues. Maybe I will integrate it with future versions of Enigmail.

Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby tehhz » 26th Dec 2011 06:29

Hi all,

To all forum readers, wishing you a Merry Christmas!!!

In my attempt to build nsEnigMsgCompose.cpp, I encountered an error (nsEnigMsgCompose.h successfully built without any problems):

1>c:\xulrunner-sdk8.0.1\include\nsCRTGlue.h(153): fatal error C1189: #error : need_to_define_your_file_path_separator_and_illegal_characters

This file is included indirectly via Gecko SDK through calling of strlen method. I am using Visual Studio 2010 Ultimate for C++ coding. The methods affected are:
1. WriteEncryptedHeaders
2. WriteSignedHeaders1(EMBool isEightBit)
3. WriteSignedHeaders2()

Can someone help me with this issue? Thank you.

Regards,
Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 27th Dec 2011 08:14

You cannot use the xulrunner SDK; does not contain the MailNews APIs. You'll need to build your own Thunderbird.
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 27th Dec 2011 15:37

Hi Patrick,

Thank you for your reply. After I have build the Thunderbird from source, can I still use Visual Studio 2010 IDE to continue developing the project? If this is not possible, which Integrated Development Environment would you recommend to build the Enigmail project? Thank you.

Regards,
Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 27th Dec 2011 15:55

I'm not developing on Windows, and I don't use an IDE, so I cannot really tell you. I'd suggest you study this link: https://developer.mozilla.org/en/Debugg ... indows_FAQ
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 28th Dec 2011 03:51

Hi Patrick,

I understand. I appreciate your help and guidance. Thanks. :D

Regards,
Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby tehhz » 21st Jan 2012 03:49

Hi all,

For compiling of binary XPCOM components for Linux, what tools / software do you recommend? I am thinking of using Netbeans together with gcc to do the compilation. Kindly advise. Thanks.

Regards,
Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 21st Jan 2012 18:07

I used Kate and Kdbg. I'd say you could also use Netbeans or Eclipdse with C++ addons.
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 8th Jun 2012 14:05

Hi Patrick,

Currently, when handling the change of content-type to "multipart/encrypted", can I exclude IPC and Javascript XPCOM sources in Enigmail and possibly other files, since my customized extension will handle encryption and decryption of emails without the need of external applications?

I have excluded most of the IPC references (except the inclusion of IPC.h and IPCProcess.h), but the conversion of content-type to "multipart-encrypted" fails. So far, I have tried to adapt nsEnigCompose.cpp codes into my customized binary extension and did not use any codes found in Enigmail JavaScript XPCOM files.
The customized extension is now able to build successfully.

Appreciate if you can kindly reply to my message as soon as possible. Thank you.

Regards,
Brian Teh, Singapore
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 8th Jun 2012 15:03

I cannot tell what you need in your application. In general, yes it is possible to write a version of nsEnigCompose.cpp that does not require any XPCOM code from Enigmail (both JavaScript and C++).
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 8th Jun 2012 17:11

Hi Patrick,

I was actually deciding whether to write a version of nsEnigMsgCompose.cpp using both JavaScript and C++ for my extension. For now, I will just focus on C++ to handle the content-type change requirements.

Regards,
Brian Teh
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Re: Changing of Content-Type

Postby patrick » 9th Jun 2012 16:44

I do not recommend to create binary XPCOM components (i.e. components in C++) for Mozilla add-ons. Given the 6-weeks release cycle you will have to re-build the component every 6 weeks, or your add-ons will be incompatible.
User avatar
patrick
Developer
Developer
 
Posts: 517
Joined: 13th Nov 2005 22:16
Location: Zurich, Switzerland

Re: Changing of Content-Type

Postby tehhz » 21st Jul 2012 06:06

Hi Patrick,

Thanks for the advice. I am aware of the inconvenience of rebuilding the binary XPCOM components every 6 weeks of release cycle. However, the project that I inherited was already done using C++. I am using Mozilla NSS library for this project.

For the time being, the project will still be done using C++ first as it is still incomplete. When it is done, I will slowly migrate to JavaScript XPCOM.

Regards,
Brian Teh, Singapore
tehhz
Novice User
Novice User
 
Posts: 12
Joined: 9th Dec 2011 03:51

Next

Return to Development Discussions