Mercurial > libpst
comparison src/lspst.c @ 211:94bde95d7e18
the shared library interface should now be thread safe
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 08 Jun 2009 11:49:39 -0700 |
parents | 2f38c4ce606f |
children | 898118c3675e |
comparison
equal
deleted
inserted
replaced
210:2d1111fd70cf | 211:94bde95d7e18 |
---|---|
45 | 45 |
46 void process(pst_item *outeritem, pst_desc_tree *d_ptr) | 46 void process(pst_item *outeritem, pst_desc_tree *d_ptr) |
47 { | 47 { |
48 struct file_ll ff; | 48 struct file_ll ff; |
49 pst_item *item = NULL; | 49 pst_item *item = NULL; |
50 char *result = NULL; | |
51 size_t resultlen = 0; | |
50 | 52 |
51 DEBUG_ENT("process"); | 53 DEBUG_ENT("process"); |
52 memset(&ff, 0, sizeof(ff)); | 54 memset(&ff, 0, sizeof(ff)); |
53 create_enter_dir(&ff, outeritem); | 55 create_enter_dir(&ff, outeritem); |
54 | 56 |
80 if (ff.type != PST_TYPE_CONTACT) { | 82 if (ff.type != PST_TYPE_CONTACT) { |
81 DEBUG_INFO(("I have a contact, but the folder isn't a contacts folder. Processing anyway\n")); | 83 DEBUG_INFO(("I have a contact, but the folder isn't a contacts folder. Processing anyway\n")); |
82 } | 84 } |
83 printf("Contact"); | 85 printf("Contact"); |
84 if (item->contact->fullname.str) | 86 if (item->contact->fullname.str) |
85 printf("\t%s", pst_rfc2426_escape(item->contact->fullname.str)); | 87 printf("\t%s", pst_rfc2426_escape(item->contact->fullname.str, &result, &resultlen)); |
86 printf("\n"); | 88 printf("\n"); |
87 | 89 |
88 } else if (item->email && ((item->type == PST_TYPE_NOTE) || (item->type == PST_TYPE_SCHEDULE) || (item->type == PST_TYPE_REPORT))) { | 90 } else if (item->email && ((item->type == PST_TYPE_NOTE) || (item->type == PST_TYPE_SCHEDULE) || (item->type == PST_TYPE_REPORT))) { |
89 if (!ff.type) ff.type = item->type; | 91 if (!ff.type) ff.type = item->type; |
90 // Process Email item | 92 // Process Email item |
103 // Process Journal item | 105 // Process Journal item |
104 if (ff.type != PST_TYPE_JOURNAL) { | 106 if (ff.type != PST_TYPE_JOURNAL) { |
105 DEBUG_INFO(("I have a journal entry, but folder isn't specified as a journal type. Processing...\n")); | 107 DEBUG_INFO(("I have a journal entry, but folder isn't specified as a journal type. Processing...\n")); |
106 } | 108 } |
107 if (item->subject.str) | 109 if (item->subject.str) |
108 printf("Journal\t%s\n", pst_rfc2426_escape(item->subject.str)); | 110 printf("Journal\t%s\n", pst_rfc2426_escape(item->subject.str, &result, &resultlen)); |
109 | 111 |
110 } else if (item->appointment && (item->type == PST_TYPE_APPOINTMENT)) { | 112 } else if (item->appointment && (item->type == PST_TYPE_APPOINTMENT)) { |
111 char time_buffer[30]; | 113 char time_buffer[30]; |
112 if (!ff.type) ff.type = item->type; | 114 if (!ff.type) ff.type = item->type; |
113 // Process Calendar Appointment item | 115 // Process Calendar Appointment item |
115 if (ff.type != PST_TYPE_APPOINTMENT) { | 117 if (ff.type != PST_TYPE_APPOINTMENT) { |
116 DEBUG_INFO(("I have an appointment, but folder isn't specified as an appointment type. Processing...\n")); | 118 DEBUG_INFO(("I have an appointment, but folder isn't specified as an appointment type. Processing...\n")); |
117 } | 119 } |
118 printf("Appointment"); | 120 printf("Appointment"); |
119 if (item->subject.str) | 121 if (item->subject.str) |
120 printf("\tSUMMARY: %s", pst_rfc2426_escape(item->subject.str)); | 122 printf("\tSUMMARY: %s", pst_rfc2426_escape(item->subject.str, &result, &resultlen)); |
121 if (item->appointment->start) | 123 if (item->appointment->start) |
122 printf("\tSTART: %s", pst_rfc2445_datetime_format(item->appointment->start, sizeof(time_buffer), time_buffer)); | 124 printf("\tSTART: %s", pst_rfc2445_datetime_format(item->appointment->start, sizeof(time_buffer), time_buffer)); |
123 if (item->appointment->end) | 125 if (item->appointment->end) |
124 printf("\tEND: %s", pst_rfc2445_datetime_format(item->appointment->end, sizeof(time_buffer), time_buffer)); | 126 printf("\tEND: %s", pst_rfc2445_datetime_format(item->appointment->end, sizeof(time_buffer), time_buffer)); |
125 printf("\tALL DAY: %s", (item->appointment->all_day==1 ? "Yes" : "No")); | 127 printf("\tALL DAY: %s", (item->appointment->all_day==1 ? "Yes" : "No")); |
137 } | 139 } |
138 d_ptr = d_ptr->next; | 140 d_ptr = d_ptr->next; |
139 } | 141 } |
140 } | 142 } |
141 close_enter_dir(&ff); | 143 close_enter_dir(&ff); |
144 if (result) free(result); | |
142 DEBUG_RET(); | 145 DEBUG_RET(); |
143 } | 146 } |
144 | 147 |
145 | 148 |
146 void usage(char *prog_name) { | 149 void usage(char *prog_name) { |