Monotone-Parent: d37b05310d38d5954711085cdeecbc2ffc7e8d82
Monotone-Revision: b6e0c5de869a2a15ff75f7dd4850ede790373285 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-09-05T20:07:17 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
9874fa469c
commit
0af7547b8a
|
@ -1,5 +1,9 @@
|
|||
2012-09-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailMessage.m (-getMessageData:inMemCtx:):
|
||||
property return recipients from all the "from", "to", "cc" and
|
||||
"bcc" header fields.
|
||||
|
||||
* OpenChange/MAPIStoreCalendarAttachment.m
|
||||
(-getPidTagDisplayName:inMemCtx:): return an allocated value,
|
||||
since returned values must be assigned to another parent.
|
||||
|
|
|
@ -1327,8 +1327,14 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
|||
- (void) getMessageData: (struct mapistore_message **) dataPtr
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
NSArray *to;
|
||||
NSInteger count, max, p;
|
||||
NSArray *addresses;
|
||||
NSString *addressMethods[] = { @"fromEnvelopeAddresses",
|
||||
@"toEnvelopeAddresses",
|
||||
@"ccEnvelopeAddresses",
|
||||
@"bccEnvelopeAddresses" };
|
||||
enum ulRecipClass addressTypes[] = { MAPI_ORIG, MAPI_TO,
|
||||
MAPI_CC, MAPI_BCC };
|
||||
NSUInteger arrayCount, count, recipientStart, max, p;
|
||||
NGImap4EnvelopeAddress *currentAddress;
|
||||
NSString *username, *cn, *email;
|
||||
NSData *entryId;
|
||||
|
@ -1349,9 +1355,9 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
|||
inMemCtx: memCtx];
|
||||
else
|
||||
{
|
||||
mgr = [SOGoUserManager sharedUserManager];
|
||||
|
||||
/* Retrieve recipients from the message */
|
||||
to = [sogoObject toEnvelopeAddresses];
|
||||
max = [to count];
|
||||
|
||||
msgData->columns = set_SPropTagArray (msgData, 9,
|
||||
PR_OBJECT_TYPE,
|
||||
|
@ -1364,75 +1370,86 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
|||
PR_RECIPIENT_ENTRYID,
|
||||
PR_RECIPIENT_TRACKSTATUS);
|
||||
|
||||
if (max > 0)
|
||||
msgData->recipients_count = 0;
|
||||
msgData->recipients = NULL;
|
||||
|
||||
recipientStart = 0;
|
||||
|
||||
for (arrayCount = 0; arrayCount < 4; arrayCount++)
|
||||
{
|
||||
mgr = [SOGoUserManager sharedUserManager];
|
||||
msgData->recipients_count = max;
|
||||
msgData->recipients = talloc_array (msgData, struct mapistore_message_recipient, max);
|
||||
for (count = 0; count < max; count++)
|
||||
addresses = [sogoObject performSelector: NSSelectorFromString (addressMethods[arrayCount])];
|
||||
max = [addresses count];
|
||||
if (max > 0)
|
||||
{
|
||||
recipient = msgData->recipients + count;
|
||||
msgData->recipients_count += max;
|
||||
msgData->recipients = talloc_realloc (msgData, msgData->recipients, struct mapistore_message_recipient, msgData->recipients_count);
|
||||
|
||||
currentAddress = [to objectAtIndex: count];
|
||||
cn = [currentAddress personalName];
|
||||
email = [currentAddress baseEMail];
|
||||
if ([cn length] == 0)
|
||||
cn = email;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
|
||||
if (contactInfos)
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
recipient->username = NULL;
|
||||
entryId = MAPIStoreExternalEntryId (cn, email);
|
||||
}
|
||||
recipient->type = MAPI_TO;
|
||||
recipient = msgData->recipients + recipientStart;
|
||||
currentAddress = [addresses objectAtIndex: count];
|
||||
cn = [currentAddress personalName];
|
||||
email = [currentAddress baseEMail];
|
||||
if ([cn length] == 0)
|
||||
cn = email;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
}
|
||||
else
|
||||
{
|
||||
recipient->username = NULL;
|
||||
entryId = MAPIStoreExternalEntryId (cn, email);
|
||||
}
|
||||
recipient->type = addressTypes[arrayCount];
|
||||
|
||||
/* properties */
|
||||
p = 0;
|
||||
recipient->data = talloc_array (msgData, void *, msgData->columns->cValues);
|
||||
memset (recipient->data, 0, msgData->columns->cValues * sizeof (void *));
|
||||
/* properties */
|
||||
p = 0;
|
||||
recipient->data = talloc_array (msgData, void *, msgData->columns->cValues);
|
||||
memset (recipient->data, 0, msgData->columns->cValues * sizeof (void *));
|
||||
|
||||
// PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
|
||||
recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
|
||||
p++;
|
||||
|
||||
// PR_OBJECT_TYPE = MAPI_MAILUSER (see MAPI_OBJTYPE)
|
||||
recipient->data[p] = MAPILongValue (msgData, MAPI_MAILUSER);
|
||||
p++;
|
||||
|
||||
// PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0);
|
||||
p++;
|
||||
// PR_DISPLAY_TYPE = DT_MAILUSER (see MS-NSPI)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0);
|
||||
p++;
|
||||
|
||||
// PR_7BIT_DISPLAY_NAME_UNICODE
|
||||
recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
// PR_7BIT_DISPLAY_NAME_UNICODE
|
||||
recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
|
||||
// PR_SMTP_ADDRESS_UNICODE
|
||||
recipient->data[p] = [email asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
// PR_SMTP_ADDRESS_UNICODE
|
||||
recipient->data[p] = [email asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
|
||||
// PR_SEND_INTERNET_ENCODING = 0x00060000 (plain text, see OXCMAIL)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x00060000);
|
||||
p++;
|
||||
// PR_SEND_INTERNET_ENCODING = 0x00060000 (plain text, see OXCMAIL)
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x00060000);
|
||||
p++;
|
||||
|
||||
// PR_RECIPIENT_DISPLAY_NAME_UNICODE
|
||||
recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
// PR_RECIPIENT_DISPLAY_NAME_UNICODE
|
||||
recipient->data[p] = [cn asUnicodeInMemCtx: msgData];
|
||||
p++;
|
||||
|
||||
// PR_RECIPIENT_FLAGS
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x01);
|
||||
p++;
|
||||
// PR_RECIPIENT_FLAGS
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x01);
|
||||
p++;
|
||||
|
||||
// PR_RECIPIENT_ENTRYID
|
||||
recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
|
||||
p++;
|
||||
// PR_RECIPIENT_ENTRYID
|
||||
recipient->data[p] = [entryId asBinaryInMemCtx: msgData];
|
||||
p++;
|
||||
|
||||
// PR_RECIPIENT_TRACKSTATUS
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x00);
|
||||
p++;
|
||||
// PR_RECIPIENT_TRACKSTATUS
|
||||
recipient->data[p] = MAPILongValue (msgData, 0x00);
|
||||
p++;
|
||||
|
||||
recipientStart++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue