oc-sharing: Guess PidLidSharingFlavor from other props

When it is not set by the client on the first place.

See [MS-OXSHARE] Section 2.2.2.5 for details on returned values.
pull/65/head
Enrique J. Hernández Blasco 2015-03-05 00:05:02 +01:00
parent ae7ac1be29
commit 2b54897d29
1 changed files with 34 additions and 1 deletions

View File

@ -147,8 +147,9 @@
- (int) getPidLidSharingFlavor: (void **) data
inMemCtx: (TALLOC_CTX *) memCtx
{
/* See [MS-OXSHARE] Section 2.2.2.5 for details */
enum mapistore_error rc = MAPISTORE_ERR_NOT_FOUND;
id value;
id value, auxValue;
value = [properties objectForKey: @"x-ms-sharing-flavor"];
if (value)
@ -156,6 +157,38 @@
*data = MAPILongValue (memCtx, [value intValue]);
rc = MAPISTORE_SUCCESS;
}
else
{
/* Guess its value required by old clients based on other properties */
value = [properties objectForKey: @"x-ms-sharing-capabilities"];
if (value)
{
if ([value intValue] == 0x40290) /* Special folder */
{
value = [properties objectForKey: @"x-ms-sharing-responsetime"];
auxValue = [properties objectForKey: @"x-ms-sharing-remotename"];
if (value) /* A sharing request */
{
if (auxValue)
*data = MAPILongValue (memCtx, 0x20710);
else
*data = MAPILongValue (memCtx, 0x20500);
}
else
{
if (auxValue) /* It SHOULD be an invitation or response acceptance */
*data = MAPILongValue (memCtx, 0x20310);
else
*data = MAPILongValue (memCtx, 0x23310);
}
}
else
{
*data = MAPILongValue (memCtx, 0x310);
}
rc = MAPISTORE_SUCCESS;
}
}
return rc;
}