comparison src/libpst.h @ 198:7c60d6d1c681

decode more recurrence mapi elements
author Carl Byington <carl@five-ten-sg.com>
date Tue, 12 May 2009 19:34:49 -0700
parents 320cfcba8058
children e3a46f66332b
comparison
equal deleted inserted replaced
197:07ceebd115ce 198:7c60d6d1c681
22 #pragma pack(1) 22 #pragma pack(1)
23 #endif 23 #endif
24 24
25 25
26 #define PST_TYPE_NOTE 1 26 #define PST_TYPE_NOTE 1
27 #define PST_TYPE_SCHEDULE 2
27 #define PST_TYPE_APPOINTMENT 8 28 #define PST_TYPE_APPOINTMENT 8
28 #define PST_TYPE_CONTACT 9 29 #define PST_TYPE_CONTACT 9
29 #define PST_TYPE_JOURNAL 10 30 #define PST_TYPE_JOURNAL 10
30 #define PST_TYPE_STICKYNOTE 11 31 #define PST_TYPE_STICKYNOTE 11
31 #define PST_TYPE_TASK 12 32 #define PST_TYPE_TASK 12
32 #define PST_TYPE_OTHER 13 33 #define PST_TYPE_OTHER 13
33 #define PST_TYPE_REPORT 14 34 #define PST_TYPE_REPORT 14
35
34 36
35 // defines types of possible encryption 37 // defines types of possible encryption
36 #define PST_NO_ENCRYPT 0 38 #define PST_NO_ENCRYPT 0
37 #define PST_COMP_ENCRYPT 1 39 #define PST_COMP_ENCRYPT 1
38 #define PST_ENCRYPT 2 40 #define PST_ENCRYPT 2
61 #define PST_APP_LABEL_NEEDS_PREP 7 63 #define PST_APP_LABEL_NEEDS_PREP 7
62 #define PST_APP_LABEL_BIRTHDAY 8 64 #define PST_APP_LABEL_BIRTHDAY 8
63 #define PST_APP_LABEL_ANNIVERSARY 9 65 #define PST_APP_LABEL_ANNIVERSARY 9
64 #define PST_APP_LABEL_PHONE_CALL 10 66 #define PST_APP_LABEL_PHONE_CALL 10
65 67
66 // define type of reccuring event 68 // define type of recuring event
67 #define PST_APP_RECUR_NONE 0 69 #define PST_APP_RECUR_NONE 0
68 #define PST_APP_RECUR_DAILY 1 70 #define PST_APP_RECUR_DAILY 1
69 #define PST_APP_RECUR_WEEKLY 2 71 #define PST_APP_RECUR_WEEKLY 2
70 #define PST_APP_RECUR_MONTHLY 3 72 #define PST_APP_RECUR_MONTHLY 3
71 #define PST_APP_RECUR_YEARLY 4 73 #define PST_APP_RECUR_YEARLY 4
355 357
356 358
357 /** This contains the contact related mapi elements 359 /** This contains the contact related mapi elements
358 */ 360 */
359 typedef struct pst_item_contact { 361 typedef struct pst_item_contact {
360 /** Unused - need to find the proper mapi element number for this */
361 pst_string access_method;
362 /** mapi element 0x3a00 PR_ACCOUNT */ 362 /** mapi element 0x3a00 PR_ACCOUNT */
363 pst_string account_name; 363 pst_string account_name;
364 /** mapi element 0x3003 PR_EMAIL_ADDRESS, or 0x8083 */ 364 /** mapi element 0x3003 PR_EMAIL_ADDRESS, or 0x8083 */
365 pst_string address1; 365 pst_string address1;
366 /** mapi element 0x8085 */ 366 /** mapi element 0x8085 */
610 610
611 611
612 /** This contains the journal related mapi elements 612 /** This contains the journal related mapi elements
613 */ 613 */
614 typedef struct pst_item_journal { 614 typedef struct pst_item_journal {
615 /** mapi element 0x8706 */
616 FILETIME *start;
615 /** mapi element 0x8708 */ 617 /** mapi element 0x8708 */
616 FILETIME *end; 618 FILETIME *end;
617 /** mapi element 0x8706 */
618 FILETIME *start;
619 /** mapi element 0x8700 */ 619 /** mapi element 0x8700 */
620 pst_string type; 620 pst_string type;
621 /** mapi element 0x8712 */ 621 /** mapi element 0x8712 */
622 pst_string description; 622 pst_string description;
623 } pst_item_journal; 623 } pst_item_journal;
624 624
625 625
626 /** This contains the recurrence data separated into fields.
627 http://www.geocities.com/cainrandom/dev/MAPIRecurrence.html
628 */
629 typedef struct pst_recurrence {
630 /** 0x30043004 */
631 uint32_t signature;
632 /** @li 0 daily
633 * @li 1 weekly
634 * @li 2 monthly
635 * @li 3 yearly */
636 uint32_t type;
637 /** implies number of recurrence parameters
638 * @li 0 has 3 parameters
639 * @li 1 has 4 parameters
640 * @li 2 has 4 parameters
641 * @li 3 has 5 parameters
642 */
643 uint32_t sub_type;
644 /** must be contiguous, not an array to make python interface easier */
645 uint32_t parm1;
646 uint32_t parm2;
647 uint32_t parm3;
648 uint32_t parm4;
649 uint32_t parm5;
650 /** type of termination of the recurrence
651 @li 0 terminates on a date
652 @li 1 terminates based on integer number of occurrences
653 @li 2 never terminates
654 */
655 uint32_t termination;
656 /** recurrence interval in terms of the recurrence type */
657 uint32_t interval;
658 /** number of occurrences, even if recurrence terminates based on date */
659 uint32_t count;
660 // there is more data, including the termination date,
661 // but we can get that from other mapi elements.
662 } pst_recurrence;
663
664
626 /** This contains the appointment related mapi elements 665 /** This contains the appointment related mapi elements
627 */ 666 */
628 typedef struct pst_item_appointment { 667 typedef struct pst_item_appointment {
668 /** mapi element 0x820d PR_OUTLOOK_EVENT_START_DATE */
669 FILETIME *start;
629 /** mapi element 0x820e PR_OUTLOOK_EVENT_START_END */ 670 /** mapi element 0x820e PR_OUTLOOK_EVENT_START_END */
630 FILETIME *end; 671 FILETIME *end;
631 /** mapi element 0x8208 PR_OUTLOOK_EVENT_LOCATION */ 672 /** mapi element 0x8208 PR_OUTLOOK_EVENT_LOCATION */
632 pst_string location; 673 pst_string location;
633 /** mapi element 0x8503 PR_OUTLOOK_COMMON_REMINDER_SET 674 /** mapi element 0x8503 PR_OUTLOOK_COMMON_REMINDER_SET
638 FILETIME *reminder; 679 FILETIME *reminder;
639 /** mapi element 0x8501 PR_OUTLOOK_COMMON_REMINDER_MINUTES_BEFORE */ 680 /** mapi element 0x8501 PR_OUTLOOK_COMMON_REMINDER_MINUTES_BEFORE */
640 int32_t alarm_minutes; 681 int32_t alarm_minutes;
641 /** mapi element 0x851f */ 682 /** mapi element 0x851f */
642 pst_string alarm_filename; 683 pst_string alarm_filename;
643 /** mapi element 0x820d PR_OUTLOOK_EVENT_START_DATE */
644 FILETIME *start;
645 /** mapi element 0x8234 */ 684 /** mapi element 0x8234 */
646 pst_string timezonestring; 685 pst_string timezonestring;
647 /** mapi element 0x8205 PR_OUTLOOK_EVENT_SHOW_TIME_AS 686 /** mapi element 0x8205 PR_OUTLOOK_EVENT_SHOW_TIME_AS
648 * @li 0 free 687 * @li 0 free
649 * @li 1 tentative 688 * @li 1 tentative
665 int32_t label; 704 int32_t label;
666 /** mapi element 0x8215 PR_OUTLOOK_EVENT_ALL_DAY 705 /** mapi element 0x8215 PR_OUTLOOK_EVENT_ALL_DAY
667 * @li 1 true 706 * @li 1 true
668 * @li 0 false */ 707 * @li 0 false */
669 int all_day; 708 int all_day;
670 /** mapi element 0x8232 recurrence description */ 709 /** mapi element 0x8223 PR_OUTLOOK_EVENT_IS_RECURRING
671 pst_string recurrence; 710 * @li 1 true
711 * @li 0 false */
712 int is_recurring;
672 /** mapi element 0x8231 713 /** mapi element 0x8231
673 * @li 0 none 714 * @li 0 none
674 * @li 1 daily 715 * @li 1 daily
675 * @li 2 weekly 716 * @li 2 weekly
676 * @li 3 monthly 717 * @li 3 monthly
677 * @li 4 yearly */ 718 * @li 4 yearly */
678 int32_t recurrence_type; 719 int32_t recurrence_type;
720 /** mapi element 0x8232 recurrence description */
721 pst_string recurrence_description;
722 /** mapi element 0x8216 recurrence data */
723 pst_binary recurrence_data;
679 /** mapi element 0x8235 PR_OUTLOOK_EVENT_RECURRENCE_START */ 724 /** mapi element 0x8235 PR_OUTLOOK_EVENT_RECURRENCE_START */
680 FILETIME *recurrence_start; 725 FILETIME *recurrence_start;
681 /** mapi element 0x8236 PR_OUTLOOK_EVENT_RECURRENCE_END */ 726 /** mapi element 0x8236 PR_OUTLOOK_EVENT_RECURRENCE_END */
682 FILETIME *recurrence_end; 727 FILETIME *recurrence_end;
683 } pst_item_appointment; 728 } pst_item_appointment;
703 pst_item_journal *journal; 748 pst_item_journal *journal;
704 /** calendar mapi elements */ 749 /** calendar mapi elements */
705 pst_item_appointment *appointment; 750 pst_item_appointment *appointment;
706 /** derived from mapi elements 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS 751 /** derived from mapi elements 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS
707 * @li 1 PST_TYPE_NOTE 752 * @li 1 PST_TYPE_NOTE
753 * @li 2 PST_TYPE_SCHEDULE
708 * @li 8 PST_TYPE_APPOINTMENT 754 * @li 8 PST_TYPE_APPOINTMENT
709 * @li 9 PST_TYPE_CONTACT 755 * @li 9 PST_TYPE_CONTACT
710 * @li 10 PST_TYPE_JOURNAL 756 * @li 10 PST_TYPE_JOURNAL
711 * @li 11 PST_TYPE_STICKYNOTE 757 * @li 11 PST_TYPE_STICKYNOTE
712 * @li 12 PST_TYPE_TASK 758 * @li 12 PST_TYPE_TASK
771 * Some mapi_id values are converted to cannonical mapi_id values 817 * Some mapi_id values are converted to cannonical mapi_id values
772 * (PST_MAP_ATTRIB), and others are converted to a string 818 * (PST_MAP_ATTRIB), and others are converted to a string
773 * (PST_ATTRIB_HEADER). 819 * (PST_ATTRIB_HEADER).
774 */ 820 */
775 typedef struct pst_x_attrib_ll { 821 typedef struct pst_x_attrib_ll {
776 /** obsolete field, this is now unused */
777 uint32_t type;
778 /** @li 1 PST_MAP_ATTRIB map->int attribute 822 /** @li 1 PST_MAP_ATTRIB map->int attribute
779 @li 2 PST_MAP_HEADER map->string header 823 @li 2 PST_MAP_HEADER map->string header
780 */ 824 */
781 uint32_t mytype; 825 uint32_t mytype;
782 /** key for the mapping */ 826 /** key for the mapping */
876 920
877 921
878 /** Assemble the binary attachment into a single buffer. 922 /** Assemble the binary attachment into a single buffer.
879 * @param pf pointer to the pst_file structure setup by pst_open(). 923 * @param pf pointer to the pst_file structure setup by pst_open().
880 * @param attach pointer to the attachment record 924 * @param attach pointer to the attachment record
881 * @param b pointer to location to store the buffer pointer. The 925 * @return structure containing size of and pointer to the buffer.
882 * caller must free this buffer. 926 * the caller must free this buffer.
883 * @return size of the buffer, and return the buffer pointer in *b 927 */
884 */ 928 pst_binary pst_attach_to_mem(pst_file *pf, pst_item_attach *attach);
885 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, char **b);
886 929
887 930
888 /** Write a binary attachment to a file. 931 /** Write a binary attachment to a file.
889 * @param pf pointer to the pst_file structure setup by pst_open(). 932 * @param pf pointer to the pst_file structure setup by pst_open().
890 * @param attach pointer to the attachment record 933 * @param attach pointer to the attachment record
998 * @return time in rfc2445 format 1041 * @return time in rfc2445 format
999 */ 1042 */
1000 char * pst_rfc2445_datetime_format(const FILETIME *ft); 1043 char * pst_rfc2445_datetime_format(const FILETIME *ft);
1001 1044
1002 1045
1046 /** Convert the current time rfc2445 date/time format 19531015T231000Z
1047 * @return time in rfc2445 format
1048 */
1049 char * pst_rfc2445_datetime_format_now();
1050
1051
1003 /** Get the default character set for this item. This is used to find 1052 /** Get the default character set for this item. This is used to find
1004 * the charset for pst_string elements that are not already in utf8 encoding. 1053 * the charset for pst_string elements that are not already in utf8 encoding.
1005 * @param item pointer to the mapi item of interest 1054 * @param item pointer to the mapi item of interest
1006 * @return default character set as a string useable by iconv() 1055 * @return default character set as a string useable by iconv()
1007 */ 1056 */
1008 const char* pst_default_charset(pst_item *item); 1057 const char* pst_default_charset(pst_item *item);
1009 1058
1010 1059
1011 /** Convert str to utf8 if possible; null strings are preserved. 1060 /** Convert str to utf8 if possible; null strings are preserved.
1012 * @param item pointer to the containing mapi item 1061 * @param item pointer to the containing mapi item
1013 * @param str pointer to the mapi string of interest 1062 * @param str pointer to the mapi string of interest
1014 */ 1063 */
1015 void pst_convert_utf8_null(pst_item *item, pst_string *str); 1064 void pst_convert_utf8_null(pst_item *item, pst_string *str);
1016 1065
1017 1066
1018 /** Convert str to utf8 if possible; null strings are converted into empty strings. 1067 /** Convert str to utf8 if possible; null strings are converted into empty strings.
1019 * @param item pointer to the containing mapi item 1068 * @param item pointer to the containing mapi item
1020 * @param str pointer to the mapi string of interest 1069 * @param str pointer to the mapi string of interest
1021 */ 1070 */
1022 void pst_convert_utf8(pst_item *item, pst_string *str); 1071 void pst_convert_utf8(pst_item *item, pst_string *str);
1072
1073
1074 /** Decode raw recurrence data into a better structure.
1075 * @param appt pointer to appointment structure
1076 * @return pointer to decoded recurrence structure that must be free'd by the caller.
1077 */
1078 pst_recurrence* pst_convert_recurrence(pst_item_appointment* appt);
1079
1080
1081 /** Free a recurrence structure.
1082 * @param r input pointer to be freed
1083 */
1084 void pst_free_recurrence(pst_recurrence* r);
1085
1023 1086
1024 1087
1025 // switch from maximal packing back to default packing 1088 // switch from maximal packing back to default packing
1026 // undo the packing from the beginning of this file 1089 // undo the packing from the beginning of this file
1027 #ifdef _MSC_VER 1090 #ifdef _MSC_VER