~ubuntu-branches/debian/experimental/openchange/experimental

« back to all changes in this revision

Viewing changes to mapiproxy/libmapistore/mapistore_interface.c

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij, Mathieu Parent, Jelmer Vernooij
  • Date: 2010-06-19 00:14:54 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100619001454-c9qbwzlbv3rgqrir
Tags: 1:0.9+svn1970-1
[ Mathieu Parent ]
* Add Vcs-Browser
* libmapi-dev depends on libndr-standard-dev.
  Fix "Missing dependency on samba4-dev" (Closes: #549012)

[ Jelmer Vernooij ]
* Use source format version 3.
* Bump standards version to 3.8.4.
* New upstream snapshot.
* Add build dependency on zlib1g-dev. Closes: #577330
* Migrate packaging to Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "mapistore.h"
23
23
#include "mapistore_errors.h"
24
24
#include "mapistore_private.h"
25
 
#include <libmapi/dlinklist.h>
 
25
#include <dlinklist.h>
26
26
 
27
27
#include <string.h>
28
28
 
60
60
        }
61
61
 
62
62
        mstore_ctx->context_list = NULL;
 
63
        mstore_ctx->indexing_list = talloc_zero(mstore_ctx, struct indexing_context_list);
 
64
 
 
65
        mstore_ctx->nprops_ctx = NULL;
 
66
        retval = mapistore_namedprops_init(mstore_ctx, &(mstore_ctx->nprops_ctx));
63
67
 
64
68
        return mstore_ctx;
65
69
}
80
84
{
81
85
        if (!mstore_ctx) return MAPISTORE_ERR_NOT_INITIALIZED;
82
86
 
 
87
        talloc_free(mstore_ctx->nprops_ctx);
83
88
        talloc_free(mstore_ctx->processing_ctx);
84
89
        talloc_free(mstore_ctx->context_list);
85
90
        talloc_free(mstore_ctx);
156
161
 
157
162
 
158
163
/**
 
164
   \details Increase the reference counter of an existing context
 
165
 
 
166
   \param mstore_ctx pointer to the mapistore context
 
167
   \param contex_id the context identifier referencing the context to
 
168
   update
 
169
 
 
170
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE error
 
171
 */
 
172
_PUBLIC_ int mapistore_add_context_ref_count(struct mapistore_context *mstore_ctx,
 
173
                                             uint32_t context_id)
 
174
{
 
175
        struct backend_context          *backend_ctx;
 
176
        int                             retval;
 
177
 
 
178
        /* Sanity checks */
 
179
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
180
 
 
181
        if (context_id == -1) return MAPISTORE_ERROR;
 
182
 
 
183
        /* Step 0. Ensure the context exists */
 
184
        DEBUG(0, ("mapistore_add_context_ref_count: context_is to increment is %d\n", context_id));
 
185
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
186
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
187
 
 
188
        /* Step 1. Increment the ref count */
 
189
        retval = mapistore_backend_add_ref_count(backend_ctx);
 
190
 
 
191
        return retval;
 
192
}
 
193
 
 
194
 
 
195
/**
 
196
   \details Search for an existing context given its uri
 
197
 
 
198
   \param mstore_ctx pointer to the mapistore context
 
199
   \param uri the URI to lookup
 
200
   \param context_id pointer to the context identifier to return
 
201
 
 
202
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE error
 
203
 */
 
204
_PUBLIC_ int mapistore_search_context_by_uri(struct mapistore_context *mstore_ctx,
 
205
                                             const char *uri,
 
206
                                             uint32_t *context_id)
 
207
{
 
208
        struct backend_context          *backend_ctx;
 
209
 
 
210
        /* Sanity checks */
 
211
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
212
 
 
213
        if (!uri) return MAPISTORE_ERROR;
 
214
 
 
215
        backend_ctx = mapistore_backend_lookup_by_uri(mstore_ctx->context_list, uri);
 
216
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_NOT_FOUND, NULL);
 
217
 
 
218
        *context_id = backend_ctx->context_id;
 
219
        return MAPISTORE_SUCCESS;
 
220
}
 
221
 
 
222
 
 
223
/**
159
224
   \details Delete an existing connection context from mapistore
160
225
 
161
226
   \param mstore_ctx pointer to the mapistore context
167
232
_PUBLIC_ int mapistore_del_context(struct mapistore_context *mstore_ctx, 
168
233
                                   uint32_t context_id)
169
234
{
170
 
        struct backend_context_list     *el;
 
235
        struct backend_context_list     *backend_list;
 
236
        struct backend_context          *backend_ctx;
171
237
        int                             retval;
172
238
        bool                            found = false;
173
239
 
174
240
        /* Sanity checks */
175
 
        if (!mstore_ctx) return MAPISTORE_ERR_NOT_INITIALIZED;
176
 
        if (!mstore_ctx->processing_ctx) return MAPISTORE_ERR_NOT_INITIALIZED;
177
 
        if (!mstore_ctx->context_list) return MAPISTORE_ERR_NOT_INITIALIZED;
 
241
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
242
 
 
243
        if (context_id == -1) return MAPISTORE_ERROR;
178
244
 
179
245
        /* Step 0. Ensure the context exists */
180
 
        for (el = mstore_ctx->context_list; el; el = el->next) {
181
 
                if (el->ctx && el->ctx->context_id == context_id) {
 
246
        DEBUG(0, ("mapistore_del_context: context_id to del is %d\n", context_id));
 
247
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
248
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
249
 
 
250
        /* search the backend_list item */
 
251
        for (backend_list = mstore_ctx->context_list; backend_list; backend_list = backend_list->next) {
 
252
                if (backend_list->ctx->context_id == context_id) {
182
253
                        found = true;
183
254
                        break;
184
 
                }
185
 
        }
186
 
        if (found == false) return MAPISTORE_ERR_INVALID_PARAMETER;
 
255
                }               
 
256
        }
 
257
        if (found == false) {
 
258
                return MAPISTORE_ERROR;
 
259
        }
187
260
 
188
261
        /* Step 1. Delete the context within backend */
189
 
        retval = mapistore_backend_delete_context(el->ctx);
190
 
        if (retval) return retval;
191
 
 
192
 
        /* Step 2. Delete the context from the processing layer */
193
 
 
194
 
        /* Step 2. Add the free'd context id to the free list */
195
 
        retval = mapistore_free_context_id(mstore_ctx->processing_ctx, context_id);
 
262
        retval = mapistore_backend_delete_context(backend_ctx);
 
263
        switch (retval) {
 
264
        case MAPISTORE_ERR_REF_COUNT:
 
265
                return MAPISTORE_SUCCESS;
 
266
        case MAPISTORE_SUCCESS:
 
267
                DLIST_REMOVE(mstore_ctx->context_list, backend_list);
 
268
                /* Step 2. Add the free'd context id to the free list */
 
269
                retval = mapistore_free_context_id(mstore_ctx->processing_ctx, context_id);
 
270
                break;
 
271
        default:
 
272
                return retval;
 
273
        }
 
274
 
196
275
        return retval;
197
276
}
198
277
 
199
278
 
200
279
/**
 
280
   \details Release private backend data associated a folder / message
 
281
   opened within the mapistore backend
 
282
 
 
283
   \param mstore_ctx pointer to the mapistore context
 
284
   \param context_id the context identifier referencing the backend
 
285
   \param fmid a folder or message identifier
 
286
   \param type the type of fmid, either MAPISTORE_FOLDER or MAPISTORE_MESSAGE
 
287
 
 
288
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
289
 */
 
290
_PUBLIC_ int mapistore_release_record(struct mapistore_context *mstore_ctx,
 
291
                                      uint32_t context_id,
 
292
                                      uint64_t fmid,
 
293
                                      uint8_t type)
 
294
{
 
295
        struct backend_context          *backend_ctx;
 
296
        int                             ret;
 
297
 
 
298
        /* Sanity checks */
 
299
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
300
 
 
301
        /* Step 1. Search the context */
 
302
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
303
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
304
 
 
305
        /* Step 2. Call backend release_record */
 
306
        ret = mapistore_backend_release_record(backend_ctx, fmid, type);
 
307
 
 
308
        return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
 
309
}
 
310
 
 
311
 
 
312
/**
 
313
   \details Associate an indexing context to a mapistore context
 
314
 
 
315
   \param mstore_ctx pointer to the mapistore context
 
316
   \param username account name referencing the indexing record
 
317
   \param context_id the context identifier referencing the context to
 
318
   alter
 
319
 
 
320
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE error
 
321
 */
 
322
_PUBLIC_ int mapistore_add_context_indexing(struct mapistore_context *mstore_ctx,
 
323
                                            const char *username,
 
324
                                            uint32_t context_id)
 
325
{
 
326
        struct indexing_context_list    *indexing_ctx;
 
327
        struct backend_context          *backend_ctx;
 
328
 
 
329
        /* Sanity checks */
 
330
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
331
        MAPISTORE_RETVAL_IF(!username, MAPISTORE_ERROR, NULL);
 
332
        MAPISTORE_RETVAL_IF(context_id == -1, MAPISTORE_ERROR, NULL);
 
333
 
 
334
        /* Step 0. Ensure the context exists */
 
335
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
336
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
337
        /* If the indexing pointer is already existing, return success */
 
338
        MAPISTORE_RETVAL_IF(backend_ctx->indexing, MAPISTORE_SUCCESS, NULL);
 
339
 
 
340
        /* Step 1. Search the indexing record */
 
341
        indexing_ctx = mapistore_indexing_search(mstore_ctx, username);
 
342
        MAPISTORE_RETVAL_IF(!indexing_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
343
 
 
344
        /* Step 2. Reference the indexing record within backend context */
 
345
        backend_ctx->indexing = indexing_ctx;
 
346
 
 
347
        /* Step 3. Increment the indexing ref counter */
 
348
        mapistore_indexing_add_ref_count(indexing_ctx);
 
349
 
 
350
        DEBUG(0, ("mapistore_add_context_indexing username: %s\n", backend_ctx->indexing->username));
 
351
 
 
352
        return MAPISTORE_SUCCESS;
 
353
}
 
354
 
 
355
 
 
356
void mapistore_set_errno(int status)
 
357
{
 
358
        errno = status;
 
359
}
 
360
 
 
361
 
 
362
/**
201
363
   \details return a string explaining what a mapistore error constant
202
364
   means.
203
365
 
232
394
 
233
395
        return "Unknown error";
234
396
}
 
397
 
 
398
 
 
399
/**
 
400
   \details Open a directory in mapistore
 
401
 
 
402
   \param mstore_ctx pointer to the mapistore context
 
403
   \param context_id the context identifier referencing the backend
 
404
   where the directory will be opened
 
405
   \param parent_fid the parent folder identifier
 
406
   \param fid folder identifier to open
 
407
 
 
408
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
409
 */
 
410
_PUBLIC_ int mapistore_opendir(struct mapistore_context *mstore_ctx,
 
411
                               uint32_t context_id,
 
412
                               uint64_t parent_fid,
 
413
                               uint64_t fid)
 
414
{
 
415
        struct backend_context          *backend_ctx;
 
416
        int                             ret;
 
417
 
 
418
        /* Sanity checks */
 
419
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
420
 
 
421
        /* Step 1. Search the context */
 
422
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
423
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
424
 
 
425
        /* Step 2. Call backend opendir */
 
426
        ret = mapistore_backend_opendir(backend_ctx, parent_fid, fid);
 
427
 
 
428
        return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
 
429
}
 
430
 
 
431
 
 
432
/**
 
433
   \details Close a directory in mapistore
 
434
 
 
435
   \param mstore_ctx pointer to the mapistore context
 
436
   \param context_id the context identifier referencing the backend
 
437
   where the directory has to be closed/released
 
438
   \param fid the folder identifier referencing the folder to close
 
439
 
 
440
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
441
 */
 
442
_PUBLIC_ int mapistore_closedir(struct mapistore_context *mstore_ctx,
 
443
                                uint32_t context_id,
 
444
                                uint64_t fid)
 
445
{
 
446
        struct backend_context          *backend_ctx;
 
447
 
 
448
        /* Sanity checks */
 
449
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
450
 
 
451
        /* Step 0. Search the context */
 
452
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
453
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
454
 
 
455
        /* mapistore_backend_closedir() */
 
456
 
 
457
        return MAPISTORE_SUCCESS;
 
458
}
 
459
 
 
460
 
 
461
/**
 
462
   \details Create a directory in mapistore
 
463
 
 
464
   \param mstore_ctx pointer to the mapistore context
 
465
   \param context_id the context identifier referencing the backend
 
466
   where the directory will be created
 
467
   \param parent_fid the parent folder identifier
 
468
   \param new_fid the folder identifier for the new folder
 
469
   \param aRow pointer to MAPI data structures with properties to be
 
470
   added to the new folder
 
471
 
 
472
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
473
 */
 
474
_PUBLIC_ int mapistore_mkdir(struct mapistore_context *mstore_ctx,
 
475
                             uint32_t context_id,
 
476
                             uint64_t parent_fid,
 
477
                             uint64_t fid,
 
478
                             struct SRow *aRow)
 
479
{
 
480
        struct backend_context          *backend_ctx;
 
481
        int                             ret;
 
482
 
 
483
        /* Sanity checks */
 
484
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
485
 
 
486
        /* Step 1. Search the context */
 
487
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
488
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);       
 
489
        
 
490
        /* Step 2. Call backend mkdir */
 
491
        ret = mapistore_backend_mkdir(backend_ctx, parent_fid, fid, aRow);
 
492
 
 
493
        return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
 
494
}
 
495
 
 
496
 
 
497
/**
 
498
   \details Remove a directory in mapistore
 
499
 
 
500
   \param mstore_ctx pointer to the mapistore context
 
501
   \param context_id the context identifier referencing the backend
 
502
   \param parent_fid the parent folder identifier
 
503
   \param fid the folder identifier representing the folder to delete
 
504
   \param flags Flags specifying the rmdir operation behavior
 
505
   (recursive for folders, messages)
 
506
 
 
507
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
508
 */
 
509
_PUBLIC_ int mapistore_rmdir(struct mapistore_context *mstore_ctx,
 
510
                             uint32_t context_id,
 
511
                             uint64_t parent_fid,
 
512
                             uint64_t fid,
 
513
                             uint8_t flags)
 
514
{
 
515
        struct backend_context          *backend_ctx;
 
516
 
 
517
        /* Sanity checks */
 
518
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
519
 
 
520
        /* Step 0. Ensure the context exists */
 
521
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
522
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);       
 
523
 
 
524
        return MAPISTORE_SUCCESS;       
 
525
}
 
526
 
 
527
 
 
528
/**
 
529
   \details Retrieve the number of child folders within a mapistore
 
530
   folder
 
531
 
 
532
   \param mstore_ctx pointer to the mapistore context
 
533
   \param context_id the context identifier referencing the backend
 
534
   \param fid the folder identifier
 
535
   \param RowCount pointer to the count result to return
 
536
 
 
537
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
538
 */
 
539
_PUBLIC_ int mapistore_get_folder_count(struct mapistore_context *mstore_ctx,
 
540
                                        uint32_t context_id,
 
541
                                        uint64_t fid,
 
542
                                        uint32_t *RowCount)
 
543
{
 
544
        struct backend_context          *backend_ctx;
 
545
        int                             ret;
 
546
 
 
547
        /* Sanity checks */
 
548
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
549
 
 
550
        /* Step 0. Ensure the context exists */
 
551
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
552
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
553
 
 
554
        /* Step 2. Call backend opendir */
 
555
        ret = mapistore_backend_readdir_count(backend_ctx, fid, MAPISTORE_FOLDER_TABLE, RowCount);
 
556
 
 
557
        return ret;
 
558
}
 
559
 
 
560
 
 
561
/**
 
562
   \details Retrieve the number of child messages within a mapistore folder
 
563
 
 
564
   \param mstore_ctx pointer to the mapistore context
 
565
   \param context_id the context identifier referencing the backend
 
566
   \param fid the folder identifier
 
567
   \param RowCount pointer to the count result to return
 
568
 
 
569
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
570
 */
 
571
_PUBLIC_ int mapistore_get_message_count(struct mapistore_context *mstore_ctx,
 
572
                                         uint32_t context_id,
 
573
                                         uint64_t fid,
 
574
                                         uint32_t *RowCount)
 
575
{
 
576
        struct backend_context          *backend_ctx;
 
577
        int                             ret;
 
578
 
 
579
        /* Sanity checks */
 
580
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
581
 
 
582
        /* Step 0. Ensure the context exists */
 
583
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
584
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
585
 
 
586
        /* Step 2. Call backend readdir_count */
 
587
        ret = mapistore_backend_readdir_count(backend_ctx, fid, MAPISTORE_MESSAGE_TABLE, RowCount);
 
588
 
 
589
        return ret;
 
590
}
 
591
 
 
592
 
 
593
/**
 
594
   \details Retrieve a MAPI property from a table
 
595
 
 
596
   \param mstore_ctx pointer to the mapistore context
 
597
   \param context_id the context identifier referencing the backend
 
598
   \param table_type the type of table (folders or messges)
 
599
   \param fid the folder identifier where the search takes place
 
600
   \param proptag the MAPI property tag to retrieve value for
 
601
   \param pos the record position in search results
 
602
   \param data pointer on pointer to the data the function returns
 
603
 
 
604
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
605
 */
 
606
_PUBLIC_ int mapistore_get_table_property(struct mapistore_context *mstore_ctx,
 
607
                                          uint32_t context_id,
 
608
                                          uint8_t table_type,
 
609
                                          uint64_t fid,
 
610
                                          uint32_t proptag,
 
611
                                          uint32_t pos,
 
612
                                          void **data)
 
613
{
 
614
        struct backend_context          *backend_ctx;
 
615
        int                             ret;
 
616
 
 
617
        /* Sanity checks */
 
618
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
619
 
 
620
        /* Step 1. Ensure the context exists */
 
621
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
622
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
623
 
 
624
        /* Step 2. Call backend readdir */
 
625
        ret = mapistore_backend_get_table_property(backend_ctx, fid, table_type, pos, proptag, data);
 
626
 
 
627
        return ret;
 
628
}
 
629
 
 
630
 
 
631
/**
 
632
   \details Open a message in mapistore
 
633
 
 
634
   \param mstore_ctx pointer to the mapistore context
 
635
   \param context_id the context identifier referencing the backend
 
636
   where the directory will be opened
 
637
   \param parent_fid the parent folder identifier
 
638
   \param mid the message identifier to open
 
639
   \param pointer to the mapistore_message structure
 
640
 
 
641
   \return MAPISTORE SUCCESS on success, otherwise MAPISTORE errors
 
642
 */
 
643
_PUBLIC_ int mapistore_openmessage(struct mapistore_context *mstore_ctx,
 
644
                                   uint32_t context_id,
 
645
                                   uint64_t parent_fid,
 
646
                                   uint64_t mid,
 
647
                                   struct mapistore_message *msg)
 
648
{
 
649
        struct backend_context          *backend_ctx;
 
650
        int                             ret;
 
651
 
 
652
        /* Sanity checks */
 
653
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
654
 
 
655
        /* Step 1. Search the context */
 
656
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
657
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
658
 
 
659
        /* Step 2. Call backend openmessage */
 
660
        ret = mapistore_backend_openmessage(backend_ctx, parent_fid, mid, msg);
 
661
 
 
662
        return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
 
663
}
 
664
 
 
665
 
 
666
/**
 
667
   \details Get properties of a message/folder in mapistore
 
668
 
 
669
   \param mstore_ctx pointer to the mapistore context
 
670
   \param context_id the context identifier referencing the backend
 
671
   where properties will be fetched
 
672
   \param fmid the identifier referencing the message/folder
 
673
   \param type the object type (folder or message)
 
674
   \param properties pointer to the list of properties to fetch
 
675
   \param aRow pointer to the SRow structure
 
676
 
 
677
   \return MAPISTORE_SUCCESS on success, otherwise MAPISTORE errors
 
678
 */
 
679
_PUBLIC_ int mapistore_getprops(struct mapistore_context *mstore_ctx,
 
680
                                uint32_t context_id,
 
681
                                uint64_t fmid,
 
682
                                uint8_t type,
 
683
                                struct SPropTagArray *properties,
 
684
                                struct SRow *aRow)
 
685
{
 
686
        struct backend_context  *backend_ctx;
 
687
        int                     ret;
 
688
 
 
689
        /* Sanity checks */
 
690
        MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
 
691
 
 
692
        /* Step 1. Search the context */
 
693
        backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
 
694
        MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
 
695
 
 
696
        /* Step 2. Call backend getprops */
 
697
        ret = mapistore_backend_getprops(backend_ctx, fmid, type, properties, aRow);
 
698
 
 
699
        return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
 
700
}