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>
|
||||
|
||||
* 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
|
||||
loginname for the default mail account contains an "@", it should
|
||||
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
|
||||
method.
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#import <NGObjWeb/SoHTTPAuthenticator.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSNull+misc.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGImap4/NGImap4Connection.h>
|
||||
#import <NGImap4/NGImap4Client.h>
|
||||
#import <NGImap4/NGImap4Context.h>
|
||||
|
@ -245,6 +246,27 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
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
|
||||
{
|
||||
/* private, overridden by SOGoSharedMailAccount */
|
||||
|
@ -258,7 +280,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
else
|
||||
[urlString appendString: @"imap://"];
|
||||
|
||||
host = [self nameInContainer];
|
||||
host = [self _urlHostString];
|
||||
if (![host rangeOfString: @"@"].length)
|
||||
[urlString appendFormat: @"%@@", [self imap4LoginFromHTTP]];
|
||||
[urlString appendFormat: @"%@/", host];
|
||||
|
|
|
@ -96,7 +96,6 @@
|
|||
// reason:@"Tried to access the mail of another user"];
|
||||
// }
|
||||
|
||||
|
||||
/* first check attributes directly bound to the application */
|
||||
obj = [super lookupName:_key inContext:_ctx acquire:NO];
|
||||
if (!obj)
|
||||
|
|
|
@ -118,6 +118,7 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
|||
- (NSTimeZone *) serverTimeZone;
|
||||
|
||||
- (NSArray *) mailAccounts;
|
||||
- (NSDictionary *) accountWithName: (NSString *) accountName;
|
||||
- (NSArray *) allIdentities;
|
||||
- (NSDictionary *) primaryIdentity;
|
||||
- (NSMutableDictionary *) defaultIdentity;
|
||||
|
|
|
@ -454,16 +454,14 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
|||
{
|
||||
NSMutableDictionary *mailAccount, *identity;
|
||||
NSMutableArray *identities;
|
||||
NSString *name, *fullName, *userName;
|
||||
NSString *name, *fullName;
|
||||
NSArray *mails;
|
||||
unsigned int count, max;
|
||||
|
||||
mailAccount = [NSMutableDictionary dictionary];
|
||||
userName = [[login stringByReplacingString: @"@" withString: @"%40"]
|
||||
stringByEscapingURL];
|
||||
name = [NSString stringWithFormat: @"%@@%@",
|
||||
userName, fallbackIMAP4Server];
|
||||
[mailAccount setObject: userName forKey: @"userName"];
|
||||
login, fallbackIMAP4Server];
|
||||
[mailAccount setObject: login forKey: @"userName"];
|
||||
[mailAccount setObject: fallbackIMAP4Server forKey: @"serverName"];
|
||||
[mailAccount setObject: name forKey: @"name"];
|
||||
|
||||
|
@ -509,6 +507,23 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
|||
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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue