From 48651d5f71655e6d608966d33ce0cb37e90c406c Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 6 Jul 2005 15:47:18 +0000 Subject: [PATCH] added special handling for permission-denied errors git-svn-id: http://svn.opengroupware.org/SOGo/trunk@669 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 5 +++++ SOGo/SoObjects/Mailer/README | 1 + SOGo/SoObjects/Mailer/SOGoMailAccounts.m | 2 +- SOGo/SoObjects/Mailer/SOGoMailManager.m | 20 +++++++++++++++++--- SOGo/SoObjects/Mailer/Version | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 7ca151f7..83d15f98 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2005-07-06 Helge Hess + + * SOGoMailManager.m: detect Cyrus 'permission denied' when changing + flags and deliver a http-code 403 exception (v0.9.84) + 2005-03-25 Helge Hess * v0.9.83 diff --git a/SOGo/SoObjects/Mailer/README b/SOGo/SoObjects/Mailer/README index b65f8f9c..62286e0f 100644 --- a/SOGo/SoObjects/Mailer/README +++ b/SOGo/SoObjects/Mailer/README @@ -15,4 +15,5 @@ SOGoMailSpoolPath path - FS path where mail drafts are stored SOGoNoDraftDeleteAfterSend YES|NO - makes the draft's -delete method a NOOP SOGoSpecialFoldersInRoot YES|NO - do special folders live under INBOX? + - corresponds to the Cyrus setting: "altnamespace: yes" SOGoEnableSieveFolder YES|NO - should the Sieve folder be visible? diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccounts.m b/SOGo/SoObjects/Mailer/SOGoMailAccounts.m index c31717ad..2db0774e 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccounts.m @@ -35,7 +35,7 @@ if (um == nil) um = [[AgenorUserManager sharedUserManager] retain]; - uid = [[self container] davDisplayName]; + uid = [[self container] davDisplayName]; /* the uid part of the URL */ account = [um getIMAPAccountStringForUID:uid]; return account ? [NSArray arrayWithObject:account] : nil; diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.m b/SOGo/SoObjects/Mailer/SOGoMailManager.m index ba7a7578..f0af8eb2 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.m +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.m @@ -661,7 +661,7 @@ static NSString *imap4Separator = nil; if (![_f isKindOfClass:[NSArray class]]) _f = [NSArray arrayWithObjects:&_f count:1]; - + /* get client */ if ((client = [self imap4ClientForURL:_url password:_p]) == nil) @@ -683,9 +683,23 @@ static NSString *imap4Separator = nil; add:[NSNumber numberWithBool:_flag] flags:_f]; if (![[result valueForKey:@"result"] boolValue]) { + unsigned int status; + NSString *r; + + r = [result valueForKey:@"reason"]; + if ([r isEqualToString:@"Permission denied"]) { + /* different for each server?, no error codes in IMAP4 ... */ + status = 403 /* Forbidden */; + } + else + status = 500 /* internal server error */; + [self logWithFormat:@"DEBUG: fail result %@", result]; - return [NSException exceptionWithHTTPStatus:500 /* server error */ - reason:@"failed to add flag to IMAP4 message"]; + + r = [@"Failed to add flag to IMAP4 message: " stringByAppendingString:r]; + + return [NSException exceptionWithHTTPStatus:status /* server error */ + reason:r]; } /* result contains 'fetch' key with the current flags */ return nil; diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index a2cadb18..73737778 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=83 +SUBMINOR_VERSION:=84 # v0.9.69 requires libNGMime v4.5.210 # v0.9.55 requires libNGExtensions v4.5.136 -- 2.39.5