inetmapi.i 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. %module inetmapi
  2. %{
  3. #include <mapix.h>
  4. #include <mapidefs.h>
  5. #include <inetmapi/options.h>
  6. #include <inetmapi/inetmapi.h>
  7. %}
  8. %include "std_string.i"
  9. %include "cstring.i"
  10. %include <kopano/typemap.i>
  11. %cstring_output_allocate(char** lppchardelete, delete []*$1);
  12. /* Finalize output parameters */
  13. %typemap(in,numinputs=0) (std::string *) (std::string temp) {
  14. $1 = &temp;
  15. }
  16. %typemap(argout) (std::string *) {
  17. /* @todo fix this not to go through a cstring */
  18. %append_output(SWIG_FromCharPtrAndSize($1->c_str(), $1->length()));
  19. }
  20. struct sending_options {
  21. char *alternate_boundary; // Specifies a specific boundary prefix to use when creating MIME boundaries
  22. bool no_recipients_workaround; // Specified that we wish to accepts messages with no recipients (for example, when converting an attached email with no recipients)
  23. bool msg_in_msg;
  24. bool headers_only;
  25. bool add_received_date;
  26. int use_tnef;
  27. bool force_utf8;
  28. char *charset_upgrade;
  29. bool allow_send_to_everyone;
  30. bool enable_dsn;
  31. %extend {
  32. sending_options() {
  33. auto sopt = new sending_options;
  34. imopt_default_sending_options(sopt);
  35. char *temp = sopt->charset_upgrade;
  36. sopt->charset_upgrade = new char[strlen(temp)+1]; /* avoid free problems */
  37. strcpy(sopt->charset_upgrade, temp);
  38. return sopt;
  39. }
  40. ~sending_options() {
  41. delete[] self->alternate_boundary;
  42. delete[] self->charset_upgrade;
  43. delete(self);
  44. }
  45. }
  46. };
  47. struct delivery_options {
  48. bool use_received_date; // Use the 'received' date instead of the current date as delivery date
  49. bool mark_as_read; // Deliver the message 'read' instead of unread
  50. bool add_imap_data; // Save IMAP optimized data to the server
  51. bool parse_smime_signed; // Parse actual S/MIME content instead of just writing out the S/MIME data to a single attachment
  52. /* LPSBinary user_entryid; // If not NULL, specifies the entryid of the user for whom we are delivering. If set, allows generating PR_MESSAGE_*_ME properties. */
  53. char *ascii_upgrade;
  54. %extend {
  55. delivery_options() {
  56. auto dopt = new delivery_options;
  57. imopt_default_delivery_options(dopt);
  58. return dopt;
  59. }
  60. ~delivery_options() {
  61. delete[] self->ascii_upgrade;
  62. delete(self);
  63. }
  64. }
  65. };
  66. HRESULT IMToMAPI(IMAPISession *lpSession, IMsgStore *lpMsgStore, IAddrBook *lpAddrBook, IMessage *lpMessage, const std::string &input, delivery_options dopt);
  67. HRESULT IMToINet(IMAPISession *lpSession, IAddrBook *lpAddrBook, IMessage *lpMessage, char** lppchardelete, sending_options sopt);
  68. HRESULT createIMAPProperties(const std::string &input, std::string *lpEnvelope, std::string *lpBody, std::string *lpBodyStructure);