HEAD: removed mrwise debug crud from uniclientgen.cc.
[wvapps.git] / wvmapi / wvtnefconv.h
blob17c27a6bd05e2dae707ac7c4c537bbcfac4be969
1 #ifndef __WVTNEFCONV_H
2 #define __WVTNEFCONV_H
4 #include "wvtnef.h"
5 #include "wvtnefconv_private.h"
6 #include "wvstringlist.h"
8 /** Tells if a TNEF has an alarm property.
9 * This function checks to see if the ALARM_TRIGGER and IS_ALARM_ENABLED
10 * properties are set in such a way that the item has an alarm.
11 * @param tnef The TNEF to check
12 * @return Whether the TNEF has an alarm. */
13 bool has_alarm(const WvTnef &tnef);
15 /** Tells if a TNEF could represent a VCal.
16 * This function checks to see if the PR_MESSAGE_CLASS MAPI property is
17 * equal to the string "IPM.Appointment" or "IPM.Task"
18 * @param tnef The TNEF to check
19 * @return Whether the TNEF represents a VCal */
20 bool is_vcal(const WvTnef &tnef);
22 /** Tells if a TNEF could represent a VCard
23 * This function checks to see if the PR_MESSAGE_CLASS MAPI property is
24 * equal to the string "IPM.Contact"
25 * @param tnef The TNEF to check
26 * @return Whether the TNEF represents a VCard */
27 bool is_vcard(const WvTnef &tnef);
29 /** Creates a VCal from the relevant MAPI properties
30 * This function executes a series of MAPI queries to get the properties
31 * necessary to generate a VCal
32 * @tnef tnef The TNEF containing the properties of the VCal
33 * @return A VCal in a null-terminated string */
34 WvString get_vcal(const WvTnef &tnef, bool task);
36 /** Creates a VCard from the relevant MAPI properties
37 * This function executes a series of MAPI queries to get the properties
38 * necessary to generate a VCard
39 * @param tnef The TNEF containing the properties of the VCard.
40 * @return A VCard in a null-terminated string */
41 WvString get_vcard(const WvTnef &tnef);
43 /** Re-writes the MAPI recurrence properties.
44 * Re-writes several MAPI properties based on the recurrence
45 * information given
46 * @param rrule The VCal RRULE string to use (including "RRULE:")
47 * @param exdates The VCal EXDATE strings to use (including "EXDATE;")
48 * (may be NULL)
49 * @param tnef The TNEF in which to rewrite the recurrence
50 * @return Whether or not the properties were updated */
51 bool tnef_rewrite_recur(WvStringParm rrule,
52 WvStringList *exdates, WvTnef &tnef);
54 /** Sets the type of a tnef
55 * Convenience function which takes an item type (IPM Calendar, etc.)
56 * as input and sets the tnef's type to the value
57 * @param tnef The TNEF to be modified
58 * @param date The type, in outlook format
60 void tnef_set_type(WvTnef &tnef, WvStringParm type);
62 /** Sets the uid of a tnef
63 * Convenience function which takes a vcal-style uid
64 * as input and sets the tnef's uid to the value
65 * @param tnef The TNEF to be modified
66 * @param date The type, in outlook format
68 void tnef_set_uid(WvTnef &tnef, WvStringParm uid);
70 /** Sets the start date of a tnef
71 * Convenience function which takes a vcal-style date as
72 * input and sets the start date property in a TNEF to
73 * that value
74 * @param tnef The TNEF to be modified
75 * @param date The date, in vcal format
76 * @param is_recurring Whether the TNEF is recurring or not
78 void tnef_set_dtstart(WvTnef &tnef, WvStringParm date,
79 const bool is_recurring);
80 void tnef_set_dtstart(PropertyKeyTable &table, WvTnef &tnef,
81 WvStringParm date, const bool is_recurring);
83 /** Sets the end date of a tnef
84 * Convenience function which takes a vcal-style date as
85 * input and sets the end date property in a TNEF to
86 * that value
87 * @param tnef The TNEF to be modified
88 * @param date The date, in vcal format
89 * @param is_recurring Whether the TNEF is recurring or not
91 void tnef_set_dtend(WvTnef &tnef, WvStringParm date,
92 const bool is_recurring);
93 void tnef_set_dtend(PropertyKeyTable &table, WvTnef &tnef,
94 WvStringParm date, const bool is_recurring);
96 /** Sets the summary of a tnef
97 * Convenience function which takes a vcal-style summary as
98 * input and sets the summary property in a TNEF to
99 * that value
100 * @param tnef The TNEF to be modified
101 * @param summary The summary, in vcal format
103 void tnef_set_summary(WvTnef &tnef, WvStringParm summary);
104 void tnef_set_summary(PropertyKeyTable &table, WvTnef &tnef,
105 WvStringParm summary);
107 /** Sets the location of a tnef
108 * Convenience function which takes a vcal-style location as
109 * input and sets the location property in a TNEF to
110 * that value
111 * @param tnef The TNEF to be modified
112 * @param location The location, in vcal format
114 void tnef_set_location(WvTnef &tnef, WvStringParm location);
115 void tnef_set_location(PropertyKeyTable &table, WvTnef &tnef,
116 WvStringParm location);
118 /** Sets the description of a tnef
119 * Convenience function which takes a vcal-style description as
120 * input and sets the description property in a TNEF to
121 * that value
122 * @param tnef The TNEF to be modified
123 * @param description The description, in vcal format
125 void tnef_set_description(WvTnef &tnef, WvStringParm description);
126 void tnef_set_description(PropertyKeyTable &table, WvTnef &tnef,
127 WvStringParm description);
129 /** Sets the last modified date of a tnef
130 * Convenience function which takes a vcal-style date as
131 * input and sets the last modified time in a TNEF to
132 * that value
133 * @param tnef The TNEF to be modified
134 * @param date The date, in vcal format
136 void tnef_set_last_modified(WvTnef &tnef, WvStringParm date);
137 void tnef_set_last_modified(PropertyKeyTable &table, WvTnef &tnef,
138 WvStringParm date);
140 /** Sets the free/busy information of a tnef
141 * Convenience function which takes a vcal TRANSP value
142 * and sets the corresponding TNEF property
143 * @param tnef The TNEF to be modified
144 * @param transp The vcal TRANSP string (OPAQUE or TRANSPARENT)
146 void tnef_set_freebusy(WvTnef &tnef, WvStringParm transp);
147 void tnef_set_freebusy(PropertyKeyTable &table, WvTnef &tnef,
148 WvStringParm transp);
150 /** Sets the class of a tnef
151 * Convenience function which takes a vcal CLASS value
152 * and sets the corresponding TNEF property
153 * @param tnef The TNEF to be modified
154 * @param vclass The vcal CLASS string (PUBLIC, PRIVATE or CONFIDENTIAL)
156 void tnef_set_class(WvTnef &tnef, WvStringParm vclass);
157 void tnef_set_class(PropertyKeyTable &table, WvTnef &tnef,
158 WvStringParm vclass);
160 /** Sets the categories of a tnef
161 * Convenience function which takes a list of vcal
162 * categories and sets the corresponding TNEF multivalued property
163 * @param tnef The TNEF to be modified
164 * @param list The list of categories
166 void tnef_set_categories(WvTnef &tnef, WvStringList &list);
167 void tnef_set_categories(PropertyKeyTable &table, WvTnef &tnef,
168 WvStringList &list);
170 /** Sets the duration property of a tnef
171 * Convenience function which takes two time strings in vcal (RFC 2445)
172 * format and computes the duration in minutes between them, and then
173 * sets the MAPI duration property accordingly
174 * @param tnef The TNEF to be modified
175 * @param start The vcal start time
176 * @param end The vcal end time
178 void tnef_set_duration(WvTnef &tnef, WvStringParm start, WvStringParm end);
179 void tnef_set_duration(PropertyKeyTable &table, WvTnef &tnef,
180 WvStringParm start, WvStringParm end);
182 /** Set the allday boolean property of a tnef
183 * Convenience function which takes two time strings in vcal (RFC 2445)
184 * format and determines whether they represent an all-day property, and
185 * then sets the MAPI allday boolean accordingly
186 * @param tnef The TNEF to be modified
187 * @param start The vcal start time
188 * @param end The vcal end time
190 void tnef_set_allday(WvTnef &tnef, WvStringParm start, WvStringParm end);
191 void tnef_set_allday(PropertyKeyTable &table, WvTnef &tnef,
192 WvStringParm start, WvStringParm end);
194 /** Takes a RFC2426 vCard and updates the corresponding properties in a TNEF
195 * @param vcard String representation of the vCard
196 * @prarm tnef The TNEF to update
198 void vcard2tnef(char *vcard, WvTnef &tnef);
200 /** Takes a RFC2445 iCal and updates the corresponding properties in a TNEF
201 * @param vcal String representation of the iCal (VEVENT only is handled atm)
202 * @param tnef The TNEF to update
204 void vcal2tnef(char *vcal, WvTnef &tnef);
206 #endif