2 Stand-alone MAPI testsuite
4 OpenChange Project - mapidump function tests
6 Copyright (C) Brad Hards 2009
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "utils/mapitest/mapitest.h"
23 #include "utils/mapitest/proto.h"
26 \file module_mapidump.c
28 \brief mapidump function tests
30 \note These tests do not show how to use libmapi properly, and should
31 not be used as a programming reference.
35 \details Test dump using mapidump_SPropValue
38 -# Tests the mapidump_SPropValue() function
40 \param mt pointer to the top-level mapitest structure
42 \return true on success, otherwise false
44 \note This currently doesn't check the results are sane, so manual inspection is required
46 _PUBLIC_ bool mapitest_mapidump_spropvalue(struct mapitest *mt)
48 struct SPropValue propvalue;
51 struct StringArray_r mvstr;
54 propvalue.ulPropTag = PR_GENDER; /* enum MAPITAGS */
55 propvalue.dwAlignPad = 0;
56 propvalue.value.i = 3; /* union SPropValue_CTR */
57 mapidump_SPropValue(propvalue, "[sep]");
59 propvalue.ulPropTag = PR_SENSITIVITY; /* enum MAPITAGS */
60 propvalue.dwAlignPad = 0;
61 propvalue.value.l = 68000; /* union SPropValue_CTR */
62 mapidump_SPropValue(propvalue, "[sep]");
64 propvalue.ulPropTag = PR_REPLY_REQUESTED; /* enum MAPITAGS */
65 propvalue.dwAlignPad = 0;
66 propvalue.value.b = 1; /* union SPropValue_CTR */
67 mapidump_SPropValue(propvalue, "[sep]");
69 propvalue.ulPropTag = PidTagMemberId; /* enum MAPITAGS */
70 propvalue.dwAlignPad = 0;
71 propvalue.value.d = 0x3DEADBEEFCAFE124LL; /* union SPropValue_CTR */
72 mapidump_SPropValue(propvalue, "[sep]");
74 propvalue.ulPropTag = PR_SENDER_NAME; /* enum MAPITAGS */
75 propvalue.dwAlignPad = 0;
76 propvalue.value.lpszA = "Mr. The Sender"; /* union SPropValue_CTR */
77 mapidump_SPropValue(propvalue, "[sep]");
79 propvalue.ulPropTag = PR_REPORT_TAG; /* enum MAPITAGS */
80 propvalue.dwAlignPad = 0;
82 bin.lpb = talloc_array(mt->mem_ctx, uint8_t, bin.cb);
83 for (i = 0; i < bin.cb; ++i) {
84 bin.lpb[i] = 0xF0 + i;
86 propvalue.value.bin = bin; /* union SPropValue_CTR */
87 mapidump_SPropValue(propvalue, "[sep]");
89 propvalue.ulPropTag = PidTagOriginalDeliveryTime ; /* enum MAPITAGS */
90 propvalue.dwAlignPad = 0;
91 ft.dwLowDateTime = 0x12345678;
92 ft.dwHighDateTime = 0x01CA6AE4;
93 propvalue.value.ft = ft; /* union SPropValue_CTR */
94 mapidump_SPropValue(propvalue, "[sep]");
96 propvalue.ulPropTag = PR_REPLY_TIME_ERROR; /* enum MAPITAGS */
97 propvalue.dwAlignPad = 0;
98 propvalue.value.err = MAPI_E_UNKNOWN_CPID; /* union SPropValue_CTR */
99 mapidump_SPropValue(propvalue, "[sep]");
101 propvalue.ulPropTag = PidTagScheduleInfoDelegateNames;
102 propvalue.dwAlignPad = 0;
104 mvstr.lppszA = talloc_array(mt->mem_ctx, const char *, mvstr.cValues);
105 mvstr.lppszA[0] = talloc_strdup(mt->mem_ctx, "Foo");
106 mvstr.lppszA[1] = talloc_strdup(mt->mem_ctx, "A longer string");
107 mvstr.lppszA[2] = talloc_strdup(mt->mem_ctx, "All strung out on bugs");
109 propvalue.value.MVszA = mvstr;
110 mapidump_SPropValue(propvalue, "[sep]");
114 // int64_t dbl;/* [case(0x0005)] */
115 // const char *lpszW;/* [unique,charset(UTF16),case(0x001f)] */
116 // struct FlatUID_r *lpguid;/* [unique,case(0x0048)] */
117 // struct ShortArray_r MVi;/* [case(0x1002)] */
118 // struct LongArray_r MVl;/* [case(0x1003)] */
119 // struct BinaryArray_r MVbin;/* [case(0x1102)] */
120 // struct FlatUIDArray_r MVguid;/* [case(0x1048)] */
121 // struct StringArrayW_r MVszW;/* [case(0x101f)] */
122 // struct DateTimeArray_r MVft;/* [case(0x1040)] */
123 // uint32_t object;/* [case(0x000d)] */
126 propvalue.ulPropTag = 0xDDDD << 16 | PT_LONG; /* This isn't a real tag, just a test case */
127 propvalue.dwAlignPad = 0;
128 propvalue.value.l = 68020;
129 mapidump_SPropValue(propvalue, "[sep]");
135 \details Test dump using mapidump_SPropTagArray
138 -# Tests the mapidump_SPropTagArray() function
140 \param mt pointer to the top-level mapitest structure
142 \return true on success, otherwise false
144 \note This currently doesn't check the results are sane, so manual inspection is required
146 _PUBLIC_ bool mapitest_mapidump_sproptagarray(struct mapitest *mt)
148 struct SPropTagArray *tagarray;
150 tagarray = set_SPropTagArray(mt->mem_ctx, 5, PR_SENDER_NAME,
152 PR_PERSONAL_HOME_PAGE,
153 PR_OTHER_ADDRESS_CITY,
154 (0xDDDD << 16 | PT_LONG));
156 mapidump_SPropTagArray(tagarray);
162 \details Test dump using mapidump_SRowSet
165 -# Tests the mapidump_SRowSet() function
166 -# Indirectly tests the mapidump_SRow() function
168 \param mt pointer to the top-level mapitest structure
170 \return true on success, otherwise false
172 \note This currently doesn't check the results are sane, so manual inspection is required
174 _PUBLIC_ bool mapitest_mapidump_srowset(struct mapitest *mt)
176 struct SRowSet srowset;
178 struct SPropValue SPropValue;
181 srowset.aRow = talloc_array(mt->mem_ctx, struct SRow, srowset.cRows);
183 srowset.aRow[0].cValues = 0;
184 srowset.aRow[0].lpProps = talloc_zero(mt->mem_ctx, struct SPropValue);
186 SPropValue.ulPropTag = PR_OBJECT_TYPE;
187 SPropValue.value.l = MAPI_MAILUSER;
188 SRow_addprop(&(srowset.aRow[0]), SPropValue);
190 SPropValue.ulPropTag = PR_DISPLAY_TYPE;
191 SPropValue.value.l = 0;
192 SRow_addprop(&(srowset.aRow[0]), SPropValue);
194 SPropValue.ulPropTag = PR_GIVEN_NAME;
195 SPropValue.value.lpszA = "gname";
196 SRow_addprop(&(srowset.aRow[0]), SPropValue);
198 srowset.aRow[1].cValues = 0;
199 srowset.aRow[1].lpProps = talloc_zero(mt->mem_ctx, struct SPropValue);
200 SPropValue.ulPropTag = PR_GIVEN_NAME;
201 SPropValue.value.lpszA = "kname";
202 SRow_addprop(&(srowset.aRow[1]), SPropValue);
204 SPropValue.ulPropTag = PR_7BIT_DISPLAY_NAME;
205 SPropValue.value.lpszA = "lname";
206 SRow_addprop(&(srowset.aRow[1]), SPropValue);
208 mapidump_SRowSet(&srowset, "[sep]");
214 \details Test dump using mapidump_pabentry
217 -# Tests the mapidump_PAB_entry() function
219 \param mt pointer to the top-level mapitest structure
221 \return true on success, otherwise false
223 \note This currently doesn't check the results are sane, so manual inspection is required
225 _PUBLIC_ bool mapitest_mapidump_pabentry(struct mapitest *mt)
227 struct SRow pabentry;
228 struct SPropValue SPropValue;
230 pabentry.cValues = 0;
231 pabentry.lpProps = talloc_zero(mt->mem_ctx, struct SPropValue);
233 SPropValue.ulPropTag = PR_ADDRTYPE_UNICODE;
234 SPropValue.value.lpszA = "dummy addrtype";
235 SRow_addprop(&(pabentry), SPropValue);
237 SPropValue.ulPropTag = PR_DISPLAY_NAME_UNICODE;
238 SPropValue.value.lpszA = "dummy display name";
239 SRow_addprop(&(pabentry), SPropValue);
241 SPropValue.ulPropTag = PR_EMAIL_ADDRESS_UNICODE;
242 SPropValue.value.lpszA = "dummy@example.com";
243 SRow_addprop(&(pabentry), SPropValue);
245 SPropValue.ulPropTag = PR_ACCOUNT_UNICODE;
246 SPropValue.value.lpszA = "dummy account";
247 SRow_addprop(&(pabentry), SPropValue);
249 mapidump_PAB_entry(&pabentry);
255 \details Test dump using mapidump_note
258 -# Tests the mapidump_note() function on a plain text message
259 -# Tests the mapidump_note() function on a HTML message
261 \param mt pointer to the top-level mapitest structure
263 \return true on success, otherwise false
265 \note This currently doesn't check the results are sane, so manual inspection is required
267 _PUBLIC_ bool mapitest_mapidump_note(struct mapitest *mt)
269 struct mapi_SPropValue_array props;
272 props.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, props.cValues);
274 props.lpProps[0].ulPropTag = PR_CONVERSATION_TOPIC;
275 props.lpProps[0].value.lpszA = "Topic of the Note";
277 props.lpProps[1].ulPropTag = PR_BODY;
278 props.lpProps[1].value.lpszA = "This is the body of the note. It has two sentences.";
280 props.lpProps[2].ulPropTag = PR_CLIENT_SUBMIT_TIME;
281 props.lpProps[2].value.ft.dwLowDateTime = 0x12345678;
282 props.lpProps[2].value.ft.dwHighDateTime = 0x01CA6BE4;
284 mapidump_note(&props, "[dummy ID]");
286 props.lpProps[1].ulPropTag = PR_BODY_HTML;
287 props.lpProps[1].value.lpszA = "<h1>Heading for the Note</h1>\n<p>This is the body of the note. It has two sentences.</p>";
289 mapidump_note(&props, "[dummy ID]");
296 \details Test dump using mapidump_task
299 -# Tests the mapidump_task() function
300 -# modifies the task to be completed
301 -# Tests the associated get_importance() function
302 -# Tests the associated get_task_status() function
304 \param mt pointer to the top-level mapitest structure
306 \return true on success, otherwise false
308 \note This currently doesn't check the results are sane, so manual inspection is required
310 _PUBLIC_ bool mapitest_mapidump_task(struct mapitest *mt)
312 struct mapi_SPropValue_array props;
315 props.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, props.cValues);
317 props.lpProps[0].ulPropTag = PR_CONVERSATION_TOPIC;
318 props.lpProps[0].value.lpszA = "Topic of the Task";
320 props.lpProps[1].ulPropTag = PR_BODY;
321 props.lpProps[1].value.lpszA = "This is the body of the task. It has two sentences.";
323 props.lpProps[2].ulPropTag = PidLidTaskDueDate;
324 props.lpProps[2].value.ft.dwLowDateTime = 0x12345678;
325 props.lpProps[2].value.ft.dwHighDateTime = 0x01CA6CE4;
327 props.lpProps[3].ulPropTag = PidLidPrivate;
328 props.lpProps[3].value.b = 0;
330 props.lpProps[4].ulPropTag = PR_IMPORTANCE;
331 props.lpProps[4].value.l = IMPORTANCE_HIGH;
333 props.lpProps[5].ulPropTag = PidLidPercentComplete;
334 props.lpProps[5].value.dbl = 0.78;
336 props.lpProps[6].ulPropTag = PidLidTaskStartDate;
337 props.lpProps[6].value.ft.dwLowDateTime = 0x09876543;
338 props.lpProps[6].value.ft.dwHighDateTime = 0x01CA6AE4;
340 props.lpProps[7].ulPropTag = PidLidTaskStatus;
341 props.lpProps[7].value.l = olTaskWaiting;
343 props.lpProps[8].ulPropTag = PidLidContacts;
344 props.lpProps[8].value.MVszA.cValues = 2;
345 props.lpProps[8].value.MVszA.strings = talloc_array(mt->mem_ctx, struct mapi_LPSTR, 2);
346 props.lpProps[8].value.MVszA.strings[0].lppszA = "Contact One";
347 props.lpProps[8].value.MVszA.strings[1].lppszA = "Contact Two Jr.";
349 mapidump_task(&props, "[dummy ID]");
351 props.lpProps[7].ulPropTag = PidLidTaskStatus;
352 props.lpProps[7].value.l = olTaskComplete;
354 props.lpProps[3].ulPropTag = PidLidTaskDateCompleted;
355 props.lpProps[3].value.ft.dwLowDateTime = 0x22345678;
356 props.lpProps[3].value.ft.dwHighDateTime = 0x01CA6CB4;
358 mapidump_task(&props, "[dummy ID]");
360 if (strcmp("Low", get_importance(IMPORTANCE_LOW)) != 0) {
361 mapitest_print(mt, "* %-40s: bad result IMPORTANCE_LOW\n", "mapidump_task");
364 if (strcmp("Normal", get_importance(IMPORTANCE_NORMAL)) != 0) {
365 mapitest_print(mt, "* %-40s: bad result IMPORTANCE_NORMAL\n", "mapidump_task");
368 if (strcmp("High", get_importance(IMPORTANCE_HIGH)) != 0) {
369 mapitest_print(mt, "* %-40s: bad result IMPORTANCE_HIGH\n", "mapidump_task");
372 if (get_importance(IMPORTANCE_HIGH+1) != 0) {
373 mapitest_print(mt, "* %-40s: bad result OUT_OF_RANGE\n", "mapidump_task");
377 if (strcmp("Not Started", get_task_status(olTaskNotStarted)) != 0) {
378 mapitest_print(mt, "* %-40s: bad result olTaskNotStarted\n", "mapidump_task");
381 if (strcmp("In Progress", get_task_status(olTaskInProgress)) != 0) {
382 mapitest_print(mt, "* %-40s: bad result olTaskInProgress\n", "mapidump_task");
385 if (strcmp("Completed", get_task_status(olTaskComplete)) != 0) {
386 mapitest_print(mt, "* %-40s: bad result olTaskCompleted\n", "mapidump_task");
389 if (strcmp("Waiting on someone else", get_task_status(olTaskWaiting)) != 0) {
390 mapitest_print(mt, "* %-40s: bad result olTaskWaiting\n", "mapidump_task");
393 if (strcmp("Deferred", get_task_status(olTaskDeferred)) != 0) {
394 mapitest_print(mt, "* %-40s: bad result olTaskDeferred\n", "mapidump_task");
397 if (get_task_status(olTaskDeferred+1) != 0) {
398 mapitest_print(mt, "* %-40s: bad result OUT_OF_RANGE\n", "mapidump_task");
405 \details Test dump using mapidump_contact
408 -# Tests the mapidump_contact() function
410 \param mt pointer to the top-level mapitest structure
412 \return true on success, otherwise false
414 \note This currently doesn't check the results are sane, so manual inspection is required
416 _PUBLIC_ bool mapitest_mapidump_contact(struct mapitest *mt)
418 struct mapi_SPropValue_array props;
421 props.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, props.cValues);
423 props.lpProps[0].ulPropTag = PR_POSTAL_ADDRESS;
424 props.lpProps[0].value.lpszA = "P.O. Box 543, KTown";
426 props.lpProps[1].ulPropTag = PR_STREET_ADDRESS;
427 props.lpProps[1].value.lpszA = "1 My Street, KTown";
429 props.lpProps[2].ulPropTag = PR_COMPANY_NAME;
430 props.lpProps[2].value.lpszA = "Dummy Company Pty Ltd";
432 props.lpProps[3].ulPropTag = PR_TITLE;
433 props.lpProps[3].value.lpszA = "Ms.";
435 props.lpProps[4].ulPropTag = PR_COUNTRY;
436 props.lpProps[4].value.lpszA = "Australia";
438 props.lpProps[5].ulPropTag = PR_GIVEN_NAME;
439 props.lpProps[5].value.lpszA = "Konq.";
441 props.lpProps[6].ulPropTag = PR_SURNAME;
442 props.lpProps[6].value.lpszA = "Dragoon";
444 props.lpProps[7].ulPropTag = PR_DEPARTMENT_NAME;
445 props.lpProps[7].value.lpszA = "Research and Marketing";
447 mapidump_contact(&props, "[dummy ID]");
449 props.lpProps[1].ulPropTag = PR_CONVERSATION_TOPIC;
450 props.lpProps[1].value.lpszA = "Contact Topic";
452 mapidump_contact(&props, "[dummy ID]");
454 props.lpProps[0].ulPropTag = PidLidFileUnder;
455 props.lpProps[0].value.lpszA = "Card Label";
457 props.lpProps[4].ulPropTag = PR_DISPLAY_NAME;
458 props.lpProps[4].value.lpszA = "Konqi Dragon";
460 mapidump_contact(&props, "[dummy ID]");
466 \details Test message dump using mapidump_appointment
469 -# Tests the mapidump_appointment() function
471 \param mt pointer to the top-level mapitest structure
473 \return true on success, otherwise false
475 \note This currently doesn't check the results are sane, so manual inspection is required
477 _PUBLIC_ bool mapitest_mapidump_appointment(struct mapitest *mt)
479 struct mapi_SPropValue_array props;
482 props.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, props.cValues);
484 props.lpProps[0].ulPropTag = PidLidContacts;
485 props.lpProps[0].value.MVszA.cValues = 2;
486 props.lpProps[0].value.MVszA.strings = talloc_array(mt->mem_ctx, struct mapi_LPSTR, 2);
487 props.lpProps[0].value.MVszA.strings[0].lppszA = "Contact One";
488 props.lpProps[0].value.MVszA.strings[1].lppszA = "Contact Two Jr.";
490 props.lpProps[1].ulPropTag = PR_CONVERSATION_TOPIC;
491 props.lpProps[1].value.lpszA = "Dummy Appointment topic";
493 props.lpProps[2].ulPropTag = PidLidTimeZoneDescription;
494 props.lpProps[2].value.lpszA = "AEDT";
496 props.lpProps[3].ulPropTag = PidLidLocation;
497 props.lpProps[3].value.lpszA = "OpenChange Conference Room #3";
499 props.lpProps[4].ulPropTag = PidLidBusyStatus;
500 props.lpProps[4].value.l = olTaskNotStarted;
502 props.lpProps[5].ulPropTag = PidLidPrivate;
503 props.lpProps[5].ulPropTag = true;
505 props.lpProps[6].ulPropTag = PR_END_DATE;
506 props.lpProps[6].value.ft.dwLowDateTime = 0x12345678;
507 props.lpProps[6].value.ft.dwHighDateTime = 0x01CA6CE4;
509 props.lpProps[7].ulPropTag = PR_START_DATE;
510 props.lpProps[7].value.ft.dwLowDateTime = 0x09876543;
511 props.lpProps[7].value.ft.dwHighDateTime = 0x01CA6AE4;
513 mapidump_appointment(&props, "[dummy ID]");
519 \details Test dump of an email message using mapidump_message
522 -# Builds an indicative email using mapi_SPropValues (sets no codepage)
523 -# Calls the mapidump_appointment() function
525 \param mt pointer to the top-level mapitest structure
527 \return true on success, otherwise false
529 \note This currently doesn't check the results are sane, so manual inspection is required
531 _PUBLIC_ bool mapitest_mapidump_message(struct mapitest *mt)
533 struct mapi_SPropValue_array props;
536 props.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, props.cValues);
538 props.lpProps[0].ulPropTag = PR_INTERNET_MESSAGE_ID;
539 props.lpProps[0].value.lpszA = "dummy-3535395fds@example.com";
541 props.lpProps[1].ulPropTag = PR_CONVERSATION_TOPIC;
542 props.lpProps[1].value.lpszA = "Dummy Email Subject";
544 props.lpProps[2].ulPropTag = PR_BODY;
545 props.lpProps[2].value.lpszA = "This is the body of the email. It has two sentences.\n";
547 props.lpProps[3].ulPropTag = PR_SENT_REPRESENTING_NAME;
548 props.lpProps[3].value.lpszA = "The Sender <sender@example.com>";
550 props.lpProps[4].ulPropTag = PR_DISPLAY_TO;
551 props.lpProps[4].value.lpszA = "The Recipient <to@example.com>";
553 props.lpProps[5].ulPropTag = PR_DISPLAY_CC;
554 props.lpProps[5].value.lpszA = "Other Recipient <cc@example.com>";
556 props.lpProps[6].ulPropTag = PR_DISPLAY_BCC;
557 props.lpProps[6].value.lpszA = "Ms. Anonymous <bcc@example.com>";
559 props.lpProps[7].ulPropTag = PidTagPriority;
560 props.lpProps[7].value.l = 0;
562 props.lpProps[8].ulPropTag = PR_HASATTACH;
563 props.lpProps[8].value.b = false;
565 mapidump_message(&props, "[dummy ID]", NULL);
567 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
568 props.lpProps[7].value.l = CP_USASCII;
570 mapidump_message(&props, "[dummy ID]", NULL);
572 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
573 props.lpProps[7].value.l = CP_UNICODE;
575 mapidump_message(&props, "[dummy ID]", NULL);
577 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
578 props.lpProps[7].value.l = CP_JAUTODETECT;
580 mapidump_message(&props, "[dummy ID]", NULL);
582 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
583 props.lpProps[7].value.l = CP_KAUTODETECT;
585 mapidump_message(&props, "[dummy ID]", NULL);
587 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
588 props.lpProps[7].value.l = CP_ISO2022JPESC;
590 mapidump_message(&props, "[dummy ID]", NULL);
592 props.lpProps[7].ulPropTag = PR_MESSAGE_CODEPAGE;
593 props.lpProps[7].value.l = CP_ISO2022JPSIO;
595 mapidump_message(&props, "[dummy ID]", NULL);
601 \details Test dump of an new mail notification
604 -# Tests the mapidump_msgflags function with no bits set
605 -# Tests the mapidump_msgflags function with one bit set
606 -# Tests the mapidump_msgflags function with all bits set
607 -# Builds an indicative new mail notification
608 -# Calls the mapidump_newmail function to test dumping of that new mail notification
610 \param mt pointer to the top-level mapitest structure
612 \return true on success, otherwise false
614 \note This currently doesn't check the results are sane, so manual inspection is required
616 _PUBLIC_ bool mapitest_mapidump_newmail(struct mapitest *mt)
618 struct NewMailNotification notif;
620 mapidump_msgflags(0x0, "[sep]");
622 mapidump_msgflags(0x100, "[sep]");
624 mapidump_msgflags(0x1|0x2|0x4|0x8|0x10|0x20|0x40|0x80|0x100|0x200, "[sep]");
626 notif.FID = 0xFEDCBA9876543210LL;
627 notif.MID = 0xBADCAFEBEEF87625LL;
628 notif.MessageFlags = 0x20|0x2;
629 notif.UnicodeFlag = false;
630 notif.MessageClass.lpszA = "Dummy class";
632 mapidump_newmail(¬if, "[sep]");
638 \details Test dump of a free/busy event
641 -# builds a freebusy binary event
642 -# tests dumping it using mapidump_freebusy_event()
643 -# modifies the event, and dumps it again
644 -# modifies the event, and dumps it again
645 -# tests dumping a date using mapidump_freebusy_date()
646 -# tests each months for mapidump_freebusy_month()
648 \param mt pointer to the top-level mapitest structure
650 \return true on success, otherwise false
652 \note This currently doesn't check the results are sane, so manual inspection is required
654 _PUBLIC_ bool mapitest_mapidump_freebusy(struct mapitest *mt)
659 bin.lpb = talloc_array(mt->mem_ctx, uint8_t, bin.cb);
660 /* this example from MS-OXOPFFB Section 4.4.3 */
666 mapidump_freebusy_event(&bin, 2009*16+11, 2008, "[sep]");
668 /* this example adapted from MS-OXOPFFB Section 4.4.3 */
674 mapidump_freebusy_event(&bin, 2009*16+11, 2009, "[sep]");
676 /* this example adapted from MS-OXOPFFB Section 4.4.3 */
682 mapidump_freebusy_event(&bin, 2009*16+11, 2009, "[sep]");
684 mapidump_freebusy_date(0x0CD18345, "[sep]");
686 if (strcmp("January", mapidump_freebusy_month(2009*16+1, 2009)) != 0) {
687 mapitest_print(mt, "* %-40s: bad result January\n", "mapidump_freebusy");
690 if (strcmp("February", mapidump_freebusy_month(2009*16+2, 2009)) != 0) {
691 mapitest_print(mt, "* %-40s: bad result February\n", "mapidump_freebusy");
694 if (strcmp("March", mapidump_freebusy_month(2009*16+3, 2009)) != 0) {
695 mapitest_print(mt, "* %-40s: bad result March\n", "mapidump_freebusy");
698 if (strcmp("April", mapidump_freebusy_month(2009*16+4, 2009)) != 0) {
699 mapitest_print(mt, "* %-40s: bad result April\n", "mapidump_freebusy");
702 if (strcmp("May", mapidump_freebusy_month(2009*16+5, 2009)) != 0) {
703 mapitest_print(mt, "* %-40s: bad result May\n", "mapidump_freebusy");
706 if (strcmp("June", mapidump_freebusy_month(2009*16+6, 2009)) != 0) {
707 mapitest_print(mt, "* %-40s: bad result June\n", "mapidump_freebusy");
710 if (strcmp("July", mapidump_freebusy_month(2009*16+7, 2009)) != 0) {
711 mapitest_print(mt, "* %-40s: bad result July\n", "mapidump_freebusy");
714 if (strcmp("August", mapidump_freebusy_month(2009*16+8, 2009)) != 0) {
715 mapitest_print(mt, "* %-40s: bad result August\n", "mapidump_freebusy");
718 if (strcmp("September", mapidump_freebusy_month(2009*16+9, 2009)) != 0) {
719 mapitest_print(mt, "* %-40s: bad result September\n", "mapidump_freebusy");
722 if (strcmp("October", mapidump_freebusy_month(2009*16+10, 2009)) != 0) {
723 mapitest_print(mt, "* %-40s: bad result October\n", "mapidump_freebusy");
726 if (strcmp("November", mapidump_freebusy_month(2009*16+11, 2009)) != 0) {
727 mapitest_print(mt, "* %-40s: bad result November\n", "mapidump_freebusy");
730 if (strcmp("December", mapidump_freebusy_month(2009*16+12, 2009)) != 0) {
731 mapitest_print(mt, "* %-40s: bad result December\n", "mapidump_freebusy");
734 if (mapidump_freebusy_month(2009*16+0, 2009) != 0) {
735 mapitest_print(mt, "* %-40s: bad result underrange\n", "mapidump_freebusy");
738 if (mapidump_freebusy_month(2009*16+13, 2009) != 0) {
739 mapitest_print(mt, "* %-40s: bad result overrange\n", "mapidump_freebusy");
746 \details Test dump of a set of recipients
749 -# builds a recipient list
750 -# dumps out the recipient list using mapidump_Recipients()
752 \param mt pointer to the top-level mapitest structure
754 \return true on success, otherwise false
756 \note This currently doesn't check the results are sane, so manual inspection is required
758 _PUBLIC_ bool mapitest_mapidump_recipients(struct mapitest *mt)
760 const char **userlist;
761 struct SRowSet resolved;
762 struct PropertyTagArray_r flaglist;
763 struct SPropValue SPropValue;
765 userlist = talloc_array(mt->mem_ctx, const char*, 3);
766 userlist[0] = "Mr. Unresolved";
767 userlist[1] = "Mr/Ms. Ambiguous";
768 userlist[2] = "Mrs. Resolved";
771 resolved.aRow = talloc_array(mt->mem_ctx, struct SRow, resolved.cRows);
772 resolved.aRow[0].cValues = 0;
773 resolved.aRow[0].lpProps = talloc_zero(mt->mem_ctx, struct SPropValue);
774 SPropValue.ulPropTag = PR_OBJECT_TYPE;
775 SPropValue.value.l = MAPI_MAILUSER;
776 SRow_addprop(&(resolved.aRow[0]), SPropValue);
778 SPropValue.ulPropTag = PR_GIVEN_NAME;
779 SPropValue.value.lpszA = "gname";
780 SRow_addprop(&(resolved.aRow[0]), SPropValue);
782 flaglist.cValues = 3;
783 flaglist.aulPropTag = talloc_zero_array(mt->mem_ctx, uint32_t, flaglist.cValues);
784 flaglist.aulPropTag[0] = MAPI_UNRESOLVED;
785 flaglist.aulPropTag[1] = MAPI_AMBIGUOUS;
786 flaglist.aulPropTag[2] = MAPI_RESOLVED;
788 mapidump_Recipients(userlist, &resolved, &flaglist);
790 talloc_free(flaglist.aulPropTag);
796 \details Test dump of a Folder deletion notification
799 -# Creates a FolderDeletedNotification structure
800 -# Dumps that structure out using mapidump_folderdeleted()
801 -# Tests mapidump_folderdeleted() with a null argument
803 \param mt pointer to the top-level mapitest structure
805 \return true on success, otherwise false
807 \note This currently doesn't check the results are sane, so manual inspection is required
809 _PUBLIC_ bool mapitest_mapidump_folderdeleted(struct mapitest *mt)
811 struct FolderDeletedNotification folderdeletednotification;
813 folderdeletednotification.ParentFID = 0x9876CAFE432LL;
814 folderdeletednotification.FID = 0x1234ABCDLL;
815 mapidump_folderdeleted(&folderdeletednotification, "[sep]");
817 mapidump_folderdeleted(0, "[sep]");
823 \details Test dump of a folder move notification
826 -# Creates a FolderMoveCopyNotification structure
827 -# Dumps that structure out using mapidump_foldermoved()
828 -# Tests mapidump_foldermoved() with a null argument
830 \param mt pointer to the top-level mapitest structure
832 \return true on success, otherwise false
834 \note This currently doesn't check the results are sane, so manual inspection is required
836 _PUBLIC_ bool mapitest_mapidump_foldermoved(struct mapitest *mt)
838 struct FolderMoveCopyNotification foldermovecopynotification;
840 foldermovecopynotification.ParentFID = 0x9876CAFE432LL;
841 foldermovecopynotification.FID = 0x1234ABCDLL;
842 foldermovecopynotification.OldParentFID = 0x9876CAFE43201DLL;
843 foldermovecopynotification.OldFID = 0x1234ABCD01DLL;
844 mapidump_foldermoved(&foldermovecopynotification, "[sep]");
846 mapidump_foldermoved(0, "[sep]");
852 \details Test dump of a folder copy notification
855 -# Creates a FolderMoveCopyNotification structure
856 -# Dumps that structure out using mapidump_foldercopy()
857 -# Tests mapidump_foldercopy() with a null argument
859 \param mt pointer to the top-level mapitest structure
861 \return true on success, otherwise false
863 \note This currently doesn't check the results are sane, so manual inspection is required
865 _PUBLIC_ bool mapitest_mapidump_foldercopied(struct mapitest *mt)
867 struct FolderMoveCopyNotification foldermovecopynotification;
869 foldermovecopynotification.ParentFID = 0x9876CAFE432LL;
870 foldermovecopynotification.FID = 0x1234ABCDLL;
871 foldermovecopynotification.OldParentFID = 0x9876CAFE43201DLL;
872 foldermovecopynotification.OldFID = 0x1234ABCD01DLL;
873 mapidump_foldercopied(&foldermovecopynotification, "[sep]");
875 mapidump_foldercopied(0, "[sep]");
881 \details Test dump of a Folder creation notification
884 -# Creates a FolderCreatedNotification structure with a null tag set
885 -# Dumps that structure out using mapidump_foldercreated()
886 -# Adds a set of tags to the FolderCreatedNotification
887 -# Dumps the modified FolderCreatedNotification structure using mapidump_foldercreated()
888 -# Tests mapidump_foldercreated() with a null argument
890 \param mt pointer to the top-level mapitest structure
892 \return true on success, otherwise false
894 \note This currently doesn't check the results are sane, so manual inspection is required
896 _PUBLIC_ bool mapitest_mapidump_foldercreated(struct mapitest *mt)
898 struct FolderCreatedNotification foldercreatednotification;
900 foldercreatednotification.ParentFID = 0x9876CAFE432LL;
901 foldercreatednotification.FID = 0x1234ABCDLL;
902 foldercreatednotification.NotificationTags.Tags = 0;
903 foldercreatednotification.TagCount = 0;
904 mapidump_foldercreated(&foldercreatednotification, "[sep]");
906 foldercreatednotification.TagCount = 3;
907 foldercreatednotification.NotificationTags.Tags = talloc_array(mt->mem_ctx, enum MAPITAGS,
908 foldercreatednotification.TagCount);
909 foldercreatednotification.NotificationTags.Tags[0] = PidTagTemplateData;
910 foldercreatednotification.NotificationTags.Tags[1] = PR_URL_COMP_NAME;
911 foldercreatednotification.NotificationTags.Tags[2] = PidTagEndAttach;
913 mapidump_foldercreated(&foldercreatednotification, "[sep]");
915 mapidump_foldercreated(0, "[sep]");
921 \details Test dump of a Message deletion notification
924 -# Creates a MessageDeletedNotification structure
925 -# Dumps that structure out using mapidump_messagedeleted()
926 -# Tests mapidump_messagedeleted() with a null argument
928 \param mt pointer to the top-level mapitest structure
930 \return true on success, otherwise false
932 \note This currently doesn't check the results are sane, so manual inspection is required
934 _PUBLIC_ bool mapitest_mapidump_messagedeleted(struct mapitest *mt)
936 struct MessageDeletedNotification messagedeletednotification;
938 messagedeletednotification.FID = 0x1234ABCDLL;
939 messagedeletednotification.MID = 0x9876FEALL;
940 mapidump_messagedeleted(&messagedeletednotification, "[sep]");
942 mapidump_messagedeleted(0, "[sep]");
948 \details Test dump of a Message creation notification
951 -# Creates a MessageCreatedNotification structure
952 -# Dumps that structure out using mapidump_messagecreated()
953 -# Adds tags to the MessageCreatedNotification structure
954 -# Dumps the structure again.
955 -# Tests mapidump_messagecreated() with a null argument
957 \param mt pointer to the top-level mapitest structure
959 \return true on success, otherwise false
961 \note This currently doesn't check the results are sane, so manual inspection is required
963 _PUBLIC_ bool mapitest_mapidump_messagecreated(struct mapitest *mt)
965 struct MessageCreatedNotification messagecreatednotification;
967 messagecreatednotification.FID = 0x1234ABCDLL;
968 messagecreatednotification.MID = 0x9876FEALL;
969 messagecreatednotification.NotificationTags.Tags = 0;
970 messagecreatednotification.TagCount = 0;
971 mapidump_messagecreated(&messagecreatednotification, "[sep]");
973 messagecreatednotification.TagCount = 3;
974 messagecreatednotification.NotificationTags.Tags = talloc_array(mt->mem_ctx, enum MAPITAGS,
975 messagecreatednotification.TagCount);
976 messagecreatednotification.NotificationTags.Tags[0] = PR_DISPLAY_NAME;
977 messagecreatednotification.NotificationTags.Tags[1] = PR_DISPLAY_NAME_UNICODE;
978 messagecreatednotification.NotificationTags.Tags[2] = PR_COMPANY_NAME;
980 mapidump_messagecreated(0, "[sep]");
986 \details Test dump of a Message moved notification
989 -# Creates a MessageMovedNotification structure
990 -# Dumps that structure out using mapidump_messagemoved()
991 -# Tests mapidump_messagemoved() with a null argument
993 \param mt pointer to the top-level mapitest structure
995 \return true on success, otherwise false
997 \note This currently doesn't check the results are sane, so manual inspection is required
999 _PUBLIC_ bool mapitest_mapidump_messagemoved(struct mapitest *mt)
1001 struct MessageMoveCopyNotification messagemovednotification;
1003 messagemovednotification.FID = 0x1234ABCDLL;
1004 messagemovednotification.MID = 0x9876FEALL;
1005 messagemovednotification.OldFID = 0x1234ABCD01dLL;
1006 messagemovednotification.OldMID = 0x9876FEA01dLL;
1007 mapidump_messagemoved(&messagemovednotification, "[sep]");
1009 mapidump_messagemoved(0, "[sep]");
1016 \details Test dump of a Message copied notification
1019 -# Creates a MessageCopiedNotification structure
1020 -# Dumps that structure out using mapidump_messagecopied()
1021 -# Tests mapidump_messagecopied() with a null argument
1023 \param mt pointer to the top-level mapitest structure
1025 \return true on success, otherwise false
1027 \note This currently doesn't check the results are sane, so manual inspection is required
1029 _PUBLIC_ bool mapitest_mapidump_messagecopied(struct mapitest *mt)
1031 struct MessageMoveCopyNotification messagecopiednotification;
1033 messagecopiednotification.FID = 0x1234ABCDLL;
1034 messagecopiednotification.MID = 0x9876FEALL;
1035 messagecopiednotification.OldFID = 0x1234ABCD01dLL;
1036 messagecopiednotification.OldMID = 0x9876FEA01dLL;
1037 mapidump_messagecopied(&messagecopiednotification, "[sep]");
1039 mapidump_messagecopied(0, "[sep]");
1045 \details Test dump of a Message modification notification
1048 -# Creates a MessageModifiedNotification structure
1049 -# Dumps that structure out using mapidump_messagemodified()
1050 -# Adds tags to the MessageModifiedNotification structure
1051 -# Dumps the structure again.
1052 -# Tests mapidump_messagemodified() with a null argument
1054 \param mt pointer to the top-level mapitest structure
1056 \return true on success, otherwise false
1058 \note This currently doesn't check the results are sane, so manual inspection is required
1060 _PUBLIC_ bool mapitest_mapidump_messagemodified(struct mapitest *mt)
1062 struct MessageModifiedNotification messagemodifiednotification;
1064 messagemodifiednotification.FID = 0x1234ABCDLL;
1065 messagemodifiednotification.MID = 0x9876FEALL;
1066 messagemodifiednotification.NotificationTags.Tags = 0;
1067 messagemodifiednotification.TagCount = 0;
1068 mapidump_messagemodified(&messagemodifiednotification, "[sep]");
1070 messagemodifiednotification.TagCount = 3;
1071 messagemodifiednotification.NotificationTags.Tags = talloc_array(mt->mem_ctx, enum MAPITAGS,
1072 messagemodifiednotification.TagCount);
1073 messagemodifiednotification.NotificationTags.Tags[0] = PR_DISPLAY_NAME;
1074 messagemodifiednotification.NotificationTags.Tags[1] = PR_DISPLAY_NAME_UNICODE;
1075 messagemodifiednotification.NotificationTags.Tags[2] = PR_COMPANY_NAME;
1077 mapidump_messagemodified(0, "[sep]");