Guest User

Untitled

a guest
Nov 24th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.99 KB | None | 0 0
  1. Index: configure.ac
  2. ===================================================================
  3. --- configure.ac (revision 3217)
  4. +++ configure.ac (working copy)
  5. @@ -11,7 +11,7 @@
  6.  
  7. if test -z "$CFLAGS";
  8. then
  9. - CFLAGS="-O2 -g";
  10. + CFLAGS="-g";
  11. fi
  12.  
  13. CFLAGS="-I. $CFLAGS"
  14. Index: mapiproxy/servers/default/emsmdb/oxcfold.c
  15. ===================================================================
  16. --- mapiproxy/servers/default/emsmdb/oxcfold.c (revision 3217)
  17. +++ mapiproxy/servers/default/emsmdb/oxcfold.c (working copy)
  18. @@ -961,3 +961,69 @@
  19.  
  20. return MAPI_E_SUCCESS;
  21. }
  22. +
  23. +/**
  24. +
  25. + */
  26. +_PUBLIC_ enum MAPISTATUS EcDoRpc_RopMoveCopyMessages(TALLOC_CTX *mem_ctx,
  27. + struct emsmdbp_context *emsmdbp_ctx,
  28. + struct EcDoRpc_MAPI_REQ *mapi_req,
  29. + struct EcDoRpc_MAPI_REPL *mapi_repl,
  30. + uint32_t *handles, uint16_t *size)
  31. +{
  32. + enum MAPISTATUS retval;
  33. + uint32_t handle;
  34. + uint32_t contextID;
  35. + struct mapi_handles *rec = NULL;
  36. + void *private_data = NULL;
  37. + struct emsmdbp_object *object;
  38. + uint64_t mid;
  39. + uint32_t i;
  40. +
  41. + DEBUG(4, ("exchange_emsmdb: [OXCFOLD] RopMoveCopyMessages (0x33)\n"));
  42. +
  43. + /* Sanity checks */
  44. + OPENCHANGE_RETVAL_IF(!emsmdbp_ctx, MAPI_E_NOT_INITIALIZED, NULL);
  45. + OPENCHANGE_RETVAL_IF(!mapi_req, MAPI_E_INVALID_PARAMETER, NULL);
  46. + OPENCHANGE_RETVAL_IF(!mapi_repl, MAPI_E_INVALID_PARAMETER, NULL);
  47. + OPENCHANGE_RETVAL_IF(!handles, MAPI_E_INVALID_PARAMETER, NULL);
  48. + OPENCHANGE_RETVAL_IF(!size, MAPI_E_INVALID_PARAMETER, NULL);
  49. +
  50. + mapi_repl->opnum = mapi_req->opnum;
  51. + mapi_repl->error_code = MAPI_E_SUCCESS;
  52. + mapi_repl->handle_idx = mapi_req->handle_idx;
  53. +
  54. + mapi_repl->u.mapi_MoveCopyMessages.PartialCompletion = 0;
  55. +
  56. + /* Get the destionation information */
  57. + handle = handles[mapi_req->u.mapi_MoveCopyMessages.handle_idx];
  58. + retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &rec);
  59. + if (retval) {
  60. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  61. + DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
  62. + goto end;
  63. + }
  64. +
  65. + retval = mapi_handles_get_private_data(rec, &private_data);
  66. + object = private_data;
  67. + if (!object) {
  68. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  69. + DEBUG(5, (" object (%x) not found: %x\n", handle, mapi_req->handle_idx));
  70. + goto end;
  71. + }
  72. +
  73. + contextID = emsmdbp_get_contextID(object);
  74. +
  75. + for (i = 0; i < mapi_req->u.mapi_MoveCopyMessages.count; i++)
  76. + {
  77. + mid = mapi_req->u.mapi_MoveCopyMessages.message_id[i];
  78. +
  79. + /* We move the message */
  80. + mapistore_folder_move_copy_message(emsmdbp_ctx->mstore_ctx, contextID, object->backend_object, mid);
  81. + }
  82. +
  83. + end:
  84. + *size += libmapiserver_RopMoveCopyMessages_size(mapi_repl);
  85. +
  86. + return MAPI_E_SUCCESS;
  87. +}
  88. Index: mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.c
  89. ===================================================================
  90. --- mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.c (revision 3217)
  91. +++ mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.c (working copy)
  92. @@ -884,7 +884,12 @@
  93. &(mapi_response->mapi_repl[idx]),
  94. mapi_response->handles, &size);
  95. break;
  96. - /* op_MAPI_MoveCopyMessages: 0x33 */
  97. + case op_MAPI_MoveCopyMessages: /* 0x33 */
  98. + retval = EcDoRpc_RopMoveCopyMessages(mem_ctx, emsmdbp_ctx,
  99. + &(mapi_request->mapi_req[i]),
  100. + &(mapi_response->mapi_repl[idx]),
  101. + mapi_response->handles, &size);
  102. + break;
  103. /* op_MAPI_AbortSubmit: 0x34 */
  104. /* op_MAPI_MoveFolder: 0x35 */
  105. /* op_MAPI_CopyFolder: 0x36 */
  106. Index: mapiproxy/servers/default/emsmdb/oxcprpt.c
  107. ===================================================================
  108. --- mapiproxy/servers/default/emsmdb/oxcprpt.c (revision 3217)
  109. +++ mapiproxy/servers/default/emsmdb/oxcprpt.c (working copy)
  110. @@ -1226,8 +1226,16 @@
  111. struct EcDoRpc_MAPI_REPL *mapi_repl,
  112. uint32_t *handles, uint16_t *size)
  113. {
  114. - DEBUG(4, ("exchange_emsmdb: [OXCPRPT] CopyTo (0x39) -- stub\n"));
  115. + enum MAPISTATUS retval;
  116. + uint32_t handle;
  117. + uint32_t contextID;
  118. + struct mapi_handles *rec = NULL;
  119. + void *private_data = NULL;
  120. + struct emsmdbp_object *a_object;
  121. + struct emsmdbp_object *b_object;
  122.  
  123. + DEBUG(4, ("exchange_emsmdb: [OXCPRPT] CopyTo (0x39)\n"));
  124. +
  125. /* Sanity checks */
  126. OPENCHANGE_RETVAL_IF(!emsmdbp_ctx, MAPI_E_NOT_INITIALIZED, NULL);
  127. OPENCHANGE_RETVAL_IF(!mapi_req, MAPI_E_INVALID_PARAMETER, NULL);
  128. @@ -1242,6 +1250,53 @@
  129. mapi_repl->u.mapi_CopyTo.PropertyProblemCount = 0;
  130. mapi_repl->u.mapi_CopyTo.PropertyProblem = NULL;
  131.  
  132. + /* Get the destination information */
  133. + handle = handles[mapi_req->handle_idx];
  134. + retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &rec);
  135. + if (retval) {
  136. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  137. + DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
  138. + goto end;
  139. + }
  140. +
  141. + retval = mapi_handles_get_private_data(rec, &private_data);
  142. + a_object = private_data;
  143. + if (!a_object) {
  144. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  145. + DEBUG(5, (" object (%x) not found: %x\n", handle, mapi_req->handle_idx));
  146. + goto end;
  147. + }
  148. +
  149. + /* Get the source information - this is the information we get from the CreateMessage */
  150. + handle = handles[mapi_req->u.mapi_CopyTo.handle_idx];
  151. + retval = mapi_handles_search(emsmdbp_ctx->handles_ctx, handle, &rec);
  152. + if (retval) {
  153. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  154. + DEBUG(5, (" handle (%x) not found: %x\n", handle, mapi_req->handle_idx));
  155. + goto end;
  156. + }
  157. +
  158. + retval = mapi_handles_get_private_data(rec, &private_data);
  159. + b_object = private_data;
  160. + if (!b_object) {
  161. + mapi_repl->error_code = MAPI_E_INVALID_OBJECT;
  162. + DEBUG(5, (" object (%x) not found: %x\n", handle, mapi_req->handle_idx));
  163. + goto end;
  164. + }
  165. +
  166. + /*
  167. + a_object->backend_object is the 'source object' - the message to be copied
  168. + b_object->backend_objectD is the 'destination folder'
  169. + b_object->object.message->messageID is the destination MID - the MID generated during the CreateMessage call
  170. + */
  171. + contextID = emsmdbp_get_contextID(a_object);
  172. +
  173. + mapistore_properties_copy_to(emsmdbp_ctx->mstore_ctx, contextID, a_object->backend_object, b_object->backend_object, b_object->object.message->messageID);
  174. +
  175. + /* The backend might do this for us. In any case, we try to add it ourselves */
  176. + mapistore_indexing_record_add_mid(emsmdbp_ctx->mstore_ctx, contextID, b_object->object.message->messageID);
  177. +
  178. + end:
  179. *size += libmapiserver_RopCopyTo_size(mapi_repl);
  180.  
  181. return MAPI_E_SUCCESS;
  182. Index: mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.h
  183. ===================================================================
  184. --- mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.h (revision 3217)
  185. +++ mapiproxy/servers/default/emsmdb/dcesrv_exchange_emsmdb.h (working copy)
  186. @@ -325,7 +325,9 @@
  187. enum MAPISTATUS EcDoRpc_RopSetSearchCriteria(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  188. enum MAPISTATUS EcDoRpc_RopGetSearchCriteria(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  189. enum MAPISTATUS EcDoRpc_RopEmptyFolder(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  190. +enum MAPISTATUS EcDoRpc_RopMoveCopyMessages(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  191.  
  192. +
  193. /* definitions from oxcmsg.c */
  194. enum MAPISTATUS EcDoRpc_RopOpenMessage(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  195. enum MAPISTATUS EcDoRpc_RopCreateMessage(TALLOC_CTX *, struct emsmdbp_context *, struct EcDoRpc_MAPI_REQ *, struct EcDoRpc_MAPI_REPL *, uint32_t *, uint16_t *);
  196. Index: mapiproxy/servers/default/emsmdb/oxcfxics.c
  197. ===================================================================
  198. --- mapiproxy/servers/default/emsmdb/oxcfxics.c (revision 3217)
  199. +++ mapiproxy/servers/default/emsmdb/oxcfxics.c (working copy)
  200. @@ -33,14 +33,74 @@
  201. #define oc_version_time 0x4dbb2dbe
  202.  
  203. /** notes:
  204. +
  205. + * Structures (taken from OXCFXICS) :
  206. +
  207. + - CN structure: A CN structure contains a change number that identifies a version of a messaging object. CNs are identical in format to FID structures
  208. + ([MS-OXCDATA] section 2.2.1.1) and MID structures ([MS- OXCDATA] section 2.2.1.2), except the GlobalCounter field represents a change
  209. + to a messaging object rather than a messaging object itself.
  210. +
  211. + - XID structure: An XID structure contains an external identifier for an entity within a store.
  212. +
  213. + - PredecessorChangeList structure: The PredecessorChangeList structure contains a set of XID structures, as specified in section 2.2.2.2, that identify
  214. + change numbers of messaging objects in different replicas (1). The order of the XIDs does not have significance for
  215. + interpretation, but is significant for serialization and deserialization.
  216. +
  217. +
  218. + * Properties (taken from OXCFXICS) :
  219. +
  220. + - PR_CHANGE_KEY / PidTagChangeKey: The PidTagChangeKey property ([MS-OXPROPS] section 2.690) contains a serialized XID structure,
  221. + as specified in section 2.2.2.2, that identifies the last change to the messaging object.
  222. +
  223. + VERY IMPORTANT NOTE FOR SYNCHRONIZATION IN ORDER TO AVOID SIMPLE CONFLICTS:
  224. +
  225. + If the last change to the messaging object was imported from the client by using the RopSynchronizationImportMessageChange
  226. + ROP (section 2.2.3.2.4.2), the value of the PidTagChangeKey property that is saved to the store by the server contains the
  227. + value for the PidTagChangeKey property that was passed in the PropertyValues field of the RopSynchronizationImportMessageChange
  228. + ROP request buffer.
  229. +
  230. + If the last change to a messaging object was made by the server, the value of the PidTagChangeKey property that is saved to the
  231. + store by the server contains an XID generated from the PidTagChangeNumber property (section 2.2.1.2.3). For more details about
  232. + generating XIDs based on internal identifiers (2), see section 3.1.5.1.
  233. +
  234. + - PR_PREDECESSOR_CHANGE_LIST / PidTagPredecessorChangeList: The PidTagPredecessorChangeList property ([MS-OXPROPS] section 2.922) contains PredecessorChangeList
  235. + structures, as specified in section 2.2.2.3. The PidTagPredecessorChangeList property contains all the XID
  236. + structures, as specified in section 2.2.2.2, from all replicas (1) that have been integrated into the
  237. + current version of the messaging object. This property is used in conflict detection by all protocol roles.
  238. +
  239. + - {Meta,Pid}TagIdsetGiven: The MetaTagIdsetGiven property contains a serialization of REPLGUID-based IDSET structures, as specified in section 2.2.2.4.2. The IDSETs contain
  240. + FID structures ([MS-OXCDATA] section 2.2.1.1) for hierarchy synchronization operations, or MID structures for content synchronization operations,
  241. + that exist in the local replica of the client. The IDSETs MUST NOT include any IDs that are not in the local replica of the client.
  242. +
  243. + - {Meta,Pid}TagCnsetSeen: The MetaTagCnsetSeen property contains a serialization of REPLGUID-based CNSET structures, as specified in section 2.2.2.4. The CN structures, as
  244. + specified in section 2.2.2.1, in the CNSET track changes to folders (for hierarchy synchronization operations) or normal messages (for content synchronization
  245. + operations) in the current synchronization scope that have been previously communicated to a client, and are reflected in its local replica.
  246. +
  247. + - {Meta,Pid}TagCnsetSeenFAI: The MetaTagCnsetSeenFAI property contains a serialization of REPLGUID-based IDSET structures, as specified in section 2.2.2.4. The semantics of
  248. + this property are identical to the MetaTagCnsetSeen property (section 2.2.1.1.2), except that this property contains IDs for folder associated information
  249. + (FAI) messages and is therefore only used in content synchronization operations.
  250. +
  251. + - {Meta,Pid}TagCnsetRead: The MetaTagCnsetRead property contains a serialization of REPLGUID-based CNSET structures, as specified in section 2.2.2.4. The CN structures, as specified
  252. + in section 2.2.2.1, in the CNSET track changes to the read state for messages in the current synchronization scope that have been previously communicated to
  253. + the client and are reflected in its local replica. This property does not track whether messages have been read, it only tracks changes to the read state of a
  254. + message. For more details about tracking read state changes, see section 3.2.5.6.
  255. +
  256. +
  257. +
  258. * conventions:
  259. - binary data must be returned as Binary_r
  260. - PR_CHANGE_NUM is computed
  261. - - PR_CHANGE_KEY, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY are deduced automatically from PR_CHANGE_NUM, PR_MID/PR_FID and PR_PARENT_FID
  262. + - PR_CHANGE_KEY (PidTagChangeKey), PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY are deduced automatically from PR_CHANGE_NUM, PR_MID/PR_FID and PR_PARENT_FID
  263. * PR_*KEY should be computed in the same manner in oxcprpt and oxctabl
  264. - - PR_PREDECESSOR_CHANGE_LIST is only a copy or PR_CHANGE_KEY for now
  265. + - PR_PREDECESSOR_CHANGE_LIST (PidTagPredecessorChangeList) is only a copy or PR_CHANGE_KEY for now
  266. - all string properties are fetched via their _UNICODE version
  267. +
  268. - "PR_LAST_MODIFICATION_TIME" is left to the backend, maybe setprops operations could provide an optional one, for reference...
  269. + Note that the doc (OXCFXICS) says:
  270. +
  271. + "Using this mechanism prevents the client from controlling certain internal properties, such as the PidTagLastModificationTime property ([MS-OXPROPS] section 2.825), as this property is controlled by the server. This is different than full item upload, which accepts the client's value of this property."
  272. +
  273. +
  274. ? idea: getprops on tables and objects without property array = get all props
  275. * no deletions yet
  276. * no conflict resolution
  277. @@ -638,13 +698,13 @@
  278. /* The "cnset_seen" range is going to be merged later with the one from synccontext since the ids are not sorted */
  279. RAWIDSET_push_guid_glob(sync_data->cnset_seen, &sync_data->replica_guid, cn);
  280.  
  281. - /* change key */
  282. + /* PidTagChangeKey / change key */
  283. bin_data = oxcfxics_make_gid(header_data_pointers, &sync_data->replica_guid, cn);
  284. query_props.aulPropTag[j] = PR_CHANGE_KEY;
  285. header_data_pointers[j] = bin_data;
  286. j++;
  287.  
  288. - /* predecessor... (already computed) */
  289. + /* PidTagPredecessorChangeList / predecessor... (already computed) */
  290. predecessors_data.cb = bin_data->cb + 1;
  291. predecessors_data.lpb = talloc_array(header_data_pointers, uint8_t, predecessors_data.cb);
  292. *predecessors_data.lpb = bin_data->cb & 0xff;
  293. @@ -784,9 +844,9 @@
  294. oxcfxics_push_messageChange(mem_ctx, emsmdbp_ctx, synccontext, sync_data, synccontext_object->parent_object);
  295. new_idset = RAWIDSET_convert_to_idset(NULL, sync_data->cnset_seen);
  296. old_idset = synccontext->cnset_seen;
  297. - /* IDSET_dump (synccontext->cnset_seen, "initial cnset_seen"); */
  298. + IDSET_dump (synccontext->cnset_seen, "initial cnset_seen");
  299. synccontext->cnset_seen = IDSET_merge_idsets(synccontext, old_idset, new_idset);
  300. - /* IDSET_dump (synccontext->cnset_seen, "merged cnset_seen"); */
  301. + IDSET_dump (synccontext->cnset_seen, "merged cnset_seen");
  302. talloc_free(old_idset);
  303. talloc_free(new_idset);
  304. talloc_free(sync_data->cnset_seen);
  305. @@ -799,9 +859,9 @@
  306. oxcfxics_push_messageChange(mem_ctx, emsmdbp_ctx, synccontext, sync_data, synccontext_object->parent_object);
  307. new_idset = RAWIDSET_convert_to_idset(NULL, sync_data->cnset_seen);
  308. old_idset = synccontext->cnset_seen_fai;
  309. - /* IDSET_dump (synccontext->cnset_seen, "initial cnset_seen_fai"); */
  310. + IDSET_dump (synccontext->cnset_seen, "initial cnset_seen_fai");
  311. synccontext->cnset_seen_fai = IDSET_merge_idsets(synccontext, old_idset, new_idset);
  312. - /* IDSET_dump (synccontext->cnset_seen, "merged cnset_seen_fai"); */
  313. + IDSET_dump (synccontext->cnset_seen, "merged cnset_seen_fai");
  314. talloc_free(old_idset);
  315. talloc_free(new_idset);
  316. talloc_free(sync_data->cnset_seen);
  317. @@ -820,7 +880,7 @@
  318. ndr_push_uint32(sync_data->cutmarks_ndr, NDR_SCALARS, sync_data->ndr->offset);
  319. ndr_push_idset(sync_data->ndr, new_idset);
  320. ndr_push_uint32(sync_data->cutmarks_ndr, NDR_SCALARS, sync_data->ndr->offset);
  321. - /* IDSET_dump (new_idset, "cnset_deleted"); */
  322. + IDSET_dump (new_idset, "cnset_deleted");
  323. talloc_free(new_idset);
  324. }
  325.  
  326. @@ -830,9 +890,9 @@
  327.  
  328. new_idset = RAWIDSET_convert_to_idset(NULL, sync_data->eid_set);
  329. old_idset = synccontext->idset_given;
  330. - /* IDSET_dump (synccontext->idset_given, "initial idset_given"); */
  331. + IDSET_dump (synccontext->idset_given, "initial idset_given");
  332. synccontext->idset_given = IDSET_merge_idsets(synccontext, old_idset, new_idset);
  333. - /* IDSET_dump (synccontext->idset_given, "merged idset_given"); */
  334. + IDSET_dump (synccontext->idset_given, "merged idset_given");
  335. talloc_free(old_idset);
  336. talloc_free(new_idset);
  337.  
  338. @@ -1091,9 +1151,9 @@
  339.  
  340. new_idset = RAWIDSET_convert_to_idset(NULL, sync_data->cnset_seen);
  341. old_idset = synccontext->cnset_seen;
  342. - /* IDSET_dump (synccontext->cnset_seen, "initial cnset_seen (folder change)"); */
  343. + IDSET_dump (synccontext->cnset_seen, "initial cnset_seen (folder change)");
  344. synccontext->cnset_seen = IDSET_merge_idsets(synccontext, old_idset, new_idset);
  345. - /* IDSET_dump (synccontext->cnset_seen, "merged cnset_seen (folder change)"); */
  346. + IDSET_dump (synccontext->cnset_seen, "merged cnset_seen (folder change)");
  347. talloc_free(old_idset);
  348. talloc_free(new_idset);
  349.  
  350. @@ -1104,9 +1164,9 @@
  351.  
  352. new_idset = RAWIDSET_convert_to_idset(NULL, sync_data->eid_set);
  353. old_idset = synccontext->idset_given;
  354. - /* IDSET_dump (synccontext->idset_given, "initial idset_given (folder change)"); */
  355. + IDSET_dump (synccontext->idset_given, "initial idset_given (folder change)");
  356. synccontext->idset_given = IDSET_merge_idsets(synccontext, old_idset, new_idset);
  357. - /* IDSET_dump (synccontext->idset_given, "merged idset_given (folder change)"); */
  358. + IDSET_dump (synccontext->idset_given, "merged idset_given (folder change)");
  359. talloc_free(old_idset);
  360. talloc_free(new_idset);
  361.  
  362. Index: mapiproxy/libmapistore/mapistore_private.h
  363. ===================================================================
  364. --- mapiproxy/libmapistore/mapistore_private.h (revision 3217)
  365. +++ mapiproxy/libmapistore/mapistore_private.h (working copy)
  366. @@ -165,6 +165,7 @@
  367. int mapistore_backend_folder_open_message(struct backend_context *, void *, TALLOC_CTX *, uint64_t, void **, struct mapistore_message **);
  368. int mapistore_backend_folder_create_message(struct backend_context *, void *, TALLOC_CTX *, uint64_t, uint8_t, void **);
  369. int mapistore_backend_folder_delete_message(struct backend_context *, void *, uint64_t, uint8_t);
  370. +int mapistore_backend_folder_move_copy_message(struct backend_context *, void *, uint64_t);
  371. int mapistore_backend_folder_get_deleted_fmids(struct backend_context *, void *, TALLOC_CTX *, uint8_t, uint64_t, struct I8Array_r **, uint64_t *);
  372. int mapistore_backend_folder_get_child_count(struct backend_context *, void *, uint8_t, uint32_t *);
  373. int mapistore_backend_folder_get_child_fid_by_name(struct backend_context *, void *, const char *, uint64_t *);
  374. @@ -189,6 +190,7 @@
  375. int mapistore_backend_properties_get_available_properties(struct backend_context *, void *, TALLOC_CTX *, struct SPropTagArray **);
  376. int mapistore_backend_properties_get_properties(struct backend_context *, void *, TALLOC_CTX *, uint16_t, enum MAPITAGS *, struct mapistore_property_data *);
  377. int mapistore_backend_properties_set_properties(struct backend_context *, void *, struct SRow *);
  378. +int mapistore_backend_properties_copy_to(struct backend_context *, void *, void *, uint64_t);
  379.  
  380. /* definitions from mapistore_tdb_wrap.c */
  381. struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *, const char *, int, int, int, mode_t);
  382. Index: mapiproxy/libmapistore/mapistore_interface.c
  383. ===================================================================
  384. --- mapiproxy/libmapistore/mapistore_interface.c (revision 3217)
  385. +++ mapiproxy/libmapistore/mapistore_interface.c (working copy)
  386. @@ -567,6 +567,29 @@
  387. }
  388.  
  389. /**
  390. +
  391. + */
  392. +_PUBLIC_ int mapistore_folder_move_copy_message(struct mapistore_context *mstore_ctx, uint32_t context_id,
  393. + void *folder, uint64_t mid)
  394. +{
  395. + struct backend_context *backend_ctx;
  396. + int ret;
  397. +
  398. + /* Sanity checks */
  399. + MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
  400. +
  401. + /* Step 1. Search the context */
  402. + backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
  403. + MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
  404. +
  405. + /* Step 2. Call backend operation */
  406. + ret = mapistore_backend_folder_move_copy_message(backend_ctx, folder, mid);
  407. +
  408. + return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
  409. +}
  410. +
  411. +
  412. +/**
  413. \details Get the array of deleted items following a specific change number
  414.  
  415. \param mstore_ctx pointer to the mapistore context
  416. @@ -1098,3 +1121,25 @@
  417.  
  418. return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
  419. }
  420. +
  421. +_PUBLIC_ int mapistore_properties_copy_to(struct mapistore_context
  422. + *mstore_ctx, uint32_t context_id,
  423. + void *object,
  424. + void *destination,
  425. + uint64_t mid)
  426. +{
  427. + struct backend_context *backend_ctx;
  428. + int ret;
  429. +
  430. + /* Sanity checks */
  431. + MAPISTORE_SANITY_CHECKS(mstore_ctx, NULL);
  432. +
  433. + /* Step 1. Search the context */
  434. + backend_ctx = mapistore_backend_lookup(mstore_ctx->context_list, context_id);
  435. + MAPISTORE_RETVAL_IF(!backend_ctx, MAPISTORE_ERR_INVALID_PARAMETER, NULL);
  436. +
  437. + /* Step 2. Call backend operation */
  438. + ret = mapistore_backend_properties_copy_to(backend_ctx, object, destination, mid);
  439. +
  440. + return !ret ? MAPISTORE_SUCCESS : MAPISTORE_ERROR;
  441. +}
  442. Index: mapiproxy/libmapistore/mapistore.h
  443. ===================================================================
  444. --- mapiproxy/libmapistore/mapistore.h (revision 3217)
  445. +++ mapiproxy/libmapistore/mapistore.h (working copy)
  446. @@ -126,6 +126,7 @@
  447. int (*open_message)(void *, TALLOC_CTX *, uint64_t, void **, struct mapistore_message **);
  448. int (*create_message)(void *, TALLOC_CTX *, uint64_t, uint8_t, void **);
  449. int (*delete_message)(void *, uint64_t, uint8_t flags);
  450. + int (*move_copy_message)(void *, uint64_t);
  451. int (*get_deleted_fmids)(void *, TALLOC_CTX *, uint8_t, uint64_t, struct I8Array_r **, uint64_t *);
  452. int (*get_child_count)(void *, uint8_t, uint32_t *);
  453.  
  454. @@ -162,6 +163,7 @@
  455. int (*get_available_properties)(void *, TALLOC_CTX *, struct SPropTagArray **);
  456. int (*get_properties)(void *, TALLOC_CTX *, uint16_t, enum MAPITAGS *, struct mapistore_property_data *);
  457. int (*set_properties)(void *, struct SRow *);
  458. + int (*copy_to)(void *, void *, uint64_t);
  459. } properties;
  460. };
  461.  
  462. @@ -228,6 +230,7 @@
  463. int mapistore_folder_open_message(struct mapistore_context *, uint32_t, void *, TALLOC_CTX *, uint64_t, void **, struct mapistore_message **);
  464. int mapistore_folder_create_message(struct mapistore_context *, uint32_t, void *, TALLOC_CTX *, uint64_t, uint8_t, void **);
  465. int mapistore_folder_delete_message(struct mapistore_context *, uint32_t, void *, uint64_t, uint8_t);
  466. +int mapistore_folder_move_copy_message(struct mapistore_context *, uint32_t, void *, uint64_t);
  467. int mapistore_folder_get_deleted_fmids(struct mapistore_context *, uint32_t, void *, TALLOC_CTX *, uint8_t, uint64_t, struct I8Array_r **, uint64_t *);
  468. int mapistore_folder_get_folder_count(struct mapistore_context *, uint32_t, void *, uint32_t *);
  469. int mapistore_folder_get_message_count(struct mapistore_context *, uint32_t, void *, uint8_t, uint32_t *);
  470. @@ -254,7 +257,9 @@
  471. int mapistore_properties_get_available_properties(struct mapistore_context *, uint32_t, void *, TALLOC_CTX *, struct SPropTagArray **);
  472. int mapistore_properties_get_properties(struct mapistore_context *, uint32_t, void *, TALLOC_CTX *, uint16_t, enum MAPITAGS *, struct mapistore_property_data *);
  473. int mapistore_properties_set_properties(struct mapistore_context *, uint32_t, void *, struct SRow *);
  474. +int mapistore_properties_copy_to(struct mapistore_context *, uint32_t, void *, void *, uint64_t);
  475.  
  476. +
  477. /* definitions from mapistore_processing.c */
  478. int mapistore_set_mapping_path(const char *);
  479.  
  480. Index: mapiproxy/libmapistore/mapistore_backend.c
  481. ===================================================================
  482. --- mapiproxy/libmapistore/mapistore_backend.c (revision 3217)
  483. +++ mapiproxy/libmapistore/mapistore_backend.c (working copy)
  484. @@ -450,6 +450,11 @@
  485. return bctx->backend->folder.delete_message(folder, mid, flags);
  486. }
  487.  
  488. +int mapistore_backend_folder_move_copy_message(struct backend_context *bctx, void *folder, uint64_t mid)
  489. +{
  490. + return bctx->backend->folder.move_copy_message(folder, mid);
  491. +}
  492. +
  493. int mapistore_backend_folder_get_deleted_fmids(struct backend_context *bctx, void *folder, TALLOC_CTX *mem_ctx, uint8_t table_type, uint64_t change_num, struct I8Array_r **fmidsp, uint64_t *cnp)
  494. {
  495. return bctx->backend->folder.get_deleted_fmids(folder, mem_ctx, table_type, change_num, fmidsp, cnp);
  496. @@ -602,3 +607,8 @@
  497. {
  498. return bctx->backend->properties.set_properties(object, aRow);
  499. }
  500. +
  501. +int mapistore_backend_properties_copy_to(struct backend_context *bctx, void *object, void *destination, uint64_t mid)
  502. +{
  503. + return bctx->backend->properties.copy_to(object, destination, mid);
  504. +}
  505. Index: mapiproxy/libmapiserver/libmapiserver_oxcfold.c
  506. ===================================================================
  507. --- mapiproxy/libmapiserver/libmapiserver_oxcfold.c (revision 3217)
  508. +++ mapiproxy/libmapiserver/libmapiserver_oxcfold.c (working copy)
  509. @@ -225,3 +225,23 @@
  510. size += SIZE_DFLT_ROPEMPTYFOLDER;
  511. return size;
  512. }
  513. +
  514. +/**
  515. + \details Calculate MoveCopyMessages rop size
  516. +
  517. + \param response pointer to the MoveCopyMessags EcDoRpc_MAPI_REPL
  518. + structure
  519. +
  520. + \return Size of MoveCopyMessages response
  521. + */
  522. +_PUBLIC_ uint16_t libmapiserver_RopMoveCopyMessages_size(struct EcDoRpc_MAPI_REPL *response)
  523. +{
  524. + uint16_t size = SIZE_DFLT_MAPI_RESPONSE;
  525. +
  526. + if (!response || response->error_code) {
  527. + return size;
  528. + }
  529. +
  530. + size += SIZE_DFLT_ROPMOVECOPYMESSAGES;
  531. + return size;
  532. +}
  533. Index: mapiproxy/libmapiserver/libmapiserver.h
  534. ===================================================================
  535. --- mapiproxy/libmapiserver/libmapiserver.h (revision 3217)
  536. +++ mapiproxy/libmapiserver/libmapiserver.h (working copy)
  537. @@ -308,6 +308,13 @@
  538. #define SIZE_DFLT_ROPEMPTYFOLDER 1
  539.  
  540. /**
  541. + \details MoveCopyMessages Rop has fixed response size for:
  542. + -#: PartialCompletion: uint8_t
  543. +
  544. +*/
  545. +#define SIZE_DFLT_ROPMOVECOPYMESSAGES 1
  546. +
  547. +/**
  548. \details DeleteMessage Rop has fixed response size for:
  549. -# PartialCompletion: uint8_t
  550. */
  551. @@ -460,7 +467,9 @@
  552. uint16_t libmapiserver_RopSetSearchCriteria_size(struct EcDoRpc_MAPI_REPL *);
  553. uint16_t libmapiserver_RopGetSearchCriteria_size(struct EcDoRpc_MAPI_REPL *);
  554. uint16_t libmapiserver_RopEmptyFolder_size(struct EcDoRpc_MAPI_REPL *);
  555. +uint16_t libmapiserver_RopMoveCopyMessages_size(struct EcDoRpc_MAPI_REPL *);
  556.  
  557. +
  558. /* definitions from libmapiserver_oxcmsg.c */
  559. uint16_t libmapiserver_OpenRecipientRow_size(struct OpenRecipientRow *);
  560. uint16_t libmapiserver_RopOpenMessage_size(struct EcDoRpc_MAPI_REPL *);
Add Comment
Please, Sign In to add comment