From 77c219509e4c89ecee6f34ff80f133e83a63cc2b Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 1 Oct 2009 13:59:04 +0000 Subject: [PATCH 1/2] Removed charset from content-type Monotone-Parent: 9281789fc046d7e0135be9fbb84b728e14218579 Monotone-Revision: 8d4d276429e5192f98568aecf0d0c541440d22fc Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-10-01T13:59:04 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailObject.m | 130 ++++++++++++++++++++++++++++++ Tests/test-maildav.py | 4 +- 2 files changed, 132 insertions(+), 2 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index ff34c46b3..0545fbf33 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -1269,4 +1269,134 @@ static BOOL debugSoParts = NO; return response; } +// For DAV REPORT +- (id) _fetchProperty: (NSString *) property +{ + NSArray *parts; + id rc, msgs; + + rc = nil; + + if (property) + { + parts = [NSArray arrayWithObjects: property, nil]; + + msgs = [self fetchParts: parts]; + msgs = [msgs valueForKey: @"fetch"]; + if ([msgs count]) { + rc = [msgs objectAtIndex: 0]; + } + } + + return rc; +} + +- (BOOL) _hasFlag: (NSString *) flag +{ + BOOL rc; + NSDictionary *values; + NSArray *flags; + + rc = NO; + values = [self _fetchProperty: @"FLAGS"]; + + if (values) + { + flags = [values objectForKey: @"flags"]; + rc = [flags containsObject: flag]; + } + return rc; +} + +- (NSArray *) _emailAddressesFrom: (NSArray *) enveloppeAddresses +{ + NSMutableArray *rc; + NGImap4EnvelopeAddress *address; + NSString *email; + int count, max; + + rc = nil; + max = [enveloppeAddresses count]; + + if (max > 0) + { + rc = [NSMutableArray array]; + for (count = 0; count < max; count++) + { + address = [enveloppeAddresses objectAtIndex: count]; + email = [NSString stringWithFormat: @"%@", [address email]]; + + [rc addObject: email]; //TODO: Bug with escaping... + } + } + + return rc; +} + +// Properties + +//{urn:schemas:httpmail:} +// date is already done + +- (BOOL) hasAttachment +{ + return ([[self fetchAttachmentIds] count] > 0); +} + +- (BOOL) read +{ + return [self _hasFlag: @"seen"]; +} + +- (NSString *) textDescription +{ + return @"TODO"; +} + + +//{urn:schemas:mailheader:} + +- (NSArray *) cc +{ + return [self _emailAddressesFrom: [self ccEnvelopeAddresses]]; +} + +// date is already done + +- (NSArray *) from +{ + return [self _emailAddressesFrom: [self fromEnvelopeAddresses]]; +} + +- (NSString *) inReplyTo +{ + return [[self envelope] inReplyTo]; +} + +- (NSString *) messageId +{ + return [[self envelope] messageID]; //TODO Bug escaping +} + +- (NSString *) received +{ + return @"TODO"; +} + +- (NSString *) references +{ + return @"TODO"; +} + +- (NSString *) davDisplayName +{ + return [self subject]; +} + +- (NSArray *) to +{ + return [self _emailAddressesFrom: [self toEnvelopeAddresses]]; +} + + @end /* SOGoMailObject */ diff --git a/Tests/test-maildav.py b/Tests/test-maildav.py index 328ccba23..d5291d071 100755 --- a/Tests/test-maildav.py +++ b/Tests/test-maildav.py @@ -122,7 +122,7 @@ class DAVMailCollectionTest(unittest.TestCase): # message creation on collection url url = "%s%s" % (self.resource, "foldertest-dav-mail/") put = webdavlib.HTTPPUT (url, message1) - put.content_type = "message/rfc822; charset=utf-8" + put.content_type = "message/rfc822" self.client.execute (put) self.assertEquals(put.response["status"], 201, "failure putting message" @@ -138,7 +138,7 @@ class DAVMailCollectionTest(unittest.TestCase): # message creation with explicit filename url = "%s%s" % (self.resource, "foldertest-dav-mail/blabla.eml") put = webdavlib.HTTPPUT (url, message1) - put.content_type = "message/rfc822; charset=utf-8" + put.content_type = "message/rfc822" self.client.execute (put) self.assertEquals(put.response["status"], 201, "failure putting message" From ad49c5dca77e60e9407875a67f9c2cc12ed931c1 Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 1 Oct 2009 14:07:59 +0000 Subject: [PATCH 2/2] Reverted an accidental commit Monotone-Parent: 8d4d276429e5192f98568aecf0d0c541440d22fc Monotone-Revision: b5beb9beec402717a04f1250f79638aae4d70b55 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-10-01T14:07:59 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailObject.m | 130 ------------------------------ 1 file changed, 130 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailObject.m b/SoObjects/Mailer/SOGoMailObject.m index 0545fbf33..ff34c46b3 100644 --- a/SoObjects/Mailer/SOGoMailObject.m +++ b/SoObjects/Mailer/SOGoMailObject.m @@ -1269,134 +1269,4 @@ static BOOL debugSoParts = NO; return response; } -// For DAV REPORT -- (id) _fetchProperty: (NSString *) property -{ - NSArray *parts; - id rc, msgs; - - rc = nil; - - if (property) - { - parts = [NSArray arrayWithObjects: property, nil]; - - msgs = [self fetchParts: parts]; - msgs = [msgs valueForKey: @"fetch"]; - if ([msgs count]) { - rc = [msgs objectAtIndex: 0]; - } - } - - return rc; -} - -- (BOOL) _hasFlag: (NSString *) flag -{ - BOOL rc; - NSDictionary *values; - NSArray *flags; - - rc = NO; - values = [self _fetchProperty: @"FLAGS"]; - - if (values) - { - flags = [values objectForKey: @"flags"]; - rc = [flags containsObject: flag]; - } - return rc; -} - -- (NSArray *) _emailAddressesFrom: (NSArray *) enveloppeAddresses -{ - NSMutableArray *rc; - NGImap4EnvelopeAddress *address; - NSString *email; - int count, max; - - rc = nil; - max = [enveloppeAddresses count]; - - if (max > 0) - { - rc = [NSMutableArray array]; - for (count = 0; count < max; count++) - { - address = [enveloppeAddresses objectAtIndex: count]; - email = [NSString stringWithFormat: @"%@", [address email]]; - - [rc addObject: email]; //TODO: Bug with escaping... - } - } - - return rc; -} - -// Properties - -//{urn:schemas:httpmail:} -// date is already done - -- (BOOL) hasAttachment -{ - return ([[self fetchAttachmentIds] count] > 0); -} - -- (BOOL) read -{ - return [self _hasFlag: @"seen"]; -} - -- (NSString *) textDescription -{ - return @"TODO"; -} - - -//{urn:schemas:mailheader:} - -- (NSArray *) cc -{ - return [self _emailAddressesFrom: [self ccEnvelopeAddresses]]; -} - -// date is already done - -- (NSArray *) from -{ - return [self _emailAddressesFrom: [self fromEnvelopeAddresses]]; -} - -- (NSString *) inReplyTo -{ - return [[self envelope] inReplyTo]; -} - -- (NSString *) messageId -{ - return [[self envelope] messageID]; //TODO Bug escaping -} - -- (NSString *) received -{ - return @"TODO"; -} - -- (NSString *) references -{ - return @"TODO"; -} - -- (NSString *) davDisplayName -{ - return [self subject]; -} - -- (NSArray *) to -{ - return [self _emailAddressesFrom: [self toEnvelopeAddresses]]; -} - - @end /* SOGoMailObject */