comparison src/readpst.c @ 125:23a36ac0514d

recover dropped pragma pack line, use int64_t rather than off_t to avoid forcing users of the shared library to enable large file support.
author Carl Byington <carl@five-ten-sg.com>
date Tue, 03 Feb 2009 15:01:47 -0800
parents ab2a11e72250
children fc11b1d1ad34
comparison
equal deleted inserted replaced
124:cbf63dd3f109 125:23a36ac0514d
920 char body_charset[60]; 920 char body_charset[60];
921 char *temp = NULL; 921 char *temp = NULL;
922 int attach_num; 922 int attach_num;
923 time_t em_time; 923 time_t em_time;
924 char *c_time; 924 char *c_time;
925 pst_item_attach* current_attach;
926 int has_from, has_subject, has_to, has_cc, has_bcc, has_date; 925 int has_from, has_subject, has_to, has_cc, has_bcc, has_date;
927 has_from = has_subject = has_to = has_cc = has_bcc = has_date = 0; 926 has_from = has_subject = has_to = has_cc = has_bcc = has_date = 0;
928 DEBUG_ENT("write_normal_email"); 927 DEBUG_ENT("write_normal_email");
929 928
930 // setup default body character set 929 // setup default body character set
998 header_strip_field(item->email->header, "\nMIME-Version: "); 997 header_strip_field(item->email->header, "\nMIME-Version: ");
999 header_strip_field(item->email->header, "\nContent-Type: "); 998 header_strip_field(item->email->header, "\nContent-Type: ");
1000 header_strip_field(item->email->header, "\nContent-Transfer-Encoding: "); 999 header_strip_field(item->email->header, "\nContent-Transfer-Encoding: ");
1001 header_strip_field(item->email->header, "\nContent-class: "); 1000 header_strip_field(item->email->header, "\nContent-class: ");
1002 header_strip_field(item->email->header, "\nX-MimeOLE: "); 1001 header_strip_field(item->email->header, "\nX-MimeOLE: ");
1002 header_strip_field(item->email->header, "\nBcc: ");
1003 } 1003 }
1004 1004
1005 DEBUG_EMAIL(("About to print Header\n")); 1005 DEBUG_EMAIL(("About to print Header\n"));
1006 1006
1007 if (item && item->email && item->email->subject && item->email->subject->subj) { 1007 if (item && item->email && item->email->subject && item->email->subject->subj) {
1094 find_html_charset(item->email->htmlbody, body_charset, sizeof(body_charset)); 1094 find_html_charset(item->email->htmlbody, body_charset, sizeof(body_charset));
1095 write_body_part(f_output, item->email->htmlbody, "text/html", body_charset, boundary); 1095 write_body_part(f_output, item->email->htmlbody, "text/html", body_charset, boundary);
1096 } 1096 }
1097 1097
1098 if (item->email->rtf_compressed && save_rtf) { 1098 if (item->email->rtf_compressed && save_rtf) {
1099 pst_item_attach* attach = (pst_item_attach*)xmalloc(sizeof(pst_item_attach));
1099 DEBUG_EMAIL(("Adding RTF body as attachment\n")); 1100 DEBUG_EMAIL(("Adding RTF body as attachment\n"));
1100 current_attach = (pst_item_attach*)xmalloc(sizeof(pst_item_attach)); 1101 memset(attach, 0, sizeof(pst_item_attach));
1101 memset(current_attach, 0, sizeof(pst_item_attach)); 1102 attach->next = item->attach;
1102 current_attach->next = item->attach; 1103 item->attach = attach;
1103 item->attach = current_attach; 1104 attach->data = lzfu_decompress(item->email->rtf_compressed, item->email->rtf_compressed_size, &attach->size);
1104 current_attach->data = lzfu_decompress(item->email->rtf_compressed, item->email->rtf_compressed_size, &current_attach->size); 1105 attach->filename2 = strdup(RTF_ATTACH_NAME);
1105 current_attach->filename2 = xmalloc(strlen(RTF_ATTACH_NAME)+2); 1106 attach->mimetype = strdup(RTF_ATTACH_TYPE);
1106 strcpy(current_attach->filename2, RTF_ATTACH_NAME);
1107 current_attach->mimetype = xmalloc(strlen(RTF_ATTACH_TYPE)+2);
1108 strcpy(current_attach->mimetype, RTF_ATTACH_TYPE);
1109 } 1107 }
1110 1108
1111 if (item->email->encrypted_body || item->email->encrypted_htmlbody) { 1109 if (item->email->encrypted_body || item->email->encrypted_htmlbody) {
1112 // if either the body or htmlbody is encrypted, add them as attachments 1110 // if either the body or htmlbody is encrypted, add them as attachments
1113 if (item->email->encrypted_body) { 1111 if (item->email->encrypted_body) {
1112 pst_item_attach* attach = (pst_item_attach*)xmalloc(sizeof(pst_item_attach));
1114 DEBUG_EMAIL(("Adding Encrypted Body as attachment\n")); 1113 DEBUG_EMAIL(("Adding Encrypted Body as attachment\n"));
1115 current_attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach)); 1114 attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach));
1116 memset(current_attach, 0, sizeof(pst_item_attach)); 1115 memset(attach, 0, sizeof(pst_item_attach));
1117 current_attach->next = item->attach; 1116 attach->next = item->attach;
1118 item->attach = current_attach; 1117 item->attach = attach;
1119 current_attach->data = item->email->encrypted_body; 1118 attach->data = item->email->encrypted_body;
1120 current_attach->size = item->email->encrypted_body_size; 1119 attach->size = item->email->encrypted_body_size;
1121 item->email->encrypted_body = NULL; 1120 item->email->encrypted_body = NULL;
1122 } 1121 }
1123 1122
1124 if (item->email->encrypted_htmlbody) { 1123 if (item->email->encrypted_htmlbody) {
1124 pst_item_attach* attach = (pst_item_attach*)xmalloc(sizeof(pst_item_attach));
1125 DEBUG_EMAIL(("Adding encrypted HTML body as attachment\n")); 1125 DEBUG_EMAIL(("Adding encrypted HTML body as attachment\n"));
1126 current_attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach)); 1126 attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach));
1127 memset(current_attach, 0, sizeof(pst_item_attach)); 1127 memset(attach, 0, sizeof(pst_item_attach));
1128 current_attach->next = item->attach; 1128 attach->next = item->attach;
1129 item->attach = current_attach; 1129 item->attach = attach;
1130 current_attach->data = item->email->encrypted_htmlbody; 1130 attach->data = item->email->encrypted_htmlbody;
1131 current_attach->size = item->email->encrypted_htmlbody_size; 1131 attach->size = item->email->encrypted_htmlbody_size;
1132 item->email->encrypted_htmlbody = NULL; 1132 item->email->encrypted_htmlbody = NULL;
1133 } 1133 }
1134 write_email_body(f_output, "The body of this email is encrypted. This isn't supported yet, but the body is now an attachment\n"); 1134 write_email_body(f_output, "The body of this email is encrypted. This isn't supported yet, but the body is now an attachment\n");
1135 } 1135 }
1136 1136
1137 // other attachments 1137 // other attachments
1138 attach_num = 0; 1138 {
1139 for (current_attach = item->attach; current_attach; current_attach = current_attach->next) { 1139 pst_item_attach* attach;
1140 DEBUG_EMAIL(("Attempting Attachment encoding\n")); 1140 attach_num = 0;
1141 if (!current_attach->data) { 1141 for (attach = item->attach; attach; attach = attach->next) {
1142 DEBUG_EMAIL(("Data of attachment is NULL!. Size is supposed to be %i\n", current_attach->size)); 1142 DEBUG_EMAIL(("Attempting Attachment encoding\n"));
1143 } 1143 if (!attach->data) {
1144 if (mode == MODE_SEPARATE && !mode_MH) 1144 DEBUG_EMAIL(("Data of attachment is NULL!. Size is supposed to be %i\n", attach->size));
1145 write_separate_attachment(f_name, current_attach, ++attach_num, pst); 1145 }
1146 else 1146 if (mode == MODE_SEPARATE && !mode_MH)
1147 write_inline_attachment(f_output, current_attach, boundary, pst); 1147 write_separate_attachment(f_name, attach, ++attach_num, pst);
1148 } 1148 else
1149 write_inline_attachment(f_output, attach, boundary, pst);
1150 }
1151 }
1152
1153 // end of this mail message
1149 if (mode != MODE_SEPARATE) { /* do not add a boundary after the last attachment for mode_MH */ 1154 if (mode != MODE_SEPARATE) { /* do not add a boundary after the last attachment for mode_MH */
1150 DEBUG_EMAIL(("Writing buffer between emails\n")); 1155 DEBUG_EMAIL(("Writing buffer between emails\n"));
1151 fprintf(f_output, "\n--%s--\n", boundary); 1156 fprintf(f_output, "\n--%s--\n", boundary);
1152 fprintf(f_output, "\n\n"); 1157 fprintf(f_output, "\n\n");
1153 } 1158 }