annotate src/msg.cpp @ 394:3cbda103e0ef

changes to build on centos 6
author Carl Byington <carl@five-ten-sg.com>
date Sun, 12 Jan 2020 11:33:45 -0800
parents c5e7f13d2836
children 1c458f13d1d3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
1 extern "C" {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
2 #include "define.h"
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
3 #include "msg.h"
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
4 #include <gsf/gsf-utils.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
5
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
6 #include <gsf/gsf-input-stdio.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
7 #include <gsf/gsf-infile.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
8 #include <gsf/gsf-infile-stdio.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
9
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
10 #include <gsf/gsf-output-stdio.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
11 #include <gsf/gsf-outfile.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
12 #include <gsf/gsf-outfile-msole.h>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
13 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
14
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
15 #include <list>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
16 #include <vector>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
17 #include <string>
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
18
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
19 using namespace std;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
20
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
21 struct property {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
22 uint32_t tag;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
23 uint32_t flags;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
24 uint32_t length; // or value
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
25 uint32_t reserved;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
26 };
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
27 typedef list<property> property_list;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
28
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
29
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
30 /** Convert str to an 8 bit charset if it is utf8, null strings are preserved.
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
31 *
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
32 * @param str reference to the mapi string of interest
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
33 * @param charset pointer to the 8 bit charset to use
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
34 */
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
35 static void convert_8bit(pst_string &str, const char *charset);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
36 static void convert_8bit(pst_string &str, const char *charset) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
37 if (!str.str) return; // null
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
38 if (!str.is_utf8) return; // not utf8
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
39
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
40 DEBUG_ENT("convert_8bit");
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
41 pst_vbuf *newer = pst_vballoc(2);
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
42 size_t strsize = strlen(str.str);
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
43 size_t rc = pst_vb_utf8to8bit(newer, str.str, strsize, charset);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
44 if (rc == (size_t)-1) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
45 // unable to convert, change the charset to utf8
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
46 free(newer->b);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
47 DEBUG_INFO(("Failed to convert utf-8 to %s\n", charset));
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
48 DEBUG_HEXDUMPC(str.str, strsize, 0x10);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
49 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
50 else {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
51 // null terminate the output string
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
52 pst_vbgrow(newer, 1);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
53 newer->b[newer->dlen] = '\0';
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
54 free(str.str);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
55 str.str = newer->b;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
56 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
57 free(newer);
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
58 DEBUG_RET();
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
59 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
60
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
61
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
62 static void empty_property(GsfOutfile *out, uint32_t tag);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
63 static void empty_property(GsfOutfile *out, uint32_t tag) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
64 vector<char> n(50);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
65 snprintf(&n[0], n.size(), "__substg1.0_%08X", tag);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
66 GsfOutput* dst = gsf_outfile_new_child(out, &n[0], false);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
67 gsf_output_close(dst);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
68 g_object_unref(G_OBJECT(dst));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
69 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
70
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
71
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
72 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char *contents, size_t size);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
73 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char *contents, size_t size) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
74 if (!contents) return;
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
75 size_t term = ((tag & 0x0000ffff) == 0x001e) ? 1 :
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
76 ((tag & 0x0000ffff) == 0x001f) ? 2 : 0; // null terminator
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
77 vector<char> n(50);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
78 snprintf(&n[0], n.size(), "__substg1.0_%08X", tag);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
79 GsfOutput* dst = gsf_outfile_new_child(out, &n[0], false);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
80 gsf_output_write(dst, size, (const guint8*)contents);
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
81 if (term) {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
82 memset(&n[0], 0, term);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
83 gsf_output_write(dst, term, (const guint8*)&n[0]);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
84 size += term;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
85 }
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
86 gsf_output_close(dst);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
87 g_object_unref(G_OBJECT(dst));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
88
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
89 property p;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
90 p.tag = tag;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
91 p.flags = 0x6; // make all the properties writable
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
92 p.length = size;
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
93 p.reserved = 0;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
94 prop.push_back(p);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
95 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
96
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
97
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
98 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, FILE *fp);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
99 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, FILE *fp) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
100 vector<char> n(50);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
101 snprintf(&n[0], n.size(), "__substg1.0_%08X", tag);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
102 GsfOutput* dst = gsf_outfile_new_child(out, &n[0], false);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
103
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
104 size_t size = 0;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
105 const size_t bsize = 10000;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
106 char buf[bsize];
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
107
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
108 while (1) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
109 size_t s = fread(buf, 1, bsize, fp);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
110 if (!s) break;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
111 gsf_output_write(dst, s, (const guint8*)buf);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
112 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
113
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
114 gsf_output_close(dst);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
115 g_object_unref(G_OBJECT(dst));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
116
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
117 property p;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
118 p.tag = tag;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
119 p.flags = 0x6; // make all the properties writable
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
120 p.length = size;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
121 p.reserved = 0;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
122 prop.push_back(p);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
123 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
124
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
125
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
126 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char* charset, pst_string &contents);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
127 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char* charset, pst_string &contents) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
128 if (contents.str) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
129 convert_8bit(contents, charset);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
130 string_property(out, prop, tag, contents.str, strlen(contents.str));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
131 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
132 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
133
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
134
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
135 static void strin0_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char* charset, pst_string &contents);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
136 static void strin0_property(GsfOutfile *out, property_list &prop, uint32_t tag, const char* charset, pst_string &contents) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
137 if (contents.str) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
138 convert_8bit(contents, charset);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
139 string_property(out, prop, tag, contents.str, strlen(contents.str)+1);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
140 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
141 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
142
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
143
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
144 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const string &contents);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
145 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, const string &contents) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
146 string_property(out, prop, tag, contents.c_str(), contents.size());
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
147 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
148
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
149
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
150 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, pst_binary &contents);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
151 static void string_property(GsfOutfile *out, property_list &prop, uint32_t tag, pst_binary &contents) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
152 if (contents.size) string_property(out, prop, tag, contents.data, contents.size);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
153 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
154
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
155
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
156 static void write_properties(GsfOutfile *out, property_list &prop, const guint8* header, size_t hlen);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
157 static void write_properties(GsfOutfile *out, property_list &prop, const guint8* header, size_t hlen) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
158 GsfOutput* dst = gsf_outfile_new_child(out, "__properties_version1.0", false);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
159 gsf_output_write(dst, hlen, header);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
160 for (property_list::iterator i=prop.begin(); i!=prop.end(); i++) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
161 property &p = *i;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
162 gsf_output_write(dst, sizeof(property), (const guint8*)&p);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
163 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
164 gsf_output_close(dst);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
165 g_object_unref(G_OBJECT(dst));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
166 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
167
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
168
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
169 static void int_property(property_list &prop_list, uint32_t tag, uint32_t flags, uint32_t value);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
170 static void int_property(property_list &prop_list, uint32_t tag, uint32_t flags, uint32_t value) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
171 property p;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
172 p.tag = tag;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
173 p.flags = flags;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
174 p.length = value;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
175 p.reserved = 0;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
176 prop_list.push_back(p);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
177 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
178
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
179
315
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
180 static void i64_property(property_list &prop_list, uint32_t tag, uint32_t flags, FILETIME *value);
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
181 static void i64_property(property_list &prop_list, uint32_t tag, uint32_t flags, FILETIME *value) {
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
182 if (value) {
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
183 property p;
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
184 p.tag = tag;
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
185 p.flags = flags;
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
186 p.length = value->dwLowDateTime;
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
187 p.reserved = value->dwHighDateTime;
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
188 prop_list.push_back(p);
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
189 }
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
190 }
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
191
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
192
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
193 static void nzi_property(property_list &prop_list, uint32_t tag, uint32_t flags, uint32_t value);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
194 static void nzi_property(property_list &prop_list, uint32_t tag, uint32_t flags, uint32_t value) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
195 if (value) int_property(prop_list, tag, flags, value);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
196 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
197
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
198
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
199 void write_msg_email(char *fname, pst_item* item, pst_file* pst) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
200 // this is not an email item
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
201 if (!item->email) return;
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
202 DEBUG_ENT("write_msg_email");
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
203
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
204 pst_item_email &email = *(item->email);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
205
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
206 char charset[30];
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
207 const char* body_charset = pst_default_charset(item, sizeof(charset), charset);
309
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
208 DEBUG_INFO(("%s body charset seems to be %s\n", fname, body_charset));
4fd5197aacc2 fix charset issue with iconv return value
Carl Byington <carl@five-ten-sg.com>
parents: 308
diff changeset
209 body_charset = "iso-8859-1//TRANSLIT//IGNORE";
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
210
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
211 gsf_init();
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
212
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
213 GsfOutfile *outfile;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
214 GsfOutput *output;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
215 GError *err = NULL;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
216
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
217 output = gsf_output_stdio_new(fname, &err);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
218 if (output == NULL) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
219 gsf_shutdown();
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
220 DEBUG_INFO(("unable to open output .msg file %s\n", fname));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
221 DEBUG_RET();
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
222 return;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
223 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
224
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
225 struct top_property_header {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
226 uint32_t reserved1;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
227 uint32_t reserved2;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
228 uint32_t next_recipient; // same as recipient count
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
229 uint32_t next_attachment; // same as attachment count
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
230 uint32_t recipient_count;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
231 uint32_t attachment_count;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
232 uint32_t reserved3;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
233 uint32_t reserved4;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
234 };
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
235
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
236 top_property_header top_head;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
237 memset(&top_head, 0, sizeof(top_head));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
238
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
239 outfile = gsf_outfile_msole_new(output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
240 g_object_unref(G_OBJECT(output));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
241
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
242 output = GSF_OUTPUT(outfile);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
243 property_list prop_list;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
244
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
245 int_property(prop_list, 0x00170003, 0x6, email.importance);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
246 nzi_property(prop_list, 0x0023000B, 0x6, email.delivery_report);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
247 nzi_property(prop_list, 0x00260003, 0x6, email.priority);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
248 nzi_property(prop_list, 0x0029000B, 0x6, email.read_receipt);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
249 nzi_property(prop_list, 0x002E0003, 0x6, email.original_sensitivity);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
250 nzi_property(prop_list, 0x00360003, 0x6, email.sensitivity);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
251 nzi_property(prop_list, 0x0C17000B, 0x6, email.reply_requested);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
252 nzi_property(prop_list, 0x0E01000B, 0x6, email.delete_after_submit);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
253 int_property(prop_list, 0x0E070003, 0x6, item->flags);
315
3e6cdd543857 date sent property is fixed size, so the value is stored directly in the property stream
Carl Byington <carl@five-ten-sg.com>
parents: 314
diff changeset
254 i64_property(prop_list, 0x00390040, 0x6, email.sent_date);
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
255 GsfOutfile *out = GSF_OUTFILE (output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
256 string_property(out, prop_list, 0x001A001E, item->ascii_type);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
257 string_property(out, prop_list, 0x0037001E, body_charset, item->subject);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
258 strin0_property(out, prop_list, 0x003B0102, body_charset, email.outlook_sender);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
259 string_property(out, prop_list, 0x003D001E, string(""));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
260 string_property(out, prop_list, 0x0040001E, body_charset, email.outlook_received_name1);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
261 string_property(out, prop_list, 0x0042001E, body_charset, email.outlook_sender_name);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
262 string_property(out, prop_list, 0x0044001E, body_charset, email.outlook_recipient_name);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
263 string_property(out, prop_list, 0x0050001E, body_charset, email.reply_to);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
264 strin0_property(out, prop_list, 0x00510102, body_charset, email.outlook_recipient);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
265 strin0_property(out, prop_list, 0x00520102, body_charset, email.outlook_recipient2);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
266 string_property(out, prop_list, 0x0064001E, body_charset, email.sender_access);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
267 string_property(out, prop_list, 0x0065001E, body_charset, email.sender_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
268 string_property(out, prop_list, 0x0070001E, body_charset, email.processed_subject);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
269 string_property(out, prop_list, 0x00710102, email.conversation_index);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
270 string_property(out, prop_list, 0x0072001E, body_charset, email.original_bcc);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
271 string_property(out, prop_list, 0x0073001E, body_charset, email.original_cc);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
272 string_property(out, prop_list, 0x0074001E, body_charset, email.original_to);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
273 string_property(out, prop_list, 0x0075001E, body_charset, email.recip_access);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
274 string_property(out, prop_list, 0x0076001E, body_charset, email.recip_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
275 string_property(out, prop_list, 0x0077001E, body_charset, email.recip2_access);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
276 string_property(out, prop_list, 0x0078001E, body_charset, email.recip2_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
277 string_property(out, prop_list, 0x007D001E, body_charset, email.header);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
278 string_property(out, prop_list, 0x0C1A001E, body_charset, email.outlook_sender_name2);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
279 strin0_property(out, prop_list, 0x0C1D0102, body_charset, email.outlook_sender2);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
280 string_property(out, prop_list, 0x0C1E001E, body_charset, email.sender2_access);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
281 string_property(out, prop_list, 0x0C1F001E, body_charset, email.sender2_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
282 string_property(out, prop_list, 0x0E02001E, body_charset, email.bcc_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
283 string_property(out, prop_list, 0x0E03001E, body_charset, email.cc_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
284 string_property(out, prop_list, 0x0E04001E, body_charset, email.sentto_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
285 string_property(out, prop_list, 0x0E1D001E, body_charset, email.outlook_normalized_subject);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
286 string_property(out, prop_list, 0x1000001E, body_charset, item->body);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
287 string_property(out, prop_list, 0x1013001E, body_charset, email.htmlbody);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
288 string_property(out, prop_list, 0x1035001E, body_charset, email.messageid);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
289 string_property(out, prop_list, 0x1042001E, body_charset, email.in_reply_to);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
290 string_property(out, prop_list, 0x1046001E, body_charset, email.return_path_address);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
291 // any property over 0x8000 needs entries in the __nameid to make them
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
292 // either string named or numerical named properties.
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
293
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
294 {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
295 vector<char> n(50);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
296 {
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
297 snprintf(&n[0], n.size(), "__recip_version1.0_#%08X", top_head.recipient_count);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
298 GsfOutput *output = gsf_outfile_new_child(out, &n[0], true);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
299 {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
300 int v = 1; // to
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
301 property_list prop_list;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
302 int_property(prop_list, 0x0C150003, 0x6, v); // PidTagRecipientType
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
303 int_property(prop_list, 0x30000003, 0x6, top_head.recipient_count); // PR_ROWID
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
304 GsfOutfile *out = GSF_OUTFILE (output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
305 string_property(out, prop_list, 0x3001001E, body_charset, item->file_as);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
306 if (item->contact) {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
307 string_property(out, prop_list, 0x3002001E, body_charset, item->contact->address1_transport);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
308 string_property(out, prop_list, 0x3003001E, body_charset, item->contact->address1);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
309 string_property(out, prop_list, 0x5ff6001E, body_charset, item->contact->address1);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
310 }
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
311 strin0_property(out, prop_list, 0x300B0102, body_charset, email.outlook_search_key);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
312 write_properties(out, prop_list, (const guint8*)&top_head, 8); // convenient 8 bytes of reserved zeros
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
313 gsf_output_close(output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
314 g_object_unref(G_OBJECT(output));
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
315 top_head.next_recipient++;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
316 top_head.recipient_count++;
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
317 }
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
318 }
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
319 if (email.cc_address.str) {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
320 snprintf(&n[0], n.size(), "__recip_version1.0_#%08X", top_head.recipient_count);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
321 GsfOutput *output = gsf_outfile_new_child(out, &n[0], true);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
322 {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
323 int v = 2; // cc
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
324 property_list prop_list;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
325 int_property(prop_list, 0x0C150003, 0x6, v); // PidTagRecipientType
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
326 int_property(prop_list, 0x30000003, 0x6, top_head.recipient_count); // PR_ROWID
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
327 GsfOutfile *out = GSF_OUTFILE (output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
328 string_property(out, prop_list, 0x3001001E, body_charset, email.cc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
329 string_property(out, prop_list, 0x3003001E, body_charset, email.cc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
330 string_property(out, prop_list, 0x5ff6001E, body_charset, email.cc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
331 write_properties(out, prop_list, (const guint8*)&top_head, 8); // convenient 8 bytes of reserved zeros
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
332 gsf_output_close(output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
333 g_object_unref(G_OBJECT(output));
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
334 top_head.next_recipient++;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
335 top_head.recipient_count++;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
336 }
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
337 }
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
338 if (email.bcc_address.str) {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
339 snprintf(&n[0], n.size(), "__recip_version1.0_#%08X", top_head.recipient_count);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
340 GsfOutput *output = gsf_outfile_new_child(out, &n[0], true);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
341 {
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
342 int v = 3; // bcc
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
343 property_list prop_list;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
344 int_property(prop_list, 0x0C150003, 0x6, v); // PidTagRecipientType
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
345 int_property(prop_list, 0x30000003, 0x6, top_head.recipient_count); // PR_ROWID
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
346 GsfOutfile *out = GSF_OUTFILE (output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
347 string_property(out, prop_list, 0x3001001E, body_charset, email.bcc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
348 string_property(out, prop_list, 0x3003001E, body_charset, email.bcc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
349 string_property(out, prop_list, 0x5ff6001E, body_charset, email.bcc_address);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
350 write_properties(out, prop_list, (const guint8*)&top_head, 8); // convenient 8 bytes of reserved zeros
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
351 gsf_output_close(output);
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
352 g_object_unref(G_OBJECT(output));
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
353 top_head.next_recipient++;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
354 top_head.recipient_count++;
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
355 }
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
356 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
357 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
358
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
359 pst_item_attach *a = item->attach;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
360 while (a) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
361 if (a->method == PST_ATTACH_EMBEDDED) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
362 // not implemented yet
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
363 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
364 else if (a->data.data || a->i_id) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
365 vector<char> n(50);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
366 snprintf(&n[0], n.size(), "__attach_version1.0_#%08X", top_head.attachment_count);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
367 GsfOutput *output = gsf_outfile_new_child(out, &n[0], true);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
368 {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
369 FILE *fp = fopen("temp_file_attachment", "w+b");
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
370 if (fp) {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
371 pst_attach_to_file(pst, a, fp); // data is now in the file
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
372 fseek(fp, 0, SEEK_SET);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
373 property_list prop_list;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
374 int_property(prop_list, 0x0E210003, 0x2, top_head.attachment_count); // MAPI_ATTACH_NUM
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
375 int_property(prop_list, 0x0FF40003, 0x2, 2); // PR_ACCESS read
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
376 int_property(prop_list, 0x0FF70003, 0x2, 0); // PR_ACCESS_LEVEL read only
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
377 int_property(prop_list, 0x0FFE0003, 0x2, 7); // PR_OBJECT_TYPE attachment
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
378 int_property(prop_list, 0x37050003, 0x7, 1); // PR_ATTACH_METHOD by value
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
379 int_property(prop_list, 0x370B0003, 0x7, a->position); // PR_RENDERING_POSITION
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
380 int_property(prop_list, 0x37100003, 0x6, a->sequence); // PR_ATTACH_MIME_SEQUENCE
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
381 GsfOutfile *out = GSF_OUTFILE (output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
382 string_property(out, prop_list, 0x0FF90102, item->record_key);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
383 string_property(out, prop_list, 0x37010102, fp);
331
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
384 if (a->filename2.str) {
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
385 // have long file name
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
386 string_property(out, prop_list, 0x3707001E, body_charset, a->filename2);
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
387 }
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
388 else if (a->filename1.str) {
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
389 // have short file name
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
390 string_property(out, prop_list, 0x3704001E, body_charset, a->filename1);
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
391 }
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
392 else {
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
393 // make up a name
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
394 const char *n = "inline";
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
395 string_property(out, prop_list, 0x3704001E, n, strlen(n));
c5e7f13d2836 .msg files should use only one of short or long filename fields
Carl Byington <carl@five-ten-sg.com>
parents: 315
diff changeset
396 }
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
397 string_property(out, prop_list, 0x370E001E, body_charset, a->mimetype);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
398 write_properties(out, prop_list, (const guint8*)&top_head, 8); // convenient 8 bytes of reserved zeros
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
399 gsf_output_close(output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
400 g_object_unref(G_OBJECT(output));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
401 top_head.next_attachment++;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
402 top_head.attachment_count++;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
403 fclose(fp);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
404 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
405 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
406 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
407 a = a->next;
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
408 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
409
313
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
410 write_properties(out, prop_list, (const guint8*)&top_head, sizeof(top_head));
0f19cd173eab fix to/cc/bcc recipients in .msg file output format
Carl Byington <carl@five-ten-sg.com>
parents: 311
diff changeset
411
308
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
412 {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
413 GsfOutput *output = gsf_outfile_new_child(out, "__nameid_version1.0", true);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
414 {
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
415 GsfOutfile *out = GSF_OUTFILE (output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
416 empty_property(out, 0x00020102);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
417 empty_property(out, 0x00030102);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
418 empty_property(out, 0x00040102);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
419 gsf_output_close(output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
420 g_object_unref(G_OBJECT(output));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
421 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
422 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
423
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
424 gsf_output_close(output);
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
425 g_object_unref(G_OBJECT(output));
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
426
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
427 gsf_shutdown();
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
428 DEBUG_RET();
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
429 }
97c53c6868ab add -m option to readpst to create Outlook .msg files
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
430