Monotone-Parent: 998f8668c2a6175352cb3f2d659db5aa04b0fa39
Monotone-Revision: eb80137abbc0c0a426a654921250804b1c3d92ab Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-02-07T23:09:12 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
d94d271408
commit
4b7785fcf7
|
@ -1,8 +1,15 @@
|
||||||
2008-02-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2008-02-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount
|
||||||
|
-imap4URLString]): compose the mail hostname part of the url by
|
||||||
|
escaping the username. This is part of the fix below.
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): if the
|
* SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): if the
|
||||||
loginname for the default mail account contains an "@", it should
|
loginname for the default mail account contains an "@", it should
|
||||||
be url-escaped to avoid confusing NSURL.
|
be url-escaped to avoid confusing NSURL.
|
||||||
|
([SOGoUser -accountWithName:accountName]): new method that wanders
|
||||||
|
the accounts list and returns the one that matches the name passed
|
||||||
|
as parameter, if found.
|
||||||
|
|
||||||
* SoObjects/SOGo/SOGoUserFolder.m ([-login]): removed useless
|
* SoObjects/SOGo/SOGoUserFolder.m ([-login]): removed useless
|
||||||
method.
|
method.
|
||||||
|
|
|
@ -28,8 +28,9 @@
|
||||||
#import <NGObjWeb/SoHTTPAuthenticator.h>
|
#import <NGObjWeb/SoHTTPAuthenticator.h>
|
||||||
#import <NGObjWeb/WORequest.h>
|
#import <NGObjWeb/WORequest.h>
|
||||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
|
||||||
#import <NGExtensions/NSNull+misc.h>
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
#import <NGExtensions/NSString+misc.h>
|
||||||
#import <NGImap4/NGImap4Connection.h>
|
#import <NGImap4/NGImap4Connection.h>
|
||||||
#import <NGImap4/NGImap4Client.h>
|
#import <NGImap4/NGImap4Client.h>
|
||||||
#import <NGImap4/NGImap4Context.h>
|
#import <NGImap4/NGImap4Context.h>
|
||||||
|
@ -245,6 +246,27 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
return [creds objectAtIndex:0]; /* the user */
|
return [creds objectAtIndex:0]; /* the user */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) _urlHostString
|
||||||
|
{
|
||||||
|
NSDictionary *mailAccount;
|
||||||
|
NSString *username, *escUsername, *hostString;
|
||||||
|
|
||||||
|
mailAccount = [[context activeUser] accountWithName: nameInContainer];
|
||||||
|
if (mailAccount)
|
||||||
|
{
|
||||||
|
username = [mailAccount objectForKey: @"userName"];
|
||||||
|
escUsername
|
||||||
|
= [[username stringByReplacingString: @"@" withString: @"%40"]
|
||||||
|
stringByEscapingURL];
|
||||||
|
hostString = [NSString stringWithFormat: @"%@@%@", escUsername,
|
||||||
|
[mailAccount objectForKey: @"serverName"]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hostString = @"localhost";
|
||||||
|
|
||||||
|
return hostString;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSMutableString *) imap4URLString
|
- (NSMutableString *) imap4URLString
|
||||||
{
|
{
|
||||||
/* private, overridden by SOGoSharedMailAccount */
|
/* private, overridden by SOGoSharedMailAccount */
|
||||||
|
@ -258,7 +280,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
else
|
else
|
||||||
[urlString appendString: @"imap://"];
|
[urlString appendString: @"imap://"];
|
||||||
|
|
||||||
host = [self nameInContainer];
|
host = [self _urlHostString];
|
||||||
if (![host rangeOfString: @"@"].length)
|
if (![host rangeOfString: @"@"].length)
|
||||||
[urlString appendFormat: @"%@@", [self imap4LoginFromHTTP]];
|
[urlString appendFormat: @"%@@", [self imap4LoginFromHTTP]];
|
||||||
[urlString appendFormat: @"%@/", host];
|
[urlString appendFormat: @"%@/", host];
|
||||||
|
|
|
@ -95,7 +95,6 @@
|
||||||
// return [NSException exceptionWithHTTPStatus:403 /* Forbidden */
|
// return [NSException exceptionWithHTTPStatus:403 /* Forbidden */
|
||||||
// reason:@"Tried to access the mail of another user"];
|
// reason:@"Tried to access the mail of another user"];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
/* first check attributes directly bound to the application */
|
/* first check attributes directly bound to the application */
|
||||||
obj = [super lookupName:_key inContext:_ctx acquire:NO];
|
obj = [super lookupName:_key inContext:_ctx acquire:NO];
|
||||||
|
|
|
@ -118,6 +118,7 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
||||||
- (NSTimeZone *) serverTimeZone;
|
- (NSTimeZone *) serverTimeZone;
|
||||||
|
|
||||||
- (NSArray *) mailAccounts;
|
- (NSArray *) mailAccounts;
|
||||||
|
- (NSDictionary *) accountWithName: (NSString *) accountName;
|
||||||
- (NSArray *) allIdentities;
|
- (NSArray *) allIdentities;
|
||||||
- (NSDictionary *) primaryIdentity;
|
- (NSDictionary *) primaryIdentity;
|
||||||
- (NSMutableDictionary *) defaultIdentity;
|
- (NSMutableDictionary *) defaultIdentity;
|
||||||
|
|
|
@ -454,16 +454,14 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||||
{
|
{
|
||||||
NSMutableDictionary *mailAccount, *identity;
|
NSMutableDictionary *mailAccount, *identity;
|
||||||
NSMutableArray *identities;
|
NSMutableArray *identities;
|
||||||
NSString *name, *fullName, *userName;
|
NSString *name, *fullName;
|
||||||
NSArray *mails;
|
NSArray *mails;
|
||||||
unsigned int count, max;
|
unsigned int count, max;
|
||||||
|
|
||||||
mailAccount = [NSMutableDictionary dictionary];
|
mailAccount = [NSMutableDictionary dictionary];
|
||||||
userName = [[login stringByReplacingString: @"@" withString: @"%40"]
|
|
||||||
stringByEscapingURL];
|
|
||||||
name = [NSString stringWithFormat: @"%@@%@",
|
name = [NSString stringWithFormat: @"%@@%@",
|
||||||
userName, fallbackIMAP4Server];
|
login, fallbackIMAP4Server];
|
||||||
[mailAccount setObject: userName forKey: @"userName"];
|
[mailAccount setObject: login forKey: @"userName"];
|
||||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||||
[mailAccount setObject: name forKey: @"name"];
|
[mailAccount setObject: name forKey: @"name"];
|
||||||
|
|
||||||
|
@ -509,6 +507,23 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||||
return mailAccounts;
|
return mailAccounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSDictionary *) accountWithName: (NSString *) accountName;
|
||||||
|
{
|
||||||
|
NSEnumerator *accounts;
|
||||||
|
NSDictionary *mailAccount, *currentAccount;
|
||||||
|
|
||||||
|
mailAccount = nil;
|
||||||
|
|
||||||
|
accounts = [[self mailAccounts] objectEnumerator];
|
||||||
|
while (!mailAccount
|
||||||
|
&& ((currentAccount = [accounts nextObject])))
|
||||||
|
if ([[currentAccount objectForKey: @"name"]
|
||||||
|
isEqualToString: accountName])
|
||||||
|
mailAccount = currentAccount;
|
||||||
|
|
||||||
|
return mailAccount;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@interface SOGoMailIdentity : NSObject
|
@interface SOGoMailIdentity : NSObject
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue