comparison src/readpst.c @ 297:8b3a827b71f4

add alarm reminders to calendar events
author Carl Byington <carl@five-ten-sg.com>
date Thu, 28 Jul 2011 17:28:49 -0700
parents e0e5844d91b3
children 201464dd356e
comparison
equal deleted inserted replaced
296:2066f13990a3 297:8b3a827b71f4
1375 fprintf(f_output, "PRODID:LibPST v%s\n", VERSION); 1375 fprintf(f_output, "PRODID:LibPST v%s\n", VERSION);
1376 if (method) fprintf(f_output, "METHOD:%s\n", method); 1376 if (method) fprintf(f_output, "METHOD:%s\n", method);
1377 fprintf(f_output, "BEGIN:VEVENT\n"); 1377 fprintf(f_output, "BEGIN:VEVENT\n");
1378 if (sender) { 1378 if (sender) {
1379 if (item->email->outlook_sender_name.str) { 1379 if (item->email->outlook_sender_name.str) {
1380 fprintf(f_output, "ORGANIZER;CN=\"%s\":MAILTO:%s\n", item->email->outlook_sender_name.str, sender); 1380 fprintf(f_output, "ORGANIZER;CN=\"%s\":MAILTO:%s\n", item->email->outlook_sender_name.str, sender);
1381 } else { 1381 } else {
1382 fprintf(f_output, "ORGANIZER;CN=\"\":MAILTO:%s\n", sender); 1382 fprintf(f_output, "ORGANIZER;CN=\"\":MAILTO:%s\n", sender);
1383 } 1383 }
1384 } 1384 }
1385 write_appointment(f_output, item); 1385 write_appointment(f_output, item);
1386 fprintf(f_output, "END:VCALENDAR\n"); 1386 fprintf(f_output, "END:VCALENDAR\n");
1387 } 1387 }
1388 1388
1963 // make everything utf8 1963 // make everything utf8
1964 pst_convert_utf8_null(item, &item->subject); 1964 pst_convert_utf8_null(item, &item->subject);
1965 pst_convert_utf8_null(item, &item->body); 1965 pst_convert_utf8_null(item, &item->body);
1966 pst_convert_utf8_null(item, &appointment->location); 1966 pst_convert_utf8_null(item, &appointment->location);
1967 1967
1968 fprintf(f_output, "UID:%#"PRIx64"\n", item->block_id);
1968 fprintf(f_output, "DTSTAMP:%s\n", pst_rfc2445_datetime_format_now(sizeof(time_buffer), time_buffer)); 1969 fprintf(f_output, "DTSTAMP:%s\n", pst_rfc2445_datetime_format_now(sizeof(time_buffer), time_buffer));
1969 if (item->create_date) 1970 if (item->create_date)
1970 fprintf(f_output, "CREATED:%s\n", pst_rfc2445_datetime_format(item->create_date, sizeof(time_buffer), time_buffer)); 1971 fprintf(f_output, "CREATED:%s\n", pst_rfc2445_datetime_format(item->create_date, sizeof(time_buffer), time_buffer));
1971 if (item->modify_date) 1972 if (item->modify_date)
1972 fprintf(f_output, "LAST-MOD:%s\n", pst_rfc2445_datetime_format(item->modify_date, sizeof(time_buffer), time_buffer)); 1973 fprintf(f_output, "LAST-MOD:%s\n", pst_rfc2445_datetime_format(item->modify_date, sizeof(time_buffer), time_buffer));
2056 break; 2057 break;
2057 case PST_APP_LABEL_PHONE_CALL: 2058 case PST_APP_LABEL_PHONE_CALL:
2058 fprintf(f_output, "CATEGORIES:PHONE-CALL\n"); 2059 fprintf(f_output, "CATEGORIES:PHONE-CALL\n");
2059 break; 2060 break;
2060 } 2061 }
2062 // ignore bogus alarms
2063 if (appointment->alarm && (appointment->alarm_minutes >= 0) && (appointment->alarm_minutes < 1440)) {
2064 fprintf(f_output, "BEGIN:VALARM\n");
2065 fprintf(f_output, "TRIGGER:-PT%dM\n", appointment->alarm_minutes);
2066 fprintf(f_output, "ACTION:DISPLAY\n");
2067 fprintf(f_output, "DESCRIPTION:Reminder\n");
2068 fprintf(f_output, "END:VALARM\n");
2069 }
2061 } 2070 }
2062 fprintf(f_output, "END:VEVENT\n"); 2071 fprintf(f_output, "END:VEVENT\n");
2063 if (result) free(result); 2072 if (result) free(result);
2064 } 2073 }
2065 2074