Revision 3281 libsylph/procmime.c

View differences:

procmime.c
210 210
	return mimeinfo;
211 211
}
212 212

  
213
MimeInfo *procmime_scan_message_stream(FILE *fp)
214
{
215
	MimeInfo *mimeinfo;
216
	glong fpos;
217

  
218
	g_return_val_if_fail(fp != NULL, NULL);
219

  
220
	if (fseek(fp, 0L, SEEK_SET) < 0) {
221
		FILE_OP_ERROR("procmime_scan_message_stream()", "fseek");
222
		return NULL;
223
	}
224

  
225
	mimeinfo = procmime_scan_mime_header(fp);
226

  
227
	if (mimeinfo) {
228
		fpos = ftell(fp);
229
		mimeinfo->content_size = get_left_file_size(fp);
230
		mimeinfo->size = fpos + mimeinfo->content_size;
231
		if (mimeinfo->encoding_type == ENC_BASE64)
232
			mimeinfo->content_size = mimeinfo->content_size / 4 * 3;
233
		if (mimeinfo->mime_type == MIME_MULTIPART ||
234
		    mimeinfo->mime_type == MIME_MESSAGE_RFC822)
235
			procmime_scan_multipart_message(mimeinfo, fp);
236
	}
237

  
238
	return mimeinfo;
239
}
240

  
213 241
void procmime_scan_multipart_message(MimeInfo *mimeinfo, FILE *fp)
214 242
{
215 243
	gchar *p;

Also available in: Unified diff