From ec868276aad6ced4be5c42ea2a9c65b62b25c269 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 25 Dec 2009 22:52:52 +0000 Subject: [PATCH 1/4] See ChangeLog Monotone-Parent: 5475eac0e45624fa60269bb388e23e6e2dc89bd8 Monotone-Revision: 53a3680b094640a96987cce96326daad38a619e0 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-25T22:52:52 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 +++++++ Tools/SOGoToolBackup.m | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7fee20f90..42e07ba88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-25 Ludovic Marcotte + + * Tools/SOGoToolBackup.m (-fetchUserIDs:): + We now use a local autorelease pool and flush + it after every 100 requests to the LDAP (or + other source type) server. + 2009-12-23 Ludovic Marcotte * UI/Scheduler/UIxCalView.m diff --git a/Tools/SOGoToolBackup.m b/Tools/SOGoToolBackup.m index c58e7dffd..907951d56 100644 --- a/Tools/SOGoToolBackup.m +++ b/Tools/SOGoToolBackup.m @@ -21,6 +21,7 @@ */ #import +#import #import #import #import @@ -118,6 +119,7 @@ - (BOOL) fetchUserIDs: (NSArray *) users { + NSAutoreleasePool *pool; SOGoUserManager *lm; NSDictionary *infos; NSString *user; @@ -125,6 +127,8 @@ int count, max; lm = [SOGoUserManager sharedUserManager]; + pool = [[NSAutoreleasePool alloc] init]; + max = [users count]; user = [users objectAtIndex: 0]; if (max == 1 && [user isEqualToString: @"ALL"]) @@ -134,6 +138,12 @@ allUsers = [NSMutableArray array]; for (count = 0; count < max; count++) { + if (count > 0 && count%100 == 0) + { + DESTROY(pool); + pool = [[NSAutoreleasePool alloc] init]; + } + user = [users objectAtIndex: count]; infos = [lm contactInfosForUserWithUIDorEmail: user]; if (infos) @@ -144,6 +154,7 @@ } ASSIGN (userIDs, [allUsers objectsForKey: @"c_uid" notFoundMarker: nil]); + DESTROY(pool); return ([userIDs count] > 0); } From e2e53b5a53fb1aa2fd83ab0fa44eedfed9de970e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 26 Dec 2009 16:01:08 +0000 Subject: [PATCH 2/4] See ChangeLog Monotone-Parent: 53a3680b094640a96987cce96326daad38a619e0 Monotone-Revision: 4b96a79ded99473f7c6766140d0cd061fbf033cf Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-26T16:01:08 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++++++++ SoObjects/SOGo/SOGoMailer.m | 27 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42e07ba88..e386e4299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-26 Ludovic Marcotte + + * SoObjects/SOGo/SOGoMailer.m (_smtpSendData: + toRecipients:sender:): We now honor the 'port' + part in the SMTP server address. So one can now + specify hostname:port (like localhost:587) as + a value of SOGoSMTPServer. This fixes + http://www.scalableogo.org/bugs/view.php?id=201 + 2009-12-25 Ludovic Marcotte * Tools/SOGoToolBackup.m (-fetchUserIDs:): diff --git a/SoObjects/SOGo/SOGoMailer.m b/SoObjects/SOGo/SOGoMailer.m index d9d40d2b9..13cd16398 100644 --- a/SoObjects/SOGo/SOGoMailer.m +++ b/SoObjects/SOGo/SOGoMailer.m @@ -30,6 +30,7 @@ #import #import #import +#import #import "NSString+Utilities.h" #import "SOGoDomainDefaults.h" @@ -115,14 +116,32 @@ toRecipients: (NSArray *) recipients sender: (NSString *) sender { + NGInternetSocketAddress *addr; + NSString *currentTo, *host; + NSEnumerator *addresses; NGSmtpClient *client; - NSEnumerator *addresses; - NSString *currentTo; - unsigned int toErrors; NSException *result; + NSRange r; + + unsigned int toErrors, port; client = [NGSmtpClient smtpClient]; - if ([client connectToHost: smtpServer]) + host = smtpServer; + port = 25; + + // We check if there is a port specified in the smtpServer ivar value + r = [smtpServer rangeOfString: @":"]; + + if (r.length) + { + port = [[smtpServer substringFromIndex: r.location+1] intValue]; + host = [smtpServer substringToIndex: r.location]; + } + + addr = [NGInternetSocketAddress addressWithPort: port + onHost: host]; + + if ([client connectToAddress: addr]) { if ([client mailFrom: sender]) { From 82f15efb6d68d841eaf7d877f82f7fd0d84808d1 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 26 Dec 2009 19:00:45 +0000 Subject: [PATCH 3/4] See ChangeLog Monotone-Parent: 4b96a79ded99473f7c6766140d0cd061fbf033cf Monotone-Revision: c5aef827213cfa0dd83fa1d18267c116529ec0d7 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-26T19:00:45 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ SoObjects/Mailer/SOGoMailForward.m | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e386e4299..e95eeeeae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,12 @@ a value of SOGoSMTPServer. This fixes http://www.scalableogo.org/bugs/view.php?id=201 + * SoObjects/Mailer/SOGoMailForward.m (init): + Now consider SOGoMailComposeMessageType instead + of ComposeMessagesType when checking if we are + using HTML mails composition mode. This fixes + http://www.scalableogo.org/bugs/view.php?id=280 + 2009-12-25 Ludovic Marcotte * Tools/SOGoToolBackup.m (-fetchUserIDs:): diff --git a/SoObjects/Mailer/SOGoMailForward.m b/SoObjects/Mailer/SOGoMailForward.m index f2a127f12..70683503e 100644 --- a/SoObjects/Mailer/SOGoMailForward.m +++ b/SoObjects/Mailer/SOGoMailForward.m @@ -38,7 +38,12 @@ { SOGoUserDefaults *ud; ud = [[context activeUser] userDefaults]; - htmlComposition = [[ud objectForKey: @"ComposeMessagesType"] isEqualToString: @"html"]; + + // Backward comptability with <= 1.1.0 (ComposeMessagesType) + if ([ud objectForKey: @"ComposeMessagesType"]) + htmlComposition = [[ud objectForKey: @"ComposeMessagesType"] isEqualToString: @"html"]; + else + htmlComposition = [[ud objectForKey: @"SOGoMailComposeMessageType"] isEqualToString: @"html"]; sourceMail = nil; currentValue = nil; From 516861d6f6c7eafdfe6ab9ac4271b4a0d1fab832 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 26 Dec 2009 19:02:01 +0000 Subject: [PATCH 4/4] Alignment fix Monotone-Parent: c5aef827213cfa0dd83fa1d18267c116529ec0d7 Monotone-Revision: 71bc211c9fb2a32b06f59717e4f1706d6482c950 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-26T19:02:01 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailForward.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoObjects/Mailer/SOGoMailForward.m b/SoObjects/Mailer/SOGoMailForward.m index 70683503e..52159376e 100644 --- a/SoObjects/Mailer/SOGoMailForward.m +++ b/SoObjects/Mailer/SOGoMailForward.m @@ -41,7 +41,7 @@ // Backward comptability with <= 1.1.0 (ComposeMessagesType) if ([ud objectForKey: @"ComposeMessagesType"]) - htmlComposition = [[ud objectForKey: @"ComposeMessagesType"] isEqualToString: @"html"]; + htmlComposition = [[ud objectForKey: @"ComposeMessagesType"] isEqualToString: @"html"]; else htmlComposition = [[ud objectForKey: @"SOGoMailComposeMessageType"] isEqualToString: @"html"];