diff --git a/OpenChange/MAPIStoreMailVolatileMessage.m b/OpenChange/MAPIStoreMailVolatileMessage.m index 77d6294ab..7ef2c2c96 100644 --- a/OpenChange/MAPIStoreMailVolatileMessage.m +++ b/OpenChange/MAPIStoreMailVolatileMessage.m @@ -28,6 +28,7 @@ #import #import #import +#import #import #import #import @@ -541,6 +542,7 @@ FillMessageHeadersFromSharingProperties (NGMutableHashMap *headers, NSDictionary about the properties */ id value; + NSNumber *sharingFlavourNum = nil; value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingCapabilities)]; if (value) @@ -549,8 +551,32 @@ FillMessageHeadersFromSharingProperties (NGMutableHashMap *headers, NSDictionary value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingFlavor)]; if (value) - [headers setObject: value - forKey: @"X-MS-Sharing-Flavor"]; + sharingFlavourNum = (NSNumber *)value; + else + { + value = [mailProperties objectForKey: MAPIPropertyKey (PidNameXSharingFlavor)]; + if (value) + { + /* Transform the hex string to unsigned int */ + NSScanner *scanner; + unsigned int sharingFlavour; + scanner = [NSScanner scannerWithString:value]; + if ([scanner scanHexInt:&sharingFlavour]) + sharingFlavourNum =[NSNumber numberWithUnsignedInt: sharingFlavour]; + } + } + if (sharingFlavourNum) + { + if ([sharingFlavourNum unsignedIntegerValue] == 0x5100) + { + /* 0x5100 sharing flavour is not in standard but it seems to + be a denial of request + invitation message so we store + deny sharing flavour */ + sharingFlavourNum = [NSNumber numberWithUnsignedInt: 0x25100]; + } + [headers setObject: sharingFlavourNum + forKey: @"X-MS-Sharing-Flavor"]; + } value = [mailProperties objectForKey: MAPIPropertyKey (PidLidSharingInitiatorEntryId)]; if (value) diff --git a/OpenChange/MAPIStoreSharingMessage.m b/OpenChange/MAPIStoreSharingMessage.m index 339ca0750..67a133bd8 100644 --- a/OpenChange/MAPIStoreSharingMessage.m +++ b/OpenChange/MAPIStoreSharingMessage.m @@ -134,7 +134,8 @@ value = [properties objectForKey: @"x-ms-sharing-capabilities"]; if (value) { - *data = [[value stringValue] asUnicodeInMemCtx: memCtx]; + *data = [[NSString stringWithFormat:@"%X", [value intValue]] + asUnicodeInMemCtx: memCtx]; rc = MAPISTORE_SUCCESS; } @@ -177,7 +178,7 @@ if ([value intValue] == 0x40290) /* Special folder */ { value = [properties objectForKey: @"x-ms-sharing-responsetime"]; - auxValue = [properties objectForKey: @"x-ms-sharing-remotename"]; + auxValue = [properties objectForKey: @"x-ms-sharing-remoteuid"]; if (value) /* A sharing request */ { if (auxValue) @@ -187,10 +188,10 @@ } else { - if (auxValue) /* It SHOULD be an invitation or response acceptance */ + if (auxValue) /* It SHOULD be an invitation or response */ *data = MAPILongValue (memCtx, 0x20310); - else - *data = MAPILongValue (memCtx, 0x23310); + else /* No remote info, then denial */ + *data = MAPILongValue (memCtx, 0x25100); } } else @@ -213,7 +214,8 @@ value = [properties objectForKey: @"x-ms-sharing-flavor"]; if (value) { - *data = [[value stringValue] asUnicodeInMemCtx: memCtx]; + *data = [[NSString stringWithFormat:@"%X", [value intValue]] + asUnicodeInMemCtx: memCtx]; rc = MAPISTORE_SUCCESS; }