Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

readpst.c File Reference

#include "define.h"
#include "lzfu.h"

Include dependency graph for readpst.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  file_ll

Defines

#define OUTPUT_TEMPLATE   "%s"
#define OUTPUT_KMAIL_DIR_TEMPLATE   ".%s.directory"
#define KMAIL_INDEX   ".%s.index"
#define SEP_MAIL_FILE_TEMPLATE   "%i"
#define C_TIME_SIZE   500
#define MODE_NORMAL   0
#define MODE_KMAIL   1
#define MODE_RECURSE   2
#define MODE_SEPARATE   3
#define MODE_DECSPEW   4
#define OUTPUT_NORMAL   0
#define OUTPUT_QUIET   1
#define MIME_TYPE_DEFAULT   "application/octet-stream"
#define RFC822   "message/rfc822"
#define CMODE_VCARD   0
#define CMODE_LIST   1
#define DMODE_EXCLUDE   0
#define DMODE_INCLUDE   1
#define RTF_ATTACH_NAME   "rtf-body.rtf"
#define RTF_ATTACH_TYPE   "application/rtf"

Functions

void process (pst_item *outeritem, pst_desc_ll *d_ptr)
void write_email_body (FILE *f, char *body)
void removeCR (char *c)
void usage ()
void version ()
char * mk_kmail_dir (char *)
int close_kmail_dir ()
char * mk_recurse_dir (char *)
int close_recurse_dir ()
char * mk_separate_dir (char *dir)
int close_separate_dir ()
int mk_separate_file (struct file_ll *f)
char * my_stristr (char *haystack, char *needle)
void check_filename (char *fname)
void write_separate_attachment (char f_name[], pst_item_attach *attach, int attach_num, pst_file *pst)
void write_embedded_message (FILE *f_output, pst_item_attach *attach, char *boundary, pst_file *pf, char **extra_mime_headers)
void write_inline_attachment (FILE *f_output, pst_item_attach *attach, char *boundary, pst_file *pst)
void header_has_field (char *header, char *field, int *flag)
void header_get_subfield (char *field, const char *subfield, char *body_subfield, size_t size_subfield)
char * header_get_field (char *header, char *field)
char * header_end_field (char *field)
void header_strip_field (char *header, char *field)
int test_base64 (char *body)
void find_html_charset (char *html, char *charset, size_t charsetlen)
void find_rfc822_headers (char **extra_mime_headers)
void write_body_part (FILE *f_output, char *body, int32_t body_was_unicode, char *mime, char *charset, char *boundary, pst_file *pst)
void write_normal_email (FILE *f_output, char f_name[], pst_item *item, int mode, int mode_MH, pst_file *pst, int save_rtf, char **extra_mime_headers)
void write_vcard (FILE *f_output, pst_item_contact *contact, char comment[])
void write_appointment (FILE *f_output, pst_item_appointment *appointment, pst_item_email *email, FILETIME *create_date, FILETIME *modify_date)
void create_enter_dir (struct file_ll *f, pst_item *item)
void close_enter_dir (struct file_ll *f)
int main (int argc, char *const *argv)
const char * codepage (int cp)

Variables

const char * prog_name
char * output_dir = "."
char * kmail_chdir = NULL
int mode = 0
int mode_MH = 0
int output_mode = 0
int contact_mode = 0
int deleted_mode = 0
int overwrite = 0
int save_rtf_body = 1
pst_file pstfile
regex_t meta_charset_pattern


Define Documentation

#define C_TIME_SIZE   500
 

Definition at line 17 of file readpst.c.

Referenced by write_normal_email().

#define CMODE_LIST   1
 

Definition at line 99 of file readpst.c.

#define CMODE_VCARD   0
 

Definition at line 98 of file readpst.c.

#define DMODE_EXCLUDE   0
 

Definition at line 102 of file readpst.c.

#define DMODE_INCLUDE   1
 

Definition at line 103 of file readpst.c.

#define KMAIL_INDEX   ".%s.index"
 

Definition at line 13 of file readpst.c.

Referenced by mk_kmail_dir().

#define MIME_TYPE_DEFAULT   "application/octet-stream"
 

Definition at line 94 of file readpst.c.

Referenced by write_inline_attachment().

#define MODE_DECSPEW   4
 

Definition at line 84 of file readpst.c.

#define MODE_KMAIL   1
 

Definition at line 72 of file readpst.c.

#define MODE_NORMAL   0
 

Definition at line 68 of file readpst.c.

Referenced by write_embedded_message().

#define MODE_RECURSE   2
 

Definition at line 76 of file readpst.c.

#define MODE_SEPARATE   3
 

Definition at line 81 of file readpst.c.

Referenced by write_normal_email().

#define OUTPUT_KMAIL_DIR_TEMPLATE   ".%s.directory"
 

Definition at line 12 of file readpst.c.

Referenced by mk_kmail_dir().

#define OUTPUT_NORMAL   0
 

Definition at line 88 of file readpst.c.

#define OUTPUT_QUIET   1
 

Definition at line 91 of file readpst.c.

#define OUTPUT_TEMPLATE   "%s"
 

Definition at line 11 of file readpst.c.

Referenced by mk_kmail_dir().

#define RFC822   "message/rfc822"
 

Definition at line 95 of file readpst.c.

Referenced by find_rfc822_headers(), and write_normal_email().

#define RTF_ATTACH_NAME   "rtf-body.rtf"
 

Definition at line 107 of file readpst.c.

Referenced by write_normal_email().

#define RTF_ATTACH_TYPE   "application/rtf"
 

Definition at line 109 of file readpst.c.

Referenced by write_normal_email().

#define SEP_MAIL_FILE_TEMPLATE   "%i"
 

Definition at line 14 of file readpst.c.

Referenced by mk_separate_dir(), and mk_separate_file().


Function Documentation

void check_filename char *  fname  ) 
 

Referenced by mk_kmail_dir(), mk_recurse_dir(), mk_separate_dir(), mk_separate_file(), and write_separate_attachment().

void close_enter_dir struct file_ll f  ) 
 

Definition at line 40 of file lspst.c.

References file_ll::dname.

Referenced by process().

int close_kmail_dir  ) 
 

Definition at line 511 of file readpst.c.

References DEBUG_ENT, DEBUG_RET, DIE, and kmail_chdir.

int close_recurse_dir  ) 
 

Definition at line 554 of file readpst.c.

References DEBUG_ENT, DEBUG_RET, and DIE.

int close_separate_dir  ) 
 

Definition at line 624 of file readpst.c.

References DEBUG_ENT, DEBUG_RET, and DIE.

const char * codepage int  cp  ) 
 

Definition at line 1035 of file readpst.c.

Referenced by write_normal_email().

void create_enter_dir struct file_ll f,
pst_item item
 

Definition at line 29 of file lspst.c.

References file_ll::dname, pst_item_folder::email_count, file_ll::email_count, pst_item::file_as, pst_item::folder, file_ll::skip_count, file_ll::stored_count, pst_item::type, file_ll::type, and xmalloc().

Referenced by process().

Here is the call graph for this function:

void find_html_charset char *  html,
char *  charset,
size_t  charsetlen
 

Definition at line 926 of file readpst.c.

References DEBUG_EMAIL, DEBUG_ENT, DEBUG_HEXDUMPC, DEBUG_RET, and meta_charset_pattern.

Referenced by write_normal_email().

void find_rfc822_headers char **  extra_mime_headers  ) 
 

Definition at line 955 of file readpst.c.

References DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, header_get_field(), and RFC822.

Referenced by write_normal_email().

Here is the call graph for this function:

char * header_end_field char *  field  ) 
 

Definition at line 875 of file readpst.c.

Referenced by header_get_subfield(), and header_strip_field().

char * header_get_field char *  header,
char *  field
 

Definition at line 865 of file readpst.c.

References my_stristr().

Referenced by find_rfc822_headers(), header_strip_field(), and write_normal_email().

Here is the call graph for this function:

void header_get_subfield char *  field,
const char *  subfield,
char *  body_subfield,
size_t  size_subfield
 

Definition at line 834 of file readpst.c.

References DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, header_end_field(), and my_stristr().

Referenced by write_normal_email().

Here is the call graph for this function:

void header_has_field char *  header,
char *  field,
int *  flag
 

Definition at line 823 of file readpst.c.

References DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, and my_stristr().

Referenced by write_normal_email().

Here is the call graph for this function:

void header_strip_field char *  header,
char *  field
 

Definition at line 885 of file readpst.c.

References header_end_field(), and header_get_field().

Referenced by write_normal_email().

Here is the call graph for this function:

int main int  argc,
char *const *  argv
 

Definition at line 228 of file readpst.c.

References pst_desc_tree::child, contact_mode, pst_file::d_head, DEBUG_ENT, DEBUG_INIT, DEBUG_MAIN, DEBUG_REGISTER_CLOSE, DEBUG_RET, deleted_mode, DIE, pst_item::file_as, getopt(), pst_item::message_store, meta_charset_pattern, mode, mode_MH, optarg, output_dir, output_mode, overwrite, process(), prog_name, pst_close(), PST_COMP_ENCRYPT, pst_decrypt(), pst_desc_ll, pst_freeItem(), pst_fwrite(), pst_getTopOfFolders(), pst_load_extended_attributes(), pst_load_index(), pst_open(), pst_parse_item(), pstfile, RET_DERROR, save_rtf_body, usage(), version(), and xmalloc().

Here is the call graph for this function:

char * mk_kmail_dir char *   ) 
 

Definition at line 472 of file readpst.c.

References check_filename(), D_MKDIR, DEBUG_ENT, DEBUG_RET, DIE, kmail_chdir, KMAIL_INDEX, OUTPUT_KMAIL_DIR_TEMPLATE, and OUTPUT_TEMPLATE.

Here is the call graph for this function:

char * mk_recurse_dir char *   ) 
 

Definition at line 532 of file readpst.c.

References check_filename(), D_MKDIR, DEBUG_ENT, DEBUG_RET, and DIE.

Here is the call graph for this function:

char * mk_separate_dir char *  dir  ) 
 

Definition at line 566 of file readpst.c.

References check_filename(), D_MKDIR, DEBUG_ENT, DEBUG_MAIN, DEBUG_RET, DIE, overwrite, SEP_MAIL_FILE_TEMPLATE, and WARN.

Here is the call graph for this function:

int mk_separate_file struct file_ll f  ) 
 

Definition at line 636 of file readpst.c.

References check_filename(), DEBUG_ENT, DEBUG_MAIN, DEBUG_RET, DIE, file_ll::email_count, file_ll::name, file_ll::output, and SEP_MAIL_FILE_TEMPLATE.

Here is the call graph for this function:

char * my_stristr char *  haystack,
char *  needle
 

Definition at line 655 of file readpst.c.

Referenced by header_get_field(), header_get_subfield(), and header_has_field().

void process pst_item outeritem,
pst_desc_ll d_ptr
 

Definition at line 46 of file lspst.c.

References pst_desc_tree::child, close_enter_dir(), create_enter_dir(), DEBUG_ENT, DEBUG_MAIN, DEBUG_RET, DEBUG_WARN, pst_desc_tree::desc, DIE, pst_desc_tree::id, pst_index_tree::id, pst_desc_tree::next, pst_desc_ll, pst_freeItem(), pst_parse_item(), pst_rfc2426_escape(), pst_rfc2445_datetime_format(), PST_TYPE_NOTE, PST_TYPE_REPORT, pstfile, and file_ll::skip_count.

Referenced by main(), and process().

Here is the call graph for this function:

void removeCR char *  c  ) 
 

Definition at line 417 of file readpst.c.

References DEBUG_ENT, and DEBUG_RET.

Referenced by write_body_part(), and write_normal_email().

int test_base64 char *  body  ) 
 

Definition at line 907 of file readpst.c.

References DEBUG_EMAIL, DEBUG_ENT, DEBUG_HEXDUMPC, and DEBUG_RET.

Referenced by write_body_part().

void usage  ) 
 

void version  ) 
 

void write_appointment FILE *  f_output,
pst_item_appointment appointment,
pst_item_email email,
FILETIME create_date,
FILETIME modify_date
 

Definition at line 1433 of file readpst.c.

References pst_item_email::body, pst_item_appointment::end, pst_item_appointment::label, pst_item_appointment::location, PST_APP_LABEL_ANNIVERSARY, PST_APP_LABEL_BIRTHDAY, PST_APP_LABEL_BUSINESS, PST_APP_LABEL_IMPORTANT, PST_APP_LABEL_MUST_ATTEND, PST_APP_LABEL_NEEDS_PREP, PST_APP_LABEL_NONE, PST_APP_LABEL_PERSONAL, PST_APP_LABEL_PHONE_CALL, PST_APP_LABEL_TRAVEL_REQ, PST_APP_LABEL_VACATION, PST_FREEBUSY_BUSY, PST_FREEBUSY_FREE, PST_FREEBUSY_OUT_OF_OFFICE, PST_FREEBUSY_TENTATIVE, pst_rfc2426_escape(), pst_rfc2445_datetime_format(), pst_item_appointment::showas, pst_item_appointment::start, pst_item_email_subject::subj, and pst_item_email::subject.

Here is the call graph for this function:

void write_body_part FILE *  f_output,
char *  body,
int32_t  body_was_unicode,
char *  mime,
char *  charset,
char *  boundary,
pst_file pst
 

Definition at line 989 of file readpst.c.

References varbuf::b, base64_encode(), DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, removeCR(), test_base64(), vb_utf8to8bit(), vballoc(), vbuf, and write_email_body().

Referenced by write_normal_email().

Here is the call graph for this function:

void write_email_body FILE *  f,
char *  body
 

Definition at line 399 of file readpst.c.

References DEBUG_ENT, DEBUG_RET, and pst_fwrite().

Referenced by write_body_part(), and write_normal_email().

Here is the call graph for this function:

void write_embedded_message FILE *  f_output,
pst_item_attach attach,
char *  boundary,
pst_file pf,
char **  extra_mime_headers
 

Definition at line 742 of file readpst.c.

References pst_desc_tree::child, pst_desc_tree::child_tail, DEBUG_ENT, DEBUG_RET, pst_desc_tree::desc, pst_index_tree::id, pst_desc_tree::id, pst_item_attach::id2_head, pst_item_attach::id_val, pst_desc_tree::list_index, pst_item_attach::mimetype, MODE_NORMAL, pst_desc_tree::next, pst_desc_tree::no_child, pst_desc_tree::parent, pst_desc_tree::parent_id, pst_desc_tree::prev, pst_desc_ll, pst_freeItem(), pst_getID(), pst_index_ll, pst_parse_item(), and write_normal_email().

Referenced by write_normal_email().

Here is the call graph for this function:

void write_inline_attachment FILE *  f_output,
pst_item_attach attach,
char *  boundary,
pst_file pst
 

Definition at line 770 of file readpst.c.

References base64_encode(), pst_item_attach::data, DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, DEBUG_WARN, pst_item_attach::filename1, pst_item_attach::filename2, pst_item_attach::id_val, MIME_TYPE_DEFAULT, pst_item_attach::mimetype, pst_attach_to_file_base64(), pst_fwrite(), pst_getID(), pst_index_ll, and pst_item_attach::size.

Referenced by write_normal_email().

Here is the call graph for this function:

void write_normal_email FILE *  f_output,
char  f_name[],
pst_item item,
int  mode,
int  mode_MH,
pst_file pst,
int  save_rtf,
char **  extra_mime_headers
 

Definition at line 1067 of file readpst.c.

References pst_item::attach, pst_item_email::bcc_address, pst_item_email::body, pst_item_email::body_charset, pst_item_email::body_was_unicode, C_TIME_SIZE, pst_item_email::cc_address, codepage(), pst_item_attach::data, DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, pst_item::email, pst_item_email::encrypted_body, pst_item_email::encrypted_body_size, pst_item_email::encrypted_htmlbody, pst_item_email::encrypted_htmlbody_size, pst_item_attach::filename2, fileTimeToUnixTime(), find_html_charset(), find_rfc822_headers(), pst_item_email::header, header_get_field(), header_get_subfield(), header_has_field(), header_strip_field(), pst_item_email::htmlbody, pst_item_email::htmlbody_was_unicode, pst_item_email::internet_cpid, lzfu_decompress(), pst_item_email::message_codepage, pst_item_email::messageid, pst_item_attach::mimetype, mode, MODE_SEPARATE, pst_item_attach::next, pst_item_email::outlook_sender_name, pst_item_attach, removeCR(), pst_item_email::report_text, pst_item_email::report_was_unicode, RFC822, RTF_ATTACH_NAME, RTF_ATTACH_TYPE, pst_item_email::rtf_compressed, pst_item_email::rtf_compressed_size, pst_item_email::sender_address, pst_item_email::sent_date, pst_item_email::sentto_address, pst_item_attach::size, pst_item_email_subject::subj, pst_item_email::subject, write_body_part(), write_email_body(), write_embedded_message(), write_inline_attachment(), write_separate_attachment(), and xmalloc().

Referenced by write_embedded_message().

Here is the call graph for this function:

void write_separate_attachment char  f_name[],
pst_item_attach attach,
int  attach_num,
pst_file pst
 

Definition at line 695 of file readpst.c.

References check_filename(), pst_item_attach::data, DEBUG_EMAIL, DEBUG_ENT, DEBUG_RET, DIE, pst_item_attach::filename1, pst_item_attach::filename2, pst_attach_to_file(), pst_fwrite(), pst_item_attach::size, WARN, and xmalloc().

Referenced by write_normal_email().

Here is the call graph for this function:

void write_vcard FILE *  f_output,
pst_item_contact contact,
char  comment[]
 

Definition at line 1337 of file readpst.c.

References pst_item_contact::address1, pst_item_contact::address2, pst_item_contact::address3, pst_item_contact::assistant_name, pst_item_contact::assistant_phone, pst_item_contact::birthday, pst_item_contact::business_address, pst_item_contact::business_city, pst_item_contact::business_country, pst_item_contact::business_fax, pst_item_contact::business_phone, pst_item_contact::business_phone2, pst_item_contact::business_po_box, pst_item_contact::business_postal_code, pst_item_contact::business_state, pst_item_contact::business_street, pst_item_contact::car_phone, pst_item_contact::company_name, DEBUG_ENT, DEBUG_RET, pst_item_contact::display_name_prefix, pst_item_contact::first_name, pst_item_contact::fullname, pst_item_contact::home_address, pst_item_contact::home_city, pst_item_contact::home_country, pst_item_contact::home_fax, pst_item_contact::home_phone, pst_item_contact::home_phone2, pst_item_contact::home_po_box, pst_item_contact::home_postal_code, pst_item_contact::home_state, pst_item_contact::home_street, pst_item_contact::isdn_phone, pst_item_contact::job_title, pst_item_contact::middle_name, pst_item_contact::mobile_phone, pst_item_contact::nickname, pst_item_contact::other_address, pst_item_contact::other_city, pst_item_contact::other_country, pst_item_contact::other_phone, pst_item_contact::other_po_box, pst_item_contact::other_postal_code, pst_item_contact::other_state, pst_item_contact::other_street, pst_item_contact::pager_phone, pst_item_contact::primary_fax, pst_item_contact::primary_phone, pst_item_contact::profession, pst_rfc2425_datetime_format(), pst_rfc2426_escape(), pst_item_contact::radio_phone, pst_item_contact::suffix, pst_item_contact::surname, and pst_item_contact::telex.

Here is the call graph for this function:


Variable Documentation

int contact_mode = 0
 

Definition at line 115 of file readpst.c.

Referenced by main().

int deleted_mode = 0
 

Definition at line 116 of file readpst.c.

Referenced by main().

char* kmail_chdir = NULL
 

Definition at line 64 of file readpst.c.

Referenced by close_kmail_dir(), and mk_kmail_dir().

regex_t meta_charset_pattern
 

Definition at line 120 of file readpst.c.

Referenced by find_html_charset(), and main().

int mode = 0
 

Definition at line 112 of file readpst.c.

Referenced by main(), and write_normal_email().

int mode_MH = 0
 

Definition at line 113 of file readpst.c.

Referenced by main().

char* output_dir = "."
 

Definition at line 63 of file readpst.c.

Referenced by main().

int output_mode = 0
 

Definition at line 114 of file readpst.c.

Referenced by main().

int overwrite = 0
 

Definition at line 117 of file readpst.c.

Referenced by main(), and mk_separate_dir().

const char* prog_name
 

Definition at line 62 of file readpst.c.

pst_file pstfile
 

Definition at line 119 of file readpst.c.

int save_rtf_body = 1
 

Definition at line 118 of file readpst.c.

Referenced by main().


Generated on Thu Feb 26 13:40:31 2009 for 'LibPst' by  doxygen 1.3.9.1